// Meniu JavaScript
/*
	Autor: Harangus Cosmin <cosmin@around25.ro>
	This script is the property of S.C. Around25 S.R.L.
	All Rights Rezerved
*/
var disappeardelay=0; 
var dropObj=Array();

//Preia numarul de pixeli pana la marginea de sus si marginea din stanga
function getposOffset(what, offsettype){
	var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
	var parentEl=what.offsetParent;
	while (parentEl!=null){
		totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft :totaloffset+parentEl.offsetTop;
		parentEl=parentEl.offsetParent;
	}
	return totaloffset;
}
//Seteaza nivelul de vizibilitate pentru un obiect html
function showhide(what, status){
	what.style.left=what.style.top=-500;
	what.style.visibility=status;
}
//Incepe ascunderea meniului cu id-ul dat
function starthide(id){
	if (dropObj[id]!=null && dropObj[id]["status"]=="active")
		dropObj[id]["status"]="inactive";
	setTimeout("hide('"+id+"')",disappeardelay);
}
//Ascunde acele meniuri care au status==inactive
function hide(id){
	if (dropObj[id]["status"]=="inactive") {
		obj = document.getElementById?document.getElementById(id) : eval(id);
		showhide(obj, "hidden");
	}
}
//Activeaza meniul cu id-ul dat si toti parintii acestuia
function setactive(id){
	dropObj[id]["status"]="active";
	pid=dropObj[id]["pid"];
	if (pid!='') setActive(pid);
}
//Afiseaza meniul cu id-ul dat, in functie de restul parametrilor
function display(what, id, pid,h,v,dir){
	dropObj[id]=Array();
	dropObj[id]["status"]="active";
	dropObj[id]["pid"]=pid;
	dropObj[id]["id"]=id;
	obj = document.getElementById?document.getElementById(id) : eval(id);
	showhide(obj, "visible");
	obj.x=getposOffset(what, "left");
	obj.y=getposOffset(what, "top");
	if (dir=='left')
		obj.style.left=obj.x + h + "px";
	else obj.style.left=obj.x + h + what.offsetWidth - obj.offsetWidth + "px";
	obj.style.top =obj.y + v + what.offsetHeight +"px";
}