// JavaScript Document
  function mostraSubmenu(nivel){
    var itens = document.getElementById('topo').getElementsByTagName('div');
    for(i = 0 ; i < itens.length; i++){
      itens[i].style.display = 'none';
    }
    document.getElementById('subMenu'+nivel).style.display = '';
  }
  
	function slide_show(){
		// Pega a primeira foto do vetor
		var srcLocal = vetor.shift();
		var lnkLocal = links.shift();
		var timeLocal = tempo.shift();
		var tituloLocal = titulos.shift();
		// Faz a transiçao das imagens
		var img = document.getElementById('foto_fundo');
		img.flag = -1;
		img.index = 100;
		setTimeout("fade('" + srcLocal + "','foto_fundo')",300);
		
		if(lnkLocal.length > 0){ 
			img.onclick = function(){ location.href = lnkLocal };
			img.style.cursor = 'pointer';
		}else{ 
			img.onclick = function(){ return false; };
			img.style.cursor = 'default';
		}
		
		
		if(tituloLocal.length > 0){ 
			document.getElementById('tituloFoto').style.display = '';
			document.getElementById('tituloFoto').innerHTML = '<img src="./imagens/template/foto_fundo_logo_acif.gif">'+tituloLocal;
		}else{ 
			document.getElementById('tituloFoto').style.display = 'none'; 
		}
		
		// Devolve a foto na ultima posicao do vetor
		vetor.push(srcLocal);
		tempo.push(timeLocal);
		titulos.push(tituloLocal);
		links.push(lnkLocal);

		// Chama o metodo recursivamente
		setTimeout("slide_show()", timeLocal);
		
	}

	if(typeof(tinyMCE) != "undefined"){

		
		tinyMCE.init({
			mode : "textareas",
			theme : "simple",
			editor_selector : "mceSimple"
		});
		
		tinyMCE.init({
			mode : "textareas",
			theme : "advanced",
			plugins : "spellchecker,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,zoom,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",
			theme_advanced_buttons1: "underline,strikethrough,separator,separator,styleselect,formatselect,separator,bullist,numlist,separator,outdent,indent",
			theme_advanced_buttons2: "undo,redo,separator,link,unlink,anchor,image",
			theme_advanced_buttons3: "",
			theme_advanced_toolbar_location : "top",
			theme_advanced_toolbar_align : "left",
			theme_advanced_path_location : "bottom",
			content_css : "css/template_web_editor.css",
			plugin_insertdate_dateFormat : "%Y-%m-%d",
			plugin_insertdate_timeFormat : "%H:%M:%S",
			extended_valid_elements : "hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]",
			theme_advanced_resize_horizontal : false,
			theme_advanced_resizing : true,
			apply_source_formatting : true,
			spellchecker_languages : "+Portuguese=pt",
			file_browser_callback : "mcFileManager.filebrowserCallBack",
			editor_selector : "mceAdv"
		});  

	}

	function consultatempo() { 
		var iframe = document.getElementById('tempo'); 
		var cidade = document.getElementById('cidade'); 
		
		var reg = new RegExp("á|a|a|â",'gi');
		cidade.value = cidade.value.replace(reg,'a');
		
		reg = new RegExp("é|e|e",'gi');
		cidade.value = cidade.value.replace(reg,'e');
		
		reg = new RegExp("í|i|î",'gi');
		cidade.value = cidade.value.replace(reg,'i');
		
		reg = new RegExp("o|ó|o|ô",'gi');
		cidade.value = cidade.value.replace(reg,'o');
		
		reg = new RegExp("ú|u|ü|u",'gi');
		cidade.value = cidade.value.replace(reg,'u');
		
		cidade.value = cidade.value.substr(0,1).toUpperCase()+cidade.value.substr(1).replace(' ','');
		iframe.src = 'http://www.tempoagora.com.br/selos/custom/selo.php?cid='+cidade.value+"-MG"; 
	} 

