// JavaScript Document

init = function() {
	setFooter()
	
}
window.onload=init;

function setFooter() {
	if (document.getElementById) {
		var windowHeight = getWindowHeight();
		
		if (windowHeight > 0) {
			var wrapperHeight = document.getElementById('wrapper').offsetHeight;
			var topperHeight = document.getElementById('topper').offsetHeight;
			var maincontentHeight = document.getElementById('maincontent').offsetHeight;
			//alert(wrapperHeight + " + " + windowHeight);
			
			//if (maincontentHeight+topperHeight > wrapperHeight) {
			//	document.getElementById('wrapper').style.height = maincontentHeight+topperHeight + 'px';
			//}
			
			if (maincontentHeight+topperHeight<windowHeight) {
				document.getElementById('wrapper').style.height = windowHeight + 'px';
				
			} else {
				document.getElementById('wrapper').style.height = maincontentHeight+topperHeight+ 30 + 'px';
				
			}
			//if (maincontentHeight+topperHeight > windowHeight) {
			//	document.getElementById('wrapper').style.height = maincontentHeight+topperHeight + 'px';
			//}
			
			
			//var contentHeight = document.getElementById('wrapper').offsetHeight;
			
			//var photoElement = document.getElementById('mainnav');
			//var footerHeight  = footerElement.offsetHeight;
			//window.status = (windowHeight - 165);
			//alert(document.getElementById('maincontent').offsetHeight);
			//photoElement.style.height = (windowHeight - 165) + 'px';
			//if (contentHeight<windowHeight) {document.getElementById('wrapper').style.height = windowHeight + 'px';}
			
			}
		}
	}

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;
		}
		
		window.onresize = function() {
			setFooter();
		}
