var menu = [
	['Home', './', null],
	['O que é o projeto', null, [
		['Infra-estrutura', 'interna.php?pagina=infra.estrutura.htm'],
		['Institucional', 'interna.php?pagina=institucional.htm'],
		['Intranet', 'intranet.php']
	]],
	['CNEE', null, [
		['Conheça a pista', 'interna.php?pagina=cnee.htm'],
		['Evolução da pista', 'gallery/CNEE/'],
		['Evolução do CT', 'gallery/CNEE2/'],
		['Como chegar', 'como.chegar.php']
	]],
	['Novos Talentos', null, [
		['Home', './nacional'],
		['Atletas', './nacional/atletas.nacional.php'],
		['Técnicos','./nacional/tecnicos.nacional.php']
	]],
	['Projetos', null, [
		['Novos Talentos', 'http://www.redeatletismonovostalentos.com.br']
	]],
	['Calendário', './calendario.php', null],
	['Contato', 'interna.php?pagina=contato.htm', null]
];




function mountMenu()
{
	var hasChild = false;
	var label, url;
	document.write('<ul>');
	for(i = 0; i < menu.length; i++)
	{
		hasChild = menu[i][2] != null ? true : false;
		label = menu[i][0];
		url = menu[i][1] != null ? menu[i][1] : 'javascript:swapMenu(' + i + ');';
		document.write('<li><a href="' + url + '" title="' + label + '" id="url_' + i + '">' + label + '</a>');

		if(hasChild)
		{
			document.write('<ul id="sub_' + i + '">');
			for(j = 0; j < menu[i][2].length; j++)
			{
				document.write('<li><a href="' + menu[i][2][j][1] + '" title="' + menu[i][2][j][0] + '">' + menu[i][2][j][0] + '</a></li>');
			}
			document.write('</ul>');
			
			if(typeof(wmenu) == 'object' && (wmenu instanceof Array))
			{
				for(s = 0; s < wmenu.length; s++)
				{  
					if(wmenu[s] == i)
					{
						document.getElementById('sub_' + i).style.display = (wmenu[s] == i) ? 'block' : 'none';
						document.getElementById('url_' + i).style.backgroundPosition = (wmenu[s] == i) ? 'right bottom' : 'right top';
					}
				}
			}
			else
			{
				document.getElementById('sub_' + i).style.display = (wmenu == i) ? 'block' : 'none';
				document.getElementById('url_' + i).style.backgroundPosition = (wmenu == i) ? 'right bottom' : 'right top';
			}
		}
		document.write('</li>');
	}
	document.write('</ul>');
	void(0);
}

function swapMenu(node)
{
	var ul = document.getElementById('sub_' + node);
	var ln = document.getElementById('url_' + node);
	ul.style.display = ul.style.display != 'block' ? 'block' : 'none';
	ln.style.backgroundPosition = ul.style.display != 'block' ? 'right top' : 'right bottom';
	void(0);
}

function showMenu(id)
{
	document.getElementById('menu-' + id).className = 'hover';
	document.getElementById('sub-' + id).style.display = 'block';
	void(0);
}

function hideMenu(id)
{
	document.getElementById('menu-' + id).className = '';
	document.getElementById('sub-' + id).style.display = 'none';
	void(0);
}

function loadSwf(fileName, lenX, lenY)
{
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+lenX+'" height="'+lenY+'">');
	document.write('<param name="allowScriptAccess" value="sameDomain" /><param name="wmode" value="transparent" />');
	document.write('<param name="movie" value="'+fileName+'" /><param name="quality" value="best" /><param name="bgcolor" value="#FFFFFF" /><embed src="'+fileName+'" wmode="transparent" quality="best" width="'+lenX+'" height="'+lenY+'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
	document.write('</object>');
}

function setPseudoClass()
{
	if (( /MSIE 6.0/ ).test( navigator.appVersion ))
	{
		var uls = document.getElementsByTagName( "ul" );
		for ( var i = 0; i < uls.length; i ++ )
		{
			if (( /(^|\s)menuroot(\s|$)/ ).test( uls[i].className ))
			{
				var lis = uls[i].getElementsByTagName( "li" );
				for ( var j = 0; j < lis.length; j ++ )
				{
					lis[j].onmouseover = function()
					{
						this.className += " hover";
					}
					lis[j].onmouseout = function()
					{
						var s = (( /\shover\s/ ).test( this.className ) ? " " : "" );
						this.className = this.className.replace( /(^|\s)hover(\s|$)/, s );
					}
				}
			}
		}
	}
}

function showList(id)
{
	var guides = 1;
	for(i = 0; i <= guides; i++)
	{
		document.getElementById('guide_' + i).className = '';
		document.getElementById('context_' + i).className = '';
	}
	document.getElementById('guide_' + id).className = 'selected';
	document.getElementById('context_' + id).className = 'selected';
}

function jumpMenu(targ,selObj,restore)
{
  eval(targ+".location='./galeria.php?id_galeria="+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function Mascara(objeto, evt, mask) {
 
	var LetrasU = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
	var LetrasL = 'abcdefghijklmnopqrstuvwxyz';
	var Letras  = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
	var Numeros = '0123456789';
	var Fixos  = '().-:/ '; 
	var Charset = " !\"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_/`abcdefghijklmnopqrstuvwxyz{|}~";

	evt = (evt) ? evt : (window.event) ? window.event : "";
	var value = objeto.value;
	
	if (evt)
	{
 		var ntecla = (evt.which) ? evt.which : evt.keyCode;
 		tecla = Charset.substr(ntecla - 32, 1);
		
 		if (ntecla < 32) return true;

 		var tamanho = value.length;
		
 		if (tamanho >= mask.length) return false;

		var pos = mask.substr(tamanho,1); 
		
 		while (Fixos.indexOf(pos) != -1) 
		{
  			value += pos;
  			tamanho = value.length;
			
  			if (tamanho >= mask.length) return false;
			
 			pos = mask.substr(tamanho,1);
 		}

		switch (pos) {
			case '#' : if (Numeros.indexOf(tecla) == -1) return false; break;
			case 'A' : if (LetrasU.indexOf(tecla) == -1) return false; break;
			case 'a' : if (LetrasL.indexOf(tecla) == -1) return false; break;
			case 'Z' : if (Letras.indexOf(tecla) == -1) return false; break;
			case '*' : objeto.value = value; return true; break;
			default : return false; break;
		}
	}
	objeto.value = value; 
	return true;
}
/*
// FUNÇOES  =========================================================>
// onkeypress="return MaskCPF(this, event)"
function MaskCep(objeto, evt) {
	return Mascara(objeto, evt, '##.###-###');
}

function MaskTelefone(objeto, evt) {
	return Mascara(objeto, evt, '(##) ####-####');
}

function MaskCPF(objeto, evt) {
	return Mascara(objeto, evt, '###.###.###-##');
}
function MaskData(objeto, evt) {
	return Mascara(objeto, evt, '##/##/####');
}
*/