﻿function showTime(container)
{
   //window.alert(container.tagName);
   var output="";
   var nowTime=new Date();
   
   var datePart=nowTime.getYear()+"年"+(nowTime.getMonth()+1)+"月"+nowTime.getDate()+"日";
   var weekPart="星期"+"日一二三四五六".charAt(nowTime.getDay());
   var timePart=covertDbl(nowTime.getHours())+"时"
                   +covertDbl(nowTime.getMinutes())+"分"
                   +covertDbl(nowTime.getSeconds())+"秒";   
   output=datePart+" "+weekPart+" "+timePart;
   
   container.innerText=output;
}

function covertDbl(value)
{
   return (value+"").length!=2?"0"+value:value;  	
} 

function hide(_sId)
{
   $(_sId).style.display=$(_sId).style.display=="none"?"block":"none"; 
}

	    
function $(elementId)
{
   return document.getElementById(elementId);
}

function onlynumber(){
	if (event.keyCode==13){
		return true;
	}
    if (event.keyCode<44||event.keyCode>57){
        event.keyCode=0;
        event.returnValue=false;
    }
	event.returnValue=true;
}

function onlyNumberandEnglish(){
	if (event.keyCode==13){
		return true;
	}
	if (event.keyCode<44)
    {
        event.keyCode=0;
        event.returnValue=false;
    }
    if (event.keyCode>57 && event.keyCode<65)
    {
        event.keyCode=0;
        event.returnValue=false;
    }
    if (event.keyCode>90 && event.keyCode<97)
    {
        event.keyCode=0;
        event.returnValue=false;
    }
    if (event.keyCode>122)
    {
        event.keyCode=0;
        event.returnValue=false;
    }
    
	event.returnValue=true;
}

function dosubmit(){ 		
         if($('cardtype').value==''){
              alert("请选择您的证件类型!");
              $('cardtype').focus();
              return false;
         }
         if($('cardid').value==''){
              alert("请输入您的证件号码!");
              $('cardid').focus();
              return false;
         }
         if($('password').value==''){
              alert("请输入您的密码!");
              $('password').focus();
              return false;
         }
         if($('yanzhengma').value==''){
              alert("请输入您的验证号码!");
              $('yanzhengma').focus();
              return false;
         }
	     loginIndex.submit();     
}


 function chkEmail(srcEL)
{
   var a=new Array();
   var j=0;
   var len=srcEL.length;
   if (srcEL=="") return true;
   var p=srcEL.indexOf("@");
   var p1=srcEL.lastIndexOf("@");
   if (p!=p1){
      alert("Email格式无效字符@只能有一个!");
      return false;
   }
   //检查字符@存在
   if (p<1){
      alert("Email格式无效缺字符@或@在第一位!");
      return false;
   }

   if (len==p+1){
      alert("Email格式无效字符@后不能没有字符!");
      return false;
   }
   //检查字符.存在
   if (srcEL.indexOf(".")==-1){
      alert("Email格式无效　缺字符.!");
      return false;
   }

	 if (CheckFirst(srcEL.substring(0,1)))
		{
		alert("不能以“_”或者“-”开始");
		return false;
	 }
	 if (CheckLast(srcEL.substring(len-1,len)))
		 {
		 alert("不能以“_”或者“-”结尾! ");
		 return false;
	 }
	  if (CheckFirstDot(srcEL.substring(0,1)))
		{
		alert("不能以“.”开始");
		return false;
	 }
	if(!havenoChar(srcEL))
		{
		alert("只能由英文字母、阿拉伯数字、下划线、横线、@和.构成，不能有空格，并且必须以英文字母或数字开头");
		return false;
	}

   //检查字符.的位置
   for (i=p+1;i<len;i++){
      if (srcEL.substr(i,1)=="."){
          if (i==srcEL.length-1) {
              alert("Email格式无效字符.后不能没有字符!");
	          return false;
          }
          else if ((srcEL.substr(i-1,1)==".")||(srcEL.substr(i+1,1)==".")){
	          alert("Email格式无效字符.前后不能没有字符!");
	          return false;
          }
       }
   }
   return true;
}









