//
// Universal Box javascript.
//

//var d=document;
//var thumb=null;

window.onresize=OnWindowResize;

function _(obj)
{
	return document.getElementById(obj);
}

function ShowWindow(title, what)
{
	var bgdiv = _("bgdiv");
	var thumb = _("thumb");
	if(thumb)
	{
		if(bgdiv)
		{
			bgdiv.style.left = 110;
			bgdiv.style.top = 110;
		
			//bgdiv.style.width = document.body.clientWidth;
			//bgdiv.style.height = document.body.clientHeight;
			bgdiv.style.display = 'block';
	        }
		
		thumb.style.left = String(document.body.clientWidth/2 - 200) + 'px';
		thumb.style.top = String(document.body.clientHeight/2 - 50) + 'px';
		thumb.style.visibility = "visible";
		thumb.innerHTML='<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="400"><tr><td width="400" height="45" background="i/smallwindow_top.png"><table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" height="100%"><tr><td width="400" height="10" colspan="3"></td></tr><tr><td width="110" height="25"></td><td width="170" height="25" align="center"><p class="title">'+title+'</p></td><td width="120" height="25"></td></tr><tr><td width="400" height="10" colspan="3"></td></tr></table></td></tr><tr><td width="400" background="i/smallwindow_body.png"><table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%"><tr><td width="100%"><p class="news">' + what + '</p></td></tr><tr><td width="100%" align="center"><a href="#"><img border="0" src="i/b_ok.gif" onclick="javascript:HideWindow()"></a></td></tr></table></td></tr><tr><td width="40" height="20" background="i/smallwindow_bottom.png"></td></tr></table>';
	}
}

function HideWindow()
{
	var bgdiv = _("bgdiv");
	if(bgdiv) bgdiv.style.display = 'none';
	var thumb = _("thumb");
	if(thumb) thumb.style.visibility = "hidden";
}

function OnWindowResize()
{
	var thumb = _("thumb");
	if(thumb)
	{
		thumb.style.left = String(document.body.clientWidth/2 - 200) + 'px';
		thumb.style.top = String(document.body.clientHeight/2 - 50) + 'px';
	}
}

function OpenWindow(fname, w, h)
{
	window.open('viewimage.php?filename=' + fname,'download','width=' + w + ',height=' + h + ',left=0,top=0,menubar=no,status=no,location=no,toolbar=no,scrollbars=no,resizable=no');
}

function Copy(sobj, tobj)
{
	var a = new Array();
	a = (sobj.options[sobj.selectedIndex]).value.split("|"); 
	tobj.value = a[1];
}

function mOver(obj)
{
	_(obj.id + "_submenu").style.display = 'block';
//	alert(obj);
}

function mOut(obj)
{
	_(obj.id + "_submenu").style.display = 'none';

//	alert(obj);
}
    
function getField(sobj, i)
{
        var a = new Array();
        a = (sobj.options[sobj.selectedIndex]).value.split("|");
        return a[i];
}
                    