// JavaScript Document
function showOverlay( img ){
	scrollInterval = window.setInterval("checkScroll()", 100 );
	checkScroll();
	
	$('overlay').className = 'visible';
	$('overlay-content').innerHTML = "<img src='" + path + img + "'>";
}

function hideOverlay(){
	window.clearInterval( scrollInterval );
	$('overlay-content').innerHTML = '';
	$('overlay').className = 'hidden';
	clearTimeout( loader.statusTimeout );
}

function checkScroll(){
	var top = Math.round((document.documentElement.clientHeight/2)-($('overlay-window').offsetHeight/2)+ getScrollTop() );
	$('overlay-window').style.top = top + 'px';
	//new Animation( 'overlay-window', 'top', 'KWCurrent', top, .2, { onAnimationComplete:function(){ checkScroll(); }, onAnimationStep:function(){} } );
	$('overlay-window').style.left = Math.round((document.documentElement.clientWidth/2)-(457/2))+"px";
}

function getScrollTop(){
	if(typeof pageYOffset!= 'undefined'){
		//most browsers
		return pageYOffset;
	}
	else{
		var B= document.body; //IE 'quirks'
		var D= document.documentElement; //IE with doctype
		D= (D.clientHeight)? D: B;
		return D.scrollTop;
	}
}

