<script>
function CountNow1(oForm)
{		
	oForm.action = 'ResiPhone.asp';
	oForm.submit();
}
function CountNow(oForm)
{	
	oForm.action = 'Count.asp';
	oForm.submit();
}
function CountNowTotal(oForm)
{
	oForm.action = 'Count_TotalUS.asp';
	oForm.submit();
}
function PopupPic(w,h,URL) 
{ 
  var winl = (screen.width - w) / 2;
  var wint = (screen.height - h) / 2;
  winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+'resizable=1'
  window.open(URL,'PrintCriteria', winprops)
} 

function PrintNow(URL)
{
	PopupPic(width=630,height=450,URL);
	
}

function trim(txt)	
 { 			
		while (txt.substring(0,1) == ' ') {
		    txt = txt.substring(1, txt.length);
		}
		while (txt.substring(txt.length-1,txt.length) == ' ') {
		    txt = txt.substring(0, txt.length-1);
		}	return txt;
}
function NoGeog()
{
	alert("Please include a Geography when performing a search. If you have any questions or would like to speak with a GoLeads representative, please call us at 402-334-1824. Thank you.");
}
function NoGeogExclude()
{
	alert("Please include a Geography to exclude your criteria");
}
function MoreGeog()
{
	alert("The maximum number of states you can select is 5. To search more than 5 states, call GoLeads at (402) 334-1824 and a representative will be happy to assist you.");
}
function Back()
{
	history.back();
}
function selectall(formname,controlname)
	{	
		if(controlname.checked)
		{
			for(i=0;i<formname.elements.length;i++)
			{	
				if(formname.elements[i].type == "checkbox")
				{
					formname.elements[i].checked=true;
				}
					
			}
		}
		else
		{
			for(i=0;i<formname.elements.length;i++)
			{
				if(formname.elements[i].type == "checkbox")
				{			
					formname.elements[i].checked=false;
				}
			}
		}
		
	}
	
	function IsNumeric(strString)
    	{    	
			var strValidChars = "0123456789.";
			var strChar;
			var blnResult = true;

			if (strString.length == 0) return false;

			for (i = 0; i < strString.length && blnResult == true; i++)
			{
				strChar = strString.charAt(i);
				if (strValidChars.indexOf(strChar) == -1)
				{
					blnResult = false;
				}
			}			
			return blnResult;
		}
		function isLetter (c)
		{   
			return ( ((c >= "a") && (c <= "z")) || ((c >= "A") && (c <= "Z")) )
		}

		function isDigit (c) {   
			return ((c >= "0") && (c <= "9"))
		}

		function isLetterOrDigit (c){   
			return (isLetter(c) || isDigit(c))
		}
		function containsLettersAndDigits(s) {
	    for (i = 0; i < s.length; i++){   
	        var c = s.charAt(i);    
	        if (isLetterOrDigit(c) == false && c!="_") return false;
								        
	    }
	    return true
	}   
	function funcheck(stObj,enObj,objForm,str)
	{	
		var errorcheck=1;		
		var stemployeesize=stObj.value;
		var enemployeesize=enObj.value;
		
		if (stemployeesize=='')
		{
			alert('Enter ' + str + ' start value');
			stObj.focus();
			errorcheck=0;
			return false;
		}
		if (!IsNumeric(stemployeesize))
		{
			alert('Enter numeric value');
			stObj.focus();
			errorcheck=0;
			return false;
		}
		if (enemployeesize=='')
		{
			alert('Enter ' + str + ' end value');
			enObj.focus();
			errorcheck=0;
			return false;
		}		
		if (!IsNumeric(enemployeesize))
		{
			alert('Enter numeric value');
			enObj.focus();
			errorcheck=0;
			return false;
		}
		if(str == "SIC-Code")
		{	
			if (stemployeesize.length != enemployeesize.length)
			{
				alert("Number of SIC-Code digits in 'From' and 'To' are not same");
				enObj.focus();
				errorcheck=0;
				return false;
			}
			if (stemployeesize.length != 8 && stemployeesize.length != 4 && stemployeesize.length != 2)
			{
				alert("Number of SIC-Code digits in 'From' and 'To' can only be 8,4 or 2");
				enObj.focus();
				errorcheck=0;
				return false;
			}			
			if (stemployeesize.length > 8)
			{
				alert("Number of SIC-Code digits in 'From' and 'To' cannot be more than '8'");
				enObj.focus();
				errorcheck=0;
				return false;
			}
		}
		if (errorcheck == 1)
		{	
			if (parseInt(stemployeesize,10) >= parseInt(enemployeesize,10))
			{
				alert('Starting value should be less than Ending value');
				stObj.focus();
				errorcheck=0;
				return false;
			}
			else
			{
				objForm.submit();
			}
		}
		
	}
	   
	function funcheckrange(obj,objForm,str)
		{	
		var errorcheck=1;
		var txtrevenue=obj.value;
			
		if (txtrevenue=='')
		{
			alert('Enter ' + str + ' range');
			obj.focus();
			errorcheck=0;
			return false;
		}
			
		if (!IsNumeric(txtrevenue))
		{
			alert('Enter numeric value');
			obj.focus();
			errorcheck=0;
			return false;
		}
		if (errorcheck == 1)
		{
			objForm.submit();
		}
	}
	
	function IsValidCCExpiry(ctrlMth,ctrlYr)
		{
			//var ctrlMth=document.getElementById(cMonthControlID);
			//var ctrlYr=document.getElementById(cYearControlID);
			
			var x = new Date();
			var today = new Date(x.toGMTString());
			var Year2 = today.getFullYear();
			var Month2 = today.getMonth();
			Month2 = parseInt(Month2);
			var Day2 = today.getDate();
			var now = (Date.UTC(Year2,Month2,Day2,0,0,0))/86400000	;		
			
			var Yr;
			var Mth;
			var TempDate;

			Yr = ctrlYr.value;			
			Mth = ctrlMth.value;
			
			TempDate = (Date.UTC(Yr,Mth,Day2,0,0,0))/86400000;
			
			
			
			if (TempDate <= now)
			{
				return false;
			}
			
			return true;
		}		
</script>
