
//Copyright (c), 2001, Innovagency

NS=(document.layers && !document.all)?1:0
NS6=(document.getElementById && !document.all)?1:0
MACOld=(navigator.userAgent.indexOf("Mac")!=-1&&navigator.userAgent.indexOf("5.1")==-1)?1:0;
MZi=((navigator.userAgent.indexOf("rv:1")!=-1||navigator.userAgent.indexOf("Mozilla/5")!=-1)&&navigator.userAgent.indexOf("Nets")==-1)?1:0;
// ---------------------------------------------- //
// Rollover Imagens				  //
// ---------------------------------------------- //

function MM_swapImgRestore() {
	var i,x,a=document.MM_sr;
	for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) {
	var p,i,x;
	if(!d) d=document;
	if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document;
		n=n.substring(0,p);
	}
	if(!(x=d[n])&&d.all) x=d.all[n];
	for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	if(!x && document.getElementById) x=document.getElementById(n);
	return x;
}

function MM_swapImage() {
	var i,j=0,x,a=MM_swapImage.arguments;
	document.MM_sr=new Array;
	for(i=0;i<(a.length-2);i+=3)
	if ((x=MM_findObj(a[i]))!=null) {
		document.MM_sr[j++]=x;
		if(!x.oSrc) x.oSrc=x.src;
		x.src=a[i+2];
	}
}

document.IN_swapArray=new Array();
var debugInit='<font color="#FFFF00">Debug Layer</font>'

// ---------------------------------------------- //
// ---------------------------------------------- //
// ---------------------------------------------- //

function IN_getImage(oImage_IN, doc) { //v1.0
	var i,tImage;if(!doc) doc=document;
	if(!(tImage=doc.images[oImage_IN])&&!(doc.all)&&doc.getElementById) tImage=doc.getElementById[oImage_IN];
	if(!(tImage=doc.images[oImage_IN])&&doc.all) tImage=doc.all[oImage_IN];
	for(i=0;!tImage&&doc.images&&i<doc.layers.length;i++) tImage=IN_getImage(oImage_IN,doc.layers[i].document);return tImage;
}

function IN_setImageSource(oImage_IN,strNewSrc) { //v1.0
	tImage=IN_getImage(oImage_IN);if(tImage){if (document.IN_swapArray[oImage_IN]==null) {document.IN_swapArray[oImage_IN]=tImage.src;}tImage.src=strNewSrc;}
}

function IN_setImageSourceOriginal(oImage_IN) { //v1.0
	tImage=IN_getImage(oImage_IN);if(tImage){if (document.IN_swapArray[oImage_IN]==null) {document.IN_swapArray[oImage_IN]=tImage.src;}tImage.src=document.IN_swapArray[oImage_IN];}
}

// ---------------------------------------------- //
// ---------------------------------------------- //
// ---------------------------------------------- //


function IN_changeTdColor(sTdId_IN,sBgColor_IN){
	//alert('teste--->'+sTdId_IN);
	
	if(!NS){
		if(NS6){
			document.getElementById(sTdId_IN).style.backgroundColor = "#" + sBgColor_IN;
		}else{
			document.all(sTdId_IN).style.backgroundColor = "#" + sBgColor_IN;
		}	
	}

}


function IN_resetTdColor(sTdPrefix_IN, iMinId_IN, iMaxId_IN, sBgcolor_IN) {
	var i;

	if(!NS){
		if(NS6){
			for(i=iMinId_IN; i<=iMaxId_IN; i++) {
				document.getElementById(sTdPrefix_IN+i).style.backgroundColor = "#" + sBgcolor_IN;
			}
		}else{
			for(i=iMinId_IN; i<=iMaxId_IN; i++) {
				document.all(sTdPrefix_IN+i).style.backgroundColor = "#" + sBgcolor_IN;
			}
		}	
	}
}


// ---------------------------------------------- //
// ---- Função de aquisição do objecto layer ---- //
// ---------------------------------------------- //
// [oLayer_IN] - ID da layer a obter
// ---------------------------------------------- //
function IN_getLayer(oLayer_IN, doc) { //v1.0
	var i,tLayer;if(!doc) doc=document;
	if(!(tLayer=doc[oLayer_IN])&&!(doc.all)) tLayer=doc.getElementById(oLayer_IN);
	if(!tLayer&&!(tLayer=doc[oLayer_IN])&&doc.all) tLayer=doc.all[oLayer_IN];
	for(i=0;!tLayer&&doc.layers&&i<doc.layers.length;i++) tLayer=IN_getLayer(oLayer_IN,doc.layers[i].document);
	return tLayer;
}

// ---------------------------------------------- //
// - Função para todos verem qual a layer Parente //
// ---------------------------------------------- //
// ---------------------------------------------- //
// [oLayer] - ID da layer a obter o seu parente
// [alerter] - Variável que a acciona um Alert
//			   com o nome da layer parente
//			   para debug, nao fazer referencia
//             se nao for o caso de debug
// ---------------------------------------------- //
function IN_findParent(oLayer) { //v1.0
	layer=IN_getLayer(oLayer);
	strResult=(NS)?layer.parentLayer.id:layer.parentNode.id;
	if(!strResult)strResult=false;
	return strResult;
}

// ---------------------------------------------- //
// -- Função para o NS ver qual a layer Parente - //
// ---------------------------------------------- //
// [oLayer] - ID da layer a obter o seu parente
// ---------------------------------------------- //
//function IN_nsFindParent(oLayer,doc) { //v1.0 todos os níveis
//	var i,j,tLayer;if(NS){if(!doc){doc=document;}for(i=0;i<doc.layers.length;i++){now=doc.layers[i].document;for(j=0;j<now.layers.length;j++){now2=now.layers[j].id;if(now2==oLayer){tLayer=doc.layers[i].id;}}if(!tLayer){tLayer=IN_nsFindParent(oLayer,now);}}return tLayer;}
//}

// ---------------------------------------------- //
// --- Função para o IE ler os valores do Clip -- //
// ---------------------------------------------- //
// [oLayer] - ID da layer a obter os valores
// [which] - 0=top, 1=right, 2=bottom, 3=left
// ---------------------------------------------- //
function IN_ieGetClips(oLayer,which) { //v1.0
		fClip=IN_getLayer(oLayer);
		Clip=fClip.style.clip;		
		iClip=parseInt(Clip.substring(5,Clip.length-1).split(" ")[which]);
		return iClip;
}

// ---------------------------------------------- //
// - Função de Mostrar Layer e esconder restantes //
// ---------------------------------------------- //
// [oLayer] - ID da layer a ser mostrada
//			  se 'all' mostra todas as que se
//			  encontram no array de controle
// ---------------------------------------------- //
function IN_hideShowLayers(oLayer_IN) { //v1.0
	var i,lArray;lArray=new Array('teste','teste1');
	if(oLayer_IN=='all'){for (i=0;i<lArray.length;i++){IN_layer1=IN_getLayer(lArray[i]);if(NS){IN_layer1.visibility='show';for(j=0;j<IN_layer1.document.layers.length;j++) {IN_layer1.document.layers[j].visibility='show';}}else{IN_layer1.style.visibility='visible';for(j=0;j<IN_layer1.childNodes.length;j++) {if(IN_layer1.childNodes[j]) {IN_layer1.childNodes[j].style.visibility='visible';}}}}
	}else{IN_oLayer=IN_getLayer(oLayer_IN);for (i=0;i<lArray.length;i++){IN_layer2=IN_getLayer(lArray[i]);if(NS){IN_layer2.visibility='hide';for(j=0;j<IN_layer2.document.layers.length;j++) {IN_layer2.document.layers[j].visibility='hide';}}else{IN_layer2.style.visibility='hidden';for(j=0;j<IN_layer2.childNodes.length;j++) {if(IN_layer2.childNodes[j]) {IN_layer2.childNodes[j].style.visibility='hidden';}}}}
		if(IN_oLayer){if(NS){IN_oLayer.visibility='show';for(j=0;j<IN_oLayer.document.layers.length;j++) {IN_oLayer.document.layers[j].visibility='show';}}else{IN_oLayer.style.visibility='visible';for(j=0;j<IN_oLayer.childNodes.length;j++) {if(IN_oLayer.childNodes[j]) {IN_oLayer.childNodes[j].style.visibility='visible';}}}}
	}
}

