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 setContent() {
	if (document.getElementById) {
		var windowHeight = getWindowHeight();
		if (windowHeight > 0) {
			//content
			var contentElement = document.getElementById('content');
			var contentHeight = contentElement.offsetHeight;
			
			var hautsiteElement = document.getElementById('hautsite');
			var hautsiteHeight = hautsiteElement.offsetHeight;
			
			var footerElement = document.getElementById('bassite');
			var footerHeight  = footerElement.offsetHeight;
			
			var containerElement = document.getElementById('container');
			var containerHeight = containerElement.offsetHeight;
			
			var zone = contentHeight+hautsiteHeight+footerHeight;
			
			var navigateur = navigator.userAgent;
			
			
			if (windowHeight - zone > 0) {
				contentElement.style.position = 'relative';
				contentElement.style.top = 0 + 'px';
			}
			else {
				contentElement.style.position = 'static';
			}
			
			//footer
			if (windowHeight - zone > 0) {
				footerElement.style.position = 'absolute';
				footerElement.style.bottom = 0;
				containerElement.style.height = '100%';
			}
			else {
				footerElement.style.position = 'relative';
				
				// Internet explorer / firefox
//				if(navigator.userAgent.indexOf('Windows')  > -1 || navigator.userAgent.indexOf('Firefox')  > -1) {
//					containerElement.style.height = contentHeight+hautsiteHeight+'px';
//					containerElement.style.height = 'auto';
//
//				}
//				
				//safari
//				if(navigator.userAgent.indexOf('Safari')  > -1) {
//					containerElement.style.height = 'auto';
//				}

				// tous les navigateurs
				containerElement.style.height = 'auto';
			}
		}
	}
}
window.onload = function() {
	setContent();
}
window.onresize = function() {
	setContent();
}