
if( document.captureEvents ) { 
	
    if( Event.MOUSEOUT ) {	
	document.captureEvents( Event.MOUSEOUT);
    }
    
}


function doTrans(subNum , endVal ,currVal) {
	subObj = document.getElementById ("sub"+subNum);	
	if (currVal < endVal){
		//subObj.filters[0].opacity = parseInt (subObj.filters[0].opacity) + 10;		
		subObj.style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity=" + (currVal+15) + ")";
		setTimeout ("doTrans("+subNum+","+endVal+"," + (currVal+15) + ")" , 10);
	
	}	
}

	
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 keepSub = 0;
var closeInterval ;
var resFix = 0;
var currVal=50;

var lastSubNum = 0;
var fixFatherNum = 0;

function flipFatherImg2Off(fatherNum){
		if (fixFatherNum!=fatherNum) {
	
			
			document.images[ "menuFatherIMG_"+fatherNum ].src = fatherOffImgs["fatherImg"+fatherNum].src ;		
	
		}
}

function flipFatherImg(fatherNum){

	if (fixFatherNum!=fatherNum) {
	
	if ( fixFatherNum!=lastSubNum && lastSubNum>0){		
		
		if (document.images[ "menuFatherIMG_"+lastSubNum ]){
			
			document.images[ "menuFatherIMG_"+lastSubNum ].src = fatherOffImgs["fatherImg"+lastSubNum].src ;		
		}
	}
	
	if (document.images[ "menuFatherIMG_"+fatherNum ]){			
		document.images[ "menuFatherIMG_"+fatherNum ].src =  fatherOnImgs["fatherImg"+fatherNum].src ;
	}
	}
}


function flipFatherImg2on(fatherNum){

	if (fixFatherNum!=fatherNum) {
	
	
	
	if (document.images[ "menuFatherIMG_"+fatherNum ]){			
		document.images[ "menuFatherIMG_"+fatherNum ].src =  fatherOnImgs["fatherImg"+fatherNum].src ;
	}
	}
}


function getOffsetLeft (el) {
	var ol = el.offsetLeft;
	while ((el = el.offsetParent) != null)
		ol += el.offsetLeft;
	return ol;
}

function getOffsetTop (el) {
	var ol = el.offsetTop;
	while ((el = el.offsetParent) != null)
		ol += el.offsetTop;
	return ol;
}

function openSub(num){
	var subObj = document.getElementById("sub" + num);
	
	keepSub = num ;		 
	
	// closes all menus and children, except for keepSub		
	closeAllSub();
	if (subObj){ 
		
	
		// displays the correct div
		subObj.style.display = "block";
		
		//if (ie55up){
		//	subObj.style.filters[0].opacity = 100;
		//subObj.style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity=0)"
		//}
		subObj.style.visibility = "visible";
		// father is the images that trigger the subMenu
	
		
		subObj.style.width = document.getElementById("menuFatherIMG_"+num).scrollWidth;			
		/*	
		if (isIE){
			resFix = (document.body.clientWidth - 780) /2 ;	
		}else if (isNS6){
			resFix = (window.innerWidth - 780) /2 ;				
		}		
		if (resFix<0) resFix=0;		
		*/
			
			
		subObj.style.left = resFix + getOffsetLeft(document.getElementById("menuFatherIMG_"+num))   ;
		subObj.style.top = getOffsetTop(document.getElementById("menuFatherIMG_"+num))+20 ;
		
		//if (ie55up){
			doTrans(num , 100,0);
		//}
		
	}
	
	flipFatherImg2on(num);
	lastSubNum = num;
	
	
	
}

function closeAllSub(){

	for (i=0; i<allSubs.length; i++){
		if (document.getElementById("sub" + allSubs[i])){		
			if (allSubs[i]!=keepSub ) {					
				document.getElementById("sub" + allSubs[i]).style.display = "none";
				if (i>0) {
				flipFatherImg2Off(allSubs[i])	;
				
				//alert(allSubs[i]);
				}
			}		
		}
	}
	
	
}



function checkIfClose (num , evt  ){			
		
		e = (isIE)? (window.event):(evt);	
		if (e){						
			eEl = (isIE)?(e.toElement):(e.relatedTarget);
			
			if (eEl){
				eId = eEl.id; 
				
				if (eId.indexOf ("ditem")==-1 && eId.indexOf ("menuRow")==-1  && eId.indexOf ("subTable")==-1 && eId.indexOf ("menuFather")==-1 ){							
					keepSub = 0;
					//flipFatherImg2Off(num)	;				
					//closeAllSub();
					tm=setTimeout("closeAllSub()",500);
					tm2=setTimeout("flipFatherImg2Off(" + num + ")",500);
				}				
			}
		}
		
	
}

function cancelCloseFrame(){
	if(self.tm) clearTimeout(tm) // cancel delayed closing
	if(self.tm2) clearTimeout(tm2) // cancel delayed closing
}
