<!--
//addEvent(window, "load", init);

function init()
{
	form = document.getElementById("comp_entry_form");
	addEvent(form, "submit", checkForm);
}

function addEvent(obj, evType, fn)
{
	if (obj.addEventListener)
	{
		obj.addEventListener(evType, fn, false);
		return true;
	}
	else if (obj.attachEvent)
	{
		var r = obj.attachEvent("on"+evType, fn);
		return r;
	}
	else
	{
		return false;
	}
}

function checkForm(e)
{}

function checkForm_old(e)
{
	var statusOK = false;
	
	var theForm = document.forms["comp_entry_form"];
	
	theForm.name.className = theForm.name.className.replace(/ error/, "");

	if(theForm.name.value == "")
	{
		theForm.name.className += " error";
		statusOK = false;
	}
	
	/* Check email address is correct format */
	theForm.emailaddress.className = theForm.emailaddress.className.replace(/ error/, "");
	var reg = new RegExp(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/);
	if (!reg.test(theForm.emailaddress.value))
	{
		theForm.emailaddress.className += " error";
		statusOK = false;
	}
	
	/* Check Country has been selected */
	theForm.country.className = theForm.country.className.replace(/ error/, "");
	if(theForm.country.options[theForm.country.selectedIndex].value=="")
	{
		theForm.country.className += " error";
		statusOK = false;
	}
	
	/* Check less than 26 words */
	
	if(statusOK)
	{
		return true;
	}
	else
	{		
		if(e && e.preventDefault)
			e.preventDefault(); //DOM Style
		return false
	}
	
	
}

	function cnt(w, strId){
var y=w.value;
var r = 0;
var maxwords = 25;
var errormessage = "Sorry, You are only allowed to enter " + maxwords + " words";
a=y.replace('\n',' ');
a=a.split(' ');
for (z=0; z<a.length; z++) {if (a[z].length > 0) r++;}

if (r > maxwords) 
{
	document.getElementById(strId).value = errormessage;
}


}

	/*
	
	
	
	
	if(document.comp_entry_form.w.value==""){
	alert("Tell us in 25 words or less what you want to experience in the Northern Territory");
	return false;
	}
	
	if (!document.comp_entry_form.terms.checked) {
	alert("Please read the terms &amp; conditions");
	return false;
	}

	return false;*/
		
//-->