/*mostra div do menu marcas*/

function mostrar_menu (div,valor){    
    if (valor == "1"){
        document.getElementById(div).style.display = "block";
		document.getElementById("menu_marca").style.backgroundColor = "#f2f2f2";
    }else{
        document.getElementById(div).style.display = "none";
		document.getElementById("menu_marca").style.backgroundColor = "#ffffff";
    }
}



function ativado(id){

	document.getElementById(id).src="imagens/logos_marcas/"+id+"_ativo.gif";	

}



function desativado(id){

	document.getElementById(id).src="imagens/logos_marcas/"+id+".gif";	

}



///////////////////////////////////////////////////////////////////


/*
#######################################################################
#validacoes de login
#######################################################################
*/
function valida_login(e){
	if($(this).val() != ""){
		$.post('buscas_cadastro.php',
			{ email : $(this).val(), acao: "login" },
			function(resposta){
			$('#erro_login').fadeOut('slow', function() {
				$('#erro_login').html(resposta).fadeIn('slow');
				setTimeout("$('#erro_login').fadeOut('slow');", 4000);
			});
		});
	}
}

function valida_login_2(e){
	$("#erro_login_2").show().html("<img src=\"imagens/ajax-loader.gif\"/>");
	if($(this).val() != ""){
		$.post('buscas_cadastro.php',
			{ email : $(this).val(), acao: "login" },
			function(resposta){
				$('#erro_login_2').fadeOut('slow', function() {
				$('#erro_login_2').html(resposta).fadeIn('slow');
				setTimeout("$('#erro_login_2').fadeOut('slow');", 4000);
			});
		});
	} else {
		$("#erro_login_2").show().html("");	
	}
}

function valida_login_3(e){
	$("#novo_erro_logar").show().html("<img src=\"imagens/ajax-loader.gif\"/>");
	if($(this).val() != ""){
		$.post('buscas_cadastro.php',
			{ email : $(this).val(), acao: "login" },
			function(resposta){
			$('#novo_erro_logar').fadeOut('slow', function() {
				$('#novo_erro_logar').html(resposta).fadeIn('slow');
				setTimeout("$('#novo_erro_logar').fadeOut('slow');", 4000);
			});
		});
	}
}


/*
#######################################################################
#validacoes de senhas
#######################################################################
*/
function valida_senha(e){
	if($(this).val() != "" + $("input[@name=login]").val() != ""){
		$.post('buscas_cadastro.php',
			{ senha : $(this).val(), email: $("input[@name=login]").val(), acao: "senha" },
			function(resposta){
			$('#erro_login').fadeOut('slow', function() {
				$('#erro_login').html(resposta).fadeIn('slow');
				setTimeout("$('#erro_login').fadeOut('slow');", 4000);
			});
		});			
	}
}


//valida_login e senha antes de logar
function valida_login_senha(e){
	if($("input[@name=senha]").val() != "" || $("input[@name=login]").val() != ""){		
		$.post('buscas_cadastro.php',
				{ senha : $("input[@name=senha]").val(), email: $("input[@name=login]").val(), acao: "senha" },
				function(resposta){
		$('#erro_login').fadeOut('slow', function() {
			$('#erro_login').html(resposta).fadeIn('slow');
			setTimeout("$('#erro_login').fadeOut('slow');", 8000);
		});
		});
	} else {
		$('#erro_login').fadeOut('slow', function() {
				$('#erro_login').html("<img src='upArrow.png' style='position: relative; left: 30px;' /><div style='padding:10px 10px 10px 10px; background-color:#6699FF; color:#ffffff; margin-bottom:5px;'>Informe Login e Senha!</div>").fadeIn('slow');
				setTimeout("$('#erro_login').fadeOut('slow');", 4000);
		});		
	}
}

function valida_login_senha_2(e){
$("#erro_login_2").show().html("<img src=\"imagens/ajax-loader.gif\"/>");
	if($("input[@name=senha_2]").val() != "" || $("input[@name=login_2]").val() != ""){		
			$.post('buscas_cadastro.php',
					{ senha : $("input[@name=senha_2]").val(), email: $("input[@name=login_2]").val(), acao: "logar" },
					function(resposta){
			$('#erro_login_2').fadeOut('slow', function() {
				$('#erro_login_2').html(resposta).fadeIn('slow');
				setTimeout("$('#erro_login_2').fadeOut('slow');", 4000);
			});
		});
	} else {
		$('#erro_login_2').fadeOut('slow', function() {
				$('#erro_login_2').html("<img src='upArrow.png' style='position: relative; left: 30px;' /><div style='padding:10px 10px 10px 10px; background-color:#6699FF; color:#ffffff; margin-bottom:5px;'>Informe E-mail e Senha!</div>").fadeIn('slow');
				setTimeout("$('#erro_login_2').fadeOut('slow');", 4000);
		});	
	}
}

function valida_login_senha_3(e){
	$("#novo_erro_logar").show().html("<img src=\"imagens/ajax-loader.gif\"/>");
	if($("input[@name=inova_senha]").val() != "" || $("input[@name=novo_login]").val() != ""){		
			$.post('buscas_cadastro.php',
					{ senha : $("input[@name=inova_senha]").val(), email: $("input[@name=novo_login]").val(), acao: "logar_novamente" },
					function(resposta){
			$('#novo_erro_logar').fadeOut('slow', function() {
				$('#novo_erro_logar').html(resposta).fadeIn('slow');
				setTimeout("$('#novo_erro_logar').fadeOut('slow');", 4000);
			});
		});
	} else {
		$('#novo_erro_logar').fadeOut('slow', function() {
				$('#novo_erro_logar').html("<img src='upArrow.png' style='position: relative; left: 30px;' /><div style='padding:10px 10px 10px 10px; background-color:#6699FF; color:#ffffff; margin-bottom:5px;'>Informe E-mail e Senha!</div>").fadeIn('slow');
				setTimeout("$('#novo_erro_logar').fadeOut('slow');", 4000);
		});	
	}
}





function overProduto(id){
	document.getElementById(id).style.backgroundColor = '#e6e8e7'; 
}

function outProduto(id){
	document.getElementById(id).style.backgroundColor = '#e6e8e7'; 
}

function overSeqCompra(id, imagem, texto){
	document.getElementById('ico_'+id).src=imagem;
	document.getElementById('text_'+id).src=texto;
}
function outSeqCompra(id, imagem, texto){
	document.getElementById('ico_'+id).src=imagem;
	document.getElementById('text_'+id).src=texto;
}

function out_menu(id){
	$("#"+id).html('<img src="imagens/tit_'+id+'_on.gif" border="0" />');
}
function out_menu(id){
	$("#"+id).html('<img src="imagens/tit_'+id+'_on.gif" border="0" />');
}

//funcao que limpa campo do input atraves id...
function onfocus_limpa(id){
	
	document.getElementById(id).value='';
}

//funcao que verifica se o this.value esta vazio e se estiver coloca a mensagem passada por parametro
function onblur_verifica(values,id,valorCampo){	
	if(values == ""){
		document.getElementById(id).value=valorCampo;
	}
}

function link_produto(linkProduto){
	var tamanhoEscolhido = $('select[name=tamanho] option:selected').text();
	location.href='lista_produtos.php?cf=1&'+linkProduto+'&tp='+tamanhoEscolhido;
}
