function validateSearch(){
	if (document.frmSearch.txtSearch.value == ""){
		alert("Please enter your search criteria.")
		document.frmSearch.txtSearch.focus()
		return false;
	}
}

function validateEmailCollector(){
	if (document.frmEmail.txtName.value == ""){
		alert("Please enter your first name.")
		document.frmEmail.txtName.focus()
		return false;
	}
	if (document.frmEmail.txtLastName.value == ""){
		alert("Please enter your last name.")
		document.frmEmail.txtLastName.focus()
		return false;
	}
	
	if (document.frmEmail.txtEmail.value.indexOf("@") == -1 || document.frmEmail.txtEmail.value.indexOf(".") == -1 || document.frmEmail.txtEmail.value.indexOf(" ") != -1) {
			alert("Please enter a valid email address.")
			document.frmEmail.txtEmail.focus()
			return false;
		}
	
	var j = 0
	for (var i = 0; i < document.frmEmail.optAge.length; i++){
		if (document.frmEmail.optAge[i].checked){
			j = 1
		}
	}
	if (j == 0){
	 alert("Please select your age group")
	 return false;
	}
}

function validateMailingList(){
	if(document.frmJournalistMailing.txtTitle.value == ""){
		alert("Please enter your Title.")
		document.frmJournalistMailing.txtTitle.focus()
		return false;
	}
	
	if(document.frmJournalistMailing.txtFirstName.value == ""){
		alert("Please enter your First Name.")
		document.frmJournalistMailing.txtFirstName.focus()
		return false;
	}
	
	if(document.frmJournalistMailing.txtLastName.value == ""){
		alert("Please enter your Last Name.")
		document.frmJournalistMailing.txtLastName.focus()
		return false;
	}
	
	if(document.frmJournalistMailing.txtOrganistaion.value == ""){
		alert("Please enter the name of your Publication/Organisation/Programme.")
		document.frmJournalistMailing.txtOrganistaion.focus()
		return false;
	}
	
	if (document.frmJournalistMailing.txtWorkEmail.value.indexOf("@") == -1 || document.frmJournalistMailing.txtWorkEmail.value.indexOf(".") == -1 || document.frmJournalistMailing.txtWorkEmail.value.indexOf(" ") != -1) {
		alert("Please enter a valid email address.")
		document.frmJournalistMailing.txtWorkEmail.focus()
		return false;
	}
	
	if(document.frmJournalistMailing.txtWorkPhone.value == ""){
		alert("Please enter your Phone Number.")
		document.frmJournalistMailing.txtWorkPhone.focus()
		return false;
	}
}

function validatePoll(){
	var j = 0
	for (var i = 0; i < document.frmPoll.optAns.length; i++){
		if (document.frmPoll.optAns[i].checked){
			j = 1
		}
	}
	if (j == 0){
	 alert("Please select a poll option.")
	 return false;
	}
}

//rollover nav images
var flag = false;
function imageLoad(){  //called with onLoad()
	if (document.images){
		img1on = new Image(); img1on.src = "res/img/nav_home_on.gif";
		img2on = new Image(); img2on.src = "res/img/nav_aboutus_on.gif";
		img3on = new Image(); img3on.src = "res/img/nav_infocentre_on.gif";
		img4on = new Image(); img4on.src = "res/img/nav_gettinginvolved_on.gif";
		img5on = new Image(); img5on.src = "res/img/nav_newsandcampaigns_on.gif";
		img6on = new Image(); img6on.src = "res/img/nav_howwehelp_on.gif";
		img7on = new Image(); img7on.src = "res/img/nav_mediacentre_on.gif";
		img8on = new Image(); img8on.src = "res/img/nav_contactus_on.gif";
		return (flag = true);  //set the flag and let the function know know it can work
	}
}
if (document.images){   //load the off images in the normal way
	img1off = new Image(); img1off.src = "res/img/nav_home_off.gif";
	img2off = new Image(); img2off.src = "res/img/nav_aboutus_off.gif";
	img3off = new Image(); img3off.src = "res/img/nav_infocentre_off.gif";
	img4off = new Image(); img4off.src = "res/img/nav_gettinginvolved_off.gif";
	img5off = new Image(); img5off.src = "res/img/nav_newsandcampaigns_off.gif";
	img6off = new Image(); img6off.src = "res/img/nav_howwehelp_off.gif";
	img7off = new Image(); img7off.src = "res/img/nav_mediacentre_off.gif";
	img8off = new Image(); img8off.src = "res/img/nav_contactus_off.gif";
}
function rollIn(imgName,title) {
	window.status = title
	if (document.images && (flag == true)) {
		document[imgName].src = eval(imgName + "on.src");
	}
}
function rollOut(imgName) {  //the normal onMouseOut function
window.status = ""
	if (document.images){
		document[imgName].src = eval(imgName + "off.src");
	}
}
function printPage(id){
	var win1 = window.open("print_Instructions.asp?id="+id,"PrintInstructions","width=730,height=650,scrollbars=yes,menubar=no,top=50");
	win1.focus();
}