function validacontato() {
   if( document.contato.nome.value == "") {
       erro('Informe o seu nome');
       return false;
   }
   if( document.contato.email.value == "") {
       erro('Informe seu email para contato');
       return false;
   }
   if( document.contato.email.value.search(/^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/) == -1) {
       erro('O e-mail informado não é válido');
	   return false;
   }
   if( document.contato.assunto.value == "") {
       erro('Informe o assunto do contato');
       return false;
   }
   if( document.contato.fone.value == "") {
       erro('Informe o assunto do contato');
       return false;
   }
   if( document.contato.cidade.value == "") {
       erro('Informe a sua cidade');
       return false;
   }
   if( document.contato.mensagem.value == "") {
       erro('Por favor, descreva a mensagem do contato');
       return false;
   }
}
function validaorcamento() {
   if( document.orcamento.nome.value == "") {
       erro('Informe o seu nome');
       return false;
   }
   if( document.orcamento.email.value == "") {
       erro('Informe seu email para orçamento');
       return false;
   }
   if( document.orcamento.email.value.search(/^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/) == -1) {
       erro('O e-mail informado não é válido');
	   return false;
   }
   if( document.orcamento.fone.value == "") {
       erro('Informe o assunto do orçamento');
       return false;
   }
   if( document.orcamento.mensagem.value == "") {
       erro('Por favor, descreva o que deseja orçar');
       return false;
   }
}
function erro(msg) {
$(document).ready(function() { 
	$.blockUI({ message: "<div id='msgalerta'><img src='img/atencao.png' width='64' height='64' alt='Ok' /><div id='tmsg'>"+msg+"...</div></div>", css: { width: '100%', left: '-3px' } });  
	setTimeout($.unblockUI, 2000);
    }); 
}
function error(msg, volta) {
$(document).ready(function() { 
	$.blockUI({ message: "<div id='msgalerta'><img src='img/atencao.png' width='64' height='64' alt='Ok' /><div id='tmsg'>"+msg+"...</div></div>", css: { width: '100%', left: '-3px' } });  
	setTimeout($.unblockUI, 2000);
	setTimeout("location.href='"+volta+"'",2400);
    }); 
}
function ok(msg, volta) {
$(document).ready(function() { 
	$.blockUI({ message: "<div id='msgalerta'><img src='img/ok.png' width='64' height='64' alt='Ok' /><div id='tmsg'>"+msg+"...</div></div>", css: { width: '100%', left: '-3px' } });  
	setTimeout($.unblockUI, 2000);
	setTimeout("location.href='"+volta+"'",2400);
    }); 
}
function confirmaDel(link){
	if(confirm("Tem certeza que deseja remover está informação?")){
	location.href=''+link+'';
	}
}
function PopUpCentralizado(nomepagina, titulopagina, w, h, scroll) {
 var winl = (screen.width - w) / 2;
 var wint = (screen.height - h) / 2;
  winprops = 'height=' + h + ', width = ' + w + ', top = ' + wint + ', left = ' + winl + ', scrollbars = ' + scroll + ', location=no, status=no';
  win = window.open(nomepagina, titulopagina, winprops);
  if (parseInt(navigator.appVersion)  >= 4) {
      win.window.focus();
  }
}
function SomenteNumero(e){
    var tecla=(window.event)?event.keyCode:e.which;   
    if((tecla>47 && tecla<58)) return true;
    else{
    	if (tecla==8 || tecla==0) return true;
	else  return false;
    }
}
function vsenha() {
	ns1 = document.pass.novasenha.value;
	ns2 = document.pass.novasenha2.value;
	if(ns1==ns2){
		$('span#ok').show();
		$('span#erro').hide();
	} else {
		$('span#erro').show();
		$('span#ok').hide();
	}
}
function offon(id) {
	var el = document.getElementById(id);
	el.style.display = (el.style.display=="") ? "none" : "";
}
