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", "");
				}
			}
		}
	}

	snav = new Array("services-nav1","services-nav2","services-nav3")
	for (i=0;i<snav.length;i++)
	{
		tnode = document.getElementById(snav[i])
		tnode.onmouseover=function() {
			this.className+="over";
		}
		tnode.onmouseout=function() {
			this.className=this.className.replace("over", "");
		}
	}
}
window.onload=startList;

// Form Validation
function isValidEmail(str) {
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(str)){
		return true;
	}
	else {
		return false;
	}
}

function checkcontactform(){
	var ftxt = '';
	
	if (document.contactform.Name.value==''){
		ftxt += '\n- Please enter a Name.';
	}
	
	if (isValidEmail(document.contactform.email.value)==false){
		ftxt += '\n- Please enter an Email Address.';
	}
	
	if (document.contactform.Company.value==''){
		ftxt += '\n- Please enter a Company Name.';
	}
	
	if (document.contactform.Telephone.value==''){
		ftxt += '\n- Please enter a Telephone Number.';
	}
	
	var bnewsletter = false;
	for (var i=0;i<2;i++){
		if (document.contactform.SubscribeNewsletter[i].checked==true){
			bnewsletter= true;
		}
	}
	if (bnewsletter==false){
		ftxt += '\n- Please select if you would like to receive our Newsletter.';
	}
	
	var bsecondhome = false;
	for (var i=0;i<2;i++){
		if (document.contactform.OwnSecondHome[i].checked==false){
			bsecondhome = true;
		}
	}
	if (bsecondhome==false){
		ftxt += '\n- Please select if you already own a Second Home.';
	}	
	
	if (ftxt!==''){
		alert('One or more errors were found while submitting this form. The errors found are displayed below.\n' + ftxt + '\n\nPlease correct the above errors and try again.');
		return false;
	}
	else {
		return true;
	}
}


