// JavaScript Document
	function checkEmail(strng) {
		var emailFilter=/^.+@.+\..{2,3}$/;
		if (!(emailFilter.test(strng))) { 
		   return false;
		}
		else {
	//test email for illegal characters
		   var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/
			 if (strng.match(illegalChars)) {
			  return false;
		   }
		}
		return true;
	}
	
	var dropDownTimeOut;
	var defaultTimeOut;
	var subTimeOut;
	var currentItem = "";
	var defaultItem = "";
	
	function removeAllSubs() {
		$("#sub-about-us").hide();$("#nav li.about-us").removeClass("current");
		$("#sub-our-staff").hide();$("#nav li.our-staff").removeClass("current");
		$("#sub-our-services").hide();$("#nav li.our-services").removeClass("current");
	}
	
	function menuHover(theItem) {
		//if (theItem != defaultItem) {
			removeAllSubs();
			currentItem = theItem;
			clearTimeout(defaultTimeOut);
			clearTimeout(subTimeOut);
			$('#sub-' + defaultItem).hide();$('#nav li.' + defaultItem).removeClass('current');
			$("#nav li." + theItem).addClass("current");
			subTimeOut = setTimeout('$("#sub-' + theItem + '").show();', 100);
		//}
	}
	
	$(document).ready(function() {
		  $("a.new-window").click(function() {
			   window.open($(this).attr("href"),"_blank","width=700,height=270");
			   return false;
		  });
		$("#nav li").hover(function(){
				clearTimeout(defaultTimeOut);
				if (currentItem != defaultItem) {
					$('#sub-' + defaultItem).hide();$('#nav li.' + defaultItem).removeClass('current');
				}
			},
			function(){
				defaultTimeOut = setTimeout("$('#sub-" + defaultItem + "').show();$('#nav li." + defaultItem + "').addClass('current');clearTimeout(dropDownTimeOut);", 150);
    	});
		
		$("#nav li.about-us a").hover(function(){
				menuHover("about-us");
			},
			function(){
				dropDownTimeOut = setTimeout('$("#sub-about-us").hide();$("#nav li.about-us").removeClass("current");clearTimeout(dropDownTimeOut);', 50);
    	});
		$("#nav li.our-services a").hover(function(){
				menuHover("our-services");
			},
			function(){
				
				dropDownTimeOut = setTimeout('$("#sub-our-services").hide();$("#nav li.our-services").removeClass("current");clearTimeout(dropDownTimeOut);', 50);
    	});
		$("#nav li.our-staff a").hover(function(){
				
				menuHover("our-staff");
			},
			function(){
				dropDownTimeOut = setTimeout('$("#sub-our-staff").hide();$("#nav li.our-staff").removeClass("current");clearTimeout(dropDownTimeOut);', 50);
    	});
		
		$("#sub-about-us li").hover(function(){
			clearTimeout(dropDownTimeOut);
			clearTimeout(defaultTimeOut);
			},function(){
				dropDownTimeOut = setTimeout("$('#sub-" + currentItem + "').hide();$('#nav li." + currentItem + "').removeClass('current');clearTimeout(dropDownTimeOut);", 100);
				defaultTimeOut = setTimeout("$('#sub-" + defaultItem + "').show();$('#nav li." + defaultItem + "').addClass('current');clearTimeout(dropDownTimeOut);", 150);
		});
		$("#sub-our-services li").hover(function(){
			clearTimeout(dropDownTimeOut);
			clearTimeout(defaultTimeOut);
			},function(){
				dropDownTimeOut = setTimeout("$('#sub-" + currentItem + "').hide();$('#nav li." + currentItem + "').removeClass('current');clearTimeout(dropDownTimeOut);", 100);
				defaultTimeOut = setTimeout("$('#sub-" + defaultItem + "').show();$('#nav li." + defaultItem + "').addClass('current');clearTimeout(dropDownTimeOut);", 150);
		});
		$("#sub-our-staff li").hover(function(){
			clearTimeout(dropDownTimeOut);
			clearTimeout(defaultTimeOut);
			},function(){
				dropDownTimeOut = setTimeout("$('#sub-" + currentItem + "').hide();$('#nav li." + currentItem + "').removeClass('current');clearTimeout(dropDownTimeOut);", 100);
				defaultTimeOut = setTimeout("$('#sub-" + defaultItem + "').show();$('#nav li." + defaultItem + "').addClass('current');clearTimeout(dropDownTimeOut);", 150);
		});
		
		$("#message-form input.submit").hover(function() {
			$("#message-form input.submit").attr("src", "images/page-bgs/contact-us/submit-hover.png");
		}, function() {
			$("#message-form input.submit").attr("src", "images/page-bgs/contact-us/submit.png");									   
		});
		$("#message-form").submit(function() {
			if ($("#txtName").val() == "") {
				$("#lblName").addClass("error");
				$("#lblName").focus();
				return false;
			} else {
				$("#lblName").removeClass("error");
			}
			if ($("#txtTelephone").val() == "") {
				$("#lblTelephone").addClass("error");
				$("#lblTelephone").focus();
				return false;
			} else {
				$("#lblTelephone").removeClass("error");
			}
			if ($("#txtEmail").val() == "" || checkEmail($("#txtEmail").val()) == false) {
				$("#lblEmail").addClass("error");
				$("#lblEmail").focus();
				return false;
			} else {
				$("#lblEmail").removeClass("error");
			}
			if ($("#txtMessage").val() == "") {
				$("#lblMessage").addClass("error");
				$("#lblMessage").focus();
				return false;
			} else {
				$("#lblMessage").removeClass("error");
			}
			return true;
		});
	});
