var carregando="<table width='100%' height='18' border='0' align='center' cellpadding='0' cellspacing='0'>  <tr>     <td background='images/barra_.jpg' bgcolor='#bbc7ce' class='tah11'><div align='right'><font color='#006633'><strong><font color='#005F66'>Aguarde...</font>&nbsp;</strong></font></div></td>  </tr></table><table width='100%' height='300' border='0' cellpadding='0' cellspacing='0'><tr><td><div align='center'><img src='images/loading.gif' align='absmiddle'></div></td></tr></table>"
var carregando2="<br><br><br><table width='100%' height='100%' border='0' cellpadding='0' cellspacing='0'><tr><td><div align='center'><img src='images/loader.gif' align='absmiddle'></div></td></tr></table>"
var carregando3="<table width='100%' height='100%' border='0' cellpadding='0' cellspacing='0'><tr><td><div align='center'><img src='../images/loader.gif' align='absmiddle'> <i class='tah11'> Carregando...</i></div></td></tr></table>"
var carregando4="<br><br><br><table width='100%' height='100%' border='0' cellpadding='0' cellspacing='0'><tr><td><div align='center'><img src='images/loading.gif' align='absmiddle'></div></td></tr></table><br><br><br>"

try{
    xmlhttp = new XMLHttpRequest();
	xmlhttp2 = new XMLHttpRequest();
	xmlhttp3 = new XMLHttpRequest();
}catch(ee){
    try{
        xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		xmlhttp2 = new ActiveXObject("Msxml2.XMLHTTP");
		xmlhttp3 = new ActiveXObject("Msxml2.XMLHTTP");
    }catch(e){
        try{
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			xmlhttp2 = new ActiveXObject("Microsoft.XMLHTTP");
			xmlhttp3 = new ActiveXObject("Microsoft.XMLHTTP");
        }catch(E){
            xmlhttp = false;
			xmlhttp2 = false;
			xmlhttp3 = false;
        }
    }
}
//Aqui variavel do valor da DIV a ser utilizada
var div;
var div2;
var div3;
//Função Principal para exibir o resultado na DIV
function resultado() { 
   if (xmlhttp2.readyState==4){
       if (xmlhttp2.status == 200) { 
			var resultado = xmlhttp2.responseText; // Coloca o retornado pelo Ajax nessa variável 
			resultado = resultado.replace(/\+/g," "); // Resolve o problema dos acentos (saiba mais aqui: http://www.plugsites.net/leandro/?p=4) 
			resultado = unescape(resultado)
			document.getElementById(div).innerHTML = resultado;
          }else{
		  		document.getElementById(div).innerHTML = xmlhttp2.responseText;
				xmlhttp2.abort();
		  }
       }
}
function resultado2() { 
   if (xmlhttp.readyState==4){
       if (xmlhttp.status == 200) { 
			var resultado2 = xmlhttp.responseText; // Coloca o retornado pelo Ajax nessa variável 
			resultado2 = resultado2.replace(/\+/g," "); // Resolve o problema dos acentos (saiba mais aqui: http://www.plugsites.net/leandro/?p=4) 
			resultado2 = unescape(resultado2)
			document.getElementById(div2).innerHTML = resultado2;
          }else{
		  		document.getElementById(div2).innerHTML = xmlhttp.responseText;
				xmlhttp.abort();
		  }
       }
}
function resultado3() { 
   if (xmlhttp3.readyState==4){
       if (xmlhttp3.status == 200) { 
			var resultado3 = xmlhttp3.responseText; // Coloca o retornado pelo Ajax nessa variável 
			resultado3 = resultado3.replace(/\+/g," "); // Resolve o problema dos acentos (saiba mais aqui: http://www.plugsites.net/leandro/?p=4) 
			resultado3 = unescape(resultado3)
			document.getElementById(div3).innerHTML = resultado3;
          }else{
		  		document.getElementById(div3).innerHTML = xmlhttp3.responseText;
				xmlhttp3.abort();
		  }
       }
}
var b=0;
function funcao(url,nome) {
	div = nome;
	if(url == 'vestibular.asp'){
			funcao2('menu_vest.asp','menu_lateral');
			b=0;
	}else{
		if(url == 'direito.asp' || url == 'turismo.asp' || url == 'administracao.asp' || url == 'sistemas.asp'){
			   funcao2('menu_curso.asp?pagina='+url,'menu_lateral');
			   b=0;
		}else{
			if(b==0){
					funcao2('menu2.asp','menu_lateral');
					b=1;
			}
		}
	}
	top.location = "#"+url;
	document.getElementById(div).innerHTML= carregando;
       xmlhttp2.open("GET", "paginas/"+url, true);
       xmlhttp2.onreadystatechange = resultado;
       xmlhttp2.send(null);
}
function funcao2(url,nome) {
	div2 = nome
	document.getElementById(div2).innerHTML= carregando2;
       xmlhttp.open("GET", "includes/"+url, true);
       xmlhttp.onreadystatechange = resultado2;
       xmlhttp.send(null);
}
function funcao3(url,nome) {
	div2 = nome;
	document.getElementById(div2).innerHTML= carregando;
       xmlhttp.open("GET", "paginas/"+url, true);
       xmlhttp.onreadystatechange = resultado2;
       xmlhttp.send(null);
}
function funcao4(url,nome) {
	div3 = nome;
	//document.getElementById(div3).innerHTML= "carregando";
       xmlhttp3.open("GET", "includes/"+url, true);
       xmlhttp3.onreadystatechange = resultado3;
       xmlhttp3.send(null);
}

