var notval5 = /[$\\@\\\#%\^\&\*\[\]\;\+\/\_\{\}\`\'\~\=\|\abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ]/;
function checkprice(val1)
{
    var strPass1 = val1.value;    
    if(strPass1.charAt(0)==" ")
    {
        strPass1="";
        val1.value="";
    }
    //var strPass1 = val1.value;
    var strLength1 = strPass1.length;
    for(i=0;i<=strLength1;i++)
    {
        var lchar1 = val1.value.charAt(i);        
        if(lchar1.search(notval5) != -1)
        {
            var tst1 = val1.value.substring(0, (i));
            val1.value = tst1;
        }        
    }
}
function fchkcode()
{
//alert(host);
        if (document.frmareacode.areacode.value  == "" )
        {
                alert ("Please Enter the Areacode ");
				document.frmareacode.areacode.focus();
                return false;
        }
        else if (document.frmareacode.areacode.value.length < 3)
        {
                alert ("Invalid AreaCode");
				document.frmareacode.areacode.focus();
                return false;
        }
        else
        {
                var gotourl;				
				gotourl="http://www.thewirelessguide.com/"+document.frmareacode.areacode.value+"areacode/page1/wirelessproviders.html";						
				
				document.frmareacode.action = gotourl;
                document.location=gotourl;
        }
}

function fchkcity()
{
	var city;
	var state;
	city = document.chkcity.city.value;
	state = document.chkcity.state.value;
	if (city.length == "" )
	{
			alert ("You have to Enter City Name First");
			document.chkcity.city.focus();
			return false;
	}
	else
	{
			var gotourl;
			gotourl="http://www.thewirelessguide.com/page1/"+state+"/"+city+"/"+city+".html";						

			document.chkcity.action = gotourl;
			document.location=gotourl;
	}
}

function testing(str)
{
        var j=0;
		var ids,n;
		ids = 0;
		for (i=0,n=document.chkform.elements.length;i<n;i++)
	    {
			if (chkform.elements[i].type == 'checkbox')
			{
				 if(chkform.elements[i].checked == true)
			  	 {
                      if (ids == 0)
                           ids = chkform.elements[i].value
                       else
                           ids = ids + "+" +chkform.elements[i].value
            		   j++
//					  alert("HELLO " + ids); 
          		 }
        	}
       }
       if(j<2)
        {
            alert("You have to select atleast two checkbox to compare the services of ISPs")
            return false;
        }
        else
        {
			var gotourl;
			if(str=="www")
				gotourl="http://www.theispdirectory.com/search/ispcompare/"+ids+"/compareisp.html";
			else if(str=="cheapisp")
				gotourl="http://cheapisp.theispdirectory.com/cheapisp/ispcompare/"+ids+"/compareisp.html";
			else
				gotourl="http://"+str+".theispdirectory.com/broadband/ispcompare/"+ids+"/compareisp.html";	
					
//			alert("URL: " + gotourl);
			document.chkform.action = gotourl;
//			document.chkform.submit();
        }
}
