	function Aleatorio(){
				aleat = Math.random() * 5000;
				aleat = Math.round(aleat);
				return aleat;
	}

	function mudaCor(identifica,tipo){
		if(tipo == 1){
			document.getElementById(identifica).style.backgroundColor = '#000000';
		} else {
			document.getElementById(identifica).style.backgroundColor = '';
		}
	}

	function mudaCorVar(identifica,tipo,cor){
		if(tipo == 1){
			document.getElementById(identifica).style.backgroundColor = cor;
		} else {
			document.getElementById(identifica).style.backgroundColor = cor;
		}
	}

function navegacaoIndex() {
	var variaveis = document.location.href.split("#");

	if(variaveis[1]) {
		var novavar = variaveis[1].split("/");
		var url = "",param = "", pag = 1;

		if(novavar[0] == "termos") {
			param = "termos.html";
		} else if (novavar[0] == "fale-conosco") {
			param = "";
		} else if (novavar[0] == "area") {
			if(isNaN(novavar[3])) {
				param = novavar[1]+"/"+novavar[2]+"/"+novavar[3]+".html";
			} else {
				param = novavar[1]+"/"+novavar[2]+"/"+novavar[3]+"/"+novavar[4]+".html";
			}
		} else if (novavar[0] == "download") {
				param = novavar[1]+"/"+novavar[2]+"/"+novavar[3]+"/"+novavar[4]+".html";
		} else {
			param = "";
		}	
		window.open('/index.php/'+param,'_self');
	}
}

