function init()
	{
	//adjust header height and adjust menu position 
	a=document.getElementById("menu")
	b=document.getElementById("middle")
	if(b && b.scrollHeight<a.scrollHeight)
		{b.style.height=a.scrollHeight+10+"px"}
	}
		
function cursor_sniff(obj)
	{
	if (document.all){obj.cursor="hand"}else{obj.cursor="pointer"}
	}
	
function check_form()
	{
	empty	= false
	fm	= document.getElementById("details")
	checker(fm.fname,"You must enter your first name")
	checker(fm.lname,"You must enter your last name")
	email_check(fm.email)
	checker(fm.tel,"You must enter a telephone number")
	if (empty == false){fm.submit()}
	}	

function checker(obj,msg){if(obj.value=="" && empty==false){alert(msg);empty=true;obj.focus()}}

function email_check(obj)
	{
	var emailStr=obj.value;var emailPat=/^(.+)@(.+)$/;
	var specialChars="\\(\\)!£$%^&*()+='#~?<>@,;:\\\\\\\"\\.\\[\\]";var validChars="\[^\\s" + specialChars + "\]";var quotedUser="(\"[^\"]*\")";var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
	var atom=validChars + '+';var word="(" + atom + "|" + quotedUser + ")";var userPat=new RegExp("^" + word + "(\\." + word + ")*$");var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");var matchArray=emailStr.match(emailPat)
	if ((matchArray==null) && empty==false){alert("Email address seems incorrect (check @ and .'s)");empty=true;obj.focus()}
	if (empty==false){var user=matchArray [1];var domain=matchArray [2];if (user.match(userPat)==null){alert("The username doesn't seem to be valid.");empty=true;obj.focus()}}
	if (empty==false){var IPArray=domain.match(ipDomainPat);if (IPArray!=null){for (var j=1;j<=4;j++){if (IPArray[j]>255){alert("Destination IP address is invalid!");empty=true;obj.focus()}}}}
	if (empty==false){var domainArray=domain.match(domainPat);if (domainArray==null){alert("The domain name doesn't seem to be valid.");empty=true;obj.focus()}}
	if (empty==false){var atomPat=new RegExp(atom,"g");var domArr=domain.match(atomPat);var len=domArr.length;if (domArr[domArr.length-1].length<2 || domArr[domArr.length-1].length>3){alert("The address must end in a three-letter domain, or two letter country.");empty=true;obj.focus()}}
	if ((len<2) && empty==false){alert("This address is missing a hostname!");empty=true;obj.focus}
	}
	
window.onload=init