function trocaImagem(imagem){
	//alert(imagem);
	document.fotoPrincipal.src = imagem;
	}
function mostraGaleriaImagens(id,pesquisa){
	
	if(document.getElementById('TrGaleriaProduto1').style.display=="none")
	  {
	  document.getElementById('TrGaleriaProduto1').style.display = "";
	  document.getElementById('TrGaleriaProduto2').style.display = "";
	  
	  
	  if((pesquisa=="detalhe")||(pesquisa=="relacionados")){
	  document.getElementById('TrDetalheProduto1').style.display = "none";
	  document.getElementById('TrDetalheProduto2').style.display = "none";
	  }
	  if((pesquisa=="inicial")||(pesquisa=="listagem")){
	  document.getElementById('TrListagem').style.display = "none";	  
	  }
	  
	  
	  document.getElementById('TrFlash905').style.display = "none";
	  document.getElementById('TrOndeEstou').style.display = "none";	  	  
	  document.getElementById("iframe_aux").src = "paginas_lojavirtual/lista_produtos/iframes/ifr_galeriaFotos.php?id_produto="+id+"&origem="+pesquisa;
	  }
	else
	  {
	  document.getElementById('TrGaleriaProduto1').style.display = "none";
	  document.getElementById('TrGaleriaProduto2').style.display = "none";  
	  
	  if((pesquisa=="detalhe")||(pesquisa=="relacionados")){
	  document.getElementById('TrDetalheProduto1').style.display = "";
	  document.getElementById('TrDetalheProduto2').style.display = "";
	  }
	   if((pesquisa=="inicial")||(pesquisa=="listagem")){
  	  document.getElementById('TrListagem').style.display = "";
	   }
	  document.getElementById('TrFlash905').style.display = "";
	  document.getElementById('TrOndeEstou').style.display = "";	  
	  }
	
	
	
	}
	
	
function aviseProduto(){
	
	if(validateForm('avise_seunome:1:Seu nome,avise_seuemail:1:Seu email'))
	 {
	 document.formaviseProduto.submit();
	 }
	
	}


function indicaProduto(){
	
	if(validateForm('indique_seunome:1:Seu nome,indique_seuemail:1:Seu email,indique_nomeamigo:1:Nome do amigo,indique_emailamigo:1:Email do amigo'))
	 {
	 document.formIndiqueProduto.submit();
	 }
	
	}




function mostraTableavise(){
	if(document.getElementById('tr_aviseProduto').style.display=="none")
		 {
		 document.getElementById('tr_TodosDetalhesProduto1').style.display = "none";	 
		 document.getElementById('tr_detalhesEspecificacoesItensAssitencia0').style.display = "none";	 
		 document.getElementById('tr_detalhesEspecificacoesItensAssitencia1').style.display = "none";	 
		 document.getElementById('tr_detalhesEspecificacoesItensAssitencia2').style.display = "none";	 
		 
		 document.getElementById('tr_aviseProduto').style.display = "";
		 document.getElementById('tr_aviseProduto0').style.display = "none";
		 
		 document.getElementById('tr_indiqueProduto').style.display = "none";
		 document.getElementById('tr_indiqueProduto0').style.display = "none";
		 
		 
		 //document.ImgMaisFrete.src = 'images/menos.jpg';
		 

		 }
	else
		 {
		 document.getElementById('tr_TodosDetalhesProduto1').style.display = "";
 		 document.getElementById('tr_detalhesEspecificacoesItensAssitencia0').style.display = "";	 
		 document.getElementById('tr_detalhesEspecificacoesItensAssitencia1').style.display = "";	 
		 document.getElementById('tr_detalhesEspecificacoesItensAssitencia2').style.display = "";	 
		 
		 document.getElementById('tr_aviseProduto').style.display = "none";
		 document.getElementById('tr_aviseProduto0').style.display = "";
		 
		 document.getElementById('tr_indiqueProduto0').style.display = "";
		 //document.getElementById('tr_indiqueProduto0').style.display = "";
		 //document.ImgMaisFrete.src = 'images/mais.jpg';		 
		 }
	}



