// JavaScript Document
function menuHover(elemento){
	elemento.style.background = "url(imagens/bg_menu_hover.png) no-repeat";
	elemento.style.color = "#fff";
}
function menuOut(elemento){
	elemento.style.background = "url(imagens/bg_menu.png) no-repeat";
	elemento.style.color = "#666";
}
function linkMenu(url, elemento){
	window.open(url, "_parent");
	menuOut(elemento);
}

function limpaNome(){

	if(document.getElementById("nome").value == "Seu nome...")
		document.getElementById("nome").value = "";
}

function retornaNome(){
	if(document.getElementById("nome").value == "")
		document.getElementById("nome").value = "Seu nome...";
}

function limpaEmail(){
	if(document.getElementById("email").value == "Seu e-mail...")
		document.getElementById("email").value = "";
}

function retornaEmail(){
	if(document.getElementById("email").value == "")
		document.getElementById("email").value = "Seu e-mail...";
}

function validaNews(){
	if(document.getElementById("nome").value == "" || document.getElementById("nome").value == "Digite seu nome...")
		alert("Preencha o campo nome!");
	else
	{
	if(document.getElementById("email").value == "" || document.getElementById("email").value == "Digite seu e-mail...")
		alert("Preencha o campo email!");
		else
	return true;
	}
	return false;
}

function echeck() {

 		var str = document.getElementById("email").value;
		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		
		if (str.indexOf(at)==-1){
		   alert("Email Invalido!")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Email Invalido!")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		   alert("Email Invalido!")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		   alert("Email Invalido!")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		   alert("Email Invalido!")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		   alert("Email Invalido!")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		   alert("Email Invalido!")
		    return false
		 }

 		 return true					
}

function validaContato(){


	d = document.FormContato;
	if (d.nome.value == "")
	{
		alert("Preencha o campo Nome!");
		d.nome.focus();
		return false;	
	}
    
    if (d.ddd.value == "")
	{
		alert("Preencha o campo DDD!");
		d.ddd.focus();
		return false;	
	}
    
	if (d.telefone.value == "")
	{
		alert("Preencha o campo Telefone!");
		d.telefone.focus();
		return false;	
	}
    
    	if (d.estado.value == "")
	{
		alert("Preencha o campo Estado!");
		d.estado.focus();
		return false;	
	}
	
	
		var str = d.email.value;
		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		
		if (str.indexOf(at)==-1){
		   alert("Email Inválido!")
       	   d.email.focus();
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Email Inválido!")
       	   d.email.focus();
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		   alert("Email Inválido!")
       	   d.email.focus();
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		   alert("Email Inválido!")
       	   d.email.focus();
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		   alert("Email Inválido!")
       	   d.email.focus();
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		   alert("Email Inválido!")
       	   d.email.focus();
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		   alert("Email Inválido!")
       	   d.email.focus();
		    return false
		 }
		 
		 
    if (d.cidade.value == "")
	{
		alert("Preencha o campo Cidade!");
		d.cidade.focus();
		return false;	
	}
	

	if (d.assunto.value == "")
	{
		alert("Preencha o campo Assunto!");
		d.assunto.focus();
		return false;	
	}

	if (d.mensagem.value == "")
	{
		alert("Preencha o campo Mensagem!");
		d.mensagem.focus();
		return false;	
	}

	else
		return true;
	
}

function validaftp(){
	
	d = document.FormFtp;
	if (d.nome.value == "")
	{
		alert("Preencha o campo Nome!");
		d.nome.focus();
		return false;	
	}
    
    if (d.email.value == "")
	{
		alert("Preencha o campo E-mail!");
		d.email.focus();
		return false;	
	}

    if (d.receber.checked == "")
	{
		alert("Selecione a opção Desejo receber dados de acesso ao FTP ");
		d.receber.focus();
		return false;	
	}

	else
		return true;
}

function validaOrcamento(){


	d = document.FormOrcamento;
	if (d.nome.value == "")
	{
		alert("Preencha o campo Nome!");
		d.nome.focus();
		return false;	
	}
    
    if (d.ddd.value == "")
	{
		alert("Preencha o campo DDD!");
		d.ddd.focus();
		return false;	
	}
    
	if (d.telefone.value == "")
	{
		alert("Preencha o campo Telefone!");
		d.telefone.focus();
		return false;	
	}
    
    	if (d.empresa.value == "")
	{
		alert("Preencha o campo Empresa!");
		d.empresa.focus();
		return false;	
	}

    
    	if (d.impresso.value == "")
	{
		alert("Preencha o campo Tipo de impresso!");
		d.impresso.focus();
		return false;	
	}
	
	
		var str = d.email.value;
		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		
		if (str.indexOf(at)==-1){
		   alert("Email Inválido!")
       	   d.email.focus();
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Email Inválido!")
       	   d.email.focus();
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		   alert("Email Inválido!")
       	   d.email.focus();
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		   alert("Email Inválido!")
       	   d.email.focus();
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		   alert("Email Inválido!")
       	   d.email.focus();
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		   alert("Email Inválido!")
       	   d.email.focus();
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		   alert("Email Inválido!")
       	   d.email.focus();
		    return false
		 }
		 
		 
    if (d.discricao.value == "")
	{
		alert("Preencha o campo Discrição do impresso!");
		d.discricao.focus();
		return false;	
	}
	

	if (d.prazo.value == "")
	{
		alert("Preencha o campo Prazo de entrega!");
		d.prazo.focus();
		return false;	
	}

	if (d.quantidade.value == "")
	{
		alert("Preencha o campo Quantidade!");
		d.quantidade.focus();
		return false;	
	}

	else
		return true;
	
}
