// JavaScript Document
function validateonlinebooking(theform) {
	msg = "";
	if (theform.txttitle.selectedIndex==0 && theform.txttitleother.value=="") msg = msg + "      - title\n";;
	if (theform.txtforename.value=="") msg = msg + "      - forename\n";
	if (theform.txtsurname.value=="") msg = msg + "      - surname\n";
	if (theform.txtorg.value=="") msg = msg + "      - organisation\n";
	if (theform.txtaddress.value=="") msg = msg + "      - address\n";
	if (theform.txtpostcode.value=="") msg = msg + "      - postcode\n";
	if (theform.txtworktel.value=="") msg = msg + "      - work telephone\n";
	if (theform.txtemail.value=="") msg = msg + "      - email\n";
	
	if (!theform.purchaseorder.checked && !theform.cheque.checked && !theform.purchaseorderfax.checked) msg = msg + "      - please select a payment method\n";
	rad_val="";
	for (var i=0; i < document.bookingform.agree.length; i++)
	   {
	   if (document.bookingform.agree[i].checked)
		  {
		  var rad_val = document.bookingform.agree[i].value;
		  }
	   }
	if (rad_val!="yes") msg = msg + "      - your must agree to the terms and conditions\n";	

	if (msg != "") {
		alert ("The following fields are required:\n\n"+msg+"\n\nPlease correct and re-submit");
		return false;
	}
	return true;
}

function validatebooking(theform) {
	msg = "";
	if (theform.txttitle.selectedIndex==0 && theform.txttitleother.value=="") msg = msg + "      - title\n";;
	if (theform.txtforename.value=="") msg = msg + "      - forename\n";
	if (theform.txtsurname.value=="") msg = msg + "      - surname\n";
	if (theform.txtorg.value=="") msg = msg + "      - organisation\n";
	if (theform.txtaddress.value=="") msg = msg + "      - address\n";
	if (theform.txtpostcode.value=="") msg = msg + "      - postcode\n";
	if (theform.txtworktel.value=="") msg = msg + "      - work telephone\n";
	if (theform.txtemail.value=="") msg = msg + "      - email\n";
	if (theform.suggest.value=="yes" && theform.txtsuggestdate.value=="") msg = msg + "      - please suggest a date\n";
	
	if (theform.txtsuggestdate.value=="" && theform.suggest.value!="yes") {
		if (!theform.purchaseorder.checked && !theform.cheque.checked && !theform.purchaseorderfax.checked) msg = msg + "      - please select a payment method\n";
		rad_val="";
		for (var i=0; i < document.bookingform.agree.length; i++)
		   {
		   if (document.bookingform.agree[i].checked)
			  {
			  var rad_val = document.bookingform.agree[i].value;
			  }
		   }
		if (rad_val!="yes") msg = msg + "      - your must agree to the terms and conditions\n";	
	}
	if (msg != "") {
		alert ("The following fields are required:\n\n"+msg+"\n\nPlease correct and re-submit");
		return false;
	}
	return true;
}

function validatebespoke(theform) {
	msg = "";
	if (theform.txttitle.selectedIndex==0 && theform.txttitleother.value=="") msg = msg + "      - title\n";;
	if (theform.txtname.value=="") msg = msg + "      - name\n";
	if (theform.txtorg.value=="") msg = msg + "      - organisation\n";
	if (theform.txtaddress.value=="") msg = msg + "      - address\n";
	if (theform.txtpostcode.value=="") msg = msg + "      - postcode\n";
	if (theform.txtbusinesstel.value=="") msg = msg + "      - business telephone\n";
	if (theform.txtemail.value=="") msg = msg + "      - email\n";
	if (theform.txtdelegates.value=="") msg = msg + "      - number of delegates\n";
	if (msg != "") {
		alert ("The following fields are required:\n\n"+msg+"\n\nPlease correct and re-submit");
		return false;
	}
	return true;
}

function validatecontact(theform) {
	msg = "";
	if (theform.txtname.value=="") msg = msg + "      - name\n";
	if (theform.txtemail.value=="") msg = msg + "      - email\n";
	if (theform.txtenquiry.value=="") msg = msg + "      - enquiry\n";

	if (msg != "") {
		alert ("The following fields are required:\n\n"+msg+"\n\nPlease correct and re-submit");
		return false;
	}
	return true;
}

function setcourse(url) {
	destination = document.getElementById("courseinfoholder");
// Make a new XMLHttp object
   if (typeof window.ActiveXObject != 'undefined' ) 
   { 
       doc = new ActiveXObject("Microsoft.XMLHTTP"); 
   } 
   else 
   { 
       doc = new XMLHttpRequest(); 
   }

	if (doc){ 	 
		 doc.open("GET", "courseshortdetails.asp?id="+url ,false);
		 doc.send(null);
		 destination.innerHTML = doc.responseText;
		 d.focus();
	}else{
		 destination.innerHTML = 'Browser unable to create XMLHttp Object';
	}
}



startList = function() {
if (document.all&&document.getElementById) {
navRoot = document.getElementById("nav");
for (i=0; i<navRoot.childNodes.length; i++) {
node = navRoot.childNodes[i];
if (node.nodeName=="LI") {
node.onmouseover=function() {
this.className+=" over";
  }
  node.onmouseout=function() {
  this.className=this.className.replace(" over", "");
   }
   }
  }
 }
}