function mostraTableIndique(){
	if(document.getElementById('tr_indiqueProduto').style.display=="none")
		 {
		 document.getElementById('tr_TodosDetalhesProduto1').style.display = "none";	 
		 document.getElementById('tr_detalhesEspecificacoesItensAssitencia0').style.display = "none";	 
		 document.getElementById('tr_detalhesEspecificacoesItensAssitencia1').style.display = "none";	 
		 document.getElementById('tr_detalhesEspecificacoesItensAssitencia2').style.display = "none";	 
		 document.getElementById('tr_indiqueProduto').style.display = "";
		 document.getElementById('tr_indiqueProduto0').style.display = "none";
		 //document.ImgMaisFrete.src = 'images/menos.jpg';
		 

		 }
	else
		 {
		 document.getElementById('tr_TodosDetalhesProduto1').style.display = "";
 		 document.getElementById('tr_detalhesEspecificacoesItensAssitencia0').style.display = "";	 
		 document.getElementById('tr_detalhesEspecificacoesItensAssitencia1').style.display = "";	 
		 document.getElementById('tr_detalhesEspecificacoesItensAssitencia2').style.display = "";	 
		 
		 document.getElementById('tr_indiqueProduto').style.display = "none";
		 document.getElementById('tr_indiqueProduto0').style.display = "";
		 //document.ImgMaisFrete.src = 'images/mais.jpg';		 
		 }
	}


	
	
function mostraOpcoesPagamento(tr){
	
	
	//FECHA TDS FORMAS EXISTENTES
	for(i=0;i<20;i++){
		IdCampo = "trIdFormaPagamento_"+i;		
		if(eval("document.getElementById('"+IdCampo+"')")) eval("document.getElementById('"+IdCampo+"').style.display = 'none'");
	}
	document.getElementById(tr).style.display = '';
	
	}








function carregaPagamentos(forma_pagamento) {

	//parent.document.getElementById('FramePai').rows = '65,*,65,0';
	
	if(forma_pagamento=='ipagare')   document.formIpagare.submit();		
	if(forma_pagamento=='pagseguro') document.formPagseguro.submit();	
	
	}
	
function gerarPedido(forma_pagamento) 
	{ 
	
	
	if(forma_pagamento=="direto_na_loja") msgmConfirma = "Confirmar compra ?";
	else 								  msgmConfirma = "Confirmar pedido e ir para interface de pagamento ?";
	
	if(forma_pagamento!="envia_email"){
		var answer = confirm (msgmConfirma);
		
		if (answer){
			//parent.framePagamento.location.href='about:blank';				
			if(document.getElementById("botaoComprarFinal")) document.getElementById("botaoComprarFinal").style.display = "none";
			
			if(forma_pagamento=="pagseguro"){
				document.getElementById("idLogoPagseguro").style.display = "none";				
				document.getElementById("idAguardeLoading").style.display = "";		
				if(document.getElementById("idLogoEmail")) document.getElementById("idLogoEmail").style.display = "none";
			}
			
			document.getElementById("iframe_aux").src = "paginas_lojavirtual/finaliza_compra/ifr_cadastra_pedido.php?forma_pagamento="+forma_pagamento;
		   }	   
		}
	else{
		var answer = confirm ("Confirmar envio do pedido por e-mail ?");
		
		if (answer){
			document.getElementById("idLogoEmail").style.display = "none";				
			document.getElementById("idAguardeLoadingEmail").style.display = "";		
			if(document.getElementById("idLogoPagseguro")) document.getElementById("idLogoPagseguro").style.display = "none";
			
			document.getElementById("iframe_aux").src = "paginas_lojavirtual/finaliza_compra/ifr_cadastra_pedido.php?forma_pagamento="+forma_pagamento;
		   }	   
		}
	}
	
	
	

