function validatePolicy() 
{
	var strPolicy = document.policy_lookup.policyno.value;
	document.policy_lookup.action='';
	if (Trim(strPolicy) == "")
	{
		alert("POLICY NUMBER IS BLANK\n---------------------------------------------\n" +	
				"Please enter a policy number and try again.\n");
		document.policy_lookup.policyno.focus();
		return false;
	}
	else
	{	
	       if (strPolicy.length < 10 || strPolicy.length > 13 || isAlphaNumeric(Trim(strPolicy)) == false) 
	       {
		   alert("INVALID POLICY NUMBER\n---------------------------------------------\n" +	
					"Please make sure your policy number\n" + 
					"does not contain any spaces or dashes (-)\n" + 
					"and try again.");
                   document.policy_lookup.policyno.focus();  
	       	   return false;
	       }
	       return true;
	}	
}

function changeLocation(){
	document.policy_lookup.policyno.value='';
	document.policy_lookup.action="http://www.secureinsforms.com/MyPolicy/Login/MainMenu.asp?target=AcctInfo";		
	document.policy_lookup.submit();
}


function isAlphaNumeric(strValue)
  {
    var j;
    var chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; 
    var strChar;
  
    for (j=0; j < strValue.length; j++)
    {
        strChar = strValue.charAt(j);
 
        if (chars.indexOf(strChar) == -1)
        {
	        return false;
   	    }
    }
    
    return true;
     
  }  
 

function LTrim(str){
	if (str==null){return null;}
	for(var i=0;str.charAt(i)==" ";i++);
	return str.substring(i,str.length);
	}

function RTrim(str){
	if (str==null){return null;}
	for(var i=str.length-1;str.charAt(i)==" ";i--);
	return str.substring(0,i+1);
	}

function Trim(str){return LTrim(RTrim(str));}