//Aqui função para criar um delay de 1,5 Segundos
var a;
function tempo(funcao){
	window.clearTimeout(a);
	a = setTimeout(funcao, 1000);
}

function fechar(){
		document.getElementById('descricao').style.display = "none";
}
function mostra(n){
	document.getElementById(n).style.visibility = "inherit";
}
function remove(n){
	document.getElementById(n).style.visibility = "hidden";
}
function mouseout(n){
	document.getElementById(n).style.backgroundColor='';
	document.getElementById(n).style.color='';
}
function mouseover(n){
	document.getElementById(n).style.backgroundColor='#F3F3F3';
	document.getElementById(n).style.cursor='pointer';
	document.getElementById(n).style.color='#666666';
}
function abrir(url){
	window.open("paginas/"+url,'Pagina','width=500,height=400,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no');
}

function popup(vUrl,vName,vPosFimX,vPosFimY,vScrollBars,vResizable,vRetorno){
	//calcula posição de abertura da janela em relação à tela
  vPosIniX=((screen.availWidth/2)-(vPosFimX/2));
  vPosIniY=((screen.availHeight/2)-(vPosFimY/2));
  //abre a janela pop up
  window.open(vUrl,vName,'toolbar=0,location=0,status=0,directories=0,menubar=0,scrollbars='+vScrollBars+',resizable='+vResizable+',top='+vPosIniY+',left='+vPosIniX+',width='+vPosFimX+',height='+vPosFimY+'');
  if (vRetorno==null)
  {
    //não retorna nada
  }
  else
  {
    //retorna qualquer coisa que você definir em vRetorno 
    //obs.: aplicavel ao caso de querer retornar uma outra função ou o valor de outra função
    return vRetorno;
  };
};


a = location.hash.split("#")[1];
//setInterval("local('"+location.hash.split("#")[1]+"')",3000);
function local(url){
		location.reload();
		//alert(url)
		b = url;
		if(b==a){
			
		}else{
			//alert(b);
			funcao(b,'principal');
			a = b;
		}
}

function fale_faete() {
	div = 'principal';
     var nome = escape(document.getElementById("nome").value);
     var telefone = escape(document.getElementById("telefone").value);
     var email = escape(document.getElementById("email").value);
     var destino = escape(document.getElementById("destino").value);
     var mensagem = escape(document.getElementById("mensagem").value);
     if(nome!='' && telefone!='' && email!='' && mensagem!=''){
	 	 document.getElementById(div).innerHTML = carregando;
		 var url = "paginas/faleconosco.asp?acao=enviar&nome="+nome+"&telefone="+telefone+"&email="+email+"&destino="+destino+"&mensagem="+mensagem;
		 xmlhttp2.open("POST", url, true);
		 xmlhttp2.onreadystatechange = resultado;
		 xmlhttp2.send(null);
	 }else{
			alert('Preencha todos os campos!!')
	}
}
function ouvidoria_() {
	div = 'principal';
     var nome = escape(document.getElementById("nome").value);
     var telefone = escape(document.getElementById("telefone").value);
     var email = escape(document.getElementById("email").value);
     var mensagem = escape(document.getElementById("mensagem").value);
     if(email=='' && mensagem==''){
	 		alert('Preencha todos os campos!!')
	 }else{		 		
		  var txt = email;
		  if ((txt.length != 0) && ((txt.indexOf("@") < 1) || (txt.indexOf('.') < 7)))
		  {
		    alert('Email incorreto');
			document.getElementById("email").focus();
		  }else{		 		
			 document.getElementById(div).innerHTML = carregando;
			 var url = "paginas/ouvidoria.asp?acao=enviar&nome="+nome+"&telefone="+telefone+"&email="+email+"&mensagem="+mensagem;
			 xmlhttp2.open("POST", url, true);
			 xmlhttp2.onreadystatechange = resultado;
			 xmlhttp2.send(null);
		  }
	}
}
function muda_calendario(url,nome){
	div = nome;
	document.getElementById(div).innerHTML = carregando4;
	//var url = "paginas/calendario.asp?acao=mostrar&imagem="+mes
	xmlhttp2.open("POST", "paginas/"+url, true);
	xmlhttp2.onreadystatechange = resultado;
	xmlhttp2.send(null);
}
function buscar(curso) {
			div = 'result'
			document.getElementById(div).innerHTML = carregando2;
			var campo =escape(document.getElementById('campo').value)
			xmlhttp2.open("GET", "paginas/planos.asp?curso="+curso+"&acao=plano&busca=sim&campo="+campo, true);
			xmlhttp2.onreadystatechange = resultado;
			xmlhttp2.send(null);
}
var administracao = 'administracao'
var direito = 'direito'
var sistemas_de_informacao = 'sistemas_de_informacao'
var turismo = 'turismo'