// ---------------------------------------------- //
// - Função de controlo de visibilidade --------- //
// ------ de uma layer -------------------------- //
// ---------------------------------------------- //
// [oLayer] - ID da layer a ser alterada
// [strStatus] - visible,hidden
// ---------------------------------------------- //
function IN_setVisibility(oLayer_IN,strStatus) { //v1.0
	oLayer=IN_getLayer(oLayer_IN);if(NS){oLayer.visibility=strStatus;}else{oLayer.style.visibility=strStatus;}
}

function IN_setVisibilityTOP(oLayer_IN,strStatus) { //v1.0
	oLayer=IN_getLayer(oLayer_IN);if(NS){oLayer.visibility=strStatus;}else{oLayer.style.visibility=strStatus;}
}

// ---------------------------------------------- //
// - Função de controlo de posição -------------- //
// ------ de uma layer -------------------------- //
// ---------------------------------------------- //
// [oLayer] - ID da layer a ser alterada
// [coordX] - coordenada no Eixo X
// [coordX] - coordenada no Eixo X
// [keepInside] - true ou false,
//				  define se a layer se mantem
//				  sempre dentro da parente ou se pode
//				  receber valores que façam com
//				  que esta desapareça
// ---------------------------------------------- //
function IN_setPositionLayer(oLayer,coordX,coordY,keepInside) { //v1.0
	var IN_oLayer,oParent,IN_oParent,thisClipTop,thisClipLeft,thisClipRight,thisClipBottom,parentClipTop,parentClipLeft,parentClipRight,parentClipBottom
	IN_oLayer=IN_getLayer(oLayer);oParent=IN_findParent(oLayer);if(keepInside){IN_oParent=IN_getLayer(oParent);}
	thisClipTop=(NS)?IN_oLayer.clip.top:IN_ieGetClips(oLayer,3);thisClipLeft=(NS)?IN_oLayer.clip.left:IN_ieGetClips(oLayer,0);thisClipRight=(NS)?IN_oLayer.clip.right:IN_ieGetClips(oLayer,1);thisClipBottom=(NS)?IN_oLayer.clip.bottom:IN_ieGetClips(oLayer,2);
	if(IN_oParent)parentClipTop=(NS)?IN_oParent.clip.top:IN_ieGetClips(oParent,3);if(IN_oParent)parentClipLeft=(NS)?IN_oParent.clip.left:IN_ieGetClips(oParent,0);if(IN_oParent)parentClipRight=(NS)?IN_oParent.clip.right:IN_ieGetClips(oParent,1);if(IN_oParent)parentClipBottom=(NS)?IN_oParent.clip.bottom:IN_ieGetClips(oParent,2);
	coordX=parseInt(coordX);coordY=parseInt(coordY);
	//alert(coordX);
	//alert(coordY);
	if(NS){
		if(!isNaN(coordX)){if(coordX>parentClipRight-thisClipRight && keepInside){IN_oLayer.left=parentClipRight-thisClipRight;} else if (coordX<parentClipLeft && keepInside) {IN_oLayer.left=parentClipLeft;} else {IN_oLayer.left=coordX;}}
		if(!isNaN(coordY)){if(coordY>parentClipBottom-thisClipBottom && keepInside){IN_oLayer.top=parentClipBottom-thisClipBottom;} else if (coordY<parentClipTop && keepInside) {IN_oLayer.top=parentClipTop;} else {IN_oLayer.top=coordY;}}
	}else{
		if(!isNaN(coordX)){if(coordX>parentClipRight-thisClipRight && keepInside){IN_oLayer.style.left=parentClipRight-thisClipRight;} else if (coordX<parentClipLeft && keepInside) {IN_oLayer.style.left=parentClipLeft;} else {IN_oLayer.style.left=coordX;}}
		if(!isNaN(coordY)){if(coordY>parentClipBottom-thisClipBottom && keepInside){IN_oLayer.style.top=parentClipBottom-thisClipBottom;} else if (coordY<parentClipTop && keepInside) {IN_oLayer.style.top=parentClipTop;} else {IN_oLayer.style.top=coordY;}}
	}
}


function IN_setPositionLayerTOP(oLayer,coordX,coordY,keepInside) { //v1.0
	var IN_oLayer,oParent,IN_oParent,thisClipTop,thisClipLeft,thisClipRight,thisClipBottom,parentClipTop,parentClipLeft,parentClipRight,parentClipBottom
	IN_oLayer=IN_getLayer(oLayer);oParent=IN_findParent(oLayer);if(keepInside){IN_oParent=IN_getLayer(oParent);}
	thisClipTop=(NS)?IN_oLayer.clip.top:IN_ieGetClips(oLayer,3);thisClipLeft=(NS)?IN_oLayer.clip.left:IN_ieGetClips(oLayer,0);thisClipRight=(NS)?IN_oLayer.clip.right:IN_ieGetClips(oLayer,1);thisClipBottom=(NS)?IN_oLayer.clip.bottom:IN_ieGetClips(oLayer,2);
	if(IN_oParent)parentClipTop=(NS)?IN_oParent.clip.top:IN_ieGetClips(oParent,3);if(IN_oParent)parentClipLeft=(NS)?IN_oParent.clip.left:IN_ieGetClips(oParent,0);if(IN_oParent)parentClipRight=(NS)?IN_oParent.clip.right:IN_ieGetClips(oParent,1);if(IN_oParent)parentClipBottom=(NS)?IN_oParent.clip.bottom:IN_ieGetClips(oParent,2);
	coordX=parseInt(coordX);coordY=parseInt(coordY);
	//alert(coordX);
	//alert(coordY);
	if(NS){
		if(!isNaN(coordX)){if(coordX>parentClipRight-thisClipRight && keepInside){IN_oLayer.left=parentClipRight-thisClipRight;} else if (coordX<parentClipLeft && keepInside) {IN_oLayer.left=parentClipLeft;} else {IN_oLayer.left=coordX;}}
		if(!isNaN(coordY)){if(coordY>parentClipBottom-thisClipBottom && keepInside){IN_oLayer.top=parentClipBottom-thisClipBottom;} else if (coordY<parentClipTop && keepInside) {IN_oLayer.top=parentClipTop;} else {IN_oLayer.top=coordY;}}
	}else{
		if(!isNaN(coordX)){if(coordX>parentClipRight-thisClipRight && keepInside){IN_oLayer.style.left=parentClipRight-thisClipRight;} else if (coordX<parentClipLeft && keepInside) {IN_oLayer.style.left=parentClipLeft;} else {IN_oLayer.style.left=coordX;}}
		if(!isNaN(coordY)){if(coordY>parentClipBottom-thisClipBottom && keepInside){IN_oLayer.style.top=parentClipBottom-thisClipBottom;} else if (coordY<parentClipTop && keepInside) {IN_oLayer.style.top=parentClipTop;} else {IN_oLayer.style.top=coordY;}}
	}
}

// ---------------------------------------------- //
// - Função de controlo de escrita -------------- //
// ------ dentro de uma layer ------------------- //
// ---------------------------------------------- //
// [oLayer] - ID da layer a ser alterada
// [strText] - Texto ou código a ser escrito
// ---------------------------------------------- //
function IN_writeLayer(oLayer_IN,strText) { //v1.0
	oLayer=IN_getLayer(oLayer_IN);if(NS){oLayer.document.open();oLayer.document.write(strText);oLayer.document.close();}else{oLayer.innerHTML=strText;}
}

function IN_writeLayerTOP(oLayer_IN,strText) { //v1.0
	oLayer=IN_getLayer(oLayer_IN);if(NS){oLayer.document.open();oLayer.document.write(strText);oLayer.document.close();}else{oLayer.innerHTML=strText;}
}



// ####################################
// ####################################
// ########## MENU SCRIPTING ##########
// ####################################
// ####################################

