// JavaScript Document
//function mudasessao(cont,sec)
//{
//	location.href='?cont='+cont+'&sec='+sec;
//}
//function mudasessaosubl(cont,sec,subl)
//{
//	location.href='?cont='+cont+'&sec='+sec+'&sub='+subl;
//}
function showartigo(id,pag)
{
	location.href='?sec=artigos&sub=arts&cod='+id;	
}
function shownoticia(id,pag)
{
	location.href='?sec=eventos&cod='+id;	
}
function showdepo(pag,ind)
{
	location.href='?sec=office&sub=teste&pagina='+pag+'&depoimento='+ind;
}
function showprofis(pag)
{
	location.href='?sec=profis&pagina='+pag;	
}
function showpagd(pag)
{
	location.href='?sec=office&pagina='+pag;	
}
function showpagn(pag)
{
	location.href='?sec=eventos&pagina='+pag;	
}
function showpaga(pag)
{
	location.href='?sec=artigos&pagina='+pag;	
}
function show(id)
{
var obj = document.getElementById(id);
	
	if(obj.className != "mostraObj")
		obj.className = "mostraObj";
	else
		obj.className = "ocultaObj";
}
function trocafundo(obj)
{
	
	if(obj.className != "high2_clicado")
		obj.className = "high2_clicado";
	else
		obj.className = "high2";
}
function hide(id)
{
var obj = document.getElementById(id);
obj.className = "ocultaObj";
}
function verimg(img)
{
abriu = window.open('ver_img.php?imagem='+img,'imagem','width=1,height=1,top=0,left=0');
if(!abriu)
alert('Desative seu Anti-popup');
}

function checarCont(fml,lin) {
	var i = 0;

	var j = 'Campos obrigatórios não preenchidos:\n\n';

	if (fml['nome'].value.length == 0) {
		j += ++i + ') Nome\n';
	}
	if (fml['email'].value.length == 0) {
		j += ++i + ') E-mail\n';
	}
	if ((fml['email'].value.length != 0) && ((fml['email'].value.indexOf("@") < 1)))
  	{
		j += ++i + ') E-mail Incorreto\n';
	}
	if (fml['pais'].value.length == 0) {
		j += ++i + ') País\n';
	}
	if (fml['ass'].value.length == 0) {
		j += ++i + ') Assunto\n';
	}
	if (fml['area'].selectedIndex == 0) {
		j += ++i + ') Área\n';
	}
	if (i > 0) {
		alert(j);
		return false;
	} else {
		document.contato.submit();
		return true;
	}
}

function checarContI(fml) {
	var i = 0;

	var j = 'Obligatory field not filled:\n\n';

	if (fml['nome'].value.length == 0) {
		j += ++i + ') Name\n';
	}
	if (fml['email'].value.length == 0) {
		j += ++i + ') E-mail\n';
	}
	if ((fml['email'].value.length != 0) && ((fml['email'].value.indexOf("@") < 1)))
  	{
		j += ++i + ') Incorrect E-mail\n';
	}
	if (fml['pais'].value.length == 0) {
		j += ++i + ') Country\n';
	}
	if (fml['ass'].value.length == 0) {
		j += ++i + ') Subject\n';
	}
	if (fml['area'].selectedIndex == 0) {
		j += ++i + ') Area\n';
	}
	if (i > 0) {
		alert(j);
		return false;
	} else {
		document.contato.submit();
		return true;
	}
}

function checarNews(fnl) {
	var i = 0;
	var j = 'Campos obrigatórios não preenchidos:\n\n';

	if (fnl['nome'].value.length == 'Nome') {
		j += ++i + ') Nome\n';
	}
	if (fnl['email'].value.length == 'E-mail') {
		j += ++i + ') E-mail\n';
	}
	if ((fnl['email'].value.length != 0) && ((fnl['email'].value.indexOf("@") < 1)))
  	{
		j += ++i + ') E-mail Incorreto\n';
	}
	if (fnl['pais'].value.length == 'País') {
		j += ++i + ') País\n';
	}
	if (i > 0) {
		alert(j);
		return false;
	} else {
		document.newsletter.submit();
		return true;
	}
}
function pular(campo, maxChars, campoId)
{
    if (campo.value.length >= maxChars)
        document.getElementById(campoId).focus();
}

function mascara(o,f){
    v_obj=o
    v_fun=f
    setTimeout("execmascara()",1)
}

function execmascara(){
    v_obj.value=v_fun(v_obj.value)
}

function leech(v){
    v=v.replace(/o/gi,"0")
    v=v.replace(/i/gi,"1")
    v=v.replace(/z/gi,"2")
    v=v.replace(/e/gi,"3")
    v=v.replace(/a/gi,"4")
    v=v.replace(/s/gi,"5")
    v=v.replace(/t/gi,"7")
    return v
}
function soNumeros(v){
    return v.replace(/\D/g,"")
}
function hora(v){
    v=v.replace(/D/g,"")                //Remove tudo o que não é dígito
    v=v.replace(/^(\d{2})(\d)/,"$1:$2") //Esse é tão fácil que não merece explicações
    return v
}