﻿       
function IsTimeValid(s) {
    var iDay, iMonth, iYear,iHour,iMinute,iSecond;
    var arrValues;

    arrValues = s.split(" ");
    arr1 = arrValues[0].split("-");
    arr2 = arrValues[1].split(":");
    
    
    iYear = arr1[0];
    iMonth = arr1[1];
    iDay = arr1[2];

    iHour = arr2[0];
    iMinute = arr2[1];
    iSecond = arr2[2];


    var testDate = new Date(iYear, iMonth - 1, iDay,iHour,iMinute,iSecond);
    if ((testDate.getDate() != iDay) ||
      (testDate.getMonth() != iMonth - 1) ||
      (testDate.getFullYear() != iYear) ||
      (testDate.getHours() != iHour) ||
      (testDate.getMinutes() != iMinute) ||
      (testDate.getSeconds() != iSecond)) {
        return false;
      
    }

    return true;
}

function IsEmail(inputobj){
    s=/\w+@\w+[.]\w+/;
    es=/@+\w*@+/;
    es2=/[.]{2,}/;
    var o=inputobj;
    var ifpoint1=o.value.substring(o.value.length-1,o.value.length);
    var ifpoint2=o.value.substring(0,1);
    try{
        if(ifpoint1=="."||ifpoint2=="."){
            window.alert("电子邮箱开始或结束不能是'.'");
            throw false;}
         }catch(e)
             {noerror=e;}
   ok=s.exec(o.value);
   error=es.exec(o.value);
   error2=es2.exec(o.value);
    try{
        if(!(ok!=null&&!error&&error2==null)){
            window.alert("请输入有效的邮件格式！如：'youname@mailserver.com'");
            o.focus();
            throw false;}
            return true;
           }catch(e){
               noerror=e;}
}
