﻿// JScript File

chkTelno="N";
chktxtabt="N";

String.prototype.trim = function() {
a = this.replace(/^\s+/, '');
return a.replace(/\s+$/, '');
};
     function CallPage(pageName)
     {
       alert(pageName);
     }
     
function UIValidate1(sender , args )
 {
    var regEXP=/^([1-zA-Z0-1']{1,255})$/;
    var vals=args.Value;
    vals=vals.trim();
      if(args.Value.trim() == "")
           args.IsValid=false;         
      else
      {
                if(vals.indexOf("<",0) > -1)         
                    args.IsValid=false;
                else
                    args.IsValid=true;    
      }
        
 }
 function checkbox()
 {
   if(!document.getElementsByName("ctl00$cph$MialsCheck").checked)
   {
    alert("Please check the 'Receive Email Alert' Checkbox");
    return false;
   }
 }


 function printing()
    {
        window.print();
    }




function CallPage(pageName)
     {
       location.href=pageName;
     }


 function cleartext()
  {
      var val1= document.getElementById("ctl00_cph_txttelno");    
    if(chkTelno == "N")
    {
        val1.value="";
        val1.focus;
        chkTelno="Y";
    }

  }
   function cleartext1()
  {
       var val1= document.getElementById("ctl00_cph_txtabout");
       if(chktxtabt == "N")
       {
            val1.value="";
            val1.focus;
            chktxtabt="Y";
       }      
}
function UIPhoneNo(sender , args)
{

    if(args.Value == "")
           args.IsValid=false; 
}
//function added by chetan
function UIValidate(sender , args )
 {
    var regEXP=/^([1-zA-Z0-1']{1,255})$/;
   
    //alert("in fun");
      if(args.Value == "")
           args.IsValid=false;         
      else
      {
              if(regEXP.test(args.Value))
                  args.IsValid=true;         
              else
                  args.IsValid=false;         
         
      }
        
 }


//function added by Ankil
function isVLength(sender , args )
{
    
    var len1 = args.Value; 
    if(len1.length >= 6 || len1.length == 0)
        args.IsValid=true;         
    else
        args.IsValid=false;     

}
function isLength(sender , args )
 {
    if((navigator.userAgent.indexOf("Opera")==-1 && navigator.appVersion.indexOf("MSIE")!=-1))
    {
           var len1 = args.Value; 
           if(document.getElementById("ctl00$cph$txtPassword").value != "")
           {
                if(len1.length >= 6 )
                    args.IsValid=true;         
                else
                    args.IsValid=false;     
            }    
            else
            {
                return true;    
            }
    }
    else
    {
            var len1 = args.Value; 
           if(document.getElementsByName("ctl00$cph$txtPassword").value != "")
           {
                if(len1.length >= 6 )
                    args.IsValid=true;         
                else
                    args.IsValid=false;     
            }    
            else
            {
                return true;    
            }
    }

 }





function isEmail(args)
 {
    if(args.value != "")
    {
        //var val = document.getElementsById("ctl00_cph_txtlogin").value;
        var val = args.value;
        var regEXP=/\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/;
        if(regEXP.test(val))
        {
            return true;
        }
        else
        {
            alert("Please enter a valid email address");
           args.focus();
            return false;
        }
        return true;
    }
    else
    {
        alert("Please enter a valid email address");
        args.focus();
        return false;
    }
 }
//function added by Ankil
function isValidPost(sender , args )
{
    var regExprPostcode = /^((([A-PR-UWYZa-pr-uwyz](\d([A-HJKSTUWa-hjkstuw]|\d)?|[A-HK-Ya-hk-y]\d([ABEHMNPRVWXYabehmnprvwxy]|\d)?))\s*(\d[ABD-HJLNP-UW-Zabd-hjlnp-uw-z]{2})?)|GIR\s*0AA)$/;
    if(args.Value == "")
           args.IsValid=false;         
      else
      {
          if(regExprPostcode.test(args.Value))
              args.IsValid=true;         
          else
              args.IsValid=false;         
         
      }
}


function isNumberKey(evt)
{
    var charCode = (evt.which) ? evt.which : event.keyCode
         //if (charCode > 31 && ((charCode < 48 || charCode > 57) || charCode == 45 || charCode == 32 || charCode == 43))
         if((charCode >=48 && charCode <=57) || charCode == 45 || charCode == 32 || charCode == 43)
            return true;

         return false;

//    var charCode = window.event.keyCode   
//    if((charCode >=48 && charCode <=57) || charCode == 45 || charCode == 32 || charCode == 43)
//        return true;
//    else
//        return false;

}
    
 function isBlank(sender , args )
 {
    if((navigator.userAgent.indexOf("Opera")==-1 && navigator.appVersion.indexOf("MSIE")!=-1))
    {
         if(document.getElementById("ctl00$cph$txtPassword").value != "")
            {
                if(args.Value == "")
                    args.IsValid=false; 
                else
                {
                    return true;
                    args.IsValid=true; 
                }
            }
            else
                return true;
    }
    else
    {
        if(document.getElementsByName("ctl00$cph$txtPassword").value != "")
        {
            if(args.Value == "")
                args.IsValid=false; 
            else
            {
                return true;
                args.IsValid=true; 
            }
        }
        else
            return true;
    }
 }
 
 function isValLength(sender , args )
 {
    if(document.getElementsByName("ctl00_cph_txtConfirmPassword").value == "")
    {
        if(document.getElementsByName("ctl00$cph$txtPassword").value != "")
        {
             var len1 = args.Value; 
              if(len1.length >= 6 )
                  args.IsValid=true;         
              else
                  args.IsValid=false;
        }
        else
            return true;
    }
    else
        return true;
        
   
 }
 
 function lfnCheckAliesKey(MyObj)
		{
			//New key code added by chetan on 4th sept. 2007
			//filecode = "34,42,47,58,60,62,63,92,124,33,36,39,94,34,35,37,38,44,43,47,60,62,63,59,42,47,58,60,62,63,92,124,13,10,"
			filecode = "32"
			codearray = filecode.split(",")
			for(i=0;i<codearray.length;i++)
			{
				if (event.keyCode == codearray[i])
				{
					event.keyCode=0;
				}
			}
			
		}
		
	function lfUpperPostcode(MyObj)
	{
	   document.getElementById("ctl00_cph_txtpostcode").value= document.getElementById("ctl00_cph_txtpostcode").value.toUpperCase();  
	   
	}
	
	

//function for saved_search page
function chnagecheck()
{
//divrblistsss2.ClientID 
            //Div12.ClientID 
            if(document.getElementsByName("ctl00$cph$MialsCheck").checked )
              {
               document.getElementById("divrblistsss2").style.display='block';
               document.getElementById("ctl00_cph_Div12").style.display='block';
              }
              else              
              {
              document.getElementById("divrblistsss2").style.display='none';
              document.getElementById("ctl00_cph_Div12").style.display='none';
              }
}