// OBJECTO OPÇÃO DE MENU ##############
function optionObj(sLabel_IN, sLabelEN_IN, sLink_IN, iSubMenu_IN, iVLevel_IN){
	//this.label= sLabel_IN.toUpperCase();
	//this.labelEN= sLabelEN_IN.toUpperCase();
	this.label= sLabel_IN;
	this.labelEN= sLabelEN_IN;
	this.link = sLink_IN;
	this.childMenu = iSubMenu_IN; // OU PARENTE NO CASO DE SER UM SUBMENU (NIVEL 2)~
	this.iVLevel = iVLevel_IN;
}
/*
function optionObj(sImageLo_IN, sImageHi_IN, sLink_IN, iSubMenu_IN, iVLevel_IN){
	this.imageLo = sImageLo_IN+".gif";
	this.imageHi = sImageHi_IN+".gif";	
	this.link = sLink_IN;
	this.childMenu = iSubMenu_IN; // OU PARENTE NO CASO DE SER UM SUBMENU (NIVEL 2)~
	this.iVLevel = iVLevel_IN;
}
*/
// ####################################

var CONST_LANG_PT = "1";
var CONST_LANG_EN = "2";

// CONSTANTES E VARIAVEIS GLOBAIS
/*
var CONST_MENU_AGENDA		= 0;	// ############################################
var CONST_MENU_PARCEIROS	= 2;	// ############################################
var CONST_MENU_PRODUTOS		= 1;	// DEFINE TAMBÉM A ORDEM HORIZONTAL DAS OPÇÕES (Serve para cálculos de posicionamento)
var CONST_MENU_PAVILHAO		= 3;	// ############################################
var CONST_MENU_ATLANTICO	= 4;	// ############################################

// NÃO PODE EXISTIR A OPÇÃO ZERO
var CONST_SUBMENU_AGENDA_EVENTOS		= 1;
var CONST_SUBMENU_PRODUTOS_ALUGUER		= 2;
var CONST_SUBMENU_PRODUTOS_SERVICOS		= 3;
var CONST_SUBMENU_PARCEIROS_PATROCINADORES	= 4;
var CONST_SUBMENU_PARCEIROS_APOIOS		= 5;
var CONST_SUBMENU_PARCEIROS_ENTIDADES		= 6;
var CONST_SUBMENU_ATLANTICO_MEDIAKIT		= 7;
var CONST_SUBMENU_ATLANTICO_EMPREGO		= 8;
*/

var testeaux = 0;

var CONST_TOP_INTERNO		= 125;
var CONST_TOP_HOME		= 230;

var CONST_MENU_TYPE_HOME	= 0;
var CONST_MENU_TYPE_AGENDA	= 1;
/*
var CONST_MENU_TYPE_PARCEIROS	= 3;
var CONST_MENU_TYPE_PRODUTOS	= 2;
var CONST_MENU_TYPE_PAVILHAO	= 4;
var CONST_MENU_TYPE_ATLANTICO	= 5;
var CONST_MENU_TYPE_OUTROS	= 6;*/

var LEVEL_1 = 1;
//var LEVEL_2 = 2;
var sUpperLevelON = "";
var iMainOptionON = 0;

var LEVEL_1_LAYERNAME = "oDivLevel1";
var LEVEL_TOP_LAYERNAME = "oDivTOP1";
//var LEVEL_2_LAYERNAME = "oDivLevel2";

var iLeftFix		= 8;
var iLevel1Top;
var iMenuTabHeight	= 19;

var iLayerGrupoTop;
var iMenuGrupoHeight;
var iPageOn;

var iGlobalWidth = 0;
var iGlobalCell	 = 0;
var iGlobalUnidade = 0;
var sGlobalColor = '';
/*
var vHorSubPos = new Array();
	vHorSubPos[CONST_MENU_AGENDA]		= 1;
	vHorSubPos[CONST_MENU_PARCEIROS]	= 1;
	vHorSubPos[CONST_MENU_PRODUTOS]		= 1;
	vHorSubPos[CONST_MENU_PAVILHAO]		= 1;
	vHorSubPos[CONST_MENU_ATLANTICO]	= -1;
*/

// DEFINICAO MENUS
//var vMenuOptions = new Array();
/*
	vMenuOptions[0] = new Array();
	vMenuOptions[0][0] = new optionObj("Agenda", "Agenda", "pavatl_agenda_00.asp", 0);
	vMenuOptions[0][1] = new optionObj("Registe-se", "Register", "pavatl_agenda_02.asp", 0);
	
	vMenuOptions[CONST_MENU_AGENDA][2] = new optionObj("Arquivo", "Record", "pavatl_agenda_03.asp", 0);
	//vMenuOptions[CONST_MENU_AGENDA][1] = new optionObj("Informações Úteis", "Informações Úteis", "pavatl_informacao_00.asp", 0);
	//vMenuOptions[CONST_MENU_AGENDA][2] = new optionObj("Plantas Gerais", "Plantas Gerais", "pavatl_planta_00.asp", 0);
	
	vMenuOptions[CONST_MENU_PRODUTOS] = new Array();
	vMenuOptions[CONST_MENU_PRODUTOS][0] = new optionObj("Aluguer de Espaços", "Hiring Spaces", "pavatl_sala_00.asp", CONST_SUBMENU_PRODUTOS_ALUGUER);
	vMenuOptions[CONST_MENU_PRODUTOS][1] = new optionObj("Plantas Gerais do Pavilhão", "General Plans of the Pavilion", "pavatl_ctexto_00.asp?ctextolocalid=76", 0);
	vMenuOptions[CONST_MENU_PRODUTOS][2] = new optionObj("Serviços Adicionais", "Addicional Services", "pavatl_ctexto_00.asp?ctextolocalid=1", 0);
	vMenuOptions[CONST_MENU_PRODUTOS][3] = new optionObj("Condições Gerais", "General Conditions", "pavatl_ctexto_00.asp?ctextolocalid=2", 0);
	vMenuOptions[CONST_MENU_PRODUTOS][4] = new optionObj("Parceiros e Camarotes", "Partners and Boxes", "pavatl_ctexto_00.asp?ctextolocalid=3", 0);
	vMenuOptions[CONST_MENU_PRODUTOS][5] = new optionObj("Galeria de Fotografias", "Photo Gallery", "pavatl_galeria_00.asp", 0);
	vMenuOptions[CONST_MENU_PRODUTOS][6] = new optionObj("Contactos Comerciais", "Commercial Contacts", "pavatl_contactocomercial_00.asp", 0);
	vMenuOptions[CONST_MENU_PRODUTOS][7] = new optionObj("Visita Virtual", "Virtual Visit", "javascript:NewWindowConfig( 'VisitaVirtual', '/site/resources/swf/index.htm', 485, 368, 0, 1 );", 0);
	vMenuOptions[CONST_MENU_PRODUTOS][8] = new optionObj("Espaços Exteriores", "External Spaces", "pavatl_ctexto_00.asp?ctextolocalid=88", 0);
	
	vMenuOptions[CONST_MENU_PARCEIROS] = new Array();
	vMenuOptions[CONST_MENU_PARCEIROS][0] = new optionObj("Patrocinadores", "Sponsors", "pavatl_patrocinador_00.asp", CONST_SUBMENU_PARCEIROS_PATROCINADORES);
	vMenuOptions[CONST_MENU_PARCEIROS][1] = new optionObj("Apoios", "Support Partners", "pavatl_apoios_00.asp", CONST_SUBMENU_PARCEIROS_APOIOS);
	vMenuOptions[CONST_MENU_PARCEIROS][2] = new optionObj("Entidades Associadas", "Associated Entities", "pavatl_entidade_00.asp", 0);
	vMenuOptions[CONST_MENU_PARCEIROS][3] = new optionObj("Fornecedores de Serviço", "Services Suppliers", "pavatl_fornecedor_00.asp", 0);
	
	vMenuOptions[CONST_MENU_PAVILHAO] = new Array();
	vMenuOptions[CONST_MENU_PAVILHAO][0] = new optionObj("Localização e Acessos", "Location and how to Get There", "pavatl_ctexto_00.asp?ctextolocalid=7", 0);
	vMenuOptions[CONST_MENU_PAVILHAO][1] = new optionObj("Informações Úteis", "Useful Information", "pavatl_informacao_00.asp", 0);
	vMenuOptions[CONST_MENU_PAVILHAO][2] = new optionObj("Segurança", "Safety and Security", "pavatl_ctexto_00.asp?ctextolocalid=8", 0);
	vMenuOptions[CONST_MENU_PAVILHAO][3] = new optionObj("História", "History", "pavatl_ctexto_00.asp?ctextolocalid=9", 0);
	vMenuOptions[CONST_MENU_PAVILHAO][4] = new optionObj("FAQ's", "FAQ's", "pavatl_faq_00.asp", 0);
	vMenuOptions[CONST_MENU_PAVILHAO][5] = new optionObj("Aluguer de Espaços", "Hiring Spaces", "pavatl_ctexto_00.asp?ctextolocalid=10", 0);
	vMenuOptions[CONST_MENU_PAVILHAO][6] = new optionObj("Curiosidades", "Curiosities", "pavatl_curiosidade_00.asp", 0);
	vMenuOptions[CONST_MENU_PAVILHAO][7] = new optionObj("Visita Virtual", "Virtual Visit", "javascript:NewWindowConfig( 'VisitaVirtual', '/site/resources/swf/index.htm', 485, 368, 0, 1 );", 0);
	
	vMenuOptions[CONST_MENU_ATLANTICO] = new Array();
	vMenuOptions[CONST_MENU_ATLANTICO][0] = new optionObj("Missão", "Mission", "pavatl_ctexto_00.asp?ctextolocalid=11", 0);
	vMenuOptions[CONST_MENU_ATLANTICO][1] = new optionObj("Estrutura Organizativa", "Institucional Structure", "pavatl_orgao_00.asp", 0);
	vMenuOptions[CONST_MENU_ATLANTICO][2] = new optionObj("Media KIT", "Media KIT", "pavatl_mediakit_00.asp", CONST_SUBMENU_ATLANTICO_MEDIAKIT);
	vMenuOptions[CONST_MENU_ATLANTICO][3] = new optionObj("Emprego", "Job", "pavatl_emprego_00.asp", CONST_SUBMENU_ATLANTICO_EMPREGO);
*/	
	
