// JavaScript Document
//用户注册
function CheckUserRegForm(d)
{
  if(d.UserName.value==""){alert("用户名不能为空！");d.UserName.focus();return false;}
  if(d.UserPass.value==""){alert("密码不能为空！");d.UserPass.focus();return false;}
  if(d.RealName.value==""){alert("姓名不能为空！");d.RealName.focus();return false;}
//  if(d.usercode.value==""){alert("机器码不能为空！");d.usercode.focus();return false;}  
  if(d.Email.value==""){alert("邮件不能为空！");d.Email.focus();return false;}
  if(d.Tel.value==""){alert("电话不能为空！");d.Tel.focus();return false;}
  //if(d.Address.value==""){alert("地址不能为空！");d.Address.focus();return false;}
}

//用户登陆
function CheckUserLoginForm(d)
{
  if(d.UserName.value==""){alert("用户名不能为空！");d.UserName.focus();return false;}
  if(d.UserPass.value==""){alert("密码不能为空！");d.UserPass.focus();return false;}
}

//找回密码
function CheckGetPassForm(d)
{
  if(d.UserName.value==""){alert("用户名不能为空！");d.UserName.focus();return false;}
if(d.Email.value=="" || d.Email.value.indexOf("@")==-1 || d.Email.value.indexOf(".")==-1){alert("请输入正确的邮件地址！");d.Email.focus();return false;}
}

//用户信息
function CheckUserInfoForm(d)
{
  if(d.RealName.value==""){alert("姓名不能为空！");d.RealName.focus();	return false;}
  if(d.Email.value==""){alert("邮件不能为空！");d.Email.focus();return false;}
  if(d.Tel.value==""){alert("电话不能为空！");d.Tel.focus();return false;}
  if(d.Address.value==""){alert("地址不能为空！");d.Address.focus();return false;}
}

//产品订购
function CheckOrderFrm(d){
if(d.ProductName.value==""){alert("产品名称不能为空！");d.ProductName.focus();return false;}
if(d.OrderNum.value==""){alert("订购数量不能为空!");d.OrderNum.focus();return false;}
if(d.LinkMan.value==""){alert("姓名不能为空！");d.LinkMan.focus();return false;}
if(d.Company.value==""){alert("单位名称不能为空!");d.Company.focus();return false;}
if(d.Addr.value==""){alert("联系地址不能为空！");d.Addr.focus();return false;}
if(d.Tel.value==""){alert("联系电话不能为空!");d.Tel.focus();return false;}
if(d.Mobile.value==""){alert("手机号码不能为空！");d.Mobile.focus();return false;}
if(d.Email.value=="" || d.Email.value.indexOf("@")==-1 || d.Email.value.indexOf(".")==-1){alert("请输入正确的邮件地址！");d.Email.focus();return false;}
}

//职位申请
function CheckJobFrm(d){
if(d.JobName.value==""){alert("应聘职位不能为空！");d.JobName.focus();return false;}
if(d.Name.value==""){alert("姓名不能为空！");d.Name.focus();return false;}
if(d.Age.value==""){alert("年龄不能为空！");d.Age.focus();return false;}
if(d.Institutions.value==""){alert("毕业院校不能为空！");d.Institutions.focus();return false;}
if(d.Professional.value==""){alert("所学专业不能为空！");d.Professional.focus();return false;}
if(d.Qualifications.value==""){alert("最高学历不能为空！");d.Qualifications.focus();return false;}
if(d.Address.value==""){alert("联系地址不能为空！");d.Address.focus();return false;}
if(d.Tel.value==""){alert("联系电话不能为空！");d.Tel.focus();return false;}
if(d.Email.value=="" || d.Email.value.indexOf("@")==-1 || d.Email.value.indexOf(".")==-1){alert("请输入正确的邮件地址！");d.Email.focus();return false;}
}

//客户反馈
function CheckFeedbackFrm(d){
if(d.LinkMan.value==""){alert("请输入您的姓名！");d.LinkMan.focus();return false;}
if(d.Tel.value==""){alert("请输入您的联系电话");d.Tel.focus();return false;}
if(d.Email.value=="" || d.Email.value.indexOf("@")==-1 || d.Email.value.indexOf(".")==-1){alert("请输入正确的邮件地址！");d.Email.focus();return false;}
if(d.Subject.value==""){alert("请输入留言主题！");d.Subject.focus();return false;}
if(d.Content.value=="" ){alert("请输入留言内容！");d.Content.focus();return false;}
}

//留言本
function CheckBookFrm(d){
if(d.RealName.value==""){alert("请输入您的姓名！");d.RealName.focus();return false;}
if(d.Email.value=="" || d.Email.value.indexOf("@")==-1 || d.Email.value.indexOf(".")==-1){alert("请输入正确的邮件地址！");d.Email.focus();return false;}
if(d.Subject.value==""){alert("请输入留言主题！");d.Subject.focus();return false;}
if(d.Content.value=="" ){alert("请输入留言内容！");d.Content.focus();return false;}
}

//显示当前日期
function showdate(obj)
{
  var now_date = new Date();
  var years = now_date.getYear();
  var months = now_date.getMonth();
  var dates = now_date.getDate();
  var days = now_date.getDay();
  if(now_date.getDay()==0) days = "星期日"
  if(now_date.getDay()==1) days = "星期一"
  if(now_date.getDay()==2) days = "星期二"
  if(now_date.getDay()==3) days = "星期三"
  if(now_date.getDay()==4) days = "星期四"
  if(now_date.getDay()==5) days = "星期五"
  if(now_date.getDay()==6) days = "星期六"
  var today = years + "年" + (months+1) + "月" + dates + "日" + " "+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";	
	}
