$(document).ready(function(){	
	
	$(".switch").bind('click',function(){
		var css_on = $(this).attr('css_on');
		var css_non = $(this).attr('css_non');
		
		if(css_on  == undefined) css_on  = 'switch_on';
		if(css_non == undefined) css_non = 'switch_non';
		
		$(this).prevAll().removeClass(css_on);
		$(this).nextAll().removeClass(css_on);
		$(this).prevAll().addClass(css_non);
		$(this).nextAll().addClass(css_non);
		$(this).removeClass(css_non);
		$(this).addClass(css_on);		
		
		var c_div = $(this).attr('con');
		$('#'+c_div).prevAll().hide();
		$('#'+c_div).nextAll().hide();			
		$('#'+c_div).show();		
	});	
	
	$("#child_sort_list a").bind('click',function(){
		
		var p = $(this).attr('val');
		var sort_id = $(this).attr('sort_id');
		var sys = $(this).attr('sys');
		//alert("sort_id=" + sort_id + "&sys=" + sys);	
		//return;
		$.ajax({
		   type: "GET",
		   url: "/php/ajax/get_list.php",
		   data: "sort_id=" + sort_id + "&sys=" + sys,
		   success: function(msg){
				//alert(msg);
				$('#info_list_div').html(msg);
		   }
		});
		
		var css_on = $(this).attr('css_on');
		var css_non = $(this).attr('css_non');
		
		if(css_on  == undefined) css_on  = 'switch2_on';
		if(css_non == undefined) css_non = 'switch2_non';
		
		$("#child_sort_list a").removeClass(css_on);
		$("#child_sort_list a").removeClass(css_non);		
		$("#child_sort_list a").addClass(css_non);
		$(this).addClass(css_on);

	});		
	
	$(".ms").bind('mouseover',function(){		
		var css = $(this).attr('css_on');
		if(css == '') css = 'mson';
		$(this).addClass(css);			
	})
	
	$(".ms").bind('mouseout',function(){		
		var css = $(this).attr('css_on');
		if(css == '') css = 'mson';
		$(this).removeClass(css);			
	})
	
	
	var l_height = $('.set_left_height').height();
	var r_height = $('.set_right_height').height();
	//alert(l_height +'|'+ r_height);
	if(l_height>r_height){
		$('.set_right_height').height(l_height);
		//alert('左高');
	}
	if(l_height<r_height){
		$('.set_left_height').height(r_height);
		//alert('右高');
	}
	//alert($('.set_left_height').height() +'|'+ $('.set_right_height').height());
	
	$(".chg_site").bind('click',function(){
		
		var p = $(this).attr('val');
		var sort_id = $(this).attr('sort_id');
		var sys = $(this).attr('sys');		
		var offset=$(this).offset();
		//alert("sort_id=" + sort_id + "&sys=" + sys);	
		//return;
		$.ajax({
		   type: "GET",
		   url: "/php/ajax/get_sites.php",
		   data:'',
		   success: function(msg){
				//alert(msg);
				$('#sites_div').show();
				$('#sites_div').css("position","absolute")
                 .css("left",offset.left)
                 .css("top",offset.top+30)
				$('#sites_div').html(msg);
		   }
		});
	});

	$("#more_price").bind('click',function(){
		
		var sys = $(this).attr('sys');
		var id = $(this).attr('pid');			
		var offset=$(this).offset();
		
		//alert("id=" + id + "&sys=" + sys);
		if($('#price_div').html() !='' )
		{
			$('#price_div').show();
			return;
		}
			
		//return;
		$.ajax({
		   type: "GET",
		   url: "/php/ajax/get_price.php",
		   data:'id='+id+'&sys='+sys,
		   success: function(msg){
				//alert(msg);
				$('#price_div').show();
				$('#price_div').css("position","absolute")
                 .css("left",offset.left-285)
                 .css("top",offset.top+35)
				$('#price_div').html(msg);
		   }
		});
	});			
	
});



//-------- ajax 分页 -------------/
function ajax_pager(sys,sort_id,page){
	//alert(sys);
	$.ajax({
	   type: "GET",
	   url: "/php/ajax/get_list.php",
	   data: "sort_id=" + sort_id + "&sys=" + sys + "&page=" + page,
	   success: function(msg){				   
			$('#info_list_div').html(msg);
	   }
	});
}

//-------- 关闭站点 -------------/
function chg_site_close(){
	$('#sites_div').hide();
}

//-------- 关闭报价 -------------/
function price_div_close(){	
	$('#price_div').hide();
}
			
