function loadpage(div_id){
    $(".w_250").show();
    div_id.find('a').click(

        function(){
            $(".w_250").show();
            if ($(this).attr("href").indexOf("http://") == -1) {

                if($(this).attr("id") == "ajax") {

                    var url = $(this).attr('href');

                    div_id.show(

                        function(){

                            $("div#loader_wait").show();

                            $.get(

                                url+'&ajax=1',{},

                                function(response){

                                    $("div#loader_wait").hide();

                                    div_id.html(response).show();
                                    
                                    loadpage(div_id);

                                }

                            )

                        }

                    );

                    return false;

                }

            }

        }

    );

}



function loadpagev2(div_get, div_set){
    $(".w_250").hide();
    var defaulth = 0;
    div_get.find('a').click(

        function(){
            $(".w_250").show();
            if ($(this).attr("href").indexOf("http://") == -1) {

                if($(this).attr("id") != "link") {

                    var url = $(this).attr('href');

                    div_set.show(

                        function(){

                            $("div#loader_wait").show();

                            $.get(

                                url+'&ajax=1',{},

                                function(response){

                                    $("div#loader_wait").hide();

                                    div_set.html(response).show();

                                    //loadpagev2(div_get,div_set);
                                    
                                    defaulth = response;

                                    loadpage(div_set);

                                }

                            )

                        }

                    );

                    return false;

                }

            }

        }

    );
    
    div_get.find('.graph_row').mouseenter(
      
        function(){
          if(defaulth == 0) {   
            $(".w_250").show();
            if ($(this).find('a').attr("href").indexOf("http://") == -1) {

                if($(this).find('a').attr("id") != "link") {

                    var url = $(this).find('a').attr('href');

                    div_set.show(

                        function(){

                            $("div#loader_wait").show();

                            $.get(

                                url+'&ajax=1',{},

                                function(response){

                                    $("div#loader_wait").hide();

                                    div_set.html(response).show();

                                    //loadpagev2(div_get,div_set);

                                    loadpage(div_set);

                                }

                            )

                        }

                    );

                }

            }
          }
        }
      );
      div_get.find('.graph_row').mouseleave(
        function() {
          if(defaulth == 0) {
            $(".w_250").hide();
            if(defaulth != 0) {
              
                    div_set.show(

                        function(){

                            $("div#loader_wait").show();

                            $("div#loader_wait").hide();

                            div_set.html(defaulth).show();

                            //loadpagev2(div_get,div_set);

                            loadpage(div_set);

                        }

                    );              
            }
          }
        }

    );    


}

$(document).ready(function(){
  var marginTop = $(window).scrollTop(); 
  $(".w_250").css({"margin-top" : marginTop +"px"});  
  $(window).scroll(function (e) { 
      var marginTop = $(window).scrollTop(); 
      $(".w_250").css({"margin-top" : marginTop +"px"});
  });
  
  $(".techinfolink").click(function() {
    $(".techdetails").slideToggle("slow");
    return false;
  })
});
