// JavaScript Document
//用户注册
function CheckUserRegForm(d)
{
	if(d.UserName.value==""){alert("UserName can't empty!");d.UserName.focus();return false;}
	if(d.UserPass.value==""){alert("Password can't empty!");d.UserPass.focus();return false;}
	if(d.RealName.value==""){alert("Name can't empty!");d.UserName.focus();return false;}
	if(d.Email.value==""){alert("Email can't empty!");d.Email.focus();return false;}
	if(d.Tel.value==""){alert("Tel can't empty!");d.Tel.focus();return false;}
	if(d.Address.value==""){alert("Address can't empty!");d.Address.focus();return false;}
}

//用户登陆
function CheckUserLoginForm(d)
{
  if(d.UserName.value==""){alert("UserName can't empty!");	d.UserName.focus();	return false;}
  if(d.UserPass.value==""){alert("Password can't empty!");	d.UserPass.focus();	return false;}
}

//用户信息
function CheckUserInfoForm(d)
{
  if(d.RealName.value==""){alert("Name can't empty!");	d.UserName.focus();	return false;}
  if(d.Email.value==""){alert("Email can't empty!");d.Email.focus();return false;}
  if(d.Tel.value==""){alert("Tel can't empty!");d.Tel.focus();return false;}
  if(d.Address.value==""){alert("Address can't empty!");d.Address.focus();return false;}
}

//产品订购
function CheckOrderFrm(d){
if(d.ProductName.value==""){alert("Product names can not be empty!");d.ProductName.focus();return false;}
if(d.OrderNum.value==""){alert("The order quantity can not be empty!");d.OrderNum.focus();return false;}
if(d.LinkMan.value==""){alert("Names can not be empty!");d.LinkMan.focus();return false;}
if(d.Company.value==""){alert("Company names can not be empty!");d.Company.focus();return false;}
if(d.Addr.value==""){alert("Contact address can not be empty!");d.Addr.focus();return false;}
if(d.Tel.value==""){alert("Contact telephone number can not be empty!");d.Tel.focus();return false;}
if(d.Mobile.value==""){alert("Phone numbers can not be empty!");d.Mobile.focus();return false;}
if(d.Email.value=="" || d.Email.value.indexOf("@")==-1 || d.Email.value.indexOf(".")==-1){alert("Please input your mail addresses!");d.Email.focus();return false;}
}

//职位申请
function CheckJobFrm(d){
if(d.JobName.value==""){alert("Job can't empty!");d.JobName.focus();return false;}
if(d.Name.value==""){alert("Name can't empty!");d.Name.focus();return false;}
if(d.Age.value==""){alert("Age can't empty!");d.Age.focus();return false;}
if(d.Institutions.value==""){alert("Institutions can't empty!");d.Institutions.focus();return false;}
if(d.Professional.value==""){alert("Professional can't empty!");d.Professional.focus();return false;}
if(d.Qualifications.value==""){alert("Qualifications can't empty!");d.Qualifications.focus();return false;}
if(d.Address.value==""){alert("Address can't empty!");d.Address.focus();return false;}
if(d.Tel.value==""){alert("Tel can't empty!");d.Tel.focus();return false;}
if(d.Email.value=="" || d.Email.value.indexOf("@")==-1 || d.Email.value.indexOf(".")==-1){alert("Please enter the correct e-mail address!");d.Email.focus();return false;}
}

//客户反馈
function CheckFeedbackFrm(d){
if(d.firstname.value==""){alert("Please input your firstname!");d.firstname.focus();return false;}
if(d.lastname.value==""){alert("Please input your lastname theme!");d.lastname.focus();return false;}
if(d.Company.value==""){alert("Please input your Company!");d.Company.focus();return false;}
if(d.Tel.value==""){alert("Please input your telephone!");d.Tel.focus();return false;}
if(d.Email.value=="" || d.Email.value.indexOf("@")==-1 || d.Email.value.indexOf(".")==-1){alert("Please input your mail addresses!");d.Email.focus();return false;}
if(d.employees.value==""){alert("Please input employees theme!");d.employees.focus();return false;}
if(d.business.value==""){alert("Please input business theme!");d.business.focus();return false;}
if(d.comments.value=="" ){alert("Please leave a comments as the importation!");d.comments.focus();return false;}
}

