// DROPDOWNS - FOR IE6 ONLY
sfHover = function() {     
		var sfEls = document.getElementById("nav_main").getElementsByTagName("LI");
		for (var i=0; i<sfEls.length; i++) {
			sfEls[i].onmouseover=function() {
				this.className+=" sfhover";
				}
				sfEls[i].onmouseout=function() {
					this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
				}     
			}
} 

if (window.attachEvent) window.attachEvent("onload", sfHover); 

/* NEW WINDOWS */

function externalLinks() {
	if (!document.getElementsByTagName) return;
	var anchors = document.getElementsByTagName("a");
	for (var i=0; i<anchors.length; i++) {
		var anchor = anchors[i];
		if (anchor.getAttribute("href") &&
				anchor.getAttribute("rel") == "external")
			anchor.target = "_blank";
	}
	}
window.onload = externalLinks;


/* EVENT TYPE - DROPDOWN LIST REDIRECT */

function EventTypeRedirect() {
  var url=document.eventtypeselect.eventtype.value
  document.location.href=url
  }


/* PAGE HIGHLIGHTING */

function extractPageName(hrefString)
{
 var arr = hrefString.split('.');
 if(arr.length >= 2) {
  arr = arr[arr.length-2].split('/');
  return arr[arr.length-1].toLowerCase();
 } else {
  return "x";
 }
}
	
function setActiveMenu(arr, crtPage)
    {
	for (var i=0; i<arr.length; i++)
	{
	 if(extractPageName(arr[i].href) == crtPage)
	 {
	  if (arr[i].parentNode.tagName != "nav_left_list")
	   {
	      arr[i].className += " selected";
	      arr[i].parentNode.className += " selected";
	      arr[i].parentNode.parentNode.className += " selected";	
	      arr[i].parentNode.parentNode.parentNode.className += " selected";
	      arr[i].parentNode.parentNode.parentNode.parentNode.className += " selected";
	      arr[i].parentNode.parentNode.parentNode.parentNode.parentNode.className += " selected";	
	      arr[i].parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.className += " selected";	
	               }
	      }
	  }
	}
	
function setPage()
     {
     hrefString = document.location.href ? document.location.href : document.location;
	if (document.getElementById("nav_left_list")!=null)
	     setActiveMenu(document.getElementById("nav_left_list").getElementsByTagName("a"), extractPageName(hrefString));
       	}


/* CALL ME */

function validateCall()
{

if (document.pleasecall.name.value == '')
 { 
  alert('Please enter your name');
  document.pleasecall.name.focus();
  return (false);
 }  
if (document.pleasecall.country.value == '')
 { 
  alert('Please enter your country');
  document.pleasecall.country.focus();
  return (false);
 } 
if (document.pleasecall.tel.value == '')
 { 
  alert('Please enter your telephone number');
  document.pleasecall.tel.focus();
  return (false);
 } 

if (document.pleasecall.help.value == '')
 { 
  alert('How can we help you?');
  document.pleasecall.help.focus();
  return (false);
 } 
{ if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.pleasecall.email.value))
  { 
  return (true) }
	alert("Please enter a valid email address")	
	document.pleasecall.email.focus();
	return (false)
	} 
document.forms[0].submit();
}


/* PROSPECTUS FORM */

function validateProspectus()
{

if (document.prospectus.child.value == '')
 { 
  alert('Please enter the name of your child');
  document.prospectus.child.focus();
  return (false);
 }  

if (document.prospectus.childdob_day.selectedIndex == 0)
	{
	 alert('Please select your child\'s date of birth');
	return (false);
	}
if (document.prospectus.childdob_month.selectedIndex == 0)
	{
	 alert('Please select your child\'s month of birth');
	return (false);
	}
if (document.prospectus.childdob_year.selectedIndex == 0)
	{
	 alert('Please select your child\'s year of birth');
	return (false);
	}
if (document.prospectus.yeargroup.value == '')
 { 
  alert('Please enter your child\'s current year group');
  document.prospectus.yeargroup.focus();
  return (false);
 }  
if (document.prospectus.yearentry.selectedIndex == 0)
	{
	 alert('Please select your child\'s year of entry');
	return (false);
	}
if (document.prospectus.presentschool.value == '')
 { 
  alert('Please enter your child\'s present school');
  document.prospectus.presentschool.focus();
  return (false);
 }  
if (document.prospectus.boarding.value == '')
 { 
  alert('Please enter boarding or day?');
  document.prospectus.boarding.focus();
  return (false);
 }  
if (document.prospectus.surname.value == '')
 { 
  alert('Please enter your surname');
  document.prospectus.surname.focus();
  return (false);
 } 
if (document.prospectus.address1.value == '')
 { 
  alert('Please enter your first address line');
  document.prospectus.address1.focus();
  return (false);
 } 
if (document.prospectus.town.value == '')
 { 
  alert('Please enter your town');
  document.prospectus.town.focus();
  return (false);
 } 
if (document.prospectus.county.value == '')
 { 
  alert('Please enter your county');
  document.prospectus.county.focus();
  return (false);
 } 
if (document.prospectus.postcode.value == '')
 { 
  alert('Please enter your postcode');
  document.prospectus.postcode.focus();
  return (false);
 } 
if (document.prospectus.country.value == '')
 { 
  alert('Please enter your country');
  document.prospectus.country.focus();
  return (false);
 } 
if (document.prospectus.tel.value == '')
 { 
  alert('Please enter your telephone number');
  document.prospectus.tel.focus();
  return (false);
 } 
{ if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.prospectus.email.value))
  { 
  return (true) }
	alert("Please enter a valid email address")	
	document.prospectus.email.focus();
	return (false)
	}
document.forms[0].submit();
}


















































