// -----------------------------------------------------------------------------
// funcoes para detalhe de produto
// -----------------------------------------------------------------------------

function Ampliada() {
 window.open("/produto/produto.dll/imagem?pro_id=" + sPRO_Id + "&pg=imagem.htm&ImgAtual=" + ImgAtual + "&PIM_ID=" + ImgId[ImgAtual], "imagem", "width=250,height=380,top=20");
}

function Opinar() {
 window.open("/produto/produto.dll/opiniao?pro_id=" + sPRO_Id, "opiniao", "width=420,height=520,scrollbars");
}

function Opinioes() {
 window.open("/produto/produto.dll/listaopiniao?pro_id=" + sPRO_Id, "opiniao", "width=420,height=520,scrollbars");
}

function Oferta() {
 window.open("/produto/produto.dll/oferta?pro_id=" + sPRO_Id, "oferta", "width=460,height=520,scrollbars");
}

function Previsao() {
 window.open("/produto/previsao.htm", "previsao", "width=600,height=400,scrollbars");
}

function LeiaMais() {
 window.open("/produto/produto.dll/leiamais?pro_id=" + sPRO_Id, "leiamais", "width=420,height=520,scrollbars");
}

function PesquisaAutor() {
 window.location = "/pesquisaweb/pesquisaweb.dll/pesquisa?FILTRON1=J&ESTRUTN1=&PALAVRASN1=" + sPRO_Id;
}

function PesquisaMarca() {
 window.location = "/pesquisaweb/pesquisaweb.dll/pesquisa?FILTRON1=C&ESTRUTN1=&PALAVRASN1=" + sFornec;
}

function OpiniaoEspecialista() {
 window.open("/produto/produto.dll/opiniaoespecialista?pro_id=" + sPRO_Id, "especialista", "width=520,height=520,scrollbars");
}

function PrazoEntrega() {
 window.open("/produto/produto.dll/prazo?pro_id=" + sPRO_Id, "prazo", "width=520,height=370");
}

function SwapImage(objeto, imagem, nivel) {
 if (nivel == 0) { 
  if ((objeto != sObjeto1) && (objeto != sObjeto2)) {
   document.getElementById(objeto).src = imagem;    
  }  
 }
 else { 
  document.getElementById(objeto).src = imagem;
 }
}

function ImgAnt() {
 ImgAtual--;
  
 if (ImgAtual < 1) {
  ImgAtual = TotalImg;
 }
  
 document.imgproduto.src = ImgSrc[ImgAtual] + "&L=120&A=-1";
 document.getElementById('NumImg').innerHTML = 'Imagem ' + ImgAtual + ' de ' + TotalImg;
}

function ImgProx() {
 ImgAtual++;
  
 if (ImgAtual > TotalImg) { 
  ImgAtual = 1;
 }
  
 document.imgproduto.src = ImgSrc[ImgAtual] + "&L=120&A=-1";
 document.getElementById('NumImg').innerHTML = 'Imagem ' + ImgAtual + ' de ' + TotalImg;
}

function SelecCartao(recebto) {
 for (i = 0; i < ArrayMeioCartao.length; i++) {
  document.getElementById('MeioRecebtoCartao' + ArrayMeioCartao[i]).style.background = "#FFFFFF";
  document.getElementById('Cartao' + ArrayMeioCartao[i]).style.zIndex = 1;
  document.getElementById('Cartao' + ArrayMeioCartao[i]).style.visibility = "hidden";
  document.getElementById('Cartao' + ArrayMeioCartao[i]).style.overflow = "hidden";      
  document.forms["bandeiras"].elements["radioCartao" + ArrayMeioCartao[i]].checked = false;
 }

 document.getElementById('MeioRecebtoCartao' + recebto).style.background = "#E3E3E3";
 document.getElementById('Cartao' + recebto).style.zIndex = 3;
 document.getElementById('Cartao' + recebto).style.visibility = "visible";
 document.getElementById('Cartao' + recebto).style.overflow = "visible";
 document.forms["bandeiras"].elements["radioCartao" + recebto].checked = true;
}

function MaxNumParcelas(){
 maxNumParcelas = 0;

 for (a = 0; a < document.forms.length; a++) {
  for (b = 0; b < document.forms[a].elements.length; b++) {
   if ((document.forms[a].elements[b].name == "NumParcelas") && (document.forms[a].elements[b].type == "hidden")) {
    if (maxNumParcelas < document.forms[a].elements[b].value) {
	 maxNumParcelas = document.forms[a].elements[b].value;
    }
   }
  }
 }
 
 return maxNumParcelas;
}

