
// JavaScript Document
function valida_dados(nomeform)
{
	if((nomeform.nome.value=="") || 
	   (nomeform.email.value=="") ||
	   (nomeform.assunto.value=="") ||
	   (nomeform.mensagem.value==""))
	{
		alert("Olá!\nTodos os campos devem ser preenchidos.");	
		return false;
	}
	//alert("Passei aqui!");
	if ((nomeform.email.value.indexOf('@',0)== -1) || 
	    (nomeform.email.value.indexOf('.',0)== -1))
	{
		alert("Por favor, digite um e-mail válido.");
		return false;
	}
	return true;
	
}

function valida_dadosContato()
{
	if(($('nome').value=="") || 
	   ($('email').value=="") ||
	   ($('assunto').value=="") ||
	   ($('mensagem').value==""))
	{
		alert("Olá!\nTodos os campos devem ser preenchidos.");	
		return false;
	}
	//alert("Passei aqui!");
	if (($('email').value.indexOf('@',0)== -1) || 
	    ($('email').value.indexOf('.',0)== -1))
	{
		alert("Por favor, digite um e-mail válido.");
		return false;
	}
	
	igoal_submitForm('contato','page_contato.php')
	return false;
	
}

function valida_dadosPedido()
{
	if(($('nome').value=="") || 
	   ($('email').value=="") ||
	   ($('produto').value=="") || 
	   ($('mensagem').value==""))
	{
		alert("Olá!\nTodos os campos devem ser preenchidos.");	
		return false;
	}
	
	if (($('email').value.indexOf('@',0)== -1) || 
	    ($('email').value.indexOf('.',0)== -1))
	{
		alert("Por favor, digite um e-mail válido.");
		return false;
	}
	
	var theURL = "page_loja.php?pedido=2&imagem=" +  $('hd_imagem').value  + "&assunto=" + $('hd_assunto').value; 
	igoal_submitForm('contato',theURL);
	return false;
	
}

function valida_dadosCadastro()
{
if(($('nome').value=="") || 
	   ($('email').value=="") || ($('sl_categorias').value=="") ||
		((!$('rd_fem').checked) && (!$('rd_masc').checked)))  
	{
		alert("Olá!\nTodos os campos obrigatórios devem ser preenchidos.");	
		return false;
	}
	
	//alert("Passei aqui!");
	if (($('email').value.indexOf('@',0)== -1) || 
	    ($('email').value.indexOf('.',0)== -1))
	{
		alert("Por favor, digite um e-mail válido.");
		return false;
	}
	

	igoal_submitForm('cadastro','page_cadastro.php');

	return false;
	
}

function valida_dadosCadastroComSenha()
{
	if(($('nome').value=="") || 
	   ($('email').value=="") || ($('cidade').value=="") ||
	   ($('resenha').value=="") || ($('senha').value=="") ||
	   ($('sobrenome').value==""))
	{
		alert("Olá!\nVocê não preencheu todos os campos obrigatórios.");	
		return false;
	}
	//alert("Passei aqui!");
	if (($('email').value.indexOf('@',0)== -1) || 
	    ($('email').value.indexOf('.',0)== -1))
	{
		alert("Por favor, digite um e-mail válido.");
		return false;
	}
	
	if ($('senha').value != $('resenha').value )
	{
		alert("Os campos 'Senha' e 'Confirme sua senha' devem conter valores iguais!");
		$('senha').value = $('resenha').value = "";
		return false;
	}

	
	igoal_submitForm('cadastro','ff_cadastro.php')
	return false;
	
}

function valida_campoEmail()
{
	if(($('email').value==""))
	{
		alert("Olá!\nVocê não preencheu o campo do e-mail.");	
		return false;
	}
	//alert("Passei aqui!");
	if (($('email').value.indexOf('@',0)== -1) || 
	    ($('email').value.indexOf('.',0)== -1))
	{
		alert("Por favor, digite um e-mail válido.");
		return false;
	}
	
	igoal_submitForm('recupera','valida_email.php')
	return false;
	
}

function valida_campoEmailAtivar()
{
	if(($('email').value==""))
	{
		alert("Olá!\nVocê não preencheu o campo do e-mail.");	
		return false;
	}
	//alert("Passei aqui!");
	if (($('email').value.indexOf('@',0)== -1) || 
	    ($('email').value.indexOf('.',0)== -1))
	{
		alert("Por favor, digite um e-mail válido.");
		return false;
	}
	
	igoal_submitForm('recupera','valida_emailAtivar.php')
	return false;
	
}

function sql_saveCadastro()
{

	var xForm = $('save_Message');
	if(xForm.value>0) 
	{ 
	  alert('Seus cadastro foi efetuado com sucesso! \nEm breve você receberá um e-mail de confirmação. \nObrigado.');
  	  if($('modulo').value == 'papaz') getHTMLDiv('areacontent','login.php','modulo=papaz');

	}
	if(xForm.value==0) alert('Não foi efetuar seu cadastro. Por favor, tente novamente ou entre em contato conosco no e-mail contato@derosecampinas.com.br.');

}

function sql_recuperarSenha()
{

	var xForm = $('save_Message');
	if(xForm.value>0) 
	{ 
	  alert('Seus dados para se logar no Festas e Flagras foram enviados para o e-mail digitado.');
	  if($('modulo').value == 'papaz') getHTMLDiv('areacontent','login.php','modulo=papaz');
	}
	if(xForm.value==0) alert('Não foi possivel recuperar sua senha. Por favor, tente novamente ou entre em contato conosco no e-mail cadastro@festaseflagras.com.br.');

}



function msg_validaEmail()
{

	var xForm = $('save_Message');
	if(xForm.value>0) alert('Sua senha de acesso ao Festas e Flagras foi enviada para o e-mail digitado.');
	if(xForm.value==0) alert('O e-mail digitado não está cadastrado no Festas e Flagras. Tente novamente ou atualize seu cadastro no site. Obrigado.');

}

function sql_savePedido()
{
	var xForm = document.getElementById('save_Message');
	if(xForm.value>0) alert('Seu pedido foi enviado com sucesso!\nAguade em breve entraremos em contato!\nObrigado.');
	if(xForm.value==0) alert('Não foi possivel enviar o seu pedido!');

}

function sql_saveMessage()
{
	var xForm = document.getElementById('save_Message');
	if(xForm.value>0) alert('Sua mensagem foi enviada com sucesso!');
	if(xForm.value==0) alert('Não foi possivel enviar sua mensagem!');

}

function change_listaProdutos(theValue)
{
	 var pars = "categoria=" + theValue;
	getHTMLDiv('area_content','page_loja.php',pars);
	}
	
function change_bustaProdutos(theValue, theValue2)
{
	 var pars = "key=" + theValue + "&categoria="+ theValue2 ;
	getHTMLDiv('area_content','page_loja.php',pars);
}

function getPagePedido()
{
	var pars = "pedido=1&" + "assunto=" + $('hd_produto').value + "&imagem=" + $('hd_imagem').value;
	getHTMLDiv('area_content','page_loja.php',pars);
	}