// JavaScript Document

// JScript File

function forgotpasswordopen()
{
    document.getElementById('light').style.display='block';
    document.getElementById('txtEmail').focus();
    document.getElementById('fade').style.display='block'
    //document.getElementById('maincontainer').disabled=true;   
}
function forgotpassvalid()
{    
    var email=trim(document.getElementById('txtEmail').value);
    if(email=='')
    {
        alert(geterrmsg('e9'));
        document.getElementById('txtEmail').focus();
        return false;
    }
    else if(checkEmail(trim(document.getElementById("txtEmail").value))==false)
    {
        alert(geterrmsg('e23'));
        document.getElementById('txtEmail').focus();       
        return false;
    }
    else
    {
       
            xmlHttp=createRequestObject();
            if (xmlHttp==null)
            {
                alert ("Your browser does not support AJAX!");
                return;
            } 
            document.getElementById('forgot').innerHTML="<img src='/images/indicator_inpage.gif'/>";
            var url="/ajax/forgot-password.aspx";    
            url=url+"?email="+trim(document.getElementById("txtEmail").value); 
            xmlHttp.open("GET",url);          
            xmlHttp.onreadystatechange=function(){  if(xmlHttp.readyState==4)   
                                                    {                                                       
                                                        if(xmlHttp.responseText=='1')                                                        
                                                            alert(geterrmsg('e79'));
                                                        else
                                                            alert(geterrmsg('e80'));
                                                       document.getElementById('forgot').innerHTML='<a href="#" class="txt"><img ID="btnForgotSubmit" title="Submit" src="/images/submit_but.jpg" border="0" onmouseover="editSubmitOver(this)" onmouseout="editEmpSubmitOut(this)" onclick="return forgotpassvalid()"/></a>';
                                                     }           
                                                 };            
            xmlHttp.send(null);
      
   } 
   
}

function checkEnter(e){ //e is event object passed from function invocation
var key;

     if(window.event)
          key = window.event.keyCode;     //IE
     else
          key = e.which;     //firefox
     if(key == 13)
     { 
       forgotpassvalid();
     }

}
function createRequestObject()
    {       
        var request_obj ;
        var browser = navigator.appName ;
        
    if (browser == "Microsoft Internet Explorer")
     {
        request_obj = new ActiveXObject("Microsoft.XMLHttp");
     } 
    else
     {
        request_obj = new XMLHttpRequest();
     }
        return request_obj;
    }


function forgotpasswordclose()
{
    document.getElementById('light').style.display='none';
    document.getElementById('txtEmail').value='';       
    document.getElementById('fade').style.display='none';
    // document.getElementById('maincontainer').disabled=false;
}

var windowHeight,windowWidth;
if (window.innerHeight) 
{
    windowHeight=window.innerHeight + window.scrollMaxY; 
    
} else if (document.body.clientHeight) 
{
    windowHeight=document.body.clientHeight;    
}

if (window.innerWidth) 
{
    windowWidth=window.innerWidth -20;    
} else if (document.body.clientWidth) 
{
    windowWidth=document.body.clientWidth;    
}
if(document.getElementById("loginblack"))
{
var theImg = document.getElementById("loginblack");
theImg.width=windowWidth;
theImg.height= windowHeight ;
theImg.src="/images/b3b3b3.gif";
}