/*
Realizado por:	Dadosoft C.A. | www.dadosoft.com.ve
creado:			19.09.2005
modificado:		08.04.2006
*/

function moveXbySlicePos (x, img) { 
	if (!document.layers) {
		var onWindows = navigator.platform ? navigator.platform == "Win32" : false;
		var macIE45 = document.all && !onWindows && getExplorerVersion() == 4.5;
		var par = img;
		var lastOffset = 0;
		while(par){
			if( par.leftMargin && ! onWindows ) x += parseInt(par.leftMargin);
			if( (par.offsetLeft != lastOffset) && par.offsetLeft ) x += parseInt(par.offsetLeft);
			if( par.offsetLeft != 0 ) lastOffset = par.offsetLeft;
			par = macIE45 ? par.parentElement : par.offsetParent;
		}
	} else if (img.x) x += img.x;
	return x;
}

function moveYbySlicePos (y, img) {
	if(!document.layers) {
		var onWindows = navigator.platform ? navigator.platform == "Win32" : false;
		var macIE45 = document.all && !onWindows && getExplorerVersion() == 4.5;
		var par = img;
		var lastOffset = 0;
		while(par){
			if( par.topMargin && !onWindows ) y += parseInt(par.topMargin);
			if( (par.offsetTop != lastOffset) && par.offsetTop ) y += parseInt(par.offsetTop);
			if( par.offsetTop != 0 ) lastOffset = par.offsetTop;
			par = macIE45 ? par.parentElement : par.offsetParent;
		}		
	} else if (img.y >= 0) y += img.y;
	return y;
}

var Retardo, ovMenuVisible = new Array();
Retardo = setTimeout("OcultarMenu('Menu.1')", 100);
clearTimeout(Retardo);

function MostrarMenu(pMenuId, pObjeto, pX, pY){
	Btn(pObjeto, 's');
	try{
		CmbOcultar(true);
	}catch(excepcion){
	}
	var ovMenuId = pMenuId.split('.');
	var vtPadre = ovMenuId[0];
	if(ovMenuId.length == 3){
		vtPadre += '.'+ovMenuId[1];
	}
/*	document.getElementById(pMenuId).style.left = moveXbySlicePos(pX, document.getElementById(vtPadre));*/
	document.getElementById(pMenuId).style.left = moveXbySlicePos(pX, pObjeto);
	document.getElementById(pMenuId).style.top = moveYbySlicePos(22, pObjeto);
	document.getElementById(pMenuId).style.visibility = 'visible';
	var ovMenuId = pMenuId.split('.');
	if (ovMenuVisible.length != 0){
		var vtIndice = ovMenuVisible.length-1;
		if(ovMenuVisible[vtIndice] != pMenuId){
			var ovAnterior = ovMenuVisible[vtIndice].split('.');
			while (ovAnterior.length >= ovMenuId.length){
				document.getElementById(ovMenuVisible[vtIndice]).style.visibility = 'hidden';
				ovMenuVisible.splice(vtIndice, 1);
				if (--vtIndice >= 0){
					ovAnterior = ovMenuVisible[vtIndice].split('.');
				}else{
					break;
				}
			}
		}
	}
	ovMenuVisible.push(pMenuId);
}

function BtnSobre(pObjeto, pNivel){
	Btn(pObjeto, 's');
	if (ovMenuVisible.length != 0){
		var vtIndice = ovMenuVisible.length-1;
		var ovAnterior = ovMenuVisible[vtIndice].split('.');
		if (ovAnterior.length == pNivel+1){
			document.getElementById(ovMenuVisible[vtIndice]).style.visibility = 'hidden';
			ovMenuVisible.splice(vtIndice, 1);
		}
	}
}

function OcultarMenu(){
	for (i=0; i<ovMenuVisible.length; i++){
		document.getElementById(ovMenuVisible[i]).style.visibility = 'hidden';
	}
	ovMenuVisible.splice(0, ovMenuVisible.length-1);
	try{
		CmbOcultar(false);
	}catch(excepcion){
	}
}

function OcultarMenuRet(pObjeto){
	Btn(pObjeto, 'f');
	Retardo = setTimeout("OcultarMenu()", 200);
}

function OcultarMenuCancelar(){
	clearTimeout(Retardo);
}

function Btn(pObjeto, pEvento){
	if(pEvento == 's'){
/*		pObjeto.style.backgroundColor = '#FFFFFF';
		pObjeto.style.color = '#FF0000';*/
		pObjeto.style.color = '#990000';
		OcultarMenuCancelar();
	}else{
/*		pObjeto.style.backgroundColor = '#FF0000';
		pObjeto.style.color = '#FFFFFF';*/
		pObjeto.style.color = '#333333';
	}
}

function CmbOcultar(pValor){
	if(pValor){
		var a = 'hidden';
	}else{
		var a = 'visible';
	}
	for (i=0; i<document.forms.length; i++){
		for (i2=0; i2<document.forms[i].elements.length; i2++){
			if (document.forms[i].elements[i2].type == 'select-one'){
				document.forms[i].elements[i2].style.visibility = a;
			}
		}
	}
/*	for (i=0; i<document.applets.length; i++){
		if(!(/^(plb_swf_).*$/.test(document.applets[i].id)) && document.applets[i].id != 'swfFrontal'){
			document.applets[i].style.visibility = a;
		}
	}
	for (i=0; i<document.embeds.length; i++){
		if(!(/^(plb_swf_).*$/.test(document.embeds[i].name)) && document.applets[i].id != 'swfFrontal'){
			document.embeds[i].style.visibility = a;
		}
	}*/
	try{
		CmbOcultarEvt();
	}catch(excepcion){
	}
}