//<script>
	function rollover(imgid,imgsrc)
	{
		document.images[imgid].src=imgsrc;	
	}
	
	function SurfTo(PageLocation) {
		window.location.href = PageLocation;
	}
	
	function bookmark()
	{
		if (window.external)
		{
			window.external.AddFavorite(window.location.href,document.title)
		}		
	}

	
	
	function findObj(n,d) { 
		var p,i,x;  
		if(!d) d=document; 
		if((p=n.indexOf("?"))>0&&parent.frames.length) 
		{
		    	d=parent.frames[n.substring(p+1)].document; 
			n=n.substring(0,p);
		}
		//Case IE
		if(!(x=d[n])&&d.all) 
			x=d.all[n]; 
		for (i=0;!x&&i<d.forms.length;i++) 
			x=d.forms[i][n];
		//Case NN
		for(i=0;!x&&d.layers&&i<d.layers.length;i++) 
			x=this.findObj(n,d.layers[i].document);
		//Case NN6
		if(!x && d.getElementById) 
			x=d.getElementById(n); 
		return x;
	}

	function changeColor(linkid, bgimg, classname)
	{
		objCellA=findObj("cellA"+linkid)
		objCellA.style.backgroundImage="url("+bgimg+")"
		objCellB=findObj("cellB"+linkid)
		objCellB.style.backgroundImage="url("+bgimg+")"
		objLink=findObj("l"+linkid)
		objLink.className=classname
	}

	function checkContactForm() {
		
		
		
		msg='Please complete the following compulsory fields:\n'
		if (document.forms.Contact.sMsg.value=='')
			msg+='Message field\n';
		
			
		if (document.forms.Contact.sMsg.value=='Type your message')
			msg+='Message field\n';
		
		
				
		if (!validEmail(document.forms.Contact.sEmail.value))
			msg ='Email address : please check that the email address is in the correct format\n';		
			
		
			
		if (msg=='Please complete the following compulsory fields:\n')
		{
			alert('Your message is being sent. Please wait a moment.');
			subLater();
		}
		else
		{
			alert(msg);
		}
	}
			
	function subLater() {
		document.forms.Contact.xMsg.value = document.forms.Contact.sMsg.value;
		document.forms.Contact.xEmail.value = document.forms.Contact.sEmail.value;
		document.forms.Contact.xName.value = document.forms.Contact.sName.value;
		document.forms.Contact.xContactDetails.value = document.forms.Contact.sContactDetails.value;
				
		document.forms.Contact.sMsg.value='';
		document.forms.Contact.sEmail.value='';
		document.forms.Contact.sName.value='';
		document.forms.Contact.sContactDetails.value='';
		
		document.forms.Contact.submit();
	}
	
	function checkEmail(address)
	{
		if (!validEmail(address))
		{
			alert('Email address : please check that the email address is in the correct format')
		}		
	}
		
	function validEmail(address) {
		if (address == 'Insert e-mail address here') return true;
		if (address == '') return true;
		
		var invalids = " /:,;";
		
		address = address.toLowerCase();
		var valids = "abcdefghijklmnopqrstuvwxyz0123456789@.-_";
		
		if (address == "")
			return true;
			
			
		for (i=0; i<address.length; i++) {
			testChar = address.charAt(i)
			if (valids.indexOf(testChar,0) == -1) {
					
				return false;
			}
		}
							
		atPos = address.indexOf("@",1)
		if (atPos == -1)
			return false;
						
		if (address.indexOf("@",atPos+1) != -1)
			return false;
						
		periodPos = address.indexOf(".",atPos)
		if (periodPos == -1)
			return false;
						
		if (periodPos+3 > address.length)
			return false;
		
		return true;
	}
		
	function checkLength(FieldName, iLength) {
		sValidate = eval('document.forms.Contact.' + FieldName);
		//alert(sValidate.value.length);
		if(sValidate.value.length > iLength) {
			alert('You have entered too many characters. The maximum amount for this field is ' + iLength);
			sValidate.focus();
		}
	}
	
	var fields = new Array();	
	
	function clearField(objField)
	{
		if (newField(objField.name))
			objField.value = '';		
	}
	
	function newField(fieldname)
	{
		for (var i = 0 ; i < fields.length ; i++)
		{
			if (fieldname == fields[i]) return false;
		}
		fields[fields.length] = fieldname;
		return true;
	}
	
	var fieldCheck = true
	function checkFieldLength(objField, maxLength) {
		// Check field does not contain too many characters
		// document.Contact.lenField.value = objField.value.length;
		// document.Contact.stateValue.value = fieldCheck;
		if(! fieldCheck) {
			if(objField.value.length < maxLength) {
				fieldCheck = true;
			}
			return true;
		}
		if(objField.value.length > maxLength && fieldCheck) {
			alert("You have reached maximum number of characters for this field: " + (maxLength + 1));
			fieldCheck = false;
			return false;
		}
		return true;
	}

	function FinalCheckFieldLength(objField, maxLength) {
		fieldCheck = true;	// force length check
		if(! checkFieldLength(objField, maxLength)) {
			objField.focus();
		}
	}	
	
//</script>