var alInitLaunched=false;

function alInit(){
	if(!alInitLaunched){
		positionFooter();
	}
	alInitLaunched=true;
}

window.onload=alInit;
window.onresize=positionFooter;

function positionFooter(){
	var wHeight=getInWinSize();
	var maxContentHeight=($('sidebar').offsetHeight < $('content').offsetHeight) ? $('content').offsetHeight : $('sidebar').offsetHeight;
	if((maxContentHeight+100) < wHeight){
		$('main').style.height=(wHeight-102)+'px';
		$('footer').className='reapBot';
	}
}

function getInWinSize(){
	var x,y
	if (self.innerHeight){ // all except Explorer
		y = self.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientHeight) {// Explorer 6 Strict Mode
		y = document.documentElement.clientHeight;
	}
	else if (document.body){ // other Explorers
		y = document.body.clientHeight;
	}
	return y;
}


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;
}