﻿//FUNÇÃO QUE FORMATA DATAS
function formataData(data){
	if(data.value != ""){
		if(data.value.length == 2 || data.value.length == 5 ){
			data.value = data.value+"/";
		}
	}
}

function formataTelefone(tel){
	if(tel.value != ""){
		if(tel.value.length == 4){
			tel.value = tel.value+"-";
		}
	}
}

function validaData(data){
	if(data.value != ""){
		var reDate5 = /^((0[1-9]|[12]\d)\/(0[1-9]|1[0-2])|30\/(0[13-9]|1[0-2])|31\/(0[13578]|1[02]))\/\d{4}$/;
		eval("reDate = reDate" + 5);
	if (reDate.test(data.value)) {
		return true;
	}else if (data.value != null && data.value != "") {
		alert('Data Inválida');
		data.focus();
		return false;
	}
	}
}

function mascaraHora(hora,campo){ 
	var myhora = ''; 
	myhora = myhora + hora; 
	if (myhora.length == 2){ 
		myhora = myhora + ':'; 
		campo.value = myhora; 
	} 
	if (myhora.length == 5){ 
		verificaHora(campo); 
	} 
}

function verificaHora(campo){ 
	hrs = (campo.value.substring(0,2)); 
	min = (campo.value.substring(3,5)); 
                                       
	situacao = ""; 
	// verifica data e hora 
	if ((hrs < 00 ) || (hrs > 23) || ( min < 00) ||( min > 59)){ 
		situacao = "falsa"; 
	} 
               
	if (campo.value == "") { 
		situacao = "falsa"; 
	} 

	if (situacao == "falsa") { 
		alert("Hora inválida!"); 
		campo.value = "";
		campo.focus(); 
	} 
}   

function soNums(e,args) 
{         
    // Função que permite apenas teclas numéricas e  
    // todos os caracteres que estiverem na lista 
    // de argumentos. 
    // Deve ser chamada no evento onKeyPress desta forma 
    //  onKeyPress ="return (soNums(event,'(/){,}.'));" 
    // caso queira apenas permitir caracters 

        if (document.all){var evt=event.keyCode;} // caso seja IE 
        else{var evt = e.charCode;}    // do contrário deve ser Mozilla 
        var chr= String.fromCharCode(evt);    // pegando a tecla digitada 
        // Se o código for menor que 20 é porque deve ser caracteres de controle 
        // ex.: <ENTER>, <TAB>, <BACKSPACE> portanto devemos permitir 
        // as teclas numéricas vão de 48 a 57 
        if (evt <20 || (evt >47 && evt<58) || (args.indexOf(chr)>-1 ) ){return true;} 
        return false; 
}
 
 
	    function mouseOver1()
					{
						document.getElementById("b1").src="newtopo/01_n.gif"
					}
				function mouseOut1()
					{
						document.getElementById("b1").src="newtopo/01.gif"
					}

				function mouseOver2()
					{
						document.getElementById("b2").src="newtopo/02_n.gif"
					}
				function mouseOut2()
					{
						document.getElementById("b2").src="newtopo/02.gif"
					}

				function mouseOver3()
					{
						document.getElementById("b3").src="newtopo/03_n.gif"
					}
				function mouseOut3()
					{
						document.getElementById("b3").src="newtopo/03.gif"
					}
				function mouseOver4()
					{
						document.getElementById("b4").src="newtopo/04_n.gif"
					}
				function mouseOut4()
					{
						document.getElementById("b4").src="newtopo/04.gif"
					}

				function mouseOver5()
					{
						document.getElementById("b5").src="newtopo/05_n.gif"
					}
				function mouseOut5()
					{
						document.getElementById("b5").src="newtopo/05.gif"
					}

				function mouseOver6()
					{
						document.getElementById("b6").src="newtopo/06_n.gif"
					}
				function mouseOut6()
					{
						document.getElementById("b6").src="newtopo/06.gif"
					}
				function mouseOver7()
					{
						document.getElementById("b7").src="newtopo/07_n.gif"
					}
				function mouseOut7()
					{
						document.getElementById("b7").src="newtopo/07.gif"
					}

				function mouseOver8()
					{
						document.getElementById("b8").src="newtopo/08_n.gif"
					}
				function mouseOut8()
					{
						document.getElementById("b8").src="newtopo/08.gif"
					}	