function initPage()
{
	initNav();
	initInputs();
}
function initNav()
{
	var nav = document.getElementById("nav");
	if(nav)
	{
		var lis = nav.getElementsByTagName("li");
		for (var i=0; i<lis.length; i++)
		{
			lis[i].onmouseover = function()
			{
				for (var j=0; j<lis.length; j++)
				{
					if(lis[j].className.indexOf("active") != -1 && lis[j].className.indexOf("hide") == -1 && this.getElementsByTagName("ul").length > 0)
						lis[j].className += " hide";
				}
				this.className += " hover";
			}
			lis[i].onmouseout = function()
			{
				for (var j=0; j<lis.length; j++)
				{
					lis[j].className = lis[j].className.replace("hide", "");
				}
				this.className = this.className.replace("hover", "");
			}
		}
	}
}
function initInputs()
{
	var inputs = document.getElementsByTagName("input");
	for (var i = 0; i < inputs.length; i++ )
	{
		if(inputs[i].type == "text" )
		{
			inputs[i].valueHtml = inputs[i].value;
			inputs[i].onfocus = function ()
			{
				if(this.valueHtml == this.value)
					this.value = "";
			}
			inputs[i].onblur = function ()
			{
				this.value != ""? this.value = this.value: this.value = this.valueHtml;
			}
		}
	}
}
if (window.addEventListener)
	window.addEventListener("load", initPage, false);
else if (window.attachEvent)
	window.attachEvent("onload", initPage);
	
	
	
	/* Validate Form */

		$(document).ready(function() {
			var validator = $("#contact-form").validate({
				errorLabelContainer: $('#errorContainer'),
				errorClass: 'error',
				rules: {
					name: "required",
					email: { required: true, email: true }
				},
				messages: {
					name: "Please enter a name, ",
					email: "Please enter an email address"
			
				}
			});

		$('#submitButton').click(function() {
			$('#contact-form').submit();
		});
	});
	