// DEFINICAO SUBMENUS
//var vSubMenuOptions = new Array();
/*
	vSubMenuOptions[CONST_SUBMENU_AGENDA_EVENTOS] = new Array();
	vSubMenuOptions[CONST_SUBMENU_AGENDA_EVENTOS][0] = new optionObj("Alerta e-mail", "Alerta e-mail", "pavatl_agenda_02.asp", CONST_MENU_AGENDA, 0);
	vSubMenuOptions[CONST_SUBMENU_AGENDA_EVENTOS][1] = new optionObj("Arquivo", "Arquivo", "pavatl_agenda_03.asp", CONST_MENU_AGENDA, 0);

	vSubMenuOptions[CONST_SUBMENU_PARCEIROS_PATROCINADORES] = new Array();
	vSubMenuOptions[CONST_SUBMENU_PARCEIROS_PATROCINADORES][0] = new optionObj("Torne-se Parceiro", "Become a partner", "pavatl_patrocinador_01.asp", CONST_MENU_PARCEIROS, 0);
	
	vSubMenuOptions[CONST_SUBMENU_PARCEIROS_APOIOS] = new Array();
	vSubMenuOptions[CONST_SUBMENU_PARCEIROS_APOIOS][0] = new optionObj("Torne-se Parceiro", "Become a partner", "pavatl_apoios_01.asp", CONST_MENU_PARCEIROS, 1);

	vSubMenuOptions[CONST_SUBMENU_PARCEIROS_ENTIDADES] = new Array();
	vSubMenuOptions[CONST_SUBMENU_PARCEIROS_ENTIDADES][0] = new optionObj("Torne-se Parceiro", "Torne-se Parceiro", "pavatl_entidade_01.asp", CONST_MENU_PARCEIROS, 2);
	
	vSubMenuOptions[CONST_SUBMENU_PRODUTOS_ALUGUER] = new Array();
	vSubMenuOptions[CONST_SUBMENU_PRODUTOS_ALUGUER][0] = new optionObj("Centro de Negócios", "Business Centre", "pavatl_sala_02.asp", CONST_MENU_PRODUTOS, 0);
	vSubMenuOptions[CONST_SUBMENU_PRODUTOS_ALUGUER][1] = new optionObj("Sala Atlântico", "Atlantic Hall", "pavatl_sala_04.asp", CONST_MENU_PRODUTOS, 0);
	vSubMenuOptions[CONST_SUBMENU_PRODUTOS_ALUGUER][2] = new optionObj("Sala Tejo", "Tejo Hall", "pavatl_sala_09.asp", CONST_MENU_PRODUTOS, 0);
	//vSubMenuOptions[CONST_SUBMENU_PRODUTOS_ALUGUER][3] = new optionObj("Deambulatório", "Deambulatório", "pavatl_sala_01.asp", CONST_MENU_PRODUTOS, 0);
	
	vSubMenuOptions[CONST_SUBMENU_PRODUTOS_SERVICOS] = new Array();
	vSubMenuOptions[CONST_SUBMENU_PRODUTOS_SERVICOS][0] = new optionObj("Catálogo", "Catalogue", "pavatl_produto_01.asp", CONST_MENU_PRODUTOS, 1);
		
	vSubMenuOptions[CONST_SUBMENU_ATLANTICO_MEDIAKIT] = new Array();
	vSubMenuOptions[CONST_SUBMENU_ATLANTICO_MEDIAKIT][0] = new optionObj("Press Releases", "Press Releases", "pavatl_press_00.asp", CONST_MENU_ATLANTICO, 2);
	
	vSubMenuOptions[CONST_SUBMENU_ATLANTICO_EMPREGO] = new Array();
	vSubMenuOptions[CONST_SUBMENU_ATLANTICO_EMPREGO][0] = new optionObj("Coordenadores/Assistentes", "Coordinators/Assistants", "pavatl_assistente_00.asp", CONST_MENU_ATLANTICO, 3);
*/
// STRINGS HTML
//alert(iGlobalCell);

//function initTable(iWidth_IN){

//alert('teste-->'+iWidth_IN);

function LevelTOPInit(){
//alert('ok');
var strLeveltopHTMLInit;
//alert(iWidth_IN);
strLeveltopHTMLInit = '<table cellpadding=0 cellspacing=0 border=1 width=100 height=200>';
strLeveltopHTMLInit += '<tr>';
strLeveltopHTMLInit += '<td width=1 height=15 rowspan=50><img src="../Design/spacer.gif" width=1 height=15 border=0></td>';
strLeveltopHTMLInit += '<td colspan=4 width=100 height=1 bgcolor="#DCDCDC"><img src="/site/resources/graphics/spacer.gif"  height=1 border=0></td>';
strLeveltopHTMLInit += '<td width=1 height=15 rowspan=50><img src="../Design/spacer.gif" width=1 height=15 border=0></td>';
strLeveltopHTMLInit += '</tr>';
strLeveltopHTMLInit += '<tr>';
strLeveltopHTMLInit += '<td width=1 height=15 rowspan=50><img src="../Design/spacer.gif" width=1 height=15 border=0></td>';
strLeveltopHTMLInit += '<td colspan=4 width=100 height=1 bgcolor="#DCDCDC">teste</td>';
strLeveltopHTMLInit += '<td width=1 height=15 rowspan=50>teste</td>';
strLeveltopHTMLInit += '</tr>';
strLeveltopHTMLInit += '</table>';

return(strLeveltopHTMLInit);
}


function Level1Init(iWidth_IN){

var strLevel1HTMLInit;
//alert(iWidth_IN);
strLevel1HTMLInit = '<table cellpadding=0 cellspacing=0 border=0 width=145>';
strLevel1HTMLInit += '<tr>';
strLevel1HTMLInit += '<td width=1 height=18 rowspan=50><img src="../Design/spacer.gif" width=1 height=15 border=0></td>';
strLevel1HTMLInit += '<td colspan=4 width=143 height=1 bgcolor="#DCDCDC"><img src="../Design/spacer.gif"  height=1 border=0></td>';
strLevel1HTMLInit += '<td width=1 height=18 rowspan=50><img src="../Design/spacer.gif" width=1 height=15 border=0></td>';
strLevel1HTMLInit += '</tr>';

return(strLevel1HTMLInit);
}
//alert('2-->'+sGlobalColor);

