
function Array_shift() {
  var A_s = 0
  var response = this[0]
  for (A_s = 0; A_s < this.length-1; A_s++) {
   this[A_s] = this[A_s + 1]
   }
  this.length--
  return response
  }

if (typeof (Array.prototype.shift) == "undefined") {
  Array.prototype.shift = Array_shift;
  }


var intervals=new Array();

var keepSub = 0;
var keepSubFather = 0;
var e;

function doTrans(subNum , endVal ) {
        subObj = document.getElementById ("sub"+subNum);
	if (subObj.filters[0].opacity < endVal){
		subObj.filters[0].opacity = parseInt (subObj.filters[0].opacity) + 10;
		setTimeout ("doTrans("+subNum+","+endVal+")" , 25);

	}
}


function openSub(subNum){
	var subObj = document.getElementById("sub" + subNum);
	if (subObj){

		keepSub = subNum ;
		keepSubFather = allSubs[subNum] ;
		// closes all menus and children, except for keepSub
		closeAllSub();
		if (ie55up){
			subObj.filters[0].opacity = 0;
		}
		subObj.style.visibility = "visible";

		if (allSubs[subNum]=="0"){

			subObj.style.top = getOffsetTop (document.getElementById("menuFatherA_" + subNum))+25;
			subObj.style.left = getOffsetLeft (document.getElementById("menuFatherA_" + subNum)) ;
			fatherWidth = document.getElementById("menuFatherA_" + subNum).scrollWidth
			if (fatherWidth <120){
				fatherWidth  = 120;
			}
			subObj.style.width =  fatherWidth;


		}else{
			e = (isIE)? (window.event):(evt);

			subObj.style.top = getOffsetTop (e.srcElement)+34 ;
			subObj.style.left = getOffsetLeft (e.srcElement) ;
		}

		lastSubNum = subNum;

		if (ie55up){
			doTrans(subNum , 100);
		}


	}
}

function closeAllSub(){

	for (var i in allSubs){
		if (document.getElementById("sub" + allSubs[i])){
			if (i!=keepSub && i!=keepSubFather ) {
				document.getElementById("sub" + allSubs[i]).style.visibility= "hidden";
			}
		}
	}
}







var closeTimeoutAr = [] ;
var lastTimeoutId = 0;
function checkIfClose (num, evt){

		clearAllClosings ();
		e = (isIE)? (window.event):(evt);

		if (e){
			eEl = (isIE)?(e.toElement):(e.relatedTarget);
			eS = (isIE)?(e.srcElement):(e.srcElement);
			if (eEl){
				eId = eEl.id;

				if (eId.indexOf ("ditem")==-1 && eId.indexOf ("sub")==-1 && eId.indexOf ("topMenu")==-1 && eId.indexOf ("menuSeper")==-1 ){
					if (eS){
						if (eS.id.indexOf ("menuFather")>-1 ){
							return;
						}
					}
					keepSub = 0;
					keepSubFather = 0;
					closeTimeoutAr[closeTimeoutAr.length] = lastTimeoutId;
					lastTimeoutId = setTimeout ("closeAllSub()" ,100 );

				}
			}
		}
}


function clearAllClosings(){
	do {
		clearTimeout (closeTimeoutAr.shift ());
	}
	while (closeTimeoutAr.length>0);
}






function getOffsetLeft (el) {
	if (!el)return ;
  var ol = el.offsetLeft;
  while ((el = el.offsetParent) != null)
    ol += el.offsetLeft;
  return ol;
}


function getOffsetTop (el) {
if (!el)return ;
  var ol = el.offsetTop;
  while ((el = el.offsetParent) != null)
    ol += el.offsetTop;
  return ol;
}

if( document.captureEvents ) {

    if( Event.MOUSEOUT ) {
	document.captureEvents( Event.MOUSEOUT);
    }

}



