
/******************************************************
Window tools
===========================
Copyright (c) 2000 by mars69 (mars69@people.cz)
*******************************************************/

var PopupWindow = null;
var pop_win_params = "fullscreen=no,directories=no,history=no,location=no,menubars=no,menubar=no,resizable=yes,scrollbars=yes,statusbars=yes,status=no,titlebar=yes,toolbar=no";

// general popWin definition
function popWin( theURL, i_width, i_height, s_name ) {
    i_height += 16;
    if (parseInt(navigator.appVersion) >= 4) { winl = 100, wint = 100; }
    var winl = (screen.width - i_height) / 2;
    var wint = (screen.height - i_width) / 2;
    day = new Date();
    eval ("page"+s_title+" = window.open(\""+theURL+"\",\""+s_name+"\",\""+pop_win_params+",width="+i_width+",height="+i_height+",left="+winl+",top="+wint+"\");");
}

function ClosePopupWindow()
{
	if (PopupWindow != null) PopupWindow = PopupWindow.close();
	//if (typeof(PopupWindow) == "object") PopupWindow.close();
	return PopupWindow;
}

function HelpWindow( source ) {
	i_width = 520;
	i_height = 300;
	PopupWindow = window.open("./system_help.php?src="+source+"", "Help", "left=10,top=10,width="+i_width+",height="+i_height+","+pop_win_params+"");
	return PopupWindow;
}

function HTMLWindow( theURL, i_width, i_height, s_name ) {
	ClosePopupWindow();
	PopupWindow = window.open(theURL, s_name, "left=10,top=10,width="+i_width+",height="+i_height+","+pop_win_params+"");
	PopupWindow.focus();
	return PopupWindow;
}

function ImageWindow( theImageURL, i_width, i_height, s_title, s_descript ) {
	ClosePopupWindow();
	if (s_descript != null) { i_height = i_height + 50; }
	PopupWindow = window.open("", "", "left=10,top=10,width="+i_width+",height="+i_height+","+pop_win_params+"");
	with (PopupWindow.document) {
		open();
		writeln("<?xml version=\"1.0\" encoding=\"utf-8\"?><!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">");
		writeln("<html xmlns=\"http://www.w3.org/1999/xhtml\">");
		writeln("<head><title>"+ s_title +"</title>");
		writeln("<style type=\"text/css\">body {margin:0; padding:0; font-family: Arial, Verdana, Geneva, Helvetica, sans-serif; font-size: 12px; border-color: #999999; background: white; color: black; text-align: center;}</style>");
		writeln("</head>");
		writeln("<body style=\"margin:0; padding:0;\">");
		write("<div><a href=\"#\" onclick=\"window.close()\"><img style=\"border: none;\" src=\""+ theImageURL +"\" alt=\"close\" /></a>");
		if (s_descript != null) { write("<p>"+ s_descript +"</p>"); }
		writeln("</div>");
		writeln("</body></html>");
		close();
	}
	PopupWindow.focus();
	return PopupWindow;
}
