﻿// JScript File

function showLoginDiv()
{
    document.getElementById("ctl00_ContentPlaceHolder1_divLoginPopUp").style.left = ((screen.availWidth - parseInt(document.getElementById("ctl00_ContentPlaceHolder1_divLoginPopUp").style.width))/2) + "px";
    document.getElementById("ctl00_ContentPlaceHolder1_divLoginPopUp").style.top = ((screen.availHeight - parseInt(document.getElementById("ctl00_ContentPlaceHolder1_divLoginPopUp").style.height))/2) + "px";
	document.getElementById("ctl00_ContentPlaceHolder1_divLoginPopUp").style.display = "";
	document.getElementById("ctl00_ContentPlaceHolder1_lblLoginErrorMsg").innerHTML="";
}

function hideLoginDiv()
{
   document.getElementById("ctl00_ContentPlaceHolder1_divLoginPopUp").style.display = "none";
}
			
function  getPassword(event)
{
    var keyval=window.event?window.event.keyCode:event.which;

    if (keyval == 13)
    {
        if(Validatefields() == true)
            __doPostBack('ctl00$ContentPlaceHolder1$btnLogin','');
    }
}
var CapchaVerification;
CapchaVerification = false;
 function validateCaptcha(obj)
 {
   
    if (obj.value != document.getElementById("ctl00_ContentPlaceHolder1_hdnCapcha").value)
    {
        //document.getElementById("ctl00_ContentPlaceHolder1_lblErrMsg").innerHTML = 'Please Enter the correct text as in the Image.';
        return false;
    }
    else
    {
        document.getElementById("ctl00_ContentPlaceHolder1_lblErrMsg").innerHTML = '';
    }
    CapchaVerification = true;
    return true;
 }
 
function Validatefields()
 {  
    var lalErrMsg = "" ;
    var flag;
    flag = true;

    if(document.getElementById("ctl00_ContentPlaceHolder1_txtEmail").value =="")
       {  
          lalErrMsg = addComma(lalErrMsg) + 'Email';
          flag = false;
          
       } 
    else if(ChkValidEmail(document.getElementById("ctl00_ContentPlaceHolder1_txtEmail").value.replace(/^\s+|\s+$/, '')) == false)
    {
        lalErrMsg = addComma(lalErrMsg) + 'Email';
        flag = false;
    }
    if (document.getElementById("ctl00_ContentPlaceHolder1_txtPassword").value == "")
    {
        lalErrMsg = addComma(lalErrMsg)  + 'Password';
        flag = false;
    }
    
    if(flag == false)   
     document.getElementById("ctl00_ContentPlaceHolder1_lblErrMsg").innerHTML = 'The following field(s) has/have invalid values: ' + lalErrMsg;
    
     return flag;
 }

function ValidateForgotPasswordEmail()
{
    var lalErrMsg = "" ;
    var flag;
    flag = true;

    if(document.getElementById("ctl00_ContentPlaceHolder1_txtLoginEmail").value =="")
       {  
          lalErrMsg = addComma(lalErrMsg) + 'Email';
          flag = false;
          
       } 
    else if(ChkValidEmail(document.getElementById("ctl00_ContentPlaceHolder1_txtLoginEmail").value.replace(/^\s+|\s+$/, '')) == false)
    {
        lalErrMsg = addComma(lalErrMsg) + 'Email';
        flag = false;
    }
    
    if(flag == false)   
     document.getElementById("ctl00_ContentPlaceHolder1_lblLoginErrorMsg").innerHTML = "Please enter valid Email Id.";
     return flag;
 }
function DoPostback(event)
{
    if (event.keyCode == 13)
    {
        var bool = Validatefields();
        if (bool == true)
        {
            __doPostBack('btnLogin', '')                    
        }
        return false;
    }            
}