<!--

/*** SET BUTTON'S FOLDER HERE ***/
var buttonFolder = "buttons/";

/*** SET BUTTONS' FILENAMES HERE ***/
upSources = new Array("button1up.png","button2up.png");


overSources = new Array("button1over.png","button2over.png");


// SUB MENUS DECLARATION, YOU DONT NEED TO EDIT THIS
subInfo = new Array();
subInfo[1] = new Array();
subInfo[2] = new Array();


//*** SET SUB MENUS TEXT LINKS AND TARGETS HERE ***//
subInfo[1][1] = new Array("Informação Geográfica","/showPG.php?Id=19","");
subInfo[1][2] = new Array("Resenha Histórica","/showPG.php?Id=9","");
subInfo[1][3] = new Array("Município em Números","showPG.php?Id=112","");
subInfo[1][4] = new Array("Símbolos do Município","/showPG.php?Id=8","");
subInfo[1][5] = new Array("Mensagem do Presidente","/showPG.php?Id=6","");


subInfo[2][1]= new Array("Cabril","showFreg.php?Id=1","");
subInfo[2][2]= new Array("Cambeses do Rio","showFreg.php?Id=2","");
subInfo[2][3]= new Array("Cervos","showFreg.php?Id=3","");
subInfo[2][4]= new Array("Chã","showFreg.php?Id=4","");
subInfo[2][5]= new Array("Contim","showFreg.php?Id=5","");
subInfo[2][6]= new Array("Covelães","showFreg.php?Id=6","");
subInfo[2][7]= new Array("Covêlo do Gerês","showFreg.php?Id=7","");
subInfo[2][8]= new Array("Don&otilde;es","showFreg.php?Id=8","");
subInfo[2][9]= new Array("Ferral","showFreg.php?Id=9","");
subInfo[2][10]= new Array("Fervidelas","showFreg.php?Id=10","");
subInfo[2][11]= new Array("Fi&atilde;es do Rio","showFreg.php?Id=11","");
subInfo[2][12]= new Array("Gralhas","showFreg.php?Id=12","");
subInfo[2][13]= new Array("Meixedo","showFreg.php?Id=13","");
subInfo[2][14]= new Array("Meixide","showFreg.php?Id=14","");
subInfo[2][15]= new Array("Montalegre","showFreg.php?Id=15","");
subInfo[2][16]= new Array("Morgade","showFreg.php?Id=16","");
subInfo[2][17]= new Array("Mourilhe","showFreg.php?Id=17","");
subInfo[2][18]= new Array("Negr&otilde;es","showFreg.php?Id=18","");
subInfo[2][19]= new Array("Outeiro","showFreg.php?Id=19","");
subInfo[2][20]= new Array("Padornelos","showFreg.php?Id=20","");
subInfo[2][21]= new Array("Padroso","showFreg.php?Id=21","");
subInfo[2][22]= new Array("Paradela","showFreg.php?Id=22","");
subInfo[2][23]= new Array("Pit&otilde;es das J&uacute;nias","showFreg.php?Id=23","");
subInfo[2][24]= new Array("Pondras","showFreg.php?Id=24","");
subInfo[2][25]= new Array("Reigoso","showFreg.php?Id=25","");
subInfo[2][26]= new Array("Salto","showFreg.php?Id=26","");
subInfo[2][27]= new Array("Santo Andr&eacute;","showFreg.php?Id=27","");
subInfo[2][28]= new Array("Sarraquinhos","showFreg.php?Id=28","");
subInfo[2][29]= new Array("Sezelhe","showFreg.php?Id=29","");
subInfo[2][30]= new Array("Solveira","showFreg.php?Id=30","");
subInfo[2][31]= new Array("Tour&eacute;m","showFreg.php?Id=31","");
subInfo[2][32]= new Array("Venda Nova","showFreg.php?Id=32","");
subInfo[2][33]= new Array("Viade de Baixo","showFreg.php?Id=33","");
subInfo[2][34]= new Array("Vila da Ponte","showFreg.php?Id=34","");
subInfo[2][35]= new Array("Vilar de Perdizes","showFreg.php?Id=35","");