function Level1HTMLOptionInit(sColor_IN, lMenu_IN, lID_IN){
//alert(sColor_IN);
var strLevel1HTMLOptionInit;
strLevel1HTMLOptionInit = '<tr bgcolor='+ sColor_IN +' id='+lMenu_IN+'_'+lID_IN+'>';
strLevel1HTMLOptionInit += '<td width=1 height=18 bgcolor="#DCDCDC"><img src="../Design/spacer.gif" width=1 height=15 border=0></td>';
strLevel1HTMLOptionInit += '<td width=7 height=18><img src="../Design/spacer.gif" width=6 height=15 border=0></td>';
strLevel1HTMLOptionInit += '<td height=15 valign="bottom">';

return(strLevel1HTMLOptionInit);
}

strLevel1HTMLOptionEnd = '</td>';
strLevel1HTMLOptionEnd += '<td width=1 height=18 bgcolor="#DCDCDC"><img src="../Design/spacer.gif" width=1 height=15 border=0></td>';
strLevel1HTMLOptionEnd += '</tr>';
strLevel1HTMLOptionEnd += '<tr>';
strLevel1HTMLOptionEnd += '<td colspan=4 height=1 bgcolor="#DCDCDC"><img src="../Design/spacer.gif" height=1 border=0></td>';
strLevel1HTMLOptionEnd += '</tr>';

strLevel1HTMLEnd = '</table>';

/*
strLevel2HTMLInit = '<table cellpadding=0 cellspacing=0 border=1 width=179>';
strLevel2HTMLInit += '<tr>';
strLevel2HTMLInit += '<td width=1 height=15 rowspan=50><img src="/site/resources/graphics/spacer.gif" width=1 height=15 border=0></td>';
strLevel2HTMLInit += '<td colspan=4 width=147 height=1 bgcolor="#ffffff"><img src="/site/resources/graphics/spacer.gif" width=147 height=1 border=0></td>';
strLevel2HTMLInit += '<td width=1 height=15 rowspan=50><img src="/site/resources/graphics/spacer.gif" width=1 height=15 border=0></td>';
strLevel2HTMLInit += '</tr>';

strLevel2HTMLOptionInit = '<tr>';
strLevel2HTMLOptionInit += '<td width=1 height=15 bgcolor="#ffffff"><img src="/site/resources/graphics/spacer.gif" width=1 height=15 border=0></td>';
strLevel2HTMLOptionInit += '<td width=7 height=15 bgcolor="#ebebeb"><img src="/site/resources/graphics/spacer.gif" width=7 height=15 border=0></td>';
strLevel2HTMLOptionInit += '<td width=140 height=15 nowrap bgcolor="#ebebeb" valign="middle">';

strLevel2HTMLOptionEnd = '</td>';
strLevel2HTMLOptionEnd += '<td width=1 height=15 bgcolor="#ffffff"><img src="/site/resources/graphics/spacer.gif" width=1 height=15 border=0></td>';
strLevel2HTMLOptionEnd += '</tr>';
strLevel2HTMLOptionEnd += '<tr>';
strLevel2HTMLOptionEnd += '<td colspan=4 width=147 height=1 bgcolor="#ffffff"><img src="/site/resources/graphics/spacer.gif" width=147 height=1 border=0></td>';
strLevel2HTMLOptionEnd += '</tr>';

strLevel2HTMLEnd = '</table>';
*/


// Construtores de objectos <--//
	

// ---------------------------------------------->
//   Captação da posição do rato,
//   inicio da avaliação
//   MENU PRINCIPAL
// ---------------------------------------------->
function checkMouse(c,b) {

	var nsChecker,nLayer=null;if(!NS&&!NS6) event.returnValue=true; nsChecker=true;var nArgs=checkMouse.arguments.length;
	if (nArgs>1) {
		sUpperLevelON=b;
		if(NS||NS6)document.captureEvents(Event.MOUSEMOVE);document.onmousemove=checkMouse;
	} else {
		pX=(NS||NS6)?c.pageX:event.clientX;pY=(NS||NS6)?c.pageY:event.clientY;
		nsChecker=false;if(!NS&&!NS6)event.returnValue=false;
		//alert('checkmouse'+pX);
		//alert('checkmouse'+pY);
		evaluateF(pX,pY);
	}
}

function checkMouseTOP(c,b) {

	var nsChecker,nLayer=null;if(!NS&&!NS6) event.returnValue=true; nsChecker=true;var nArgs=checkMouseTOP.arguments.length;
	if (nArgs>1) {
		sUpperLevelON=b;
		if(NS||NS6)document.captureEvents(Event.MOUSEMOVE);document.onmousemove=checkMouseTOP;
	} else {
		pX=(NS||NS6)?c.pageX:event.clientX;pY=(NS||NS6)?c.pageY:event.clientY;
		nsChecker=false;if(!NS&&!NS6)event.returnValue=false;
		//alert('checkmouse'+pX);
		//alert('checkmouse'+pY);
		evaluateFTOP(pX,pY);
	}
}
// ---------------------------------------------->
// ---------------------------------------------->
// ---------------------------------------------->

// ---------------------------------------------->
//   Captação da posição do rato,
//   inicio da avaliação
//   MENU GRUPO
// ---------------------------------------------->
function checkMouse2(c) {
	var nsChecker,nLayer=null;if(!NS&&!NS6) event.returnValue=true; nsChecker=true;var nArgs=checkMouse2.arguments.length;
	if (nArgs>1) {
		if(NS||NS6)document.captureEvents(Event.MOUSEMOVE);document.onmousemove=checkMouse2;
	} else {
		pX=(NS||NS6)?c.pageX:event.clientX;pY=(NS||NS6)?c.pageY:event.clientY;
		nsChecker=false;if(!NS&&!NS6)event.returnValue=false;evaluateF2(pX,pY, testeaux);
	}
}
// ---------------------------------------------->
// ---------------------------------------------->
// ---------------------------------------------->

function pavatl_layerRectangle(oLayer_IN){
	this.leftMargin=(NS)?oLayer_IN.left:(NS6)?parseInt(oLayer_IN.style.left):oLayer_IN.style.pixelLeft;
	this.rightMargin=(NS)?this.leftMargin+oLayer_IN.clip.width:this.leftMargin+oLayer_IN.offsetWidth;
	this.topMargin=(NS)?oLayer_IN.top:(NS6)?parseInt(oLayer_IN.style.top):oLayer_IN.style.pixelTop;
	this.bottomMargin=(NS)?this.topMargin+oLayer_IN.clip.height:this.topMargin+oLayer_IN.offsetHeight;
}

// ---------------------------------------------->
//   Avaliação do rato relativamente
//   a uma determinada layer
// ---------------------------------------------->
function pavatl_evaluateMouseOnLayer(oLayer_IN,vx,vy){
	//alert('#');
	var rectLayer=new pavatl_layerRectangle(oLayer_IN);
	var scrollTopPos=(NS||NS6)?window.pageYOffset:document.body.scrollTop; // posição relativa da scrollbar
	if (vx<parseInt(rectLayer.leftMargin)||vx>parseInt(rectLayer.rightMargin)||vy<parseInt((rectLayer.topMargin)-scrollTopPos)||vy>parseInt((rectLayer.bottomMargin)-scrollTopPos)) {
	return false;}else{return true;}
}
// ---------------------------------------------->
// ---------------------------------------------->
// ---------------------------------------------->

// ---------------------------------------------->
//    Avaliação da posição do rato relativamente
//    à layer chamada e suas parentes
//    MENU GRUPO
// ---------------------------------------------->
function evaluateF2(vx,vy, lMenuID_IN) {
	menuToControl="oDivGrupoMenu"+lMenuID_IN;
	var tableWidth=750;
	var docWidth=(NS)?window.innerWidth:document.body.offsetWidth-4;
	var scrollTopPos=(NS||NS6)?window.pageYOffset:document.body.scrollTop; // posição relativa da scrollbar
	var bMouseIsOnTree=false;
	var oLayer;
// para avaliar o link principal
	//var iInitialLeft = (docWidth<=tableWidth)?iLeftFix+2:(((docWidth-tableWidth)/2)-iLeftFix);
	var iInitialLeft = 10;
	var esq=iInitialLeft+4;

	var top=iLayerGrupoTop-scrollTopPos;
	if (!(vx<parseInt(esq)||vx>parseInt(esq+146)||vy<parseInt(top)||vy>parseInt(top+iMenuGrupoHeight))) {
		bMouseIsOnTree=true;
	}
// -----------------------------
	if(!bMouseIsOnTree){
		IN_setVisibility(menuToControl,'hidden');
		if(NS)document.releaseEvents(Event.MOUSEMOVE);document.onmousemove=null;
	}
}

