var blnUseTLC = false;
function TLC_getDimension(objElm) {
	var elmHeight, elmMargin;
	if(document.all) { // IE
		elmHeight=objElm.currentStyle.height;
		elmWidth=objElm.currentStyle.width;
		elmMarginTop=parseInt(objElm.currentStyle.marginTop);
		elmMarginBottom=parseInt(objElm.currentStyle.marginBottom);
		elmMarginLeft=parseInt(objElm.currentStyle.marginLeft);
		elmMarginRight=parseInt(objElm.currentStyle.marginRight);
	}	else { // Mozilla
		elmHeight=document.defaultView.getComputedStyle(objElm, '').getPropertyValue('height');
		elmWidth=document.defaultView.getComputedStyle(objElm, '').getPropertyValue('width');
		elmMarginTop=parseInt(document.defaultView.getComputedStyle(objElm, '').getPropertyValue('margin-top'));
		elmMarginBottom=parseInt(document.defaultView.getComputedStyle(objElm, '').getPropertyValue('margin-bottom'));
		elmMarginLeft=parseInt(document.defaultView.getComputedStyle(objElm, '').getPropertyValue('margin-left'));
		elmMarginRight=parseInt(document.defaultView.getComputedStyle(objElm, '').getPropertyValue('margin-right'));
	}
	return {
		'height':elmHeight,
		'width':elmWidth,
		'marginTop':elmMarginTop,
		'marginBottom':elmMarginBottom,
		'marginLeft':elmMarginLeft,
		'marginRight':elmMarginRight
	};
}

function TLC_ShowCover(){
	TLC_ResizeOverlay();
	document.getElementById('TLC_overlay').style.display = 'block';
	var objContentOverlay = document.getElementById('TLC_content_overlay');
	objContentOverlay.style.display = 'block';
	var intViewWidth = TLC_getCurrentViewWH()[0];
	var intViewHeight = TLC_getCurrentViewWH()[1];
	var intScrollX = TLC_getScrollXY()[0];
	var intScrollY = TLC_getScrollXY()[1];
	var intContentWidth = objContentOverlay.offsetWidth;
	var intContentHeight = objContentOverlay.offsetHeight;
	objContentOverlay.style.left = (intScrollX + intViewWidth / 2 - intContentWidth / 2) + 'px';
	objContentOverlay.style.top = (intScrollY + intViewHeight / 2 - intContentHeight / 2) + 'px';
}
function TLC_HideCover(){
	document.getElementById('TLC_overlay').style.display = 'none';
	document.getElementById('TLC_content_overlay').style.display = 'none';
	blnUseTLC = false;
}
function TLC_ResizeOverlay(){
	var objBody = document.getElementsByTagName('body')[0];
	var intBodyWidth = objBody.offsetWidth;
	var intBodyHeight = objBody.offsetHeight;
	var objDimension = TLC_getDimension(objBody);
	intBodyWidth = intBodyWidth + objDimension.marginLeft + objDimension.marginRight;
	intBodyHeight = intBodyHeight + objDimension.marginTop + objDimension.marginBottom;
	var objOverlay = document.getElementById('TLC_overlay');
	objOverlay.style.width = intBodyWidth + 'px';
	objOverlay.style.height = intBodyHeight + 'px';
}
function TLC_InitCover(){
	TLC_ResizeOverlay();
	TLC_HideCover();
}
function TLC_getScrollXY() {
	var scrOfX = 0, scrOfY = 0;
	if( typeof( window.pageYOffset ) == 'number' ) {
		//Netscape compliant
		scrOfY = window.pageYOffset;
		scrOfX = window.pageXOffset;
	} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
		//DOM compliant
		scrOfY = document.body.scrollTop;
		scrOfX = document.body.scrollLeft;
	} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
		//IE6 standards compliant mode
		scrOfY = document.documentElement.scrollTop;
		scrOfX = document.documentElement.scrollLeft;
	}
	return [ scrOfX, scrOfY ];
}
function TLC_getCurrentViewWH() {
	var myWidth = 0, myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	}
	return [myWidth, myHeight];
}