



var isIE  = navigator.userAgent.toLowerCase().indexOf('msie') > -1;
var isIE7 = navigator.userAgent.toLowerCase().indexOf('msie 7') > -1;



window.onload = fix;
window.onresize = fix;

function fix() {
	
	var wh = window.outerHeight;
	var sh = document.documentElement.scrollHeight;
	var ch = Math.max( 500, document.documentElement.clientHeight );
	var fh = document.getElementById('footer').offsetHeight;
	var eh = Math.max( ch, sh );
	
	
	
	//document.getElementById('debug').innerHTML = "window: "+wh+"<br />scroll: "+sh+"<br /> client: "+ch;
	if ( sh<=ch ) {
	//document.getElementById('debug').innerHTML += "<br /><br />FIX";
		
		document.getElementById('footer').style.position = 'absolute';
		document.getElementById('footer').style.top = ch-fh+'px';
		document.getElementById('container').style.height = ch+'px';
	}
	
}



/**
 * Show or hide the element defined by the given id
 *
 * @param String	the element ID, or a list of element id
 * @param String	[ the display style : block (default), inline, etc… ]
 * @param boolean	[ force the element to stay in the given style (false by default)  ]
 *
 * @return String	the current element ID display style (only for a single ID)
 */
function display( id, style, fix ) {

	var i,elem;

	if ( !style ) style = "block";
	if ( !fix ) fix = false;
	if ( typeof(id)=="string" ) id = [id];
	
	for( i in id  ) {
		elem = document.getElementById( id[i] );
		elem.style.display = elem.style.display== style && !fix ? 'none' : style;
	}
	
	
	// return style
	if ( i==0 ) return elem.style.display;
}


