

function formChecker() {

		valid				=	true
		var FormErrors 		=	[];
		var arrayCount		=	0;
		var min_age 		=	13;
		var Year 		 = parseInt(document.getElementById("Register").year.value);
		var Month 		 = parseInt(document.getElementById("Register").month.value);
		var Day			 = parseInt(document.getElementById("Register").day.value);
		
		
		
    if ( document.getElementById('EMAIL_FIELD').value == "" )
    {
				FormErrors[arrayCount] = "You have not entered a Email.";
				arrayCount++;
				valid = false;
    }
	
    if ( document.getElementById('FIRSTNAME_FIELD').value == "" )
    {
				FormErrors[arrayCount] = "You have not entered a First Name.";
				arrayCount++;
				valid = false;
    }
	
    if ( document.getElementById('LASTNAME_FIELD').value == "" )
    {
				FormErrors[arrayCount] = "You have not entered a Last Name.";
				arrayCount++;
				valid = false;
    }

	 if ( document.getElementById('CITY_FIELD').value == "" )
    {
				FormErrors[arrayCount] = "You have not entered a City.";
				arrayCount++;
				valid = false;
    }
	
	 if ( document.getElementById('month').value == "" || document.getElementById('year').value == "" || document.getElementById('day').value == "")
    {
				FormErrors[arrayCount] = "You have not entered a Date Of Birth.";
				arrayCount++;
				valid = false;
    } else {
		
	
		var theirDate 	 = new Date((Year + min_age), Month, Day);
		var toDay 		 = new Date;
		var difference	 = toDay.getTime() - theirDate.getTime();
		
		if (difference < 0) {
				
				valid	=	false;
				window.location.replace("newsletter.php?error=1");			
			
		}
		
	}
	
	 if ( document.getElementById('COUNTRY_FIELD').value == "Please Select:" )
    {
				FormErrors[arrayCount] = "You have not entered a Country.";
				arrayCount++;
				valid = false;
    }


			if(valid == false && FormErrors.length >= 1) {
			
			var msgString	=	"";
			
			var start	=	"The following errors occured:\n\n";
			
			var end		=	"Please check the form before submitting.";
			
					for(i=0; i<FormErrors.length; i++) { 
				
						msgString = msgString + "     - " + FormErrors[i] + "\n\n"; 
				
				}
				
				alert(start + msgString + end);
				
			}
						
			return valid;										

	
		}