//留言本
function CheckBookFrm(d){
if(d.RealName.value==""){alert("Please input your name!");d.RealName.focus();return false;}
if(d.Email.value=="" || d.Email.value.indexOf("@")==-1 || d.Email.value.indexOf(".")==-1){alert("Please enter the correct e-mail address!");d.Email.focus();return false;}
if(d.Subject.value==""){alert("Please input messages theme!");d.Subject.focus();return false;}
if(d.Content.value=="" ){alert("Please leave a message as the importation!");d.Content.focus();return false;}
}
//显示当前日期
function showdate(obj)
{
  var now_date = new Date();
  var years = now_date.getYear();
  var months = now_date.getMonth()+1;
  var dates = now_date.getDate();
  var days = now_date.getDay();
  var m;
  if (months==1){ m="Jan";}
  if (months==2){ m="Feb";}
  if (months==3){ m="Mar";}
  if (months==4){ m="Apr";}
  if (months==5){ m="May";}
  if (months==6){ m="Jun";}
  if (months==7){ m="Jul";}
  if (months==8){ m="Aug";}
  if (months==9){ m="Sep";}
  if (months==10){ m="Oct";}
  if (months==11){ m="Nov";}
  if (months==12){ m="Dec";}
  if(now_date.getDay()==0) days = "Sunday"
  if(now_date.getDay()==1) days = "Monday"
  if(now_date.getDay()==2) days = "Tuesday"
  if(now_date.getDay()==3) days = "Wednesday"
  if(now_date.getDay()==4) days = "Thursday"
  if(now_date.getDay()==5) days = "Friday"
  if(now_date.getDay()==6) days = "Saturday"
  var today =  m + "&nbsp;"+ dates+ "&nbsp;," + years + "&nbsp;"+days +" ";
  obj.innerHTML=today;
 }

//显示当前时间
function showtime(obj)
{
    var now_time = new Date();
	var hours = now_time.getHours();
	var minutes = now_time.getMinutes();
	var seconds = now_time.getSeconds();
	var timer = hours;
	timer  += ((minutes < 10) ? ":0" : ":") + minutes;
	timer  += ((seconds < 10) ? ":0" : ":") + seconds;
    obj.innerHTML=timer;
	setTimeout("showtime()",1000);
}

//限制输入的内容只能为Refstring
function isNumberString (InString,RefString)
{
if(InString.length==0) return (false);
for (Count=0; Count < InString.length; Count++)  {
	TempChar= InString.substring (Count, Count+1);
	if (RefString.indexOf (TempChar, 0)==-1)  
	return (false);
}
return (true);
}

/**去掉前后空格:包括全角空格*/
function trim(str)
{   
    str += "";
    while( (str.charAt(0)==' ')||(str.charAt(0)=='　')||(escape(str.charAt(0))=='%u3000') )     
         str=str.substring(1,str.length);
    while( (str.charAt(str.length-1)==' ')||(str.charAt(str.length-1)=='　')||(escape(str.charAt(str.length-1))=='%u3000') )  
        str=str.substring(0,str.length-1);
    return str;
}

//弹出式窗口
function openWin(URL) 
{
  window.open(URL,'_blank','toolbar=no,menubar=no,location=no,status=no,scrollbars=no,resizable=no,top=200,left=200,width=600,height=500');
}

//网页对话框
function openDialog(URL)
{
var val=document.addform.myname.value;
window.showModalDialog(URL,val,"dialogWidth=400px;dialogHeight=500px;dialogTop=0;center=yes;help=no;resizable=no;status=yes;scroll=yes");
}
//添加到收藏夹
function addfav(url,name)
{
	window.external.addFavorite(url,name)
}
//把网站设为首页
function sethome(id,url)
{
	id.style.behavior='url(#default#homepage)';id.sethomepage(url);return false;
}

//onMouseOver事件
function over(id)
{
	for(var i=1;i<=6;i++)
	{
		document.getElementById("tb"+i).style.display="none";
		}
		document.getElementById(id).style.display="";
}
//显示层
function showLayer(id)
{
	id.style.visibility="visible";	
	}
	
//隐藏层
function hiddenLayer(id)
{
	id.style.visibility="hidden";	
	}