function menu(id){
	var sid=document.getElementById(id);
	if (sid.style.background=='url(img/'+id+'.gif) 0px 22px'){
		sid.style.background='url(img/'+id+'.gif) 0px 0px';
	}else{
		sid.style.background='url(img/'+id+'.gif) 0px 22px';
	}
}
function goURL(id){
	switch(id){
		case "menu_1":
			window.location.href="index.php";
		break;
		case "menu_2":
			window.location.href="product.php";
		break;
		case "menu_3":
			window.location.href="newProduct.php";
		break;
		case "menu_4":
			window.location.href="catalog.php";
		break;
		case "menu_5":
			window.location.href="feedback.php";
		break;
		case "menu_6":
			window.location.href="contact.php";
		break;
		//case default:
			//window.location.href="index.asp";
	}
}
function mailto(){
	var email="info@junlanglighting.com";
	window.location.href="mailto:"+email;
}
//:::::::::页面载入时
function window.onload(){
	//t=setInterval("ShowDate()",100);
}
//:::::::::显示日期
function ShowDate(){
	day = new Date();
	var x = new Array("Sunday", "Monday", "Tuesday");
	var x = x.concat("Sebsday","Thursday", "Friday");
	var x = x.concat("Saturday");
	str=day.getYear()+"-";
	str+=(day.getMonth()+1)+"-";
	str+=day.getDate()+" "+x[day.getDay()]+" ";
	s=day.getHours();
	if (s<6){
		str+="darknight ";
	}else if(s<12){
		str+="morning ";
	}else if(s<14){
		str+="noon ";
	}else if(s<18){
		str+="afternoon ";
	}else if(s<24){
		str+="night ";
	}
	if(s<10)s="0"+s;
	str+=s+":";
	str+=day.getMinutes()+":";
	s=day.getSeconds();
	if(s<10)s="0"+s;
	str+=s;
	timer.innerHTML=str;
}
function check(){
	var go=true;
	var msg="";
	var uid=document.getElementById("UserName").value;
	var pw=document.getElementById("Passwords").value;
	if (uid==""){
		go=false;
		msg="<li>Plesae input username!";
		document.getElementById("UserName").focus();
	}
	if (pw==""){
		go=false;
		msg+="<li>Plesae input passwords!";
		document.getElementById("Passwords").focus();
	}
	if (go==true){
		var Url="Login_Check.asp?UserName="+uid+"&Passwords="+pw;
		var strResult=GetActionResult(Url);
		timer.innerHTML=strResult;
		if (strResult=="ok"){
			ShowError("OK","Pass...",false,true);
			window.location.reload();
		}else{
			ShowError("Alert","Sorry,Username or password is Wrong,Please try again...",true,false);return false;
		}
	}else{
		ShowError("Alert",msg,true,false);return false;
	}
}
function gocheck(){
	if(event.keyCode==13){check();}
}
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::返回:简化的
function goback(n){
	history.go(n);
}
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::返回:错误返回的
function goback2(n){
	maskbar.style.display="none";maskbox.style.display="none";bannar1.style.display="";
}
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::跳转页面：
function goPage(n,Url){
	if((event.keyCode<45)||(event.keyCode>57)) event.returnValue=false;
	if(event.keyCode==13){
		var page=document.getElementById("PageNumber").value;
		var str=Url+"PageNo="+page;
		ShowError("载入中,请稍候...","正在载入转到第 " + page + " 页......",false,true)
		window.location.href=str;
	}
}
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::错误信息处理
function ShowError(title,content,btn,load){
	maskbar.style.display="";maskbox.style.display="";bannar1.style.display="none";
	maskbar.style.height=document.body.scrollHeight;
	maskbar.style.width=document.body.scrollWidth;
	var str="<div id='err_title'><img src='img/err_1.gif' align='absmiddle'>&nbsp;"+title+"</div>";
	str+="<div id='err_content'>"+content+"</div>";
	if (btn==true){
		str+="<div id='err_button'><div id='btn2' onClick='goback2()'>";
		str+="<img src='img/goback.gif' align='absmiddle'>&nbsp;返回</div></div>";
	}
	if (load==true){
		str+="<img src='img/loading.gif' align='absmiddle'>";
	}
	moveid.innerHTML=str;
	maskbox.style.top=document.body.scrollTop+(document.body.offsetHeight-maskbox.offsetHeight)/2;
}
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
function XmlObjPKY(){
	if (window.XMLHttpRequest){
		xmlObj = new XMLHttpRequest();
	}else if (window.ActiveXObject){
		xmlObj = new ActiveXObject("Microsoft.XMLHTTP");
	}
	return xmlObj;
}
function GetActionResult(Url){
	var xmlObj=XmlObjPKY();
	xmlObj.open("POST",Url,false);
	xmlObj.send();
	return unescape(xmlObj.responseText);
}
function checkfeedback(){
	var go=true;
	var msg="";
	var linkman=document.form1.Linkman;
	var phone=document.form1.Phone;
	var email=document.form1.Email;
	var title=document.form1.Title;
	if (linkman.value==""){
		go=false;
		msg="<li>Plesae input linkman!";
		linkman.focus();
	}
	if (phone.value==""){
		go=false;
		msg+="<li>Plesae input phone!";
		phone.focus();
	}
	if (email.value==""){
		go=false;
		msg+="<li>Plesae input email!";
		email.focus();
	}
	if (title.value==""){
		go=false;
		msg+="<li>Plesae input title!";
		title.focus();
	}
	if (go==true){
		ShowError("OK","Saving...",false,true);return true;;
	}
	ShowError("Alert",msg,true,false);return false;
	return false;
}
