﻿// JScript File

//ADDED BY                :   VILAS PALVE.
//DATE                    :   11-NOV-2008.
//PURPOSE                 :   ADD FUNCTIONS.
//BROWSER COMPATIBILITY   :   Microsoft Internet Explorer.
    

//IMP. NOTE  :   If your changing the code in following function then
//               you also need to change in following file.
// File Name :   Login_FF.Js

    function OpenPassword(Request)
    {
        var ab;
        ab = "toolbar=no,height=150,width=425,left=200,top=200,scrollbars=no,status=no";
        
        if(Request=='Cand')
        {
            open("Forgotpwd.aspx?Type=Cand","NewPass",ab);        
            return false;
        }
        else if(Request=='Client')
        {
            open("Forgotpwd.aspx?Type=Employer","NewPass",ab);        
            return false;
        }
    }    

//IMP. NOTE  :   If your changing the code in following function then
//               you also need to change in following file.
// File Name :   Login_FF.Js

    
    //function for check valid input
    function ValidInput(Request)
    {
        var Check;
        if(Request=='Cand')
        {
            var VLoginId;
             Check=trimAll(document.getElementById('TxtUser').value);
             
             if(Check.length==0)
             {
                 alert("Please enter Login id.");
                 document.getElementById('TxtUser').focus()
                 return false;
             }
             VLoginId = Check;
             
             Check=trimAll(document.getElementById('TxtPwd').value);
             if (Check.length == 0) 
             {
                 alert("Please enter password.");
                 document.getElementById('TxtPwd').focus()
                 return false;
             }             
             //CHECK FOR PROPER USER NAME
             //CLIENT NAME  :   INDIA RECRUIT
            if(document.getElementById("HDNClient").value=='ir')
            { 
           
                if(document.getElementById("HDNRProfile").value == "Conf" )
                {             
                    Check = CheckEmail(VLoginId);                    
                    if(Check == "false")
                    {
                        return false;
                    }
                }                      
            }
             
             
             
             
        }
        else if(Request=='Client')
        {
            Check=trimAll(document.getElementById('TxtEmp_Uname').value);
             if(Check.length==0)
             {
                alert("Please enter Login id.");
                return false;
             }
             
             Check=trimAll(document.getElementById('TxtEmp_pwd').value);
             if(Check.length==0)
             {
                alert("Please enter password.");
                return false;
             }
        }
    }
    
//IMP. NOTE  :   If your changing the code in following function then
//               you also need to change in following file.
// File Name :   Login_FF.Js

 //Check email id in proper format
  function CheckEmail(PARAM)
  {
          var obj1;
          var BError;
          obj=new RegExp(/\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/);
          obj1=obj.exec(PARAM);          
          if(!obj1)
          {
               alert("Please enter Email Id.");
               BError="false";
          }      
      return BError;      
  }
      
//IMP. NOTE  :   If your changing the code in following function then
//               you also need to change in following file.
// File Name :   Login_FF.Js

  function trimAll( strValue ) 
  {
/************************************************
DESCRIPTION: Removes leading and trailing spaces.

PARAMETERS: Source string from which spaces will
  be removed;

RETURNS: Source string with whitespaces removed.
*************************************************/
 var objRegExp = /^(\s*)$/;

         //check for all spaces    
    if(objRegExp.test(strValue)) 
    {
       strValue = strValue.replace(objRegExp, '');
       if( strValue.length == 0)
       
          return strValue;
     }
        //check for leading & trailing spaces
       objRegExp = /^(\s*)([\W\w]*)(\b\s*$)/;
    if(objRegExp.test(strValue))
    {
       //remove leading and trailing whitespace characters
       strValue = strValue.replace(objRegExp, '$2');
    }
  return strValue;
}
        
   
//IMP. NOTE  :   If your changing the code in following function then
//               you also need to change in following file.
// File Name :   Login_FF.Js

    function BodyLoad()
    {  
        if(document.getElementById("HDNFlag").value=="1")
        {               
           var Tlb;
           var WindName ="Index";
           var Temp;
           
           Tlb = "height=690,width=1010,left=0,top=0,scrollbars=no,status=yes"; 
           Temp=document.getElementById("HDNRequest").value;
           if(Temp.length > 0)
           {
                WindName=Temp.substring(0,4);
                var VVacId = document.getElementById("HDNVacId").value;
                var VURL = "../CandLogin/Index.aspx?RF=" + Temp + "&VacId=" + VVacId + "&PType=Normal";                
                open(VURL, WindName, Tlb);
                self.parent=this;
                self.close();
                parent.parent.close();
                
           }
           
        }
    }

