// JavaScript Document

	var w, h;
	
	function getWindowDimensions () {
		if (document.innerHeight){
			h=document.innerHeight;
			w=document.innerWidth;
		} else if (document.documentElement.clientHeight) {
			h=document.documentElement.clientHeight;
			w=document.documentElement.clientWidth;
		} else if(document.body) {
			h=document.body.clientHeight;
			w=document.body.clientWidth; 
		}
		return h;
		return w;
	}
	
	function setDimensions() {
		var footer = document.getElementById("vestige");
		var contentHeight = parseInt(document.getElementById("header").offsetHeight) + parseInt(document.getElementById("mainContainer").offsetHeight) + 20;
		getWindowDimensions();
		if (w) {
			if (contentHeight > h || parseInt(document.getElementById("mainContainer").style.width) + 170 > w) {
				footer.style.position = "static";
				footer.style.marginTop = "210px";
				footer.style.textAlign = "right";
			} else {
				footer.style.position = "fixed";
				footer.style.bottom = "0px";
				footer.style.right = "0px";
			}
			if (w < 1264) {
				var navigation = document.getElementById("nav");
				navigation.style.marginLeft="-"+(1264-w)/2+'px';
			}
		}
		
	}
	
	function validate_form() {
		valid = true;
		if ( document.contactForm.name.value == "" || document.contactForm.name.value == "Please fill in your name") {
			document.contactForm.name.style.backgroundColor="#ffee99";
			document.contactForm.name.value = "Please fill in your name";
			valid = false;
		}
		if (document.contactForm.address.value == "" || document.contactForm.address.value == "Please fill in your address") {
			document.contactForm.address.style.backgroundColor="#ffee99";
			document.contactForm.address.value = "Please fill in your address";
			valid = false;
		}
		if (document.contactForm.email.value == "" || document.contactForm.email.value == "Please fill in your email" ) {
			document.contactForm.email.style.backgroundColor="#FFEE99";
			document.contactForm.email.value = "Please fill in your email";
			valid = false;
		}
		if (document.contactForm.phone.value == "" || document.contactForm.phone.value == "Please fill in your phone number" ) {
			document.contactForm.phone.style.backgroundColor="#FFEE99";
			document.contactForm.phone.value = "Please fill in your phone number";
			valid = false;
		}
		if (document.contactForm.services.value == "null" ) {
			if (document.getElementById("services").innerHTML.indexOf("Please") == -1) {
				document.getElementById("services").innerHTML = document.getElementById("services").innerHTML + '<span class="accent">Please select a service</span>';
			}
			valid = false;
		}
		return valid;
	}

	function resetInput(obj) {
		if (obj.value.indexOf("Please") != -1 ) {
			obj.style.backgroundColor="#FFFFFF";
			obj.value = "";
		}
	}