
var myWin;

function imgWin(imgSrc,pwidth,pheight,title) {

	var winw = (screen.width - pwidth) / 2;
	var winh = (screen.height - pheight) / 2;

	if (myWin) myWin.close();
	myWin = open("js/index.html", "pilt", "toolbar=no,directories=no,status=no,location=no,resizable=no,scrollbars=no,menubar=no,height="+pheight+",width="+pwidth+",top="+winh+",left="+winw+"");

	myWin.document.open();

	myWin.document.write("<html><head><title>" + title);
	myWin.document.write("</title><meta HTTP-EQUIV=\"imagetoolbar\" content=\"no\">\n</head>\n<body scrolling=no marginheight=0 marginwidth=0 leftmargin=0 topmargin=0 bgcolor=white>");
	myWin.document.write("<a href=# onClick=window.close()><img src="+imgSrc+" width="+pwidth+" height="+pheight+" border=0></a>");
	myWin.document.write("</body></html>");

	myWin.document.close();
	return false;
}

var dom = (document.getElementById)? true:false;
var ns4 = (document.layers)? true:false;
var opera = (navigator.userAgent.indexOf("Opera")!= -1)? true:false;
var ie = (document.all && !opera)? true:false;
var ie4 = (ie && !dom)? true:false;
var ie5 = (ie && dom)? true:false;
var mac = (navigator.appVersion.indexOf("Mac")!=-1)? true:false;



function menu(id) {
	this.id = id;
	this.visible = false;
	this.menuItems = new Array();
	this.show = showMenu;
	this.hide = hideMenu;
	this.over = menuItemOver;
	this.test = testbr;
	this.hideChildren = hideMenuChildren;
}
function showMenu() {
	this.visible = true;
	if (document.getElementById) document.getElementById(this.id).style.visibility = 'visible';
	else if (document.all) document.all[this.id].style.visibility = 'visible';
    else if (document.layers) document.layers[this.id].visibility = 'visible';
}
function hideMenu() {
	this.visible = false;
	if (document.getElementById) document.getElementById(this.id).style.visibility = 'hidden';
	else if (document.all) document.all[this.id].style.visibility = 'hidden';
	else if (document.layers) document.layers[this.id].visibility = 'hidden';
	this.hideChildren();
}
function hideMenuChildren(exept) {
	for (var i=0; i<this.menuItems.length; i++) {
		var mI = this.menuItems[i];
		if (mI.submenu) {
			if (mI.submenu.visible && (mI.submenu != exept)) mI.submenu.hide();
		}
	}
}
function menuItem(submenu) {
	this.submenu = submenu;
}
function menuItemOver() {
	this.test();
	stopTimer();
}
function hideAll(except) {
	for (var i=0; i<topMenusArray.length; i++) {
		if (topMenusArray[i] != except) {
			topMenusArray[i].hideChildren();
			topMenusArray[i].hide();
		}
	}
}
function testbr() {
	if (ie==true) {
	if (document.getElementById) document.getElementById(this.id).style.margin = '0px';
	else if (document.all) document.all[this.id].style.margin = '0px'
	else if (document.layers) document.layers[this.id].margin = '0px'
	}
}
// menu timer
var menuDelay = 500;
var timerID = null

function restartTimer() {
	clearTimeout(timerID);
	timerID = setTimeout("hideAll()", menuDelay);
}
function stopTimer() {
	clearTimeout(timerID);
}
