function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}

MM_reloadPage(true);

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

    function visivel(){
    if (document.getElementById('clicado').className == 'off') {
        document.getElementById('clicado').className = 'on';
    } else if (document.getElementById('clicado').className == 'on') {
        document.getElementById('clicado').className = 'off';
    }
}

function textOn(txt){
	document.getElementById(txt).className="textboxOn";
}

function textNormal(txt){
	document.getElementById(txt).className="textbox";
}

function textArea(txt){
	document.getElementById(txt).className="txtArea";
}

function textAreaOn(txt){
	document.getElementById(txt).className="textAreaOn";
}


    
    
  /* VALIDACAO CONTATO */
function loadFunctions() {
	validaContato();
}
window.onload = loadFunctions;

function validaContato() {
	if(document.getElementById('nome')) {
		var fieldNome = document.getElementById('nome');
		var fieldEmail = document.getElementById('email');
		var fieldAssunto = document.getElementById('assunto');
		var fieldMsg = document.getElementById('mensagem');
		var btn = document.getElementById('btnEnviar');
		
		btn.onclick = function() {
			if(fieldNome.value == "" || fieldNome.value == "Insira seu nome aqui!") {
				erro('nome','Insira seu nome aqui!','fieldNome');
				return false;
			}
			
			if(fieldEmail.value == "" || fieldNome.value == "Insira seu e-mail aqui!") {
				erro('email','Insira seu e-mail aqui!','fieldEmail');
				return false;
			}
			
			confEmail = validaEmail(fieldEmail.value);
			
			if(!confEmail) {
				erro('email','Digite um e-mail valido!.','fieldEmail');
				return false;
			}
			
			if(fieldAssunto.value == "" || fieldAssunto.value == "Insira o assunto aqui!") {
				erro('assunto','Insira o assunto aqui!','fieldNome');
				return false;
			}
			
			
			if(fieldMsg.value == "" || fieldMsg.value == "Insira uma mensagem aqui.") {
				erroText('mensagem','Insira uma mensagem aqui.','fieldMsg');
				return false;
			}
			return true;
		}
	}
}

function erro(reference,msgToUser,field) {
	var refer = document.getElementById(reference);
	refer.value = msgToUser;
	refer.focus();
}

function erroText(reference,msgToUser,field) {
	var referText = document.getElementById(reference);
	referText.value = msgToUser;
	referText.focus();
}

function validaEmail(email){
	return email.search(/(\w[\w\.\+]+)@(.+)\.(\w+)$/)==0;
}



