function advertiseValidateInit() {
	$("cname").focus();
}

function advertiseform() {
	allowSubmit = 0;
	var fo ='';
	result = jcap($F("word"));
	var phone=$F("ph1")+$F("ph2")+$F("ph3");
	if ($F("cname")=="") {
			$("cnameError").innerHTML = 'Required Organisation / Company Name';
			allowSubmit++;
			if(fo=='')
			{
				fo='cname';
			}
	} else {
			$("cnameError").innerHTML = "";
	}
	if ($F("yname")=="") {
			$("ynameError").innerHTML = 'Required Your Name';
			allowSubmit++;
			if(fo=='')
			{
				fo='yname';
			}
	} else {
			$("ynameError").innerHTML = "";
	}
	if (phone!="" && IsNumeric(phone) && phone.length==10) {
		$("phoneError").innerHTML = "";
	} else {
			$("phoneError").innerHTML = 'Required valid phone number';
			allowSubmit++;
			if(fo=='')
			{
				fo='ph1';
			}
	}
	if (checkMail($F("email"))) {
		$("emailError").innerHTML = "";
	} else {
		$("emailError").innerHTML = 'Required email';
			allowSubmit++;
			if(fo=='')
			{
				fo='email';
			}
	}
	if ($F("nbusiness")=="") {
			$("nbusinessError").innerHTML = 'Required Nature Of Business';
			allowSubmit++;
			if(fo=='')
			{
				fo='nbusiness';
			}
	} else {
			$("nbusinessError").innerHTML = "";
	}
	if ($("state").selectedIndex==0 || $F("state")=="") {
			$("stateError").innerHTML = 'Required State';
			allowSubmit++;
			if(fo=='')
			{
				fo='state';
			}
	} else {
			$("stateError").innerHTML = "";
	}
	
	if ($F("zip")=="" && IsNumeric($F("zip"))) {
			$("zipError").innerHTML = 'Required Zip Code';
			allowSubmit++;
			if(fo=='')
			{
				fo='zip';
			}
	} else {
			$("zipError").innerHTML = "";
	}
	
	
	
	if (result == false) {
			$("wordError").innerHTML = 'Enter code as shown';
			allowSubmit++;
			if(fo=='')
			{
				fo='word';
			}
	} else {
			$("wordError").innerHTML = "";
	}
	if (allowSubmit>0) {
		$(fo).focus();
		return false;
	} else {
		return true;
	}
	return false;
}
addEvent(window,'load', advertiseValidateInit);

