// copyright (c) Piotr Sawicki

// dropdown menus

var isDOM = (document.getElementById ? true : false); 
var isIE4 = ((document.all && !isDOM) ? true : false);
var isNS4 = (document.layers ? true : false);

function getRef(id) {
	if (isDOM) return document.getElementById(id);
	else if (isIE4) return document.all[id];
	else if (isNS4) return document.layers[id];
}

function getSty(id) {
	return (isNS4 ? getRef(id) : getRef(id).style);
} 

function getImg(id) {
	return document.images[id];
}

function imgChange(name, src) {
	getImg(name).src = src;
}

var int_menuTimer	= 0;
var int_menuPrevId	= 0;
function int_menuDivHide(divId) {
	getSty(divId).visibility ="hidden";
}

function menuDropDown(divId) {
	if ( int_menuPrevId ) int_menuDivHide(int_menuPrevId);
	if ( int_menuTimer ) clearTimeout(int_menuTimer);
	getSty(divId).visibility = "visible";
}

function menuPrepare(divId) {
	int_menuPrevId	= divId;
	int_menuTimer	= setTimeout('int_menuDivHide(\'' + divId + '\')', 100);
}

function menuDivOver() {
	if ( int_menuTimer ) clearTimeout(int_menuTimer);
}

function menuDivOut(divId) {
	int_menuTimer = setTimeout('int_menuDivHide(\'' + divId + '\')', 100);
}


function popupOpen(url, cx, cy) {
	var xOffset = (screen.availWidth - cx) / 2;
	var yOffset = (screen.availHeight - cy) / 2.3;
	popup = window.open(url, 'popup'+cx+'_'+cy, 'alwaysRaised=yes,dependent,scrollbars=no,resizable=yes,width='+cx+',height='+cy+',screenX='+xOffset+',screenY='+yOffset+',top='+yOffset+',left='+xOffset+'');
	popup.focus();
	return false;
}