// ---------------------------------------------->
//    Avaliação da posição do rato relativamente
//    à layer chamada e suas parentes
//    MENU PRINCIPAL
// ---------------------------------------------->
function evaluateF(vx,vy) {
	//alert('x'+vx);
	//alert('y'+vy);
	menuToControl=sUpperLevelON;
	//alert(menuToControl);
	var tableWidth=760;
	var docWidth=(NS)?window.innerWidth:document.body.offsetWidth-4;
	//alert('cell--->'+iGlobalCell)
	var scrollTopPos=(NS||NS6)?window.pageYOffset:document.body.scrollTop; // posição relativa da scrollbar
	var bMouseIsOnTree=false;
	var oLayer;
// para avaliar o link principal
	//var iInitialLeft = (docWidth<=tableWidth)?iLeftFix+2:(((docWidth-tableWidth)/2)-iLeftFix);
	var iInitialLeft = 9;
	//alert(iInitialLeft);
	
//DÚVIDA	
	//alert()
	//alert(iGlobalWidth);
	var esq=iInitialLeft+(iGlobalWidth);
	//alert('iLevel1Top'+iLevel1Top);
	//alert('iMenuTabHeight'+iMenuTabHeight);
	//alert('scrollTopPos'+scrollTopPos);
	var top=iLevel1Top-iMenuTabHeight-scrollTopPos;
	//alert('esq'+esq);
	//alert('top'+top);
	
//		var esq=((docWidth-tableWidth)/2);
//	var top=parseInt(iInitialTop+(iMenuTabHeight*vTree[vTree.length-1])-scrollTopPos)
	
	if(NS){top-=5;}else if(MZi||NS6){top-=15;}
	var NSTopFix = (NS)?10:(MZi||NS6)?10:0;
	
	if (!(vx<parseInt(esq)||vx>parseInt(esq+iGlobalCell)||vy<parseInt(top)||vy>parseInt(top+iMenuTabHeight+NSTopFix))) {
		//alert('1');
		bMouseIsOnTree=true;
	}
// -----------------------------
		//	alert(bMouseIsOnTree);
	if(!bMouseIsOnTree){
		if(sUpperLevelON==LEVEL_1_LAYERNAME){
			//IN_setVisibility(LEVEL_2_LAYERNAME,'hidden');
			oLayer=IN_getLayer(LEVEL_1_LAYERNAME);
			bMouseIsOnTree=pavatl_evaluateMouseOnLayer(oLayer,vx,vy);
		//	alert(bMouseIsOnTree);
			if(!bMouseIsOnTree){
				IN_setVisibility(menuToControl,'hidden');sUpperLevelON = "";				
				for(var i=0; i<5; i++){
					if((i+1)!=iPageOn){
						//IN_changeTdColor('menu'+i,'0060a7');
					}
				}
				if(NS)document.releaseEvents(Event.MOUSEMOVE);document.onmousemove=null;
			}
		}//else if(sUpperLevelON==LEVEL_2_LAYERNAME){
			//oLayer=IN_getLayer(LEVEL_2_LAYERNAME);bMouseIsOnTree=pavatl_evaluateMouseOnLayer(oLayer,vx,vy);
			//oLayer=IN_getLayer(LEVEL_1_LAYERNAME);bMouseIsOnTreeAux=pavatl_evaluateMouseOnLayer(oLayer,vx,vy);
			//if(!bMouseIsOnTreeAux){
				//if(!bMouseIsOnTree){
					//IN_setVisibility(menuToControl,'hidden');sUpperLevelON = LEVEL_1_LAYERNAME;
				//}
			//}
		//}
	}
}


// ---------------------------------------------->
//    Avaliação da posição do rato relativamente
//    à layer chamada e suas parentes
//    MENU PRINCIPAL
// ---------------------------------------------->
function evaluateFTOP(vx,vy) {
	//alert('x'+vx);
	//alert('y'+vy);
	menuToControl=sUpperLevelON;
	//alert(menuToControl);
	var tableWidth=760;
	var docWidth=(NS)?window.innerWidth:document.body.offsetWidth-4;
	//alert('cell--->'+iGlobalCell)
	var scrollTopPos=(NS||NS6)?window.pageYOffset:document.body.scrollTop; // posição relativa da scrollbar
	var bMouseIsOnTree=false;
	var oLayer;
// para avaliar o link principal
	//var iInitialLeft = (docWidth<=tableWidth)?iLeftFix+2:(((docWidth-tableWidth)/2)-iLeftFix);
	//var iInitialLeft = (docWidth<=tableWidth)?iLeftFix+2:(((docWidth-tableWidth)/2)-iLeftFix)+305;
	var iInitialLeft = 9;
	
	//alert(iInitialLeft);
	
//DÚVIDA	
	//alert()
	//alert(iGlobalWidth);
	var esq=iInitialLeft;
	//alert(iInitialLeft)
	//alert('iLevel1Top'+iLevel1Top);
	//alert('iMenuTabHeight'+iMenuTabHeight);
	//alert('scrollTopPos'+scrollTopPos);
	var top=iLevel1Top-scrollTopPos;
	//alert('esq'+esq);
	//alert('top'+top);
	
//		var esq=((docWidth-tableWidth)/2);
//	var top=parseInt(iInitialTop+(iMenuTabHeight*vTree[vTree.length-1])-scrollTopPos)
	
	if(NS){top-=5;}else if(MZi||NS6){top-=15;}
	var NSTopFix = (NS)?10:(MZi||NS6)?10:0;
	
	if (!(vx<parseInt(esq)||vx>parseInt(esq+iGlobalCell)||vy<parseInt(top)||vy>parseInt(top+iMenuTabHeight+NSTopFix))) {
		//alert('1');
		bMouseIsOnTree=true;
	}
// -----------------------------
		//	alert(bMouseIsOnTree);
	if(!bMouseIsOnTree){
		if(sUpperLevelON==LEVEL_TOP_LAYERNAME){
			//IN_setVisibility(LEVEL_2_LAYERNAME,'hidden');
			oLayer=IN_getLayer(LEVEL_TOP_LAYERNAME);
			bMouseIsOnTree=pavatl_evaluateMouseOnLayer(oLayer,vx,vy);
		//	alert(bMouseIsOnTree);
			if(!bMouseIsOnTree){
				IN_setVisibility(menuToControl,'hidden');sUpperLevelON = "";				
				for(var i=0; i<5; i++){
					if((i+1)!=iPageOn){
						//IN_changeTdColor('menu'+i,'0060a7');
					}
				}
				if(NS)document.releaseEvents(Event.MOUSEMOVE);document.onmousemove=null;
			}
		}//else if(sUpperLevelON==LEVEL_2_LAYERNAME){
			//oLayer=IN_getLayer(LEVEL_2_LAYERNAME);bMouseIsOnTree=pavatl_evaluateMouseOnLayer(oLayer,vx,vy);
			//oLayer=IN_getLayer(LEVEL_1_LAYERNAME);bMouseIsOnTreeAux=pavatl_evaluateMouseOnLayer(oLayer,vx,vy);
			//if(!bMouseIsOnTreeAux){
				//if(!bMouseIsOnTree){
					//IN_setVisibility(menuToControl,'hidden');sUpperLevelON = LEVEL_1_LAYERNAME;
				//}
			//}
		//}
	}
}


function pavatl_getBackAux(){
//IN_setVisibility(LEVEL_2_LAYERNAME,'hidden');
sUpperLevelON = LEVEL_1_LAYERNAME;
}
// ---------------------------------------------->
// ---------------------------------------------->
// ---------------------------------------------->

