﻿function f_min(){
   $('.instructor_cart *').css({opacity: "1.0"}).animate({opacity: "0.0"}, 1000);
   $('.instructor_cart').animate({opacity: "0.0"}, 1000);
   $('.instructor_cart_top, .instructor_cart_bottom').animate({opacity: "0.0"}, 1000); 
   
  // $(".instructor_cart *, .instructor_cart, .instructor_cart_top, .instructor_cart_bottom").fadeOut(300);
   
};

function f_max(){ 
   $('.instructor_cart *').css({opacity: "0.0"});
   $('.instructor_cart').css({opacity: "0.0"});
   $('.instructor_cart_top, .instructor_cart_bottom').css({opacity: "0.0"}); 
   
   $('.instructor_cart').animate({opacity: "1.0"}, 1500);
   $('.instructor_cart_top, .instructor_cart_bottom').animate({opacity: "1.0"}, 1500); 
  // setTimeout(function(){$('.instructor_cart *').animate({opacity: "0.1"}, 1500);}, 0);

   $('.instructor_cart *').animate({opacity: "1.0"}, 500);    
        
  // setTimeout(function(){$(".instructor_cart *, .instructor_cart, .instructor_cart_top, .instructor_cart_bottom").fadein(300)}, 300);     
   
};

var old_id = 0;

var instructors	=	[];

function f_content(id){
   
	var container		=	document.getElementById('area');
			 
	container.innerHTML	=	'Загрузка...'; //alert('id - ' + id + 'old - ' + old_id);
	//$('#area').html('<img src="/img/jquery-preloader.gif" alt="Загрузка..." id="loading" />');
	
	jQuery.ajax({
		/*type:	"GET",
		url:	"/data/" + id + ".xml",
		dataType: "xml",*/

        url    :"/tpl/map/station_info.php",
		type   :'POST',
		data   :{ajax_name: 'get_instr',id: id},
		
		success: function(data) {
		    $('#area').html(data);
            var count = $('.master_box').size() + 1;
            $('#instructor_content .Instructor_bg').animate({'min-height': count*140 + 90 + 'px'});
			f_max();
		}//success
	});//ajax
}

function loadInfo(id){
 $('#metro_plan a').unbind('click');

 if (id == old_id)  {
       //alert('==');
       f_min();
       setTimeout(function(){f_max();}, 1000);
       $('#metro_plan a').bind('click').stop(true,true);
      }
  else    {
       //alert('<>');
       f_min();
       setTimeout(function(){//f_max();
             f_content(id);}, 1000);
       $('#metro_plan a').bind('click').stop(true,true);
      }


 //$('#metro_plan a').bind('click').stop(true,true);
 //setTimeout(function(){f_max();f_content(id); $('#metro_plan a').bind('click');}, 1000);

 old_id = id;

}//loadInfo;





