<!-- // Hide
function formvalidation(theform) {
	function GetSelectValue(ele) {
	    return ele.options[ele.selectedIndex].value;
	}
	//if ((GetSelectValue(theform.state) == "none") && (theform.otherstate.value.length<2)) {
	//	alert('Please select the state from the drop down list or fill in the field for Other State or Province.');
	//	theform.state.focus();
	//	return false;
	//}			
	if (((GetSelectValue(theform.country) == "US") || (GetSelectValue(theform.country) == "CA")) && (theform.state.value=="none") && (theform.otherstate.value.length<2)) {
		alert('Please select the state from the drop down list OR fill in the field for Other State or Province.');
		theform.state.focus();
		return false;
	}			
	if ((GetSelectValue(theform.state) != "none") && (theform.otherstate.value.length>0)) {
		alert('Please select the state from the drop down list OR fill in the field for Other State or Province, both should not be filled in.');
		theform.state.focus();
		return false;
	}	
	if (theform.headline.value.length<5) {
	    alert('Please make sure you have a descriptive headline for this business listing.');
	    theform.headline.focus();
	    return false;
	}
	if (theform.description.value.length<10) {
	    alert('Please make sure you have a good description for this ad.');
	    theform.description.focus();
	    return false;
	}		
	if (theform.askingprice.value.length<2) {
	    alert('Please make sure you have an asking price listed for this ad with numbers only.');
	    theform.askingprice.focus();
	    return false;
	}
	if (!numbercheck(theform.askingprice.value)) {
	theform.askingprice.focus();
	return false;
	}	
	if (GetSelectValue(theform.sellercategory) == "none") {
		alert('Please select your seller category from the drop down list.');
		theform.sellercategory.focus();
		return false;
	}
	if (theform.monthlyinsidesales.value.length<2) {
	    alert('Please make sure you have entered your monthly inside sales with numbers only.');
	    theform.monthlyinsidesales.focus();
	    return false;
	}
	if (!numbercheck(theform.monthlyinsidesales.value)) {
	theform.monthlyinsidesales.focus();
	return false;
	}	
	if (theform.monthlyfuelgallons.value.length<2) {
	    alert('Please make sure you have entered your monthly number of fuel gallons sold with numbers only.');
	    theform.monthlyfuelgallons.focus();
	    return false;
	}
	if (!numbercheck(theform.monthlyfuelgallons.value)) {
	theform.monthlyfuelgallons.focus();
	return false;
	}
	if (((theform.realestate[0].checked) == false) && ((theform.realestate[1].checked) == false)) {
		alert('Please Select if you own the property or lease the property'); 
		return false;
	}
	if (((theform.realestate[1].checked) == true) && (theform.leaseterms.value.length<2)) {
		alert('Please input deatil the terms of your lease'); 
		theform.leaseterms.focus();
		return false;
	}
	if (((theform.branded[0].checked) == true) && (theform.whatbrand.value.length<2)) {
		alert('Please input the brand of your business'); 
		theform.whatbrand.focus();
		return false;
	}				
	if ((theform.termsandconditions[0].checked) == false) {
	    alert('You must read and agree to the terms and conditions in order to place this business listing.');
	    return false;
	}					

}

function numbercheck(field) {
var valid = "0123456789"
var ok = "yes";
var temp;
for (var i=0; i<field.length; i++) {
temp = "" + field.substring(i, i+1);
if (valid.indexOf(temp) == "-1") ok = "no";
}
if (ok == "no") {
alert("Please enter whole numbers only.");
//theform.HomePhone.focus();
//theform.HomePhone.select();
return false
   }
else {
	return true;
}   
}

function validateTxt (sTextValue, iLength, sFieldName) 
{
	var iReturn = false;        
	 
	if (sTextValue.length > iLength)		
	{
		var sMsgText = new String()

		sMsgText	= "The length of \'" + sFieldName + "\' should be no greater than " + iLength + " characters.\n\n"
					+ "The length of \'" + sFieldName + "\' is " + sTextValue.length + " characters. \n"
					+ "Please reduce \'" + sFieldName + "\' by " + + (sTextValue.length - iLength) + " characters.";
		
		alert(sMsgText);    

		iReturn = false; 
	}
	else
	{
		iReturn = true;
	}
	
	return (iReturn);
}



function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else 
countfield.value = maxlimit - field.value.length;
}	

var r={
  'special':/[\W]/g,
  'quotes':/['\''&'\"']/g,
  'notnumbers':/[^\d]/g
}

function valid(o,w){
  o.value = o.value.replace(r[w],'');
}
		
// End Hide -->
