﻿$(function(){
var ctl00_ContentPlaceHolder1_ForgotEmail = {"isVali":false};
$("#ctl00_ContentPlaceHolder1_ForgotEmail").focus(function(){
   ctl00_ContentPlaceHolder1_ForgotEmail.isVali = false;
}).submit(function(){
   var valikey = /^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
   if(valikey.test($(this).val()) && !ctl00_ContentPlaceHolder1_ForgotEmail.isVali)
   {
       showwaiting("ctl00_ContentPlaceHolder1_ForgotEmail");
       var mydate = new Date().toLocaleString();
       $.get("common/CheckEmail.ashx?LoginEmail="+$(this).val()+"&mydate="+mydate,function(data){
       removewaiting();
       if(data == "Y")
       {
           ctl00_ContentPlaceHolder1_ForgotEmail.isVali = true;
           removeerr("ctl00_ContentPlaceHolder1_ForgotEmail","Please enter a valid e-mail address.");
           if(ctl00_ContentPlaceHolder1_ImageButton1.isVali)
           {
               $("#ctl00_ContentPlaceHolder1_ImageButton1").click();
               ctl00_ContentPlaceHolder1_ImageButton1.isVali = false;
           }
       }
       else
       {
           adderr("ctl00_ContentPlaceHolder1_ForgotEmail","Your e-mail address is not on file.");
       }});
   }
   else if(!valikey.test($(this).val()))
   {
       adderr("ctl00_ContentPlaceHolder1_ForgotEmail","Please enter a valid e-mail address.");
   }
});

var ctl00_ContentPlaceHolder1_ImageButton1 = {"isVali":false};
$("#ctl00_ContentPlaceHolder1_ImageButton1").click(function(){
$("#").html("");
$("#ctl00_ContentPlaceHolder1_ForgotEmail").submit();


ctl00_ContentPlaceHolder1_ImageButton1.isVali = true;
if(ctl00_ContentPlaceHolder1_ForgotEmail.isVali ){ return true;}else{ return false;}});
});
adderr = function(id,err)
{
    $("#"+id+"_Err").html(err);
    try{
       ShowErr(id);
    }catch(e){}
}

removeerr = function(id,err)
{
    $("#"+id+"_Err").html("");
    try{
       HideErr(id);
    }catch(e){}
}