//*** SET SUB MENU POSITION ( RELATIVE TO BUTTON ) ***//
var xSubOffset = 0;
var ySubOffset = 15;



//*** NO MORE SETTINGS BEYOND THIS POINT ***//
var overSub = false;
var delay = 1000;
totalButtons = upSources.length;

// GENERATE SUB MENUS
for ( x=0; x<totalButtons; x++) {
	// SET EMPTY DIV FOR BUTTONS WITHOUT SUBMENU
	if ( subInfo[x+1].length < 1 ) { 
		document.write('<div id="submenu' + (x+1) + '">');
	// SET DIV FOR BUTTONS WITH SUBMENU
	} else {
		document.write('<div id="submenu' + (x+1) + '" class="dropmenu" ');
		document.write('onMouseOver="overSub=true;');
		document.write('setOverImg(\'' + (x+1) + '\',\'\');"');
		document.write('onMouseOut="overSub=false;');
		document.write('setTimeout(\'hideSubMenu(\\\'submenu' + (x+1) + '\\\')\',delay);');
		document.write('setOutImg(\'' + (x+1) + '\',\'\');">');


		document.write('<ul>');
		for ( k=0; k<subInfo[x+1].length-1; k++ ) {
			document.write('<li>');
			document.write('<a href="' + subInfo[x+1][k+1][1] + '" ');
			document.write('target="' + subInfo[x+1][k+1][2] + '">');
			document.write( subInfo[x+1][k+1][0] + '</a>');
			document.write('</li>');
		}
		document.write('</ul>');
	}
	document.write('</div>');
}





//*** MAIN BUTTONS FUNCTIONS ***//
// PRELOAD MAIN MENU BUTTON IMAGES
function preload() {
	for ( x=0; x<totalButtons; x++ ) {
		buttonUp = new Image();
		buttonUp.src = buttonFolder + upSources[x];
		buttonOver = new Image();
		buttonOver.src = buttonFolder + overSources[x];
	}
}

// SET MOUSEOVER BUTTON
function setOverImg(But, ID) {
	document.getElementById('button' + But + ID).src = buttonFolder + overSources[But-1];
}

// SET MOUSEOUT BUTTON
function setOutImg(But, ID) {
	document.getElementById('button' + But + ID).src = buttonFolder + upSources[But-1];
}



//*** SUB MENU FUNCTIONS ***//
// GET ELEMENT ID MULTI BROWSER
function getElement(id) {
	return document.getElementById ? document.getElementById(id) : document.all ? document.all(id) : null; 
}

// GET X COORDINATE
function getRealLeft(id) { 
	var el = getElement(id);
	if (el) { 
		xPos = el.offsetLeft;
		tempEl = el.offsetParent;
		while (tempEl != null) {
			xPos += tempEl.offsetLeft;
			tempEl = tempEl.offsetParent;
		} 
		return xPos;
	} 
} 

// GET Y COORDINATE
function getRealTop(id) {
	var el = getElement(id);
	if (el) { 
		yPos = el.offsetTop;
		tempEl = el.offsetParent;
		while (tempEl != null) {
			yPos += tempEl.offsetTop;
			tempEl = tempEl.offsetParent;
		}
		return yPos;
	}
}

// MOVE OBJECT TO COORDINATE
function moveObjectTo(objectID,x,y) {
	var el = getElement(objectID);
	el.style.left = x;
	el.style.top = y;
}

// MOVE SUBMENU TO CORRESPONDING BUTTON
function showSubMenu(subID, buttonID) {
	hideAllSubMenus();
	butX = getRealLeft(buttonID);
	butY = getRealTop(buttonID);
	moveObjectTo(subID,butX+xSubOffset, butY+ySubOffset);
}

// HIDE ALL SUB MENUS
function hideAllSubMenus() {
	for ( x=0; x<totalButtons; x++) {
		moveObjectTo("submenu" + (x+1) + "",-500, -500 );
	}
}

// HIDE ONE SUB MENU
function hideSubMenu(subID) {
	if ( overSub == false ) {
		moveObjectTo(subID,-500, -500);
	}
}



//preload();

-->