﻿// JScript File

var Prefix;
function SetUserNameVal(type)
{
        if(type=='1')
        {
             var txtUserName=document.getElementById(Prefix+'txtUserName');
            
             if(txtUserName.value=='Username')
             {
                txtUserName.value="";
             }
           
      }
      else if(type=='3')
        {
         var txtPwd=document.getElementById(Prefix+'txtPwd');
          if(txtPwd.value=='password')
             {
                txtPwd.value='';
                
             }
        }
      else
      {
            var txtEmail=document.getElementById(Prefix+'txtEmail');
           
              if(txtEmail.value=='Enter email or user name')
             {
                txtEmail.value="";
             }
      }
}

function ShowDiv()
{
    var DivPWD=document.getElementById('DivPWD');
  
    DivPWD.style.display="block";
}


 function changeBox()
 {
    document.getElementById('div1').style.display='none';
    document.getElementById('div2').style.display='';
    
    document.getElementById(Prefix+'txtPwd').focus();
 }
 function restoreBox()
 {
    
    if(document.getElementById('password').value=='')
    {
      document.getElementById('div1').style.display='';
      document.getElementById('div2').style.display='none';
    }
 }

function SenMail()
{
    
      var txtEmail=document.getElementById(Prefix+'txtEmail');
         CallServer("Action=SendMail&Email="+txtEmail.value);
         return false;
}
function ChkCapcha()
        {
        
            var txtCaptcha=document.getElementById('ctl00_ContentPlaceHolder1_txtCaptcha');
           
            CapchaCallServer(txtCaptcha.value);
        }
function ReceiveCapchaServerData(retVal)
        {
           var  hdnIsCapcha=document.getElementById('ctl00_ContentPlaceHolder1_hdnIsCapcha');
            if(retVal=="Error")
            {
                hdnIsCapcha.value="0";
            }
            else
            {
             hdnIsCapcha.value="1";
            }
            
        }
        
    function ChkValidation()
    {
            var validated = Page_ClientValidate("VGClient");
             var  hdnIsCapcha=document.getElementById('ctl00_ContentPlaceHolder1_hdnIsCapcha');
             var lblError=document.getElementById('lblError');
            
            if(validated)
            {
                if(hdnIsCapcha.value=="0" || hdnIsCapcha.value=="")
                {
             
                    lblError.innerHTML ="Type the characters you see in the picture above.";
                    return false;
                }
                else
                {
                    lblError.InnerHTML="";
                    return true;
                }
            }
            
            return true;
        
    }