//função de compra
function comprar(url)
{
	if(logado==0)
	{
		var docUrl = document.getElementById('txtUrl');
		docUrl.value = url;
		var login = document.getElementById('telaLogin');
		login.style.display = '';
		var fundo = document.getElementById("fundo");
		fundo.style.display = '';
		var larg = screen.width/2 - 300;
		var alt = screen.height/2 - 270;
		login.style.top = alt;
		login.style.left = larg;
	}
	else
	{
		//alert('ATENÇÃO !  Para montar seu FotoPresente ou FotoLivro você estará saindo do ambiente da Revelaweb, todo esse procedimento é feito dentro do ambiente DIGIPIX!');
		urlGlobal = url;
		abrePop(urlGlobal);					//ajax('inc/login2.php','','POST','url='+encodeURI(url)+'&txtEmail='+encodeURI(document.getElementById('login').value));
		
		
		//document.location.href = url;	
	}
}

function contatoEnvia()
{
	var contatoNome = document.getElementById('contatoNome').value;
	var contatoEmail = document.getElementById('contatoEmail').value;
	var contatoDDD = document.getElementById('contatoDDD').value;
	var contatoTelefone = document.getElementById('contatoTelefone').value;
	var contatoAssunto = document.getElementById('contatoAssunto').value;
	var contatoPedido = document.getElementById('contatoPedido').value;
	var contatoMsg = document.getElementById('contatoMsg').value;
	/* var contatoCaptcha = document.getElementById('captcha_code').value; */
	
	var erro = "";
	if(contatoNome=='')
	{
		erro = "- Preencha o nome!\n";	
	}
	if(contatoEmail=='')
	{
		erro += "- Preencha o Email!\n";	
	}
	if(contatoDDD=='')
	{
		erro += "- Preencha o DDD!\n";	
	}
	if(contatoTelefone=='')
	{
		erro += "- Preencha o Telefone!\n";	
	}
	if(contatoAssunto=='')
	{
		erro += "- Preencha o Assunto!\n";	
	}

	if(contatoMsg=='')
	{
		erro += "- Preencha a Mensagem!\n";	
	}
	
	if(erro!='')
	{
		alert(erro);	
	}
	else
	{
	   ajax('inc/contato.php','contatoMsg1','POST','contatoNome='+encodeURI(contatoNome)+'&contatoEmail='+encodeURI(contatoEmail)+'&contatoDDD='+encodeURI(contatoDDD)+'&contatoTelefone='+encodeURI(contatoTelefone)+'&contatoAssunto='+encodeURI(contatoAssunto)+'&contatoPedido='+encodeURI(contatoPedido)+'&contatoMsg='+encodeURI(contatoMsg));
		/* ajax('inc/contato.php','contatoMsg1','POST','contatoNome='+encodeURI(contatoNome)+'&contatoEmail='+encodeURI(contatoEmail)+'&contatoDDD='+encodeURI(contatoDDD)+'&contatoTelefone='+encodeURI(contatoTelefone)+'&contatoAssunto='+encodeURI(contatoAssunto)+'&contatoPedido='+encodeURI(contatoPedido)+'&contatoMsg='+encodeURI(contatoMsg)+'&contatoCaptcha='+encodeURI(contatoCaptcha)); */
	}
}

function depoimento()
{
	var nome = document.getElementById('depoimentoNome').value;
	var desc = document.getElementById('depoimentoTexto').value;
	var erro = "";
	if(nome=='')
	{
		erro = "- Preencha o nome!\n";	
	}
	if(desc=='')
	{
		erro += "- Preencha o Depoimento!\n";	
	}
	
	if(erro!='')
	{
		alert(erro);	
	}
	else
	{
		ajax('inc/depoimento.php','depoimentoMsg','POST','txtNome='+encodeURI(nome)+'&txtDesc='+encodeURI(desc));
	}
}

function abrePop(url)
{
	window.open(url,'digipixPop','width=950,height=600,scrollbars=yes');
}

function comprarFechar()
{
	var login = document.getElementById('telaLogin');
	login.style.display = 'none';
	var fundo = document.getElementById("fundo");
	fundo.style.display = 'none';
}



function esqueci()
{
	var elemento = document.getElementById('loginJaCadastradoBox').style.display;
	if(elemento=='none')
	{
		document.getElementById('loginJaCadastradoBox').style.display = '';
		document.getElementById('loginJaCadastradoBoxEsqueci').style.display = 'none';		
	}
	else
	{
		document.getElementById('loginJaCadastradoBox').style.display = 'none';
		document.getElementById('loginJaCadastradoBoxEsqueci').style.display = '';
	}	
}

function makeLogin() {
  var email = document.getElementById('txtEmail').value;
  var password = document.getElementById('txtPassword').value;
  var url = document.getElementById('txtUrl').value;
  err = '';
	if (email.length < 1 || email == 'seu e-mail'){ 
		err+='\n- Entre com o seu e-mail.';
		erro=true;
	}
	if (password.length < 1 || password == 'sua senha'){ 
		err+='\n- Entre com a sua senha.';
		erro=true;
	}

	 
  if (err.length > 0) {
      alert('Por Favor, verifique os seguintes erros: '+err);
  } else {
      ajaxLogin('inc/login.php','erroLogin','POST','url='+encodeURI(url)+'&txtEmail='+email+'&txtPassword='+encodeURI(password),email,password);
	  
  } 
}

function makeEsqueciSenha() {
  var email = document.getElementById('txtEmail2').value;
  err = '';
	if (email.length < 1 || email == 'seu e-mail'){ 
		err+='\n- Entre com o seu e-mail.';
		erro=true;
	}

	 
  if (err.length > 0) {
      alert('Por Favor, verifique os seguintes erros: '+err);
  } else {
      ajax('inc/esqueciSenha.php','erroEsqueciSenha','POST','txtEmail='+encodeURI(email));
  } 
}

function aviso()
{
	var larg = screen.width/2 - 150;
	var alt = screen.height/2 - 75;
	var aviso = document.getElementById('aviso');
	var fundo = document.getElementById("fundo");
	aviso.style.top = alt;
	aviso.style.left = larg;
	if(aviso.style.display=='none')
	{
		aviso.style.display = '';
		fundo.style.display = '';
	}
	else
	{
		aviso.style.display = 'none';
		fundo.style.display = 'none';
	}
}



//

