// JavaScript Document

function redirect(L){
	window.location.href=L;
}

function vComentarios(){
	doc = document.fComentarios;
	msg = "Favor preencher corretamente!";
	if(doc.com_nome.value == ""){
		alert(msg);
		doc.com_nome.focus();
		return false;
	}
	if(doc.com_email.value == ""){
		alert(msg);
		doc.com_email.focus();
		return false;
	}
	if(doc.com_localidade.value == ""){
		alert(msg);
		doc.com_localidade.focus();
		return false;
	}
	if(doc.com_comentario.value == ""){
		alert(msg);
		doc.com_comentario.focus();
		return false;
	}
	return true;	
}

function charLimiter(elem, limit){
	var texto = elem.value;
	var pos = elem.value.length;
	var lim = limit;
	var dif = eval(lim - pos);

	if(dif <= 1){
	 	//alert("Você está atingindo o limite máximo de "+lim+" caracteres");  
		elem.value = texto.substr(0, lim);
		dif =0;
	}
	document.getElementById('labelPos').innerHTML = dif;
}


function streaming(V){
	window.open("streaming/index.php?video="+V,"STREAMING","toolbar=0,location=0,directories=0,scrollbars=0,width=640,height=420,left=10,top=10");
}

function showData(){
	var objData = new Date();
	var mes = objData.getMonth();
	var semana = objData.getDay();
	var dia = objData.getDate();
	var ano = objData.getFullYear();
	var hora= objData.getHours();
	arSemana = Array("Domingo","Segunda-feira","Terça-feira","Quarta-feira","Quinta-feira","Sexta-feira","Sábado");
	arMes = Array("Janeiro","Fevereiro","Março","Abril","Maio","Junho","Julho","Agosto","Setembro","Outubro","Novembro","Dezembro");
	if (dia < 10){dia = "0" + dia;}
	if (mes < 10){mes = "0" + mes;}
	if ((hora>=0)&&(hora<12)){var hora = "Bom dia! Médio Norte - ";}
	if ((hora>=12)&&(hora<18)){var hora = "Boa tarde! Médio Norte - ";}
	if ((hora>=18)&&(hora<24)){var hora = "Boa noite! Médio Norte - ";}
	document.write(hora + " " + arSemana[parseFloat(semana)] + ", " + dia + " de " + arMes[parseFloat(mes)] + " de " + ano);
}


function target_blank(P){
	window.open(P);
}

function target_self(P){
	window.location.href=P;
}



/////////////////////////

function slide(){
	
	if(N >= T){
		N = 0;
	}
	
	if(N < 0){
		N = T - 1;
	}
	
	var C = 1;
	for(C > 1; C <= T; C++){	
		if(document.getElementById("slide_" + C)){
			document.getElementById("slide_" + C).style.display = "none";
		}
	}
	N++;
	
	var ide = "slide_" + N;
	if(document.getElementById(ide)){
		var reg = 	document.getElementById(ide);
	}
	
	if(reg.style.display == ""){
		reg.style.display = "block";
	}else{
		reg.style.display = "";
	}
	
	I = setTimeout(slide, D);

}

function stopInterval(){
	clearInterval(I);	
}

function startInterval(){
	I = setTimeout(slide, D);
}

function slidePrior(){
	stopInterval();
	N = N - 2;
	slide();
}

function slideNext(){
	stopInterval();
	slide();
}