//IMP. NOTE  :   If your changing the code in following function then
//               you also need to change in following file.
// File Name :   Login_FF.Js

    
    function setLogin(ParamRF)
    {      
          window.focus();  
          var ShowTable;
          ShowTable=document.getElementById("HDNShowTable").value;

          var param1 = document.getElementById("HDNShowLogin").value;
          if (ParamRF == '' || ParamRF == null)//
          {
              ParamRF = param1;              
          }                    
          if(ParamRF=='CANDIDATE')
          { 
                  ShowTable="CAND";
          }  
          else if(ParamRF=='CLIENT')
          {
                  ShowTable="CLIENT";
          }
          if(ParamRF=='CLIENT')
          { 
                  ShowTable="CLIENT";
          }
          if (ParamRF == "CAND") 
          {
              document.getElementById("divCandLog").style.visibility = 'visible';
              document.getElementById("divCandLog").style.height = '150px';
              document.getElementById('TxtEmp_Uname').value = "";
              document.getElementById('TxtEmp_pwd').value = "";
              document.getElementById("divCandLog").style.position='relative';
              document.getElementById("divClientLog").style.visibility = 'hidden';
              document.getElementById("divClientLog").style.height = '0px';
              document.getElementById("TxtUser").focus();          
          }
          else if (ParamRF == "CLIENT")//
          {
              
              document.getElementById("divCandLog").style.visibility = 'hidden';
              document.getElementById("divCandLog").style.height = '0px';
              document.getElementById("divClientLog").style.visibility = 'visible';
              document.getElementById("divClientLog").style.height = '150px';
                document.getElementById('TxtUser').value = "";
                document.getElementById('TxtPwd').value = "";
                document.getElementById("divClientLog").style.position = 'relative';
                document.getElementById("TxtEmp_Uname").focus();
          }
    }

//IMP. NOTE  :   If your changing the code in following function then
//               you also need to change in following file.
// File Name :   Login_FF.Js


    function NewLoginId(Request)
    {
         var Tlb;
         var RequestFor;
         Tlb = "height=690,width=1010,left=0,top=0,scrollbars=no,status=yes";
         //alert(Request);
         if (Request == "Cand") //
         {
         //alert(document.getElementById("HDNClient").value);
             if (document.getElementById("HDNClient").value == 'ir')//
             {
                 //
                 if (document.getElementById("HDNRProfile").value == "Conf")//
                 {
                     open("../CandLogin/Index.aspx?RF=Cand&PType=Conf", "ConP", Tlb);
                     // window.close();
                 }
                 else if (document.getElementById("HDNRProfile").value == "Normal")//
                 {
                     open("../CandLogin/Index.aspx?RF=Cand&PType=Normal", "Normal", Tlb);
                     //window.close();
                 }

             }
////             else//
////             if (document.getElementById("HDNClient").value == 'leecap')//
////             {
////                 Tlb = "height=430,width=500,left=0,top=0,scrollbars=no,status=yes";
////                 //alert(document.getElementById("HDNClient").value);
////                 open("../CandLogin/JSRegistration.aspx?User=New", "Registration", Tlb);
////            }
             else//
             {
                 open("../CandLogin/Index.aspx?RF=Cand", "Cand", Tlb);
             }
             return false;
         }
         else if (Request == "Client") {
             open("../CandLogin/Index.aspx?RF=Client", "Client", Tlb);
             return false;
         }        
        return false;        
    }

//IMP. NOTE  :   If your changing the code in following function then
//               you also need to change in following file.
// File Name :   Login_FF.Js

    
        function EmpLogin(obj)
        {         
            var obj=document.getElementById(obj).value;            
            if(window.event.keyCode==13)
            {  
                 Check=trimAll(document.getElementById('TxtEmp_Uname').value);
                 if(Check.length==0)
                 {
                    alert("Please enter Login id.");
                    return false;
                 }
                 
                 Check=trimAll(document.getElementById('TxtEmp_pwd').value);
                 if(Check.length==0)
                 {
                    alert("Please enter password.");
                    return false;
                 }            
                   window.__doPostBack("BtnEmpLogin","");     
                   return true;          
             }
        }         

//IMP. NOTE  :   If your changing the code in following function then
//               you also need to change in following file.
// File Name :   Login_FF.Js

    
    function ShowLinks()
    {
        if(document.getElementById("HDNClient").value=='ir')
        {
            document.getElementById('lblCandSet').style.visibility='hidden';
            document.getElementById('Label3').style.visibility='hidden';
            
            document.getElementById('lblemp').style.visibility='hidden';
            document.getElementById('td1').style.backgroundColor='white';
            document.getElementById('td2').style.backgroundColor='white';
        }
        if (document.getElementById("HDNClient").value == 'wsg') 
        {
            document.getElementById('TblOuter').style.height = '100px';
        }
    }
    