function showMenu(e, iType_IN, iMenu_IN, iPage_IN, sIdioma_IN, lUnidadeID_IN){
	//alert('menu'+iMenu_IN);
	
	var sAuxID = "";
	var iWidthAux = BuildSpacerMenu(iMenu_IN, lUnidadeID_IN, iPage_IN);
	//alert('cell sum'+iWidthAux);
	//alert('global cell'+iGlobalCell);
	//alert('global width'+iGlobalWidth);
	//alert('#GLOBAL#'+sGlobalColor);
	
	if(iPage_IN == CONST_MENU_TYPE_HOME){
		iLevel1Top = CONST_TOP_HOME;
		if(MACOld){iLevel1Top = 0;}
		//alert('#top#'+iLevel1Top);
	}else{
	//alert('OK');
		iLevel1Top = CONST_TOP_INTERNO;
		
		if(MACOld){iLevel1Top = 0;}
	}
	if(NS)iLevel1Top-=10;
	var sContentInit;var sOptionInit;var sOptionEnd;var sContentEnd;
	var sLayer;var vMenuList;var sOut = "";
	var docWidth = (NS)?window.innerWidth:document.body.offsetWidth-4;
	var tableWidth = 760;
	var oLayerLeft;var oLayerTop;
	MZiLeftFix = (!MZi&&!NS6)?0:(docWidth<=tableWidth)?7:12;
	MZiTopFix = (MZi||NS6)?10:0;
	//var iInitialLeft = (docWidth<=tableWidth)?iLeftFix+2-MZiLeftFix:(((docWidth-tableWidth)/2)-iLeftFix)+MZiLeftFix;
	var iInitialLeft = 9;
	
	if(iType_IN==LEVEL_1){
		//for(var i=0; i<5; i++){
		//	if((i+1)!=iPage_IN){
				//IN_changeTdColor('menu'+i,'0060a7');
		//	}
		//}
		//IN_setVisibility(LEVEL_2_LAYERNAME,'hidden');
		//alert('#TABLE#'+iGlobalCell);
		//sContentInit = strLevel1HTMLInit;sOptionInit = strLevel1HTMLOptionInit;sOptionEnd = strLevel1HTMLOptionEnd;sContentEnd = strLevel1HTMLEnd;
		//initTable(iGlobalCell);
		sContentInit = Level1Init(iGlobalCell);
		//sOptionInit = strLevel1HTMLOptionInit;
		//sOptionInit = Level1HTMLOptionInit(sGlobalColor);
		sOptionEnd = strLevel1HTMLOptionEnd;
		sContentEnd = strLevel1HTMLEnd;

		sLayer = LEVEL_1_LAYERNAME;vMenuList = vMenuOptions[iMenu_IN];
		//valor da função...
		//alert(iInitialLeft);
		//alert(iGlobalWidth);
		oLayerLeft=iInitialLeft+iGlobalWidth;
		//alert(iLevel1Top);
		oLayerTop = iLevel1Top-MZiTopFix;
		
	}//else if(iType_IN==LEVEL_2){
	//	sContentInit = strLevel1HTMLInit;sOptionInit = strLevel2HTMLOptionInit;sOptionEnd = strLevel1HTMLOptionEnd;sContentEnd = strLevel1HTMLEnd;
	//	sLayer = LEVEL_2_LAYERNAME;vMenuList = vSubMenuOptions[iMenu_IN];
		//oLayerLeft=iInitialLeft+(179.5*vMenuList[0].childMenu)+(179*vHorSubPos[vMenuList[0].childMenu]);oLayerTop = iLevel1Top+(vMenuList[0].iVLevel*(iMenuTabHeight+2))-MZiTopFix;
	//	oLayerLeft=iInitialLeft+(179.5*vMenuList[0].childMenu)+(179*vHorSubPos[vMenuList[0].childMenu]);oLayerTop = iLevel1Top+(vMenuList[0].iVLevel*(iMenuTabHeight+2))-MZiTopFix;
		
	//}
	sOut += sContentInit;
	
	for(i=0; i<vMenuList.length; i++){
		
		sOut += Level1HTMLOptionInit(sGlobalColor, iMenu_IN, i);
		
		
		if(iType_IN==LEVEL_1&&vMenuList[i].childMenu!=0){
			//IN_changeTdColor('menu'+iMenu_IN,'ffc100');
			sOut += '\r<a href="'+vMenuList[i].link+'" ';
		}else if(iType_IN==LEVEL_1){
		
			//IN_changeTdColor('menu'+iMenu_IN,'ffc100');
			sOut += '\r<a href="'+vMenuList[i].link+'" ';
		}else{
			sOut += '\r<a href="'+vMenuList[i].link+'"';
		}
		if(!NS){
			//sOut += ' CLASS="linksubmenu">'+ iMenu_IN+'_'+i;
			//alert('sdafas');
			sAuxID = iMenu_IN+'_'+i;
			//alert(sAuxID);
			sOut += ' CLASS="linksubmenu" onMouseOver=IN_changeTdColor("'+ sAuxID +'","999999") onMouseOut=IN_changeTdColor("'+ sAuxID +'","C8C8C8")>';
			sOut += '<DIV STYLE="position:relative;width:'+ Number((iGlobalCell) - 5) +';height:100%;cursor:hand">';
			//sOut += '<DIV STYLE="position:absolute;width:'+ Number((iGlobalCell) - 5) +';height:100%;cursor:hand">';
		}else{
			sOut += '>';
		}
		sOut += '<img src="../Design/spacer.gif" width=1 height=2 border=0><br>';
		if(NS){
			sOut += '<font face="Verdana" size=1 color="#02407b">';
		}
		if(sIdioma_IN==CONST_LANG_PT){
			sOut += vMenuList[i].label;
		}else{
			sOut += vMenuList[i].labelEN;
		}
		if(NS){
			sOut += '</font>';
		}
		if(!NS){
			sOut += '</DIV>';
		}
		sOut += '</a>';
		sOut += sOptionEnd;
	}
	sOut += sContentEnd;
	iMainOptionON = iMenu_IN;
	iPageOn = iPage_IN;
	IN_setPositionLayer(sLayer,oLayerLeft,oLayerTop,false);
	IN_setVisibility(sLayer, "visible");
	IN_writeLayer(sLayer, sOut);

	checkMouse(e, sLayer );
}


function showMenuTop(e, lUnidadeID_IN){
	
	iLevel1Top = 20;
		
	if(NS)iLevel1Top-=10;
	var sContentInit;var sOptionInit;var sOptionEnd;var sContentEnd;
	var sLayer;var vMenuList;var sOut = "";
	var docWidth = (NS)?window.innerWidth:document.body.offsetWidth-4;
	var tableWidth = 760;
	var oLayerLeft;var oLayerTop;
	MZiLeftFix = (!MZi&&!NS6)?0:(docWidth<=tableWidth)?7:12;
	MZiTopFix = (MZi||NS6)?10:0;
	
	//var iInitialLeft = (docWidth<=tableWidth)?iLeftFix+2-MZiLeftFix:(((docWidth-tableWidth)/2)-iLeftFix)+MZiLeftFix+305;
	var iInitialLeft = 9;
	//alert(iInitialLeft);
	
	sContentInit = LevelTOPInit();
	
	sLayer = LEVEL_TOP_LAYERNAME;
	
	oLayerLeft=iInitialLeft;
	oLayerTop = iLevel1Top-MZiTopFix;
		
	sOut += sContentInit;

	//iMainOptionON = iMenu_IN;
	//iPageOn = iPage_IN;

	IN_setPositionLayerTOP(sLayer,oLayerLeft,oLayerTop,false);
	IN_setVisibilityTOP(sLayer, "visible");
	IN_writeLayerTOP(sLayer, sOut);
	checkMouseTOP(e, sLayer );
}

// ---------------------------------------------->
// Menu com Imagens
// ---------------------------------------------->

