// Function to keep the footer at the bottom of the page.
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.onresize = function() {
	setFooter();
}
// general popup window function
function open_popup(url,w,h,statusbar) {
	if(statusbar==null) statusbar=0;
	if(w==null) w=400;
	if(h==null) h=200;
	x = screen.width/2 - w/2;
	y = screen.height/2 - h/2;
	pWindow = window.open(url,"popup",'toolbar=0,location=0,directories=0,status='+statusbar+',menubar=0,width='+w+',height='+h+',scrollbars');	
	pWindow.moveTo(x,y);
	pWindow.focus();
}

