function validabusca() {
	if( document.fbusca.palavra.value == "O QUE VOCÊ PROCURA?") {
       erro('Informe o que deseja encontrar');
	   return false;
   }
}
function validar() {
	if( document.formr.nomerecado.value == "Seu Nome") {
       erro('Informe o seu nome para deixar um recado');
	   return false;
   }
	if( document.formr.emailrecado.value == "E-mail") {
       erro('Informe o seu e-mail');
	   return false;
   }
	if( document.formr.conteudo.value == "") {
       erro('Informe o seu e-mail');
	   return false;
   }
}
function validanuncio() {
   if( document.anuncio.nome.value == "") {
       erro('Informe seu nome completo');
	   return false;
   }
   if( document.anuncio.email.value == "") {
       erro('Informe o seu e-mail');
	   return false;
   }
   if( document.anuncio.email.value.search(/^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/) == -1) {
       erro('O e-mail informado não é válido');
	   return false;
   }
   if( document.anuncio.fone.value == "") {
       erro('Informe o seu telefone');
	   return false;
   }
   if( document.anuncio.nproduto.value == "") {
       erro('Informe ao menos o nome do produto que deseja vender');
	   return false;
   }
}
function validapremio() {
   if( document.premios.nome.value == "") {
       erro('Informe seu nome completo');
	   return false;
   }
   if( document.premios.email.value == "") {
       erro('Informe o seu e-mail');
	   return false;
   }
   if( document.premios.email.value.search(/^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/) == -1) {
       erro('O e-mail informado não é válido');
	   return false;
   }
   if( document.premios.cpf.value == "") {
       erro('Informe o seu CPF');
	   return false;
   }
   if( document.premios.fone.value == "") {
       erro('Informe o seu telefone');
	   return false;
   }
}
function validapub() {
   if( document.publicidade.arquivo.value == "") {
       erro('Insira uma logomarca');
	   return false;
   }
	if( document.publicidade.categoria.value == "") {
       erro('Informe uma categoria para está empresa');
	   return false;
   }
   if( document.publicidade.empresa.value == "") {
       erro('Insira o nome desta empresa');
	   return false;
   }
}
function validapub2() {
	if( document.publicidade.categoria.value == "") {
       erro('Informe uma categoria para está empresa');
	   return false;
   }
   if( document.publicidade.empresa.value == "") {
       erro('Insira o nome desta empresa');
	   return false;
   }
}
function validacat() {
   if( document.categorias.nomecategoria.value == "") {
       erro('Insira um nome para está categoria');
	   return false;
   }
}
function validalogin() {
   if( document.login.login.value == "") {
       erro('Informe seu login');
	   return false;
   }
   if( document.login.senha.value == "") {
       erro('Informe uma senha');
	   return false;
   }
}
function validacontato() {
   if( document.contato.nome.value == "* Seu Nome") {
       erro('Informe o seu nome');
       return false;
   }
   if( document.contato.email.value == "* E-mail") {
       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 == "* Assunto") {
       erro('Informe o assunto do contato');
       return false;
   }
   if( document.contato.fone.value == "* Telefone") {
       erro('Informe o assunto do contato');
       return false;
   }
   if( document.contato.msg.value == "* Mensagem") {
       erro('Por favor, descreva a mensagem do contato');
       return false;
   }
}
function validauser() {
	if( document.user.nomeuser.value == "") {
       erro('Informe um nome para este usuário');
	   return false;
   }
   if( document.user.loginuser.value == "") {
       erro('Informe um login para este usuário');
	   return false;
   }
   if( document.user.senhauser.value == "") {
       erro('Informe uma senha para este usuário');
	   return false;
   }
   if( document.user.emailuser.value == "") {
       erro('Informe um e-mail para contato');
	   return false;
   }
   if( document.user.emailuser.value.search(/^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/) == -1) {
       erro('Informe um e-mail válido');
	   return false;
   }
   if( document.user.niveluser.value == "") {
       erro('Selecione um nível para este usuário');
	   return false;
   }
   if( document.user.rua.value == "") {
       erro('Informe o endereço');
	   return false;
   }
   if( document.user.bairro.value == "") {
       erro('Informe o bairro');
	   return false;
   }
   if( document.user.cidade.value == "") {
       erro('Informe a cidade');
	   return false;
   }
   if( document.user.estado.value == "") {
       erro('Informe o estado');
	   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 inseresmile(string) {
    document.formr.conteudo.value = document.formr.conteudo.value + " " + string + " ";
    document.formr.conteudo.focus();
}
