
var overlay=null;
var frame=null;

var msx=new function() {};

msx.constructor.prototype.ShowSlideShow=function(url,start,play,w,h) {
	ShowOverlay();
	ShowWindow(url+(url.indexOf('?')<0 ? '?open' : '')+'&mode=2&pos='+start+(play ? '&play=true' : ''),true,!true,w,h);
}
msx.constructor.prototype.ShowImages=function(url,start,w,h) {
	ShowOverlay();
	ShowWindow(url+(url.indexOf('?')<0 ? '?open' : '')+'&mode=1&pos='+start,true,!true,w,h);
}

/*
document.ondblclick=function() {
	var dlg=new tmt.FloatingFrame(false);
	dlg.LoadURL('/C12574DC0053E69B/tmt.view/EAA2693879526793C125755300614A31');
}

document.ondblclick=function() {
	alert(document.body.clientWidth+':'+document.body.offsetWidth);
}
*/

function ShowOverlay() {

/*
	if (document.getElementById("TB_HideSelect") == null) {
		$("body").append("<iframe id='TB_HideSelect'></iframe><div id='TB_overlay'></div><div id='TB_window'></div>");
		$("#TB_overlay").click(TB_remove);
		}	
*/

	if (overlay==null) {
		overlay=document.createElement('div');
		overlay.className='overlay';
		document.body.appendChild(overlay);
		//overlay.tabIndex=1;
		//overlay.onfocus=function() {overlay.parentNode.removeChild(overlay); overlay=null;}
	}
	else if (overlay.parentNode!=document.body) {
		document.body.insertBefore(overlay,document.body.lastChild);
	}

	var msie6=(document.documentElement && document.documentElement.currentStyle && typeof(document.documentElement.currentStyle.maxWidth)=='undefined');
	if (msie6) document.documentElement.runtimeStyle.overflow='hidden';

}
function HideOverlay() {

	var msie6=(document.documentElement && document.documentElement.currentStyle && typeof(document.documentElement.currentStyle.maxWidth)=='undefined');
	if (msie6) document.documentElement.runtimeStyle.overflow='';
}

function ShowWindow(url,autoclose,hidewhenclosed,w,h) {

	//var url='/C12574DC0053E69B/0/AE93C4D357CB54B2C125751E0080E430/$file/kork.jpg';

if (frame==null) {
	frame=new tmt.FloatingFrame(autoclose);
	if (!isNaN(w+h)) {
		frame.SetSize(w,h,true);
		frame.Hide();
	}
	frame.onclose=function(returnvalue) {
//		if (returnvalue) location.reload(false);

		this.Hide();
		if (!hidewhenclosed) frame=null;

		if (overlay) {
			if (overlay.parentNode) overlay.parentNode.removeChild(overlay);
			//overlay=null
			HideOverlay();
		}

		return (frame==null);
	}
//	frame.LoadURL('/C12574DC0053E69B/0/6382F7C3664B4E0AC125751B002D0331/$file/html.html?open&load='+url);
//	frame.LoadURL('/C12574DC0053E69B/0/E11C9355D5E996E5C125753D006007D3?open&load='+url);
//	frame.LoadURL('/C12574DC0053E69B/0/EF462A4BAA6B84E4C125753D005EE642?open&pos=2');
//	frame.LoadURL('/C12574DC0053E69B/0/D22D9640C1310CBAC125753D0062DEE5?open&pos=1&play=1');
	frame.LoadURL(url,true);

//	frame.Show();
}
else {
	frame.Show();
	frame.Focus();
}


}

document.onactivate22=function() {
	if (overlay) {
		overlay.parentNode.removeChild(overlay);
		overlay=null
	}
}

window.onscroll22=function() {
	//if (overlay) overlay.style.top=document.body.scrollTop;
}
