function formValidate()
{

	/*// Validation script for field 'FirstName' (First Name)
	if (theForm.CODE.value.length <= 0)
	{
			alert("Please enter The unique alpha-numeric Code.");
			theForm.LAST_NAME.focus();
			return (false);
	}

	if (theForm.FIRST_NAME.value == "")
	{
		alert("Please enter your first name.");
	   theForm.FIRST_NAME.focus();
	   return (false);
	}

	if (theForm.FIRST_NAME.value.length < 1)
  	{
     	alert("Please enter at least 1 characters in the \"First Name\" field.");
     	theForm.FIRST_NAME.focus();
     	return (false);
  	}
	
	var charpos = theForm.FIRST_NAME.value.search("[^A-Za-z]"); 
	if(theForm.FIRST_NAME.value.length > 0 &&  charpos >= 0) 
    { 
           var strError = "For First Name, Only alphabetic characters are allowed "; 
		   alert(strError);
		   return false;
    }//if   

	// Validation script for field 'LastName' (Last Name)
	if (theForm.LAST_NAME.value == "")
	{
		alert("Please enter your family name");
	   theForm.LAST_NAME.focus();
	   return (false);
	}

	if (theForm.LAST_NAME.value.length < 1)
  	{
     	alert("Please enter at least 1 characters in the \"Family Name\" field.");
     	theForm.LAST_NAME.focus();
     	return (false);
  	}
	
	var charpos = theForm.LAST_NAME.value.search("[^A-Za-z]"); 
	if(theForm.LAST_NAME.value.length > 0 &&  charpos >= 0) 
    { 
           var strError = "For Family Name, Only alphabetic characters are allowed "; 
		   alert(strError);
		   return false;
    }//if   
	
	var comboValue
	var selIndex = theForm.AGE.selectedIndex;
	comboValue = theForm.AGE.options[selIndex].value;
	if(comboValue == ""){
		alert('Sorry!\n\nEntry is only open to people over the age of 18.\n\nIf you are 18 years of age or older please check the tick box on the entry screen');
		return (false);
	}


	
	
	if(theForm.EMAIL.value.length > 0){
	 if (theForm.EMAIL.value.indexOf("@",1) == -1)
	 {
		alert("Please enter a valid email address");
		theForm.EMAIL.focus();
		return (false);
	 }

	  if (theForm.EMAIL.value.indexOf(".",theForm.EMAIL.value.indexOf("@")+1) == -1)
	  {
		alert("Please enter a valid email address");
		theForm.EMAIL.focus();
		return (false);
	  }
	}else{
		alert("Please enter your email address");
		theForm.EMAIL.focus();
		return (false);
	}
	
	
	if (theForm.ADDRESS.value.length <= 0)
  	{
     	alert("Please enter your full address including street address, town or suburb, post code and state");
     	theForm.ADDRESS.focus();
     	return (false);
  	}
	
	

	if (theForm.TOWN.value.length <= 0)
  	{
     	alert("Please enter your Town/Suburb Name.");
     	theForm.TOWN.focus();
     	return (false);
  	}
	var charpos = theForm.TOWN.value.search("[^A-Za-z]"); 
	if(theForm.TOWN.value.length > 0 &&  charpos >= 0) 
    { 
           var strError = "Please enter valid town name."; 
		   alert(strError);
		   return false;
    }//if   

	if (theForm.STATE.value.length <= 0)
	{
		alert("Please enter your State Name.");
		theForm.STATE.focus();
		return (false);
	}

	var charpos = theForm.STATE.value.search("[^A-Za-z]"); 
	if(theForm.STATE.value.length > 0 &&  charpos >= 0) 
    { 
           var strError = "Please enter valid State name."; 
		   alert(strError);
		   return false;
    }//if   

	if (theForm.POST_CODE.value.length <= 0)
  	{
     	alert("Please enter The Postcode.");
     	theForm.POST_CODE.focus();
     	return (false);
  	}

	var charpos = theForm.POST_CODE.value.search("[^0-9]"); 
	if(theForm.POST_CODE.value.length > 0 &&  charpos >= 0) 
    { 
           var strError = "Please enter valid Post Code."; 
		   alert(strError);
		   return false;
    }//if   
	
	
	
	if (theForm.ORIGINATOR.value.length <= 9)
  	{
     	alert("Please enter a Valid Mobile number.");
     	theForm.ORIGINATOR.focus();
     	return (false);
  	}
	
	var selIndex = theForm.STORE_NAME.selectedIndex;
	var comboValue = theForm.STORE_NAME.options[selIndex].value;
	if(comboValue == "" || comboValue == 0){
		alert('Please choose Any Store Name');
		return false;
	}

	
	
	if(TERMS == 0){
		alert('Sorry!\n\nYou must agree to accept the terms and conditions of this promotion.\n\nIf you accept these terms and conditions please check the tick box on the entry screen.');
		return false;
	}

*/
	
	
	
var TERMS = 0;
//alert(document.theForm.elements.length);
//	return false;
	for (var i = 0; i<document.theForm.elements.length; i++) {
		
        if ((document.theForm.elements[i].name.indexOf('TERMS') > -1)) {
            if (document.theForm.elements[i].checked) {
                TERMS=1;
            }
        }
    }


var OPTIN = 0;
for (var i = 0; i<document.theForm.elements.length; i++) {
        if ((document.theForm.elements[i].name.indexOf('OPTIN') > -1)) {
            if (document.theForm.elements[i].checked) {
                OPTIN=1;
            }
        }
    }


	var CODE = document.theForm.CODE.value;
	var POST_CODE = document.theForm.POST_CODE.value;
	var FIRST_NAME = document.theForm.FIRST_NAME.value;
	var LAST_NAME = document.theForm.LAST_NAME.value;
	var STORE_NAME = document.theForm.STORE_NAME.value;
	var EMAIL = document.theForm.EMAIL.value;
	var ADDRESS = document.theForm.ADDRESS.value;
	var ORIGINATOR = document.theForm.ORIGINATOR.value;
	var AGE = document.theForm.AGE.value;
	var TOWN = document.theForm.TOWN.value;
	var STATE = document.theForm.STATE.value;

	window.open("../webrequest.php?CODE="+CODE+"&POST_CODE="+POST_CODE+"&FIRST_NAME="+FIRST_NAME+"&LAST_NAME="+LAST_NAME+"&STORE_NAME="+STORE_NAME+"&OPTIN="+OPTIN+"&ORIGINATOR="+ORIGINATOR+"&EMAIL="+EMAIL+"&ADDRESS="+ADDRESS+"&AGE="+AGE+"&TOWN="+TOWN+"&STATE="+STATE+"&TERMS="+TERMS,"null","height=700,width=800,menubar=no,location=no,resizable=yes,scrollbars=yes,status=yes");
	
		
			document.getElementById('submitimg').style.visibility = 'hidden';
		
		/*document.getElementById('submitimg').width=0;
		document.getElementById('submitimg').height=0;
		document.getElementById('submitimg').src='';
		*/
			//document.theForm.submitimg.disabled = true;


  return (false);

}

function openPopup() {

	url = arguments[0];

	var iWidth = 700;
	var iHeight = 540;
	var sScrollbars = "yes";
	
	if (arguments[1] != undefined) {
		iWidth = arguments[1];
	}
	if (arguments[2] != undefined) {
		iHeight = arguments[2];
	}
	if (arguments[3] != undefined) {
		sScrollbars = arguments[3];
	}		
	
	var winLeft = ((screen.width - iWidth) / 2)
	var winTop = ((screen.height - iHeight) / 2)
	windowFeatures = "width="+iWidth+",height="+iHeight+",scrollbars="+sScrollbars+",resize=no,";
	windowFeatures = windowFeatures + "top=" + winTop + ",";
	windowFeatures = windowFeatures + "left=" + winLeft;	
	window.open(url, "",windowFeatures);
}