function mudaCorEps(identifica,tipo){
	if(tipo == 1){
		document.getElementById("a"+identifica).style.backgroundColor = '#F0F0F0';
		document.getElementById("b"+identifica).style.backgroundColor = '#F0F0F0';
		document.getElementById("c"+identifica).style.backgroundColor = '#F0F0F0';
		document.getElementById("d"+identifica).style.backgroundColor = '#F0F0F0';
	} else {
		document.getElementById("a"+identifica).style.backgroundColor = '';
		document.getElementById("b"+identifica).style.backgroundColor = '';
		document.getElementById("c"+identifica).style.backgroundColor = '';
		document.getElementById("d"+identifica).style.backgroundColor = '';
	}
}
function mudaCorDownEps(identifica,tipo){
	if(tipo == 1){
		document.getElementById("d_a"+identifica).style.backgroundColor = '#FFFFFF';
		document.getElementById("down_local_"+identifica).style.backgroundColor = '#FFFFFF';
		document.getElementById("d_b"+identifica).style.backgroundColor = '#FFFFFF';
		document.getElementById("d_c"+identifica).style.backgroundColor = '#FFFFFF';
	} else {
		document.getElementById("d_a"+identifica).style.backgroundColor = '';
		document.getElementById("down_local_"+identifica).style.backgroundColor = '';
		document.getElementById("d_b"+identifica).style.backgroundColor = '';
		document.getElementById("d_c"+identifica).style.backgroundColor = '';
	}
}

	function download(url) {
		var nomeDown = "nmOn" + url;
		var nomeDownOff = "nmOff" + url;
		var local = "down_" + url;
		var localDown = "down_local_" + url;
		if(url != '') {
			var XMLHTTP;
			if (window.XMLHttpRequest) {

				// code for IE7+, Firefox, Chrome, Opera, Safari
				XMLHTTP=new XMLHttpRequest();

			} else if (window.ActiveXObject) {

			  // code for IE6, IE5
			  XMLHTTP=new ActiveXObject("Microsoft.XMLHTTP");

		  } else {

			  alert("Sem suporte a XMLHTTP!");

		  }

			XMLHTTP.onreadystatechange=function()	{
				if(XMLHTTP.readyState==4)  {

					document.getElementById(""+nomeDown+"").style.display = 'none';
					document.getElementById(""+nomeDownOff+"").style.display = '';
					document.getElementById(""+local+"").style.display = '';
					document.getElementById(""+localDown+"").innerHTML = XMLHTTP.responseText;

				} else {
					document.getElementById(""+nomeDown+"").style.display = 'none';
					document.getElementById(""+nomeDownOff+"").style.display = '';
					document.getElementById(""+local+"").style.display = '';
					document.getElementById(""+localDown+"").innerHTML = "<div id=\"carregando\">AGUARDE... CARREGANDO... </div>";

				}
			}

			XMLHTTP.open("GET",URL_ROOT_SITE+"/includes/links.php?p="+url+"&aleat="+Aleatorio(),true);
			XMLHTTP.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate");
			XMLHTTP.setRequestHeader("Cache-Control", "post-check=0, pre-check=0");
			XMLHTTP.setRequestHeader("Pragma", "no-cache");
			XMLHTTP.send(null);
		}
	}
	
	function fechaDownload(url){
		var nomeDown = "nmOn" + url;
		var nomeDownOff = "nmOff" + url;
		var local = "down_" + url;
		document.getElementById(""+nomeDown+"").style.display = '';	
		document.getElementById(""+nomeDownOff+"").style.display = 'none';	
		document.getElementById(""+local+"").style.display = 'none';	
	}

	function validarContato(){
		//validar nome
		d = document.formmail;
		if(d.nome.value == ""){
			alert("O campo NOME deve ser preenchido!");
			d.nome.focus();
			return false;
		}
		if(d.email.value == ""){
			alert("O campo EMAIL deve ser preenchido!");
			d.email.focus();
			return false;
		}
		if(d.assunto.value == ""){
			alert("O campo ASSUNTO deve ser preenchido!");
			d.assunto.focus();
			return false;
		}
		if(d.msg.value == ""){
			alert("O campo MENSAGEM deve ser preenchido!");
			d.msg.focus();
			return false;
		}
	}

	function validarErro(){
		//validar nome
		d = document.formmail;
		if(d.email.value == ""){
			alert("O campo EMAIL deve ser preenchido!");
			d.email.focus();
			return false;
		}
		if(d.desc.value == ""){
			alert("O campo DESCRIÇÃO DO ERRO deve ser preenchido!");
			d.desc.focus();
			return false;
		}
	}
	function navegacao(url,param) {

		if(url != '') {
			var XMLHTTP;
			if (window.XMLHttpRequest) {

				// code for IE7+, Firefox, Chrome, Opera, Safari
				XMLHTTP=new XMLHttpRequest();

			} else if (window.ActiveXObject) {

			  // code for IE6, IE5
			  XMLHTTP=new ActiveXObject("Microsoft.XMLHTTP");

		  } else {

			  alert("Sem suporte a XMLHTTP!");

		  }
		
		if(url == "includes/temporada.php" || url == "includes/episodios.php" || url == "includes/obrigado.php") {
			url2 = URL_ROOT_SITE + "/" + url;
		} else {
			url2 = url;				
		}
		
			XMLHTTP.onreadystatechange=function()	{
				if(XMLHTTP.readyState==4)  {
					if(url == "includes/temporada.php" || url == "includes/episodios.php") {
						document.getElementById("temporadas").innerHTML = XMLHTTP.responseText;
					} else if(url == "includes/obrigado.php") {
						document.getElementById("agradeca").innerHTML = XMLHTTP.responseText;								
					} else {
						document.getElementById("centro").innerHTML = XMLHTTP.responseText;								
					}

				} else {
					if(url == "includes/temporada.php" || url == "includes/episodios.php") {
						document.getElementById("temporadas").innerHTML = "<div id=\"carregando\"><img src=\"/biblioteca/imagens/carregando.gif\" border=\"0\"><br>AGUARDE...</div>";
					} else if(url == "includes/obrigado.php") {
						document.getElementById("agradeca").innerHTML = "<div id=\"carregando\">AGUARDE...</div>";
					} else {
						document.getElementById("centro").innerHTML = "<div id=\"carregando\"><img src=\"/biblioteca/imagens/carregando.gif\" border=\"0\"><br>AGUARDE...</div>";
					}

				}
			}

			XMLHTTP.open("GET",url2+"?aleat="+Aleatorio()+"&"+param,true);
			XMLHTTP.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate");
			XMLHTTP.setRequestHeader("Cache-Control", "post-check=0, pre-check=0");
			XMLHTTP.setRequestHeader("Pragma", "no-cache");
			XMLHTTP.send(null);
		}
	}