
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 setFooter() {
	if (document.getElementById) {
		var windowHeight = getWindowHeight();
		if (windowHeight > 0) {
			
			var contentHeight = document.getElementById('container').offsetHeight;
			var footerElement = document.getElementById('footer');
			//footerElement.style.position = 'absolute';
			var footerHeight  = footerElement.offsetHeight;
			//alert( windowHeight + '+' + contentHeight + '+' + footerHeight + ' < height, top > ' +footerElement.style.top );
			if (windowHeight - (contentHeight + footerHeight) >= 0) {
				footerElement.style.top = (windowHeight - (contentHeight + footerHeight)) + 'px';
				//
				
			}
			else if( windowHeight == contentHeight || windowHeight == (contentHeight - 1) || windowHeight == contentHeight + 1) {
				var add = windowHeight - contentHeight;
				footerElement.style.top = '-'+ (footerHeight - add) + 'px';
			}
			else {
				footerElement.style.top = '0px';
			}
		}
	}
}

 function OnTheLevel( id1, id2 ) {
	if (document.getElementById) {
		var elm1 = document.getElementById(id1);
		var elm2 = document.getElementById(id2);
		
		if( elm1 && elm2 )
		{
			var offset = elm2.offsetTop - elm1.offsetTop;
			//elm2.style.position = 'absolute';
			alert( elm1.offsetTop + '<1 2>'+elm2.offsetTop);
			elm2.style.top = '-' +offset  + 'px';
		}
	}
 }