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() {
	var windowHeight = getWindowHeight();
	if (windowHeight>0) {
		var contentHeight = document.getElementById('wrapper').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'; }
	}
}

function fixMinWidth(id, w) {
	e = document.getElementById(id);
	if(!e) return;
	if (e.offsetWidth < w) { e.style.width = w; }
	else { e.style.width = "100%"; }
}

function popdemo() {
	var popdemos = document.getElementsByTagName("a");
	for(var i=0, p; p=popdemos[i]; i++) {
		if (p.className.search("popdemo")!=-1) {
			p.onclick = function(){
				var w = screen.width - 10;
				var h = screen.height - 10;
				var winobj = window.open(this.href, "popdemo", "width="+w+",height="+h+",left=0,top=0,menubar=no,location=no,resizable=yes,scrollbars=no,status=no,toolbar=no,alwaysRaised=yes");
				winobj.focus();
				return false;
			}
		}
	}
}

function domReady() { // domReady by brothercake - http://www.brothercake.com/
	this.n = typeof this.n == 'undefined' ? 0 : this.n + 1;
	if (typeof document.getElementsByTagName != 'undefined' && (document.getElementsByTagName('body')[0] != null || document.body != null)) {
		popdemo(); setFooter(); fixMinWidth("banner", 750);
	} else if(this.n < 60) {
		setTimeout('domReady()', 250);
	}
}

if (document.getElementById) {
	domReady();
	window.onresize = function() { setFooter(); fixMinWidth("banner", 750); }
}