
function validate_form(thisform)
	{
		with (thisform)
			{
				if (emptyvalidation(contact_name,"Please enter in your NAME.")==false) {contact_name.focus(); return false;};
//				if (emptyvalidation(contact_address,"Please enter in your ADDRESS.")==false) {contact_address.focus(); return false;};
//				if (emptyvalidation(contact_suburb,"Please enter in your SUBURB.")==false) {contact_suburb.focus(); return false;};
//				if (emptyvalidation(contact_pc,"Please enter in your POSTCODE.")==false) {contact_pc.focus(); return false;};
//				if (digitvalidation(contact_pc,4,4,"A valid post code has 4 digits, please retype your postcode.","I")==false) {contact_pc.focus(); return false;};
//				if (emptyvalidation(contact_state,"Please enter in your STATE.")==false) {contact_state.focus(); return false;};
				if (emptyvalidation(contact_email,"Please enter in your EMAIL.")==false) {contact_email.focus(); return false;};
				if (emailvalidation(contact_email,"Your email address is not valid, please retype your email address.")==false) {contact_email.focus(); return false;};
				if (emptyvalidation(contact_phone,"Please enter in your PHONE.")==false) {contact_phone.focus(); return false;};
//				if (emptyvalidation(contact_fax,"Please enter in your FAX.")==false) {contact_fax.focus(); return false;};
				if (emptyvalidation(contact_feedback,"Please enter in your COMMENTS/FEEDBACK.")==false) {contact_feedback.focus(); return false;};



//	--			if (emailvalidation(Email,"Illegal E-mail")==false) {Email.focus(); return false;};
//	--			if (valuevalidation(Value,0,5,"Value MUST be in the range 0-5")==false) {Value.focus(); return false;};
//	--			if (digitvalidation(Digits,4,4,"You MUST enter 4 numbers","I")==false) {Digits.focus(); return false;};
			}
	}

function emailvalidation(entered, alertbox)
	{
		with (entered)
			{
				apos=value.indexOf("@"); 
				dotpos=value.lastIndexOf(".");
				lastpos=value.length-1;
				if (apos<1 || dotpos-apos<2 || lastpos-dotpos>3 || lastpos-dotpos<2) 
					{if (alertbox) {alert(alertbox);} return false;}
				else {return true;}
			}
	} 

function valuevalidation(entered, min, max, alertbox, datatype)
	{
		with (entered)
			{
				checkvalue=parseFloat(value);
				if (datatype)
					{smalldatatype=datatype.toLowerCase();
				if (smalldatatype.charAt(0)=="i") {checkvalue=parseInt(value)};
			}
				if ((parseFloat(min)==min && checkvalue<min) || (parseFloat(max)==max && checkvalue>max) || value!=checkvalue)
					{if (alertbox!="") {alert(alertbox);} return false;}
				else {return true;}
			}
	}

function digitvalidation(entered, min, max, alertbox, datatype)
	{
		with (entered)
			{
				checkvalue=parseFloat(value);
				if (datatype)
					{smalldatatype=datatype.toLowerCase();
				if (smalldatatype.charAt(0)=="i") 
					{checkvalue=parseInt(value); if (value.indexOf(".")!=-1) {checkvalue=checkvalue+1}};
					}
				if ((parseFloat(min)==min && value.length<min) || (parseFloat(max)==max && value.length>max) || value!=checkvalue)
					{if (alertbox!="") {alert(alertbox);} return false;}
				else {return true;}
			}
	} 
function emptyvalidation(entered, alertbox)
// Emptyfield Validation 
	{
		with (entered)
			{
				if (value==null || value=="")
					{if (alertbox!="") {alert(alertbox);} return false;}
				else {return true;}
			}
	} 
