﻿function CheckEmailt()
{
   var patrn=/^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
   var value=$.trim($("#EMail").val());
   if (!patrn.exec(value)) 
   return false;
   else
   return true;
}
function CheckEmail()
{
if($("#EMail").val()!="")
{
 if(!CheckEmailt())
       {
       
        $("#eminfo").html("<img src='http://static.6dxy.com/image/check_error.gif' />邮箱不正确");
        return false;
        }
        else
        {
        ajax('email',$("#EMail").val(),'#eminfo');
        if($("#eminfo").html().indexOf("check_error")>0)
        {

        return false;
        
        }
        
        else
        {
        return true;
        }
        }
  }
else
{
  $("#eminfo").html("<img src='http://static.6dxy.com/image/check_error.gif' />邮箱不能为空");
  return false;
}
}
function ajax(tp,va,infoid){
   $.ajax({
  type: "Post",
  url: "../Service/RegisterVaildatorUser.aspx",
  data: "tp="+tp+"&va="+va,
  dataType:"html",
  success: function(msg){ 
  $(infoid).html(msg);
  } 
}); 
}
function CheckUsername()
{
      if( $("#username").val()!=""&&($("#username").val().length>2&&$("#username").val().length<14))
      {
      ajax('username',$("#username").val(),'#uninfo');
       if($("#uninfo").html().indexOf("check_error")>0)
      {

        return false;
        }
        else
        {

        return true;
        }
      }
      else if($("#username").val().length<3||$("#username").val().length>14)
      {
       $("#uninfo").html("<img src='http://static.6dxy.com/image/check_error.gif' />用户名长度在3－14之间");
       return false;
      }
      else
      {
       $("#uninfo").html("<img src='http://static.6dxy.com/image/check_error.gif' />用户名不能为空");
       return false;
      }
}
function CheckPassword()
{
 if($("#Password").val().length<4||$("#Password").val().length>14)
                {
                $("#passinfo").html("<img src='http://static.6dxy.com/image/check_error.gif' />密码要在长度在4-14之间");
                return false;
                }
                else
                {
                 $("#passinfo").html("<img src='http://static.6dxy.com/image/check_right.gif' />");
                 return true;
                }
}
function CheckPassword1()
{
if($("#Password").val().length<4||$("#Password").val().length>14)
{
    $("#passinfo1").html("<img src='http://static.6dxy.com/image/check_error.gif' />密码要在长度在4-14之间");
      return false;
  }
  else
  {

 if($("#Password1").val()!=$("#Password").val())
                {
                $("#passinfo1").html("<img src='http://static.6dxy.com/image/check_error.gif' />密码不一致");
                return false;
                }
                else
                {
                $("#passinfo1").html("<img src='http://static.6dxy.com/image/check_right.gif' />");
                return true;
                }
  }
}
function getcode(Vid)
{
 $(Vid).html("<img src='http://www.6dxy.com/common/code.aspx' />");
}
//日期差计算
function DateTillNow(){
        todayDate = new Date()
        date2 = new Date("08-08-2008")
        date1 = new Date((todayDate.getMonth()+1) + '-' + todayDate.getDate() + '-' + todayDate.getYear())
        return ((date2-date1)/1000/60/60/24)
}