function validate(theform) {

	var requiredFields = new Array();
	var intCounter = 0;
	var strWarningMessage = "Please enter the following details\n";
	var bgColour = "#E9CDD0";

	if(theform.promo != null) {
		var promoCode = theform.promo.value;
		promoCode = promoCode.toUpperCase();
		if(theform.promo.value.length < 1 || promoCode != 'QWA') {
			intCounter = intCounter + 1;
			requiredFields[intCounter] = "Promo code";
			document.getElementById("promo").style.backgroundColor = bgColour;
		}
	}
	
	if(theform.title != null) {
		if(theform.title.value.length < 1) {
			intCounter = intCounter + 1;
			requiredFields[intCounter] = "Title";
			document.getElementById("title").style.backgroundColor = bgColour;
		}
	}
	
	if(theform.first_name != null) {
		if(theform.first_name.value.length < 1) {
			intCounter = intCounter + 1;
			requiredFields[intCounter] = "First name";
			document.getElementById("first_name").style.backgroundColor = bgColour;
		}
	}
	
	if(theform.last_name != null) {
		if(theform.last_name.value.length < 1) {
			intCounter = intCounter + 1;
			requiredFields[intCounter] = "Last name";
			document.getElementById("last_name").style.backgroundColor = bgColour;
		}
	}
	
	if(theform.address_line_1 != null) {
		if(theform.address_line_1.value.length < 1) {
			intCounter = intCounter + 1;
			requiredFields[intCounter] = "Address line 1";
			document.getElementById("address_line_1").style.backgroundColor = bgColour;
		}
	}
	
	if(theform.county != null) {
		if(theform.county.value.length < 1) {
			intCounter = intCounter + 1;
			requiredFields[intCounter] = "County";
			document.getElementById("county").style.backgroundColor = bgColour;
		}
	}
	
	if(theform.postcode != null) {
		if(theform.postcode.value.length < 1) {
			intCounter = intCounter + 1;
			requiredFields[intCounter] = "Postcode";
			document.getElementById("postcode").style.backgroundColor = bgColour;
		}
	}
	
	if(theform.country != null) {
		if(theform.country.value.length < 1) {
			intCounter = intCounter + 1;
			requiredFields[intCounter] = "Country";
			document.getElementById("country").style.backgroundColor = bgColour;
		}
	}

	if(theform.theme != null) {
		if(theform.theme.value.length < 1) {
			intCounter = intCounter + 1;
			requiredFields[intCounter] = "Theme";
			document.getElementById("theme").style.backgroundColor = bgColour;
		}
	}
	
	if(theform.form_first_name != null) {
		if(theform.form_first_name.value.length < 1) {
			intCounter = intCounter + 1;
			requiredFields[intCounter] = "First name";
			document.getElementById("form_first_name").style.backgroundColor = bgColour;
		}
	}
	if(theform.firstname != null) {
		if(theform.firstname.value.length < 1) {
			intCounter = intCounter + 1;
			requiredFields[intCounter] = "First name";
			document.getElementById("firstname").style.backgroundColor = bgColour;
		}
	}
	
	if(theform.form_last_name != null) {
		if(theform.form_last_name.value.length < 1) {
			intCounter = intCounter + 1;
			requiredFields[intCounter] = "Last name";
			document.getElementById("form_last_name").style.backgroundColor = bgColour;
		}
	}
	
	if(theform.lastname != null) {
		if(theform.lastname.value.length < 1) {
			intCounter = intCounter + 1;
			requiredFields[intCounter] = "Last name";
			document.getElementById("lastname").style.backgroundColor = bgColour;
		}
	}
	
	if(theform.form_no_travellers != null) {
		if(theform.form_no_travellers.value.length < 1) {
			intCounter = intCounter + 1;
			requiredFields[intCounter] = "No. of travellers";
			document.getElementById("form_no_travellers").style.backgroundColor = bgColour;
		}
	}
	
	if(theform.travellers != null) {
		if(theform.travellers.value.length < 1) {
			intCounter = intCounter + 1;
			requiredFields[intCounter] = "No. of travellers";
			document.getElementById("travellers").style.backgroundColor = bgColour;
		}
	}
	
	
	if (theform.recipientemailaddress != null) {
		var strEmail = theform.recipientemailaddress.value;
		var isEmail = ((strEmail.indexOf("@") != -1) && (strEmail.indexOf(".") != -1));
		
		if (theform.recipientemailaddress.value.length < 1) {
			intCounter = intCounter + 1;
			requiredFields[intCounter] = "Email address";
			document.getElementById("recipientemailaddress").style.backgroundColor = bgColour;
		}
		if (!isEmail && theform.recipientemailaddress.value.length > 1) {
			intCounter = intCounter + 1;
			requiredFields[intCounter] = "A valid email address";
			document.getElementById("recipientemailaddress").style.backgroundColor = bgColour;
		}
	}
	
	if (theform.email != null) {
		var strEmail = theform.email.value;
		var isEmail = ((strEmail.indexOf("@") != -1) && (strEmail.indexOf(".") != -1));
		
		if (theform.email.value.length < 1) {
			intCounter = intCounter + 1;
			requiredFields[intCounter] = "Email address";
			document.getElementById("email").style.backgroundColor = bgColour;
		}
		if (!isEmail && theform.email.value.length > 1) {
			intCounter = intCounter + 1;
			requiredFields[intCounter] = "A valid email address";
			document.getElementById("email").style.backgroundColor = bgColour;
		}
	}
	
	if (theform.form_email != null) {
		var strEmail = theform.form_email.value;
		var isEmail = ((strEmail.indexOf("@") != -1) && (strEmail.indexOf(".") != -1));
		
		if (theform.form_email.value.length < 1) {
			intCounter = intCounter + 1;
			requiredFields[intCounter] = "Email address";
			document.getElementById("form_email").style.backgroundColor = bgColour;
		}
		if (!isEmail && theform.form_email.value.length > 1) {
			intCounter = intCounter + 1;
			requiredFields[intCounter] = "A valid email address";
			document.getElementById("form_email").style.backgroundColor = bgColour;
		}
	}
	
	if(theform.form_phone != null) {
		if(theform.form_phone.value.length < 1) {
			intCounter = intCounter + 1;
			requiredFields[intCounter] = "Phone number";
			document.getElementById("form_phone").style.backgroundColor = bgColour;
		}
	}
	
	if(theform.telno != null) {
		if(theform.telno.value.length < 1) {
			intCounter = intCounter + 1;
			requiredFields[intCounter] = "Phone number";
			document.getElementById("telno").style.backgroundColor = bgColour;
		}
	}
	
	if(theform.form_time_to_call != null) {
		if(theform.form_time_to_call.value.length < 1) {
			intCounter = intCounter + 1;
			requiredFields[intCounter] = "Time to call";
			document.getElementById("form_time_to_call").style.backgroundColor = bgColour;
		}
	}
	
	if(theform.bestcall != null) {
		if(theform.bestcall.value.length < 1) {
			intCounter = intCounter + 1;
			requiredFields[intCounter] = "Time to call";
			document.getElementById("bestcall").style.backgroundColor = bgColour;
		}
	}
	
	if(theform.form_january != null) {
		if(theform.form_january.checked == false && theform.form_february.checked == false && theform.form_march.checked == false && theform.form_april.checked == false && theform.form_may.checked == false && theform.form_june.checked == false && theform.form_july.checked == false && theform.form_august.checked == false && theform.form_september.checked == false && theform.form_october.checked == false && theform.form_november.checked == false && theform.form_december.checked == false) {
			intCounter = intCounter + 1;
			requiredFields[intCounter] = "Preferred month(s)";
			document.getElementById("form_january").style.backgroundColor = bgColour;
			document.getElementById("form_february").style.backgroundColor = bgColour;
			document.getElementById("form_march").style.backgroundColor = bgColour;
			document.getElementById("form_april").style.backgroundColor = bgColour;
			document.getElementById("form_may").style.backgroundColor = bgColour;
			document.getElementById("form_june").style.backgroundColor = bgColour;
			document.getElementById("form_july").style.backgroundColor = bgColour;
			document.getElementById("form_august").style.backgroundColor = bgColour;
			document.getElementById("form_september").style.backgroundColor = bgColour;
			document.getElementById("form_october").style.backgroundColor = bgColour;
			document.getElementById("form_november").style.backgroundColor = bgColour;
			document.getElementById("form_december").style.backgroundColor = bgColour;
		}
	}
	
//	if(theform.jan-box != null) {
//		if(theform.jan-box.checked == false && theform.feb-box.checked == false && theform.mar-box.checked == false && theform.apr-box.checked == false && theform.may-box.checked == false && theform.jun-box.checked == false && theform.jul-box.checked == false && theform.aug-box.checked == false && theform.sep-box.checked == false && theform.oct-box.checked == false && theform.nov-box.checked == false && theform.dec-box.checked == false) {
//			intCounter = intCounter + 1;
//			requiredFields[intCounter] = "Preferred month(s)";
//			document.getElementById("jan-box").style.backgroundColor = bgColour;
//			document.getElementById("feb-box").style.backgroundColor = bgColour;
//			document.getElementById("mar-box").style.backgroundColor = bgColour;
//			document.getElementById("apr-box").style.backgroundColor = bgColour;
//			document.getElementById("may-box").style.backgroundColor = bgColour;
//			document.getElementById("jun-box").style.backgroundColor = bgColour;
//			document.getElementById("jul-box").style.backgroundColor = bgColour;
//			document.getElementById("aug-box").style.backgroundColor = bgColour;
//			document.getElementById("sep-box").style.backgroundColor = bgColour;
//			document.getElementById("oct-box").style.backgroundColor = bgColour;
//			document.getElementById("nov-box").style.backgroundColor = bgColour;
//			document.getElementById("dec-box").style.backgroundColor = bgColour;
//		}
//	}
	




	
	//Display warning message
	if (intCounter > 0) {
		for (i = 1; i <= intCounter; i++) {
			strWarningMessage = strWarningMessage + "\n" + requiredFields[i];
		}
		alert(strWarningMessage);
		return false;
	}

	return true;
}