function vitrineaa(tags,qtd){ var arr = tags.split(',') if (qtd) { qtd_ofertast = parseInt(qtd/arr.length) }else{ var h_cold = $('#coluna_direita').height() var qtd_ofertas = $('#coluna_direita').height() - $('#vitrine_not').height() var qtd_ofertas = parseInt((qtd_ofertas/105)-1) var qtd_ofertast = parseInt(qtd_ofertas/arr.length) } if (qtd_ofertast < 1){ var qtd_ofertast = 1; } if (qtd_ofertast > 10){ var qtd_ofertast = 10; } for(var i = 0; i < arr.length; i++) { $.ajax({ type: 'GET', url: 'http://www.andafter.org/labs/vitrine/r/buscape/'+ $.trim(arr[i]) +'/' + qtd_ofertast + '/1', dataType: 'xml', async: false, success: function(xml) { var jData = $(xml); var oferta = jData.find('ofr'); var ofertas = oferta.children(); var vitrine = $('#ofertas'); vitrine.append(''); //vitrine.empty(); var count=0 oferta.each( function( intSectionIndex ){ count=count+1 //info oferta var id_oferta = $(this).attr('id') var produto = $(this).children('prd').children('dl').text(); var thumb = $(this).children('prd').find('src').attr('url'); var link = $(this).find('lnk').attr('url'); var loja = $(this).children('emp').children('n').text(); //var produto2 = limita(produto,50); var produto2 = produto.substr(0,80) //info preco var preco = $(this).children('prc').attr('vlr'); var parcela = $(this).children('prc').attr('prcl'); var preco_parcela = $(this).children('prc').attr('vlrp'); var jTerm = $('
'); //monta a visualização da oferta jTerm.html('
'+produto2 +'

Compre agora por R$ ' + preco +'
'); //exibe os dados da oferta //jTerm.html("Loja: "+ loja +"

ID oferta: " + id_oferta +"

Imagem: "+ thumb +"

Nome: " + produto + "

Preço: R$ " + preco +"
Ou em " + parcela + " vezes de "+ preco_parcela + "

Link: "+ link +"

"); vitrine.append(jTerm); //vitrine.shuffle(); $('#vitrineandafter .ofertav').hover( function () { $(this).addClass('ofertav2'); }, function () { $(this).removeClass('ofertav2'); } ); } ); // } }); //close $.ajax( } }