// JavaScript Document

	function conHideShow(nav,conBox,className,effect,speed)
		{
			$(nav).click(function(){
				var i=$(this).index();
				$(nav).removeClass(className);
				$(this).addClass(className);
				if(effect=='fade')
				{
					$(conBox+":visible").fadeOut(speed,function(){
							$(conBox).eq(i).fadeIn(speed);
						});
				}
				if(effect=='hideshow')
				{
					$(conBox+":visible").hide(speed,function(){
							$(conBox).eq(i).show(speed,function(){
									$(conBox).eq(i).show(speed);
								});
						});
				}
				if(effect=='slide')
				{
					$(conBox+":visible").slideUp(speed,function(){
							$(conBox).eq(i).slideDown(speed);
						});
				}
			});
		}
		
	function checkBottonBg(id,className,url)
	{
		$('#'+id).mouseover(function(){
			$(this).toggleClass(className);
		})
		$('#'+id).mouseout(function(){
			$(this).toggleClass(className);
		})
		$('#'+id).click(function(){
			window.open(url);
		})
	}

	function checkPageJump(inputId,url,other)
	{
		var input=document.getElementById(inputId);
		var inputVal=document.getElementById(inputId).value;
		if(isNaN(inputVal)||inputVal=="")
		{
			return false;
		}
		else
		{
			location.href=url+inputVal+other;
		}
	}
	
	//保存高度一致
	function keepHeight(ID1,ID2)
	{
		var  a=document.getElementById(ID1); 
		var  b=document.getElementById(ID2);
		if(a.clientHeight < b.clientHeight) 
		{ 
		a.style.height=b.clientHeight+ "px "; 
		} 
		else{ 
		b.style.height=a.clientHeight+ "px "; 
		} 
	}
	
	//按下搜索按钮时
	function checkSearchSubmit(formId,keywordIputId,url,val)
	{
		var form=document.getElementById(formId);
		var keyword=document.getElementById(keywordIputId);
		if(keyword.value.replace(/(^\s*)|(\s*$)/g, "")==''||keyword.value==val)
		{
			keyword.value=val;
			return false;
		}
		else
		{
			form.action=url;
			form.submit();
		}
		
	}
	
	//search表单检查
	function checkSearchInput(keywordIputId,val)
	{
		var keyword=document.getElementById(keywordIputId);
		keyword.onfocus=function()
		{
			keyword.value='';
		}
		keyword.onblur=function()
		{
			if(keyword.value.replace(/(^\s*)|(\s*$)/g, "")==''||keyword.value==val)
			{
				keyword.value=val;
			}
		}
	}
function preloadImages() {
	var d=document;
	if(d.images){
		if(!d.p) d.p=new Array();
		var i,j=d.p.length,a=preloadImages.arguments;
		for(i=0; i<a.length; i++)
		if (a[i].indexOf("#")!=0){
			d.p[j]=new Image;
			d.p[j++].src=a[i];
		}
	}
}