function abrePopImprime(id_cliente,id){
	//alert(id);
	window.open('paginas_lojavirtual/lista_produtos/imprimir_produto.php?path=../../&id_cliente='+id_cliente+'&id_produto='+id+'','consulta','top=10,left=10,dependent=yes,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=695,height=550');
	
	}

function mostraAbaProdutoDetalhe(dir,aba,path){
	
	
 	  document.getElementById("detalhes").style.display = 'none';	  
	  document.getElementById("especificacoes").style.display = 'none';	  
	  document.getElementById("itens").style.display = 'none';	  
	  document.getElementById("assistencia").style.display = 'none';	  
	 
	  document.getElementById(aba).style.display = '';
	  
	  
	  eval("document.getElementById('td_detalhes').style.backgroundImage=\"url('"+path+"paginas_lojavirtual/lista_produtos/images/"+dir+"/menu_esq_notsel.jpg')\""); 
	  eval("document.getElementById('td_especificacoes').style.backgroundImage=\"url('"+path+"paginas_lojavirtual/lista_produtos/images/"+dir+"/menu_meio_notsel.jpg')\""); 
	  eval("document.getElementById('td_itens').style.backgroundImage=\"url('"+path+"paginas_lojavirtual/lista_produtos/images/"+dir+"/menu_meio_notsel.jpg')\""); 
	  eval("document.getElementById('td_assistencia').style.backgroundImage=\"url('"+path+"paginas_lojavirtual/lista_produtos/images/"+dir+"/menu_meio_notsel.jpg')\""); 
	  
	  if(aba!="detalhes")
	  eval("document.getElementById('td_"+aba+"').style.backgroundImage=\"url('"+path+"paginas_lojavirtual/lista_produtos/images/"+dir+"/menu_meio_sel.jpg')\""); 
	  else
	  eval("document.getElementById('td_"+aba+"').style.backgroundImage=\"url("+path+"'paginas_lojavirtual/lista_produtos/images/"+dir+"/menu_esq_sel.jpg')\""); 
	  
	  
	  /*document.getElementById('td_interatividade').style.backgroundImage="url('editor/images/menu_meio_notsel.jpg')"; 
	  document.getElementById('td_aparencia').style.backgroundImage="url('editor/images/menu_esq_notsel.jpg')";
	  document.getElementById('td_ajuda').style.backgroundImage="url('editor/images/menu_meio_notsel.jpg')"; */
	   
	
}

function mostraSubCategoria(id) {
	fechaTodasSubCategorias();
	eval("document.getElementById('menuSubCategoria_"+id+"').style.display = '';");
	//document.getElementById('menuCategorias').style.display = 'none';
	//document.getElementById('menuVerOutrasCategorias').style.display = '';
	}
	
function mostraSubsubCategoria(id) {
	//alert(eval("document.getElementById('menuSubsubCategoria_"+id+"').style.display"));
	if(eval("document.getElementById('menuSubsubCategoria_"+id+"').style.display")=="none")
	    {
		eval("document.getElementById('menuSubsubCategoria_"+id+"').style.display=''");		
		}
	else
	    {
	    eval("document.getElementById('menuSubsubCategoria_"+id+"').style.display='none'");		
		}
	}
function mostraOutrasCategorias() {
	AbreTodasSubCategorias();
	//document.getElementById('menuCategorias').style.display = '';
	//document.getElementById('menuVerOutrasCategorias').style.display = 'none';
	}
	
function mostraApenasBarraVerOutrasCategorias() {
	fechaTodasSubCategorias();
	document.getElementById('menuCategorias').style.display = 'none';
	document.getElementById('menuVerOutrasCategorias').style.display = '';
	}

function compararRemover(id,foto)
 {			
 		if(document.formComparar.compararCount.value>2)
		document.getElementById("iframe_aux").src = "paginas_lojavirtual/lista_produtos/iframes/ifr_comparaProdutos.php?idp="+id+"&fotop="+foto+"&add=nao&detalhe=sim&remover=sim";   	
		else alert("É necessário no mínimo 2 produtos para comparação.");
 }
 
