//公用window.onload方法
function addLoadEvent(func){
	var oldonload = window.onload;
	if(typeof window.onload != "function"){
		window.onload = func;
	}else{
		window.onload = function(){
			oldonload();
			func();
		};
	};
};

//招商和服务切换内容
addLoadEvent(function(){
	var oMerImg1 = document.getElementById("merImg1");
	var oMerImg2 = document.getElementById("merImg2");
	
	var oDemo1 = document.getElementById("demo1");
	var oDemo2 = document.getElementById("demo2");
	
	if(!document.getElementById("merImg1")) return false;
	if(!document.getElementById("merImg2")) return false;
	if(!document.getElementById("demo1")) return false;
	if(!document.getElementById("demo2")) return false;
	
	oMerImg1.onclick = function(){
		oMerImg1.src = "images/button/MerSerLeftDown.gif";
		oMerImg2.src = "images/button/MerSerRightUp.gif";
		oDemo1.style.display = "block";
		oDemo2.style.display = "none";
	}
	oMerImg2.onclick = function(){
		oMerImg1.src = "images/button/MerSerLeftUp.gif";
		oMerImg2.src = "images/button/MerSerRightDown.gif";
		oDemo1.style.display = "none";
		oDemo2.style.display = "block";
	}

});

//搜索框，支持回车按钮
addLoadEvent(function(){
	var oText = document.getElementById("searchText1");
	var oSearBtn = document.getElementById("SearBtn1");
	
	if(!document.getElementById("searchText1")) return false;
	if(!document.getElementById("SearBtn1")) return false;
	
	oText.onfocus = function(){
		this.value = "";
	};
	oText.onblur = function(){
		this.value = "Search";
	};
	oText.onkeydown = function(ev){
		var oEvent = ev || event;
		if(oEvent.keyCode == 13){
			oText.value = "";
		};
	};
});

jQuery(document).ready(function($){
	
	if($("#navMenu").length = 0) return false;
	var timer = null;
	var times = null;
	var times1 = null;

		$("#navMenu li").each(function(i){
			$("#navMenu li:eq("+i+")").hover(function(){
				$("#navMenu li:eq("+i+") span").stop().animate({top:"30px"},300)
				$("#navMenu li:eq("+i+") h1").stop().animate({top:"0px"},300,function(){
					$("#navMenu li:eq("+i+") h1").animate({top:"0px"},300,function(){
						$("#navMenu li:eq("+i+") h1").animate({top:"0px"},300)
					});
				});			
			},function(){
				$("#navMenu li:eq("+i+") h1").stop().animate({top:"-30px"},100)
				$("#navMenu li:eq("+i+") span").stop().animate({top:"0px"},300)
			});
		});	
	function oMenuBot(navHei){
		oMenuBot = $(navHei).height();
	}
	

	function showTabs(oBox,num){
		var timer = null;
		$("#navMenu li:eq("+num+")").hover(function(){
			$(oBox).css({"top":-470,"display":"block"})
			$(oBox).stop().animate({top:"0px",opacity:"1"},600);
		},function(){
			$(oBox).stop().animate({top:"-470px",opacity:"0"},800);
		});	
		$(oBox).hover(function(){
			$(this).stop().animate({top:"0px",opacity:"1"},600);
		},function(){
			$(this).stop().animate({top:"-470px",opacity:"0"},800);
		})
	};
	showTabs("#PasseCars02",1);
	showTabs("#PasseCars03",2);
	showTabs("#lovely",3);
	showTabs("#lovely1",4);
	showTabs("#lovely2",5);
	showTabs("#lovely3",6);
	showTabs("#lovely4",7);
	showTabs("#lovely5",8);
	showTabs("#lovely6",9);
	
	
});


//商用车和通用车内容页鼠标点击显示信息事件
/*jQuery(document).ready(function($){
	
	var $time = 700;
	var $category = $(".commB6_Tab1 tr:gt(4)");
	$category.hide();
	
	var $toggleBtn = $("#zhankai");
	$toggleBtn.click(function(){
		if($category.is(":visible")){
			$category.fadeOut($time);
			$toggleBtn.attr("src","web/images/commTabBtn1.jpg");
		}else{
			$category.fadeIn($time);
			$toggleBtn.attr("src","web/images/commTabBtn2.jpg");
		}
	});
});*/
var tag = 1;
jQuery(document).ready(function($){
	var $time = 700;
	
	var $Num = 6;
	$(".commB6_Tab1 tr").hide($time).slice(0,$Num).show($time);
	$("#zhankai").click(function(){
		if($Num > $(".commB6_Tab1 tr").length){
			$Num = $(".commB6_Tab1 tr").length;
		}
		if(tag){
			$(".commB6_Tab1 tr").slice(0,($Num+6)).fadeIn();
		}else{
			$(".commB6_Tab1 tr").hide($time).slice(0,6).show($time);
		}
		tag = tag == 1? 0 : 1;
	});
});

//商用车和通用车鼠标显示车型
jQuery(document).ready(function($){
	var $show = 300;
	
	function showHide(parent,fristChild){
		if(!($(parent).length)){return;}
		$(parent).each(function(i){
			$(parent + ":eq("+i+")").hover(function(){
				$(this).css({"z-index":99,"position":"relative"});
				$(parent + ":eq("+i+") " + fristChild).stop(false,true).fadeIn(100);
			},function(){
				$(this).css({"z-index":1,"position":"relative"});
				$(parent + ":eq("+i+") " + fristChild).stop(false,true).fadeOut($show);
			});
		});
	};

	showHide("ul.commPad2_ul li","div.commBox6")
});

//banner高度
jQuery(document).ready(function($){
	//var $caHei = $('<div id="bodHei"></div>');
	//if(!$(".body")){return false;}
	//$("body").append($caHei);
	//$(".body").before($("#bodHei"));
	//$('body').css('background','url(web/images/Tech_Bg.jpg) repeat-x 0 93px #FFF;')
});



jQuery(document).ready(function($){
	function boDeWid(content,bParent){
		
		var $oDiv = $(content).width();
		
		if(!$(content)) return false;
		$(bParent).css("width",$oDiv);
	};
	boDeWid("#pascar_BigBox1", ".body");
})

//车系内容页面左侧样式
jQuery(document).ready(function($){
	
	
	if($("#commPos").length = 0) return false;
	
	$("#commPos li").each(function(i){
		$("#commPos li:eq("+i+")").hover(function(){
			$(this).addClass("carparCon_Le1");
		},function(){
			$(this).removeClass("carparCon_Le1");
		});
	});
})


