isDOM=document.getElementById 
isOpera=isOpera5=window.opera && isDOM 
isOpera6=isOpera && window.print 
isOpera7=isOpera && document.readyState 
isMSIE=document.all && document.all.item && !isOpera 
isMSIE5=isDOM && isMSIE 
isNetscape4=document.layers 
isMozilla=isDOM && navigator.appName=="Netscape" 


var POPUP_PREFIX = 'popup_';
var openItems = new Array();
var totalOpenItems = 0;
var popTimeout = new Array();

//biv
var delay = 500;

function mover(obj){
	obj.style.backgroundColor='#EFEFEF'
}
function mout(obj){
	obj.style.backgroundColor='white'
}

function getTop(ctrl){
	var value = 0;
	if(ctrl.offsetParent) value = getTop(ctrl.offsetParent);
	return ctrl.offsetTop + value;
}
function getLeft(ctrl){
	var value = 0;
	if(ctrl.offsetParent)  value = getLeft(ctrl.offsetParent);
	return ctrl.offsetLeft + value;
}



function h1(ctrl, event){
	if(!ctrl.id)
		return false;
	
	var subMenu = document.getElementById(POPUP_PREFIX + ctrl.id);
	openItems[totalOpenItems+1] = POPUP_PREFIX + ctrl.id;
	clearItems(POPUP_PREFIX + ctrl.id);

	x = getLeft(ctrl) + 13;
	y = getTop(ctrl) + 20;
	//if(isMozilla) 
	y += 6;
	subMenu.style.top = y + 'px';
	subMenu.style.left = x + 'px';
	subMenu.style.display = 'block';
	return true;
}

function clearItems(item, event){
//	alert(item);
	for(i=0; i<totalOpenItems; i++){
//		alert(openItems[i]);
		if(openItems[i] == item) continue;
//		alert("clear");
		clear(openItems[i]);
	}
	totalOpenItems = 1;
	openItems[0] = item;
}

function h2(ctrl, event){
	if(!ctrl.id) return false;
	ctrl_id = POPUP_PREFIX+ctrl.id;
	if (popTimeout[ctrl_id]) clearTimeout(popTimeout[ctrl_id]);
	popTimeout[POPUP_PREFIX+ctrl.id] = setTimeout("clear('"+ctrl_id+"')", delay);
	return true;
}

var sm_shown = false;
function handleMouseOverPopupMenu(ctrl, event){
	if (sm_shown) return;
	sm_shown=true;
	clearTimeout(popTimeout[ctrl.id]);
}

function handleMouseOutPopupMenu(ctrl, event){
	if (!sm_shown) return;
	sm_shown = false;
	if(!ctrl.id) return false;
	popTimeout[ctrl.id] = setTimeout("clear('"+ctrl.id+"')", delay);
	repaintFlash();
}

function clear(c){
	var ctrl = document.getElementById(c);
	clearTimeout(popTimeout[c]);
	if(ctrl) ctrl.style.display = 'none';
}

//==============================================================================
function go(obj){
	try{
		location.href = obj.childNodes[0].href;
	}catch(e){}
}

function repaintFlash(){
	var flash = document.getElementById('main_flash');
	if(flash){
		flash.SetVariable('_quality','LOW');
		flash.SetVariable('_quality','HIGH');
	}
}