function paginarVisitados(lado){	
	document.getElementById("iframe_aux").src = "paginas_lojavirtual/lista_produtos/iframes/ifr_paginaVisitados.php?lado="+lado;   						
	}
	







	 

	

 
 
 
function carregaDetalhesProduto(id,retorno,obsTamanhoCorVoltagem)
 {			
 document.formListaPor.paginaDeRetorno.value = retorno;
 document.getElementById("iframe_aux").src = "paginas_lojavirtual/lista_produtos/iframes/ifr_detalheProduto.php?id_produto="+id+"&retorno="+retorno+"&obsTamanhoCorVoltagem="+obsTamanhoCorVoltagem;   					
 }
 
function retornaPraListagem(){	
	
	
	if((document.getElementById('tr_indiqueProduto'))&&(document.getElementById('tr_indiqueProduto').style.display==""))
	  {
		
			  mostraTableIndique();
		
	}else{		 
		
			if(document.getElementById("OndeEstouCategorias")) document.getElementById("OndeEstouCategorias").style.display = "";
			
			
			if(document.getElementById('paginaDeRetorno').value=="")
			 {
			 window.location= "index.php"; 
			 }
			else {
				
				document.getElementById('TrDetalheProduto1').style.display = 'none';
				document.getElementById('TrDetalheProduto2').style.display = 'none';
				document.getElementById('TrListagem').style.display = '';
				document.formListaPor.paginaDeRetorno.value = "";
			}
	
	}
	/*
	
	
	
	if(retorno=='listagem') { document.getElementById('img_voltar').style.display = 'none'; document.getElementById("OndeEstouCategorias").style.display = '';}*/

	} 


function realizaComparacao(id_cliente){
	
	if(document.formComparar.compararCount.value>1)
	document.getElementById("iframe_aux").src = "paginas_lojavirtual/lista_produtos/iframes/ifr_mostraComparacao.php";   					
	else alert("É necessário no mínimo 2 produtos para comparação.");
	
	
	
	
	}

function compararDetalhe(id,foto)
 {

	if(eval("document.formComparar.campo_comparar"+id+".checked")==true)
		{
		if(document.formComparar.compararCount.value==3)
		  {
		  eval("document.formComparar.campo_comparar"+id+".checked=false;")
		  alert("Você pode comparar no máximo 3 produtos.");
		  }
		else document.getElementById("iframe_aux").src = "paginas_lojavirtual/lista_produtos/iframes/ifr_comparaProdutos.php?idp="+id+"&fotop="+foto+"&add=sim&detalhe=sim";   	
		}
	  else
		{
		document.getElementById("iframe_aux").src = "paginas_lojavirtual/lista_produtos/iframes/ifr_comparaProdutos.php?idp="+id+"&fotop="+foto+"&add=nao&detalhe=sim";   	
		}
 
  
 // 
}
function comparar(id,foto)
 {
	if(eval("document.formComparar.campo_comparar"+id+".checked")==true)
		{
		if(document.formComparar.compararCount.value==3)
		  {
		  eval("document.formComparar.campo_comparar"+id+".checked=false;")
		  alert("Você pode comparar no máximo 3 produtos.");
		  }
		else document.getElementById("iframe_aux").src = "paginas_lojavirtual/lista_produtos/iframes/ifr_comparaProdutos.php?idp="+id+"&fotop="+foto+"&add=sim";   	
		}
	  else
		{
		document.getElementById("iframe_aux").src = "paginas_lojavirtual/lista_produtos/iframes/ifr_comparaProdutos.php?idp="+id+"&fotop="+foto+"&add=nao";   	
		}
}

function rating(id, pontos, pontuacao_atual, numero_votos)
 {
//   alert(pontuacao_atual);
   document.getElementById("iframe_aux").src = "paginas_lojavirtual/lista_produtos/iframes/ifr_rating_control.php?id="+id+"&pontos="+pontos+"&pontuacao_atual="+pontuacao_atual+"&numero_votos="+numero_votos+"";   
 }
