// Footer
function getWindowHeight() {
	var windowHeight = 0;
	if (typeof(window.innerHeight) == 'number') {
		windowHeight = window.innerHeight;
	} else {
	if (document.documentElement && document.documentElement.clientHeight) {
		windowHeight = document.documentElement.clientHeight;
	} else {
	if (document.body && document.body.clientHeight) {
		windowHeight = document.body.clientHeight;
			}
		}
	}
	return windowHeight;
	}
	function setFooter() {
		if (document.getElementById) {
		var windowHeight = getWindowHeight();
		if (windowHeight > 0) {
			var contentHeight = document.getElementById('page').offsetHeight;
			var footerElement = document.getElementById('footer');
			var footerHeight  = footerElement.offsetHeight;
			if (windowHeight - (contentHeight + footerHeight) >= 0) {
				footerElement.style.position = 'relative';
				footerElement.style.top = (windowHeight - (contentHeight + footerHeight)) + 'px';
			} else {
				footerElement.style.position = 'static';
				}
			}
		}
	}
	window.onload = function() {
	setFooter();
	}
	window.onresize = function() {
		setFooter();
}



// Form Validation
function setFocus(aField) {
	document.forms[0][aField].focus();
}

function isEmpty(aTextField) {
	if ((document.forms[0][aTextField].value.length==0) || (document.forms[0][aTextField].value==null))
	{
		return true;
	} else { 
		return false;
	}
}

function validate()
{
	if (isEmpty("post_name")) {
		alert("Please fill in your name.");
		setFocus("post_name");
		return false;
	}

	if (isEmpty("post_message")) {
		alert("Please fill in a comment.");
		setFocus("post_message");
		return false;
	}
		return true;
}

/*
function email_validate()
{
	var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
	var elem = document.forms[0]["email"];
	
	if(elem.value.match(emailExp)) {
		return true;
		
	} else {
		alert("Please enter a valid email address.");
		elem.focus();
		return false;
	}
}
*/

