<!--//


function validEmail(str)
{
	var emailReg = new RegExp('^\\s*[\\-\\\'\\w\\x2d_.][\\-\\\'\\w\\x2d_.]*\\@[\\w][\\-\\w]*\\.[\\w][\\-\\w\\.]*\\s*$','');
	var ret = (emailReg.test(str)) ? true : false;
	return ret;
}

function validation()
{

	//reset all colour backgrounds to white (they change colour if the req validation)
	document.forms[0].FORM_NAME.style.background = '#FFFFFF';
	document.forms[0].FORM_ADDRESS.style.background = '#FFFFFF';
	document.forms[0].FORM_CITY.style.background = '#FFFFFF';
	document.forms[0].FORM_REGION.style.background = '#FFFFFF';
	document.forms[0].FORM_POSTCODE.style.background = '#FFFFFF';
	document.forms[0].FORM_EMAIL.style.background = '#FFFFFF';
	document.forms[0].FORM_COUNTRY.style.background = '#FFFFFF';
	document.forms[0].FORM_PROFESSION.style.background = '#FFFFFF';
	document.forms[0].FORM_SPECIALINTEREST.style.background = '#FFFFFF';
	document.forms[0].FORM_DISTRIBUTOR.style.background = '#FFFFFF';
	document.forms[0].FORM_CONTACTSTATUS.style.background = '#FFFFFF';
	document.forms[0].FORM_TEL.style.background = '#FFFFFF';
	
	var message='';
	var highlightcol = '#FFFF99'

	if(document.forms[0].FORM_NAME.value=='')
	{
		message = message + 'Please enter your NAME.\n';
		document.forms[0].FORM_NAME.style.background = highlightcol;
	}

	if(document.forms[0].FORM_TEL.value=='')
	{
		message = message + 'Please enter your TELEPHONE NUMBER.\n';
		document.forms[0].FORM_TEL.style.background = highlightcol;
	}
	
	
	if(document.forms[0].FORM_ADDRESS.value=='')
	{
		message = message + 'Please enter your COMPANY ADDRESS.\n';
		document.forms[0].FORM_ADDRESS.style.background = highlightcol;
	}

	if(document.forms[0].FORM_CITY.value=='')
	{
		message = message + 'Please enter your CITY.\n';
		document.forms[0].FORM_CITY.style.background = highlightcol;
	}

	if(document.forms[0].FORM_REGION.value=='')
	{
		message = message + 'Please enter your STATE / REGION.\n';
		document.forms[0].FORM_REGION.style.background = highlightcol;
	}

	if(document.forms[0].FORM_POSTCODE.value=='')
	{
		message = message + 'Please enter your POSTCODE / ZIP.\n';
		document.forms[0].FORM_POSTCODE.style.background = highlightcol;
	}

		
	if(document.forms[0].FORM_EMAIL.value == '')
	{
		message = message + 'Please enter your EMAIL address.\n';
		document.forms[0].FORM_EMAIL.style.background = highlightcol;
	}
	
	var indexvalue = document.forms[0].FORM_COUNTRY.selectedIndex
	if(document.forms[0].FORM_COUNTRY[indexvalue].innerHTML == '')
	{
	
		message = message + 'Please enter your COUNTRY.\n';
		document.forms[0].FORM_COUNTRY.style.background = 'red';
	}
	
	
	if(document.forms[0].FORM_PROFESSION.value == '')
	{
		message = message + 'Please enter your PROFESSION.\n';
		document.forms[0].FORM_PROFESSION.style.background = 'red';
	}


	if(document.forms[0].FORM_SPECIALINTEREST.value == '')
	{
		message = message + 'Please enter your Area of Special Interest.\n';
		document.forms[0].FORM_ENQUIRYDETAIL.style.background = highlightcol;
	}

	
	if(document.forms[0].FORM_EMAIL.value != '')
	{
		if(!validEmail(String(document.forms[0].FORM_EMAIL.value)))
		{
 			message = message + 'The email address entered is not of valid format: i.e. me@mydomain.com.au\n';

			document.forms[0].FORM_EMAIL.style.background = highlightcol;

		}
	}
	
	
	
	
	
	if(document.forms[0].FORM_CONTACTSTATUS.value=='')
	{
		message = message + 'Please indicate how you would like KEY-SUN to contact you.\n';
		document.forms[0].FORM_CONTACTSTATUS.style.background = 'red';
	}


	
	if(message == '')
	{
		document.forms[0].submit();
	}
	else
	{
		message = "The form could not be submitted as some of the required information is missing\nThe required fields are highlighted\nPlease complete and submit again - Thank you\n\n"+message	

		alert(message);
	}
}
//-->
