function getWinH(){
	var winH=0;
	if(typeof(window.innerHeight)=='number'){
		winH=window.innerHeight;
	}else{
		if(document.documentElement && document.documentElement.clientHeight){
			winH=document.documentElement.clientHeight;
		}else{
			if(document.body && document.body.clientHeight) winH=document.body.clientHeight;
		}
	}
	return winH;
}
function findPosY(obj){
	var cT=0;
	if(obj.offsetParent){
		while(obj.offsetParent){
			cT+=obj.offsetTop;
			obj=obj.offsetParent;
		}
	}else if(obj.y){
		cT+=obj.y;
	}
	return cT;
}
function positionFooter(){
	if(document.getElementById){
		if(document.getElementById('crack') && document.getElementById('footer')) {
			var winH=getWinH();
			if(winH>0){
				var elmCrack=document.getElementById('crack');
				var elmFooter=document.getElementById('footer');
				var elmNews=document.getElementById('newsBox');
				var elmContent=document.getElementById('content');
				var intConEnd=elmContent.offsetHeight+findPosY(elmContent);
				var intNewsEnd=elmNews.offsetHeight+findPosY(elmNews);
				var intCrackH = document.getElementById('crack').offsetHeight;
				var intWinH=getWinH();
				intPageEnd=(intConEnd>=intNewsEnd) ? intConEnd : intNewsEnd;
				if(intPageEnd+intCrackH<=intWinH){
					elmCrack.style.top=(intWinH-intCrackH)+"px";
					elmFooter.style.top=(intWinH-95)+"px";
				} else {
					elmCrack.style.top=intPageEnd+"px";
					elmFooter.style.top=(intPageEnd+(intCrackH-95))+"px";
				}
				elmCrack.style.visibility="visible";
				elmFooter.style.visibility="visible";
			}
		}
	}
}
window.onload=function(){
	positionFooter();
}
window.onresize=function(){
	positionFooter();
}
