// JScript File

function CompareOldNew(elemnewID, Msg, elemOldID, DisplayID)
{
try
   {
  if(elemnewID.value == elemOldID.value)
        {
            DisplayID.innerText =  Msg;
            elemnewID.focus();
            return false;
           
        }
        else
        {
            DisplayID.innerText = "";
            return true;
        }
     }
    catch (ex)
    {
        throw(ex);
    }    
}

function Compare2TextBox(elemnewID, Msg, elemOldID, DisplayID)
{
   try
   {
       if(elemnewID.value == elemOldID.value)
        {
            return true;
            DisplayID.innerText = "";
        }
        else
        {
            DisplayID.innerText = Msg;
            elemnewID.focus();
            return false;
        }
     }
    catch (ex)
    {
        throw (ex);
    }    
}
function Passwordvalidator()
	{
        if (isEmpty(document.getElementById('ctl00_cphsharmaTransports_txtoldpwd'), "Old Password must'nt be empty", document.getElementById('ctl00_cphsharmaTransports_lblmsg')))
        {
            if (isEmpty(document.getElementById('ctl00_cphsharmaTransports_txtnewpwd'), "New Password must'nt be empty", document.getElementById('ctl00_cphsharmaTransports_lblmsg')))
            {
                if (isEmpty(document.getElementById('ctl00_cphsharmaTransports_txtconfirmpwd'), "Confirm Password must'nt be empty", document.getElementById('ctl00_cphsharmaTransports_lblmsg')))
                {
				    if (Compare2TextBox(document.getElementById('ctl00_cphsharmaTransports_txtconfirmpwd'), "Both Confirm password and new password must be same.", document.getElementById('ctl00_cphsharmaTransports_txtnewpwd'), document.getElementById('ctl00_cphsharmaTransports_lblmsg')))
				    {
				        if (CompareOldNew(document.getElementById('ctl00_cphsharmaTransports_txtnewpwd'), "New Password is similar to Old", document.getElementById('ctl00_cphsharmaTransports_txtoldpwd'), document.getElementById('ctl00_cphsharmaTransports_lblmsg')))
				        {
				            return true;
				        }
				    }
		        }
		    }
		}			
	    return false;		
	}
	
	function AgentPasswordvalidator()
	{
	  if (isEmpty(document.getElementById('ctl00_cphsharmaTransports_txtTerminalId'), "Terminal ID can't be empty", document.getElementById('ctl00_cphsharmaTransports_lblmsg')))
	  {
        if (isEmpty(document.getElementById('ctl00_cphsharmaTransports_txtoldpwd'), "Old Password can't be empty", document.getElementById('ctl00_cphsharmaTransports_lblmsg')))
        {
            if (isEmpty(document.getElementById('ctl00_cphsharmaTransports_txtnewpwd'), "New Password can't be empty", document.getElementById('ctl00_cphsharmaTransports_lblmsg')))
            {
                if (isEmpty(document.getElementById('ctl00_cphsharmaTransports_txtconfirmpwd'), "Confirm Password can't be empty", document.getElementById('ctl00_cphsharmaTransports_lblmsg')))
                {
				    if (Compare2TextBox(document.getElementById('ctl00_cphsharmaTransports_txtconfirmpwd'), "Check it out, confirmation", document.getElementById('ctl00_cphsharmaTransports_txtnewpwd'), document.getElementById('ctl00_cphsharmaTransports_lblmsg')))
				    {
				        if (CompareOldNew(document.getElementById('ctl00_cphsharmaTransports_txtnewpwd'), "New Password is similar to Old", document.getElementById('ctl00_cphsharmaTransports_txtoldpwd'), document.getElementById('ctl00_cphsharmaTransports_lblmsg')))
				        {
				        return true;
				        }
				    }
		        }
		    }
		}
	 }				
	    return false;		
	}



function ForgotPasswordvalidator()
	{
	  if (isEmpty(document.getElementById('ctl00$cphsharmaTransports$txtemailid'), "E-Mail ID can'nt be empty", document.getElementById('ctl00_cphsharmaTransports_lblmsg')))
      {
        return true;
	  }				
	    return false;		
	}