function check_browser()
	{
	if (!document.getElementById)
		{alert('You will need to update your browser to view this site properly')}
	else
		{
		men	= document.getElementById("menu")
		mid	= document.getElementById("middle")
		a	= 0
		add = 0
		if (mid.scrollHeight<400){mid.style.height="400px";a=1;add=-20}
		if (a==1){h=400}else{h=mid.scrollHeight}
		if (document.all){add=add+19}else{add=add+23}
		men.style.height = (h-add)+"px"
		pic_resizer()
		}	
	}
	
function pic_resizer()
	{
	var a = document.getElementById("middle").getElementsByTagName("IMG")
	for (var b=0;b<a.length;b++)
		{
		if (a[b].className=="pic")
			{
			var alt_old=this.alt;
			a[b].onmouseover=function(){cursor_sniff(this.style)}
			a[b].onmouseout =function(){this.style.cursor=""}
			a[b].onclick	=function(){location.href='/car.asp?model='+escape(this.alt)}
			}
		}
	}

function cursor_sniff(obj)
	{
	if (document.all){obj.cursor="hand"}
	else{obj.cursor="pointer"}
	}
	
function check_form()
	{
	empty	= false
	form_id	= document.getElementById("contact")
	checker(form_id.fname,"You must enter your first name")
	checker(form_id.lname,"You must enter your last name")
	email_check(form_id.email)
	checker(form_id.tel,"You must enter a telephone number")
	if (empty == false){form_id.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}
	}