
var image=new Image();   
function ShowBigPic(img)
{	
	$("#bigPic").hide();
	$("#preImage").show();
	var bigPic = $(img).attr("bigPic");
	image.onload = function(){			
		$("#preImage").hide();
		$("#bigPic").show();
		$("#bigPic").attr("src",image.src);
	}
	image.src=bigPic; 
}

$(document).ready(function(){

	var navM = $('#navMenu li');
	var navA = $('#navMenu a');
	navM.hover(
		function(){
			if($(this).attr("class") != 'first' && $(this).attr("class") != 'last' ){
				if($('ul',$(this)).text() !=""){
					$(this).attr("class",'iehover');
				}
				$('ul',$(this)).slideToggle('normal');
				$('ul a:last',$(this)).css("height","29px");
			}
		},
		function(){
			if($('ul',$(this)).text() !=""){
				$(this).attr("class",'');
			}
			$('ul',$(this)).slideToggle('normal');
		}
	);


	//调整高度
	var imgs = $('#productSmall img');
	imgs.each(function(){
		$(this).bind (
		"click",
			function(){
				ShowBigPic($(this));
			}
		);					   
	});

	//
	$(".tab a").eq(0).addClass("sel"); 
	$(".tabContent").eq(0).fadeIn("slow"); 
	$(".tab a").each(function(idx){
		$(this).bind (
		"click",
			function(){
				$(".tab a").each(function(){$(this).removeClass("sel"); })
				$(".tabContent").each(function(){$(this).hide();})
				$(this).toggleClass("sel"); 
				$(".tabContent").eq(idx).fadeIn("slow"); 
				autoHeight();
			}
		);				  
	});
	
	var defaultBig = $('#productSmall img:first').attr("bigPic");
	$("#bigPic").attr("src",defaultBig); 		   
	//var dImage = $('#productSmall img:first').attr("bigPic");
	//alert(dImage);
	autoHeight();

}); 

function autoHeight(){
	$('.side-left').css('height',$('.side-right').height()+'px');
	return;
	if($('.side-right').height() > $('.side-left').height()){
		$('.side-left').css('height',$('.side-right').height()+'px');
	}else{
		$('.side-right').css('height',$('.side-left').height()+'px');
	}
	//
}