/*
function showMenu(e, iType_IN, iMenu_IN){
	var sContentInit;var sOptionInit;var sOptionEnd;var sContentEnd;
	var sLayer;var vMenuList;var sOut = "";
	var docWidth = (NS)?window.innerWidth:document.body.offsetWidth-4;
	var tableWidth = 750;
	var oLayerLeft;var oLayerTop;
	var iInitialLeft = (docWidth<=tableWidth)?iLeftFix+2:(((docWidth-tableWidth)/2)-iLeftFix);
	if(iType_IN==LEVEL_1){
		IN_setVisibility(LEVEL_2_LAYERNAME,'hidden');
		sContentInit = strLevel1HTMLInit;sOptionInit =  strLevel1HTMLOptionInit;sOptionEnd = strLevel1HTMLOptionEnd;sContentEnd = strLevel1HTMLEnd;
		sLayer = LEVEL_1_LAYERNAME;vMenuList = vMenuOptions[iMenu_IN];
		oLayerLeft=iInitialLeft+(149.5*iMenu_IN);oLayerTop = iLevel1Top;
	}else if(iType_IN==LEVEL_2){
		sContentInit = strLevel1HTMLInit;sOptionInit =  strLevel1HTMLOptionInit;sOptionEnd = strLevel1HTMLOptionEnd;sContentEnd = strLevel1HTMLEnd;
		sLayer = LEVEL_2_LAYERNAME;vMenuList = vSubMenuOptions[iMenu_IN];
		oLayerLeft=iInitialLeft+(149.5*vMenuList[0].childMenu)+(149*vHorSubPos[vMenuList[0].childMenu]);oLayerTop = iLevel1Top+(vMenuList[0].iVLevel*(iMenuTabHeight+2));
	}
	sOut += sContentInit;
	for(i=0; i<vMenuList.length; i++){
		sOut += sOptionInit;
		if(iType_IN==LEVEL_1&&vMenuList[i].childMenu!=0){
			sOut += '\r<a href="'+vMenuList[i].link+'" onMouseOver="IN_setImageSource(\'img'+sLayer+''+i+''+iMenu_IN+'\',\'/site/resources/graphics/'+vMenuList[i].imageHi+'\');showMenu(event, '+LEVEL_2+', '+vMenuList[i].childMenu+');"';			
		}else if(iType_IN==LEVEL_1){
			sOut += '\r<a href="'+vMenuList[i].link+'" onMouseOver="IN_setImageSource(\'img'+sLayer+''+i+''+iMenu_IN+'\',\'/site/resources/graphics/'+vMenuList[i].imageHi+'\');pavatl_getBackAux();"';
		}else{
			sOut += '\r<a href="'+vMenuList[i].link+'" onMouseOver="IN_setImageSource(\'img'+sLayer+''+i+''+iMenu_IN+'\',\'/site/resources/graphics/'+vMenuList[i].imageHi+'\');"';
		}
		sOut += ' onMouseOut="IN_setImageSourceOriginal(\'img'+sLayer+''+i+''+iMenu_IN+'\');">\r';
		sOut += '<img src="/site/resources/graphics/'+vMenuList[i].imageLo+'" border=0 name="img'+sLayer+''+i+''+iMenu_IN+'">\r';
		sOut += '</a>\r';
		sOut += sOptionEnd;		
	}
	sOut += sContentEnd;
	iMainOptionON = iMenu_IN;
	IN_writeLayer(sLayer, sOut);IN_setPositionLayer(sLayer,oLayerLeft,oLayerTop,false);IN_setVisibility(sLayer, "visible");checkMouse(e, sLayer);
}
*/

function showGrupoMenu(e, lMenuID_IN ){
	//alert(lMenuID_IN);
	testeaux = lMenuID_IN
	var oHeightLayer = IN_getLayer('oDivHeight');
	//alert('oDivGrupoMenu'+ lMenuID_IN);
	var oLayer = IN_getLayer('oDivGrupoMenu'+ lMenuID_IN);
	var docWidth = (NS)?window.innerWidth:document.body.offsetWidth-4;
	var tableWidth = 750;
	var oLayerLeft;var oLayerTop;
	//var iInitialLeft = (docWidth<=tableWidth)?iLeftFix+2:(((docWidth-tableWidth)/2)-iLeftFix);
	var iInitialLeft = 10;
	oLayerLeft=iInitialLeft+5;
	oLayerHeight = (NS)?oLayer.clip.height:oLayer.offsetHeight;
	//alert('-->'+oLayerHeight);
	oLayerTop = (NS)?oHeightLayer.clip.height:oHeightLayer.offsetHeight;
	
	if (lMenuID_IN == 0) {
		oLayerTop -= oLayerHeight + 113;
	}
	
	if (lMenuID_IN == 1) {
		oLayerTop -= oLayerHeight + (113 - 20);
	}
	
	if (lMenuID_IN == 2) {
		oLayerTop -= oLayerHeight + (113 - 40);
	}
	
	iLayerGrupoTop = oLayerTop;
	iMenuGrupoHeight = oLayerHeight+20;
	IN_setPositionLayer("oDivGrupoMenu"+lMenuID_IN ,oLayerLeft,oLayerTop,false);IN_setVisibility("oDivGrupoMenu"+lMenuID_IN, "visible");checkMouse2(e,1);
}

// ---------------------------------------------->
// ---------------------------------------------->
// ---------------------------------------------->

function CertificacaoQualidadeSelection() {
	if( document.frmCandidatura.qualidade[1].checked == true ) {
		document.frmCandidatura.norma.disabled = true;
		document.frmCandidatura.norma.value = "";
		document.frmCandidatura.certificado.disabled = true;
		document.frmCandidatura.certificado.value = "";

		document.frmCandidatura.certificacao.disabled = false;

		if( document.frmCandidatura.certificacao.checked ) {
			document.frmCandidatura.certificacaonorma.disabled = false;
		} else {
			document.frmCandidatura.certificacaonorma.disabled = true;
			document.frmCandidatura.certificacaonorma.value = "";
		}
		
	} else {
		document.frmCandidatura.norma.disabled = false;
		document.frmCandidatura.certificado.disabled = false;

		document.frmCandidatura.certificacao.disabled = true;
		document.frmCandidatura.certificacao.checked = false;
		document.frmCandidatura.certificacaonorma.disabled = true;
		document.frmCandidatura.certificacaonorma.value = "";
	}
}

function BuildSpacerMenu(lMenuID_IN, lUnidadeID_IN, iPage_IN){
//alert('---->'+iPage_IN);
var i
var iResult = 0;
var vMenuConst = new Array();	
	//vMenuConst[0] = new Array();	
	
	/*
	if (lUnidadeID_IN != 3){
	
	vMenuConst[0] = 89;
	vMenuConst[1] = 132;
	vMenuConst[2] = 131;
	vMenuConst[3] = 126;
	vMenuConst[4] = 165;
	vMenuConst[5] = 95;
	sGlobalColor = '#00549A';
	}else{
	
	vMenuConst[0] = 96;
	vMenuConst[1] = 150;
	vMenuConst[2] = 140;
	vMenuConst[3] = 158;
	vMenuConst[4] = 195;
	sGlobalColor = '#841010';
	}
	//alert(sGlobalColor);
	*/
	/*
			vMenuConst[0] = 148;
			vMenuConst[1] = 148;
			vMenuConst[2] = 148;
			vMenuConst[3] = 148;
			vMenuConst[4] = 148;
			sGlobalColor = '#C8C8C8';
	*/
			
			vMenuConst[0] = 120;
			vMenuConst[1] = 159;
			vMenuConst[2] = 141;
			vMenuConst[3] = 110;
			vMenuConst[4] = 125;
			sGlobalColor = '#C8C8C8';
	
	for(i=0;i<lMenuID_IN;i++){
		iResult += vMenuConst[i];
	}
	
	iGlobalUnidade = lUnidadeID_IN
	iGlobalCell = 145;
	iGlobalWidth = iResult;
	
	//alert('leftfix'+iLeftFix);
	
	return iGlobalWidth;
}

// ------------------------------------------------ //
// COMBO-BOX EXPANDER
// ------------------------------------------------ //
function retractCombo(sFormName, sDivID, sSelectInDivID, sSelectID) {
	document.getElementById(sDivID).style.visibility = 'hidden';
	window.document.getElementById(sSelectID).selectedIndex = window.document.getElementById(sSelectInDivID).selectedIndex;
}

function expandLayer(sFormName, sDivID, sSelectInDivID, sSelectID) {
	window.document.forms[sFormName].elements[sSelectInDivID].selectedIndex = window.document.getElementById(sSelectID).selectedIndex;
	document.getElementById(sDivID).style.visibility = 'visible';
	window.document.getElementById(sSelectInDivID).focus();
}
