function timeSpan(a,b,c){if(c==null)c="milliseconds";var d={milliseconds:1,seconds:1e3,minutes:1e3*60,hours:1e3*60*60,days:1e3*60*60*24,weeks:1e3*60*60*24*7,months:function(a){var b=this.days,c=[31,28,31,30,31,30,31,31,30,31,30,31];return b*c[a]},years:function(a){var b=1e3*60*60*24*365;if(a%4==0&&a%100==0||a%400==0)b+=this.days;return b}};var e=b.getTime()-a.getTime();var f=c.split(",");var g=c.indexOf("years")>-1;var h=c.indexOf("months")>-1;var i={};if(g){i["years"]=0;for(var j=a.getFullYear();j<=b.getFullYear();j++){var k=d.years(j);if(e>=k){e-=k;i["years"]+=1}}d.years=d.years(b.getFullYear())}if(h){i["months"]=0;var l=a.getMonth(),m=i["years"]>0?a.getFullYear()+i["years"]:a.getFullYear();for(l;l<=11;l++){var n=d.months(l);if(l==b.getMonth()&&m==b.getFullYear())break;else if(e>=n){e-=n;i["months"]+=1}if(l==12&&m<b.getFullYear()){l=0;m++}}d.months=d.months(b.getMonth())}for(var o=0;o<f.length&&f[0]!="";o++){var p=o<f.length-1?Math.floor(e/d[f[o]]):e/d[f[o]];if(e>0)i[f[o]]=i[f[o]]>=0?i[f[o]]+=p:p;else i[f[o]]=0;e-=p*d[f[o]]}return i}function Notification(){function e(a,b){return'<label class="'+b+'">'+a+"</label>"}function d(){$("span.notification").html(e("",""));$("span.notification").fadeOut("fast")}function c(a,b){$("span.notification").html(e(a,"problem"));if(b)$("span.notification").fadeIn("fast").delay(this.time).fadeOut("fast");else $("span.notification").fadeIn("fast")}function b(a,b){$("span.notification").html(e(a,"success"));if(b)$("span.notification").fadeIn("fast").delay(this.time).fadeOut("fast");else $("span.notification").fadeIn("fast")}function a(a){$("span.notification").html(e(a,"start"));$("span.notification").fadeIn("fast")}this.start=a;this.success=b;this.error=c;this.templateMsg=e;this.end=d;this.time=1e4}function Geral(){function o(b){$("."+b.split("#")[1]+" .pagination ul li").find("a").live("click",function(){if($("#pag-arrematados").length>0){$("html, body").animate({scrollTop:$("#pag-arrematados").offset().top},100)}else if($("#wrapper").length>0){$("html, body").animate({scrollTop:$("#wrapper").offset().top},100)}a.start("Carregando...");var c=$(this).attr("hreflang")+" "+b;$(b).load(c,{aba:$(".abas li a.selected").attr("name")});$(".pagination ul li").removeClass("current");if($(this).parent("li").addClass("current"))setTimeout(function(){a.end()},1200)})}function n(){$(".comprar").click(function(){$(this).after('<span class="loading"></span>').remove()})}function m(b){$(b).click(function(){a.start("Carregando...")})}function l(){function b(){$("a.lance").click(function(){var b=$(this).parents(".auction").attr("id").split("-")[1];if(parseInt($("#leilao-"+b+" span.tempo").html())==0&&$("#leilao-"+b+" .user").html()!="")return;$.ajax({dataType:"json",url:"http://"+location.hostname+"/bid/"+b,type:"POST",cache:false,global:false,success:function(c){if(c.u){$("strong#quant_lances").html(c.u.l);$("#leilao-"+b+" strong.preco").html(formatCurrency(c.pa));$("#leilao-"+b+" .user").html(c.u.n);if(c.u.m){$("#leilao-"+b+" a.comprar_produto").html(formatCurrency(c.u.m));$("ul#leilao-"+b+" #precototal span:eq(1)").html(formatCurrency(c.u.m));$("ul#leilao-"+b+" #lanceusado span:eq(0)").html("Lance(s) usado(s)("+c.u.d+"):");$("ul#leilao-"+b+" #lanceusado span:eq(1)").html(formatCurrency(c.u.v));$("ul#leilao-"+b+" #precoleilao span:eq(1)").html(formatCurrency(c.pa))}}else{a.error(c.e,true)}}})})}$("#layout_leilao").click(function(){a.start("Carregando...");var c='<h2><a title="${t}" href="${pl}">${t}</a></h2><a class="produto_imagem opacity" title="${t}" href="${pl}"><img border="0" width="230" height="190" alt="${t}" src="${f}"><span class="promo" style="display: block; ">${promo}</span></a><!-- /produto_imagem --><div class="clear-both"></div>{{html ini}}<div class="leilao_dados"><span class="tempo">${tl}</span><div class="info"><strong class="preco">${pa}</strong><span class="user">${u}</span><ul class="social"><li><a class="icon twitter" title="Compartilhe no Twitter" target="_blank" href="http://twitter.com/home?status=${t} via @lancelivre"></a></li><li><a class="icon facebook" title="Divulgue no Facebook" target="_blank" href="http://www.facebook.com/sharer.php?u=${t} - PS3 via @lancelivre"></a></li></ul></div></div><!-- /leilao_dados --><span class="msg"></span><div class="${cssbt}"><a title="Lance" href="javascript:void(0);" class="lance opacity"></a><a title="Compra produto por ${c}" href="${href}" class="${cssa}">${c}</a></div><!-- /leilao_botoes -->';var d='<a class="produto_imagem opacity" title="${t}" href="${pl}"> <img border="0" width="230" height="190" alt="${t}" src="${f}"><span class="promo" style="display: block; ">${promo}</span></a><!-- /produto_imagem --><div class="leilao_dados"> <h3><a title="${t}" href="${pl}">${t}</a> </h3> <strong class="preco">${pa}</strong> <span class="tempo">${tl}</span> <span class="user">${u}</span></div><!-- /leilao_dados --><div class="${cssbt}"> <a title="Lance" href="javascript:void(0)" class="lance opacity"></a><a style="display:none;" title="Compra produto por ${c}" href="${href}" class="${cssa}">${c}</a></div><!-- /leilao_botoes -->{{html ini}}<span class="msg"></span>      <!-- /leilao_inicio -->';var e;if(this.name=="reduzida"){jQuery.template("layout",d);$('ul[id^="leiloes"]').attr("id","leiloes_interna")}else{jQuery.template("layout",c);$('ul[id^="leiloes"]').attr("id","leiloes")}var f=new Array,g;$.each($('[id^="leilao"]'),function(a,b){g=b.id.split("-")[1];e=$("#leilao-"+g+" .leilao_inicio").html();style_leilao_inicio=$("#leilao-"+g+" .leilao_inicio").attr("style");e=e==null?"":'<div class="leilao_inicio" style="'+style_leilao_inicio+'">'+e+"</div>";f[a]={t:$("#leilao-"+g+" a").attr("title"),pl:$("#leilao-"+g+" a").attr("href"),f:$("#leilao-"+g+" a img").attr("src"),tl:$("#leilao-"+g+" .tempo").html(),de:$("#leilao-"+g+" .leilao_data").html(),pa:$("#leilao-"+g+" .preco").html(),u:$("#leilao-"+g+" .user").html(),c:$("#leilao-"+g+" .comprar_produto_disponivel").html(),promo:$("#leilao-"+g+" .promo").html(),cssbt:$("#leilao-"+g+" .leilao_botoes").attr("class"),cssa:$("#leilao-"+g+" .comprar_produto_disponivel").attr("class"),href:$("#leilao-"+g+" .comprar_produto_disponivel").attr("href"),ini:e};$("#leilao-"+g).empty();jQuery.tmpl("layout",f[a]).appendTo("#leilao-"+g);$("#leilao-"+g).addClass(" auction ");if(this.name=="reduzida")$("#leilao-"+g).removeClass("arrematado");else $("#leilao-"+g).parents("li").removeClass("arrematado")});if(this.name=="reduzida"){$(this).html("Exibição normal");$(this).attr("title","Exibição normal");$(this).attr("name","normal")}else{$(this).html("Exibição reduzida");$(this).attr("title","Exibição reduzida");$(this).attr("name","reduzida")}a.end();b()})}function k(){$(".abas li a").click(function(){var b=$(".content_abas li#"+this.name);$(".abas li a").removeClass();$(this).addClass("selected");if(b.html()==""){$.ajax({url:"http://"+location.hostname+"/usuario/abas/",type:"POST",cache:false,global:false,data:{aba:this.name},ajaxStart:a.start("Carregando..."),error:function(){b.html("As vezes erros acontecem. Tente novamente, por favor.")},success:function(c){if(c){if(b.html(c).fadeIn("fast"))a.end()}}})}});$("ul.content_abas").cycle({fx:"none",timeout:0,delay:1e3,speed:1e3,pager:".abas li a",pagerAnchorBuilder:function(a,b){return".abas li:eq("+a+") a"}})}function j(b,c,d,e){b.submit(function(){if(confirm("Você tem certeza que deseja adquirir este Pé de coelho?")){$.ajax({url:"http://"+location.hostname+c,type:d,cache:false,global:false,data:b.serialize(),ajaxStart:a.start("Carregando..."),error:function(){a.error("As vezes erros acontecem. Tente novamente, por favor.")},success:function(b){if(b.search("<")==1){if(e.html(b).fadeIn("fast"))a.end()}else{var c=jQuery.parseJSON(b);if(d.search("login")==1){if(c.msg.error)a.error(c.msg.error,true);if(c.msg.success)a.success(c.msg.success,false)}else{if(c.msg.error){$("#response").html('<label class="problem">'+c.msg.error+"</label>");a.end()}if(c.msg.success){$("#response").html('<label class="success">'+c.msg.success+"</label>");a.end()}}}}})}})}function i(b,c,d,e){b.attr("action","javascript:void(0)");b.submit(function(){$.ajax({url:"http://"+location.hostname+c,type:d,data:b.serialize(),cache:false,global:false,ajaxStart:a.start("Carregando..."),error:function(){a.error("As vezes erros acontecem. Tente novamente, por favor.")},success:function(b){if(b.search("<")==1){if(e.html(b).fadeIn("fast"))a.end()}else{var c=jQuery.parseJSON(b);if(c.msg.error)a.error(c.msg.error,true);if(c.msg.success)a.success(c.msg.success,false)}}})})}function h(){$(".cpf").mask("999.999.999-99");$(".cep").mask("99999-999");$(".dt_nasc").mask("99/99/9999");$(".telefone").mask("(99)9999-9999")}function g(){$(".trigger").click(function(){$(this).toggleClass("trigger_active").next().slideToggle("slow")});$(".toggle").click(function(){$(this).toggleClass("toggle_container_active").next().slideToggle("slow")})}function f(){$("a.target-blank").click(function(){window.open(this.href,"_blank");return false})}function e(){$("#imagem_produto").cycle({fx:"fade",timeout:0,delay:1e3,speed:1e3,pager:"ul#nav li.galeria_content ul",pagerEvent:"click",pauseOnPagerHover:true,pagerAnchorBuilder:function(a,b){return"ul#nav li.galeria_content ul li:eq("+a+") a"}});$("ul#nav").cycle({fx:"scrollHorz",timeout:0,delay:1e3,speed:1e3,prev:"#prev_produto",next:"#next_produto"})}function d(a,b,c,d){var e=new Array;$.each($("#banner_principal li"),function(a,b){e[a]=b.id});var f=c.currSlide;return e[f]*1e3}function c(){$("#banner_principal ul").cycle({fx:"scrollHorz",timeout:8e3,delay:1e3,speed:1e3,timeoutFn:d,prev:"#prev",next:"#next"});$("#banner_pequeno ul").cycle({fx:"fade",timeout:11e3,delay:1e3,speed:1e3})}function b(){$(".social_site").hover(function(){$(this).stop().animate({left:"0px"},"fast")},function(){$(this).stop().animate({left:"-140px"},"fast")})}this.socialButtons=b;this.galeriaBanners=c;this.galeriaProduto=e;this.targetBlank=f;this.toggleBox=g;this.mascaras=h;this.executeForm=i;this.executeFormTools=j;this.abasConta=k;this.layoutLeilao=l;this.notificaoHref=m;this.controlButtons=n;this.paginationAjax=o;var a=new Notification}function LanceLivre(){function L(){i(function(){setTimeout(function(){i("img[data-type]").each(function(){var a=i(this).attr("data-type");var b=i(this).attr("data-src");var c=i(this);switch(a){case"img":c.attr("src",b);break}})},2e3)})}function K(){i(function(){setTimeout(function(){i("[data-type]").each(function(){var a=i(this).attr("data-type");var b=i(this).attr("data-src");var c=i(this).attr("data-h")||200;var d=i(this).attr("data-w")||200;var e="";switch(a){case"img":e='<img alt="" src="'+b+'" width="'+d+'" height="'+c+'" />';break;case"object":e='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+d+'" height="'+c+'"><param name="movie" value="'+b+'" /><param name="quality" value="high" /><param name="wmode" value="transparent"><embed src="'+b+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"  wmode="transparent" width="'+d+'" height="'+c+'"></embed>';break}i(this).after(e);i(this).remove()})},2e3)})}function J(){if(i(".result-arrematados").exists()){i(".result-arrematados").html('<img src="/images/site/ajax-loader.gif">');var a=i(".result-arrematados").attr("id");if(a)a="/index/arrematadossemelhantes/leilao/"+a;else a="/index/arrematados/";i(window).load(function(){var b=new Notification;i.ajax({url:"http://"+location.hostname+a,cache:false,global:false,success:function(a){i(".result-arrematados").html(a)}})})}}function I(a,b,c,d){function g(a){var b=new Array;i.each(a,function(a){b[a]=i(this).attr("name")});return b.sort().toString()||0}function f(a){jQuery.cookie(a,null)}function e(){jQuery.cookie(c,g(i(a+" li.product")),{expires:d})}i(i(a+" li.product")).mouseover(function(){i(this).children(b).fadeIn("fast")});i(i(a+" li.product")).mouseleave(function(){i(this).children(b).fadeOut("fast")});i(i(a)).mouseout(function(){i(this).children(b).fadeOut("fast")});i(a).dragsort({dragSelector:b,dragBetween:true,dragEnd:e,placeHolderTemplate:"<li class='placeHolder'><div class='leilao_top'></div></li>"});}function H(){var a=i("#formlanceauto");var b=i("#agendar");if(a.exists()){a.submit(function(){var c=new Notification;if(b.attr("name")=="agendar"){var d="Agendando.";var e=a.serialize()+"&id="+i(".dados").attr("id").split("-")[1]+"&acao="+b.attr("name")}else{var d="Desligando.";var e="id="+i(".dados").attr("id").split("-")[1]+"&acao="+b.attr("name")+"&idlanceautomatico="+a.attr("name")}i.ajax({dataType:"json",url:"http://"+location.hostname+"/usuario/agendarlanceautomatico/",type:"POST",cache:false,global:false,data:e,ajaxStart:c.start(d),error:function(){local.html("As vezes erros acontecem. Tente novamente, por favor.")},success:function(d){if(d){if(b.attr("name")=="agendar"){if(d.i){a.attr("name",d.i);b.attr("src","/images/site/desligar.png");b.attr("name","desligar");i.each(a.serializeArray(),function(a,b){i("#"+b.name).attr("disabled","disabled").addClass("desativado")});c.success("Lance automático ativado com sucesso!",true)}else{c.success(d.e,true)}}else{b.attr("src","/images/site/agendar.png");b.attr("name","agendar");i("input:disabled").removeClass("desativado").val("").removeAttr("disabled");c.success("Lance automático desativado.",true)}}}})})}}function G(a){return a>9?a:"0"+a}function F(b,c){var b=new Date(b*1e3+h);var c=new Date(c*1e3+h);if(b.getDate()==c.getDate()&&b.getMonth()==c.getMonth()){var d=timeSpan(c,b,"minutes,seconds");if(d.minutes<30){l(a);return"FALTAM - "+G(d.minutes)+"m"+G(d.seconds)+"s"}return"HOJE - "+G(b.getHours())+":"+G(b.getMinutes())}if(b.getDate()==c.getDate()+1&&b.getMonth()==c.getMonth())return"AMANHÃ - "+G(b.getHours())+":"+G(b.getMinutes());return G(b.getDate())+"/"+G(b.getMonth()+1)+"/"+b.getFullYear()+" - "+G(b.getHours())+":"+G(b.getMinutes())}function E(a,b){var c=new Date(b*1e3+h);a.html(G(c.getHours())+":"+G(c.getMinutes()))}function D(){var a=new Date;return(a.getTimezoneOffset()-180)*6e4}function C(a,b){if(a.html()!=b)return a.html(b).fadeOut("fast").fadeIn("fast");else return false}function B(a){a=a.toString().replace(/\$|\,/g,"");if(isNaN(a))a="0";sign=a==(a=Math.abs(a));a=Math.floor(a*100+.50000000001);cents=a%100;a=Math.floor(a/100).toString();if(cents<10)cents="0"+cents;for(var b=0;b<Math.floor((a.length-(1+b))/3);b++)a=a.substring(0,a.length-(4*b+3))+"."+a.substring(a.length-(4*b+3));return(sign?"":"-")+"R$ "+a+","+cents}function A(){var a=new Array;i.each(i(".auction"),function(b,c){a[b]=c.id.split("-")[1]});return a.sort().toString()||0}function z(){if(e++<f/8){l(1e3)}else if(e<f/2){l(2e3);g.error("Sua conexão está lenta.",true)}else if(e<f){l(3e3);g.error("Tentando conectar ao LanceLivre.com.",true)}else{l(1e3);g.error("Tentando conectar ao LanceLivre.com.",true)}}function y(a,b){if(i("#leilao-"+a.i).parents("li").length>0&&!i("#leilao-"+a.i).parents("li").hasClass("suspenso")){i("#leilao-"+a.i).parents("li").removeClass(" nao_iniciado iniciado ").addClass("suspenso");i("#leilao-"+a.i+" div.leilao_inicio").attr("style","");i("#leilao-"+a.i+" .leilao_inicio").html('<label>Reinício do Cronômetro</label><strong class="leilao_data">'+F(a.de,b)+"</strong><label>Horário de Brasília</label>")}if(i("ul#leilao-"+a.i).length>0&&!i(".produto").hasClass("suspenso")){i(".produto").removeClass(" nao_iniciado iniciado ").addClass("suspenso");i("#leilao-"+a.i+" div.leilao_inicio").attr("style","");i("ul#leilao-"+a.i+" li.leilao_inicio").html('<span class="float-left font-weight-bold">Reinício do Cronômetro</span><span class="float-right leilao_data  font-weight-bold">'+F(a.de,b)+"</span>")}}function x(a,b){if(i("#leilao-"+a.i).parents("li").length>0&&!i("#leilao-"+a.i).parents("li").hasClass("nao_iniciado")){i("#leilao-"+a.i).parents("li").removeClass(" iniciado suspenso ").addClass("nao_iniciado");i("#leilao-"+a.i+" div.leilao_inicio").attr("style","");i("#leilao-"+a.i+" div.leilao_inicio").html('<label>Início do Cronômetro</label><strong class="leilao_data">'+F(a.de,b)+"</strong><label>Horário de Brasília</label>")}if(i("ul#leilao-"+a.i).length>0&&!i(".produto").hasClass("nao_iniciado")){i("#leilao-"+a.i+" div.leilao_inicio").attr("style","");i(".produto").removeClass(" iniciado suspenso ").addClass("nao_iniciado");i("ul#leilao-"+a.i+" li.leilao_inicio").html('<span class="float-left">Início do Cronômetro</span><span class="float-right leilao_data">'+F(a.de,b)+"</span>")}}function w(a){if(i("#leilao-"+a.i).parents("li").length>0&&!i("#leilao-"+a.i).parents("li").hasClass("arrematado")){var b=i('ul[id^="leiloes"]').attr("id");i("#leilao-"+a.i).removeClass("auction");i("#leilao-"+a.i).parents("li").attr("class","product arrematado ");if(b=="leiloes"){i("#leilao-"+a.i+" .lance").remove();i("#leilao-"+a.i+" .leilao_inicio").remove("div");i("#leilao-"+a.i+" .leilao_dados").fadeIn("fast").html("<span class='finished'>ARREMATADO</span>");i("#leilao-"+a.i+" .leilao_botoes").prepend("<div class='info'><strong class='preco'>"+B(a.pa)+"</strong><span class='user'>"+a.ul+"</span></div>")}else if(b=="leiloes_interna"){i("#leilao-"+a.i+" .lance").remove();i("#leilao-"+a.i+" .leilao_inicio").remove("div");i("#leilao-"+a.i+" .leilao_botoes").fadeIn("fast").html("<span class='finished'>ARREMATADO</span>");i("#leilao-"+a.i+" .leilao_dados").html("<h3>"+i("#leilao-"+a.i+" .leilao_dados h3").html()+"</h3><div class='info'>"+"<strong class='preco'>"+B(a.pa)+"</strong><span class='user'>"+a.ul+"</span>"+"</div>")}}if(i("ul#leilao-"+a.i).length>0&&!i(".produto").hasClass("arrematado")){i("ul#leilao-"+a.i+" .tempo").remove();i("ul#leilao-"+a.i+" .lance").remove();i("ul#leilao-"+a.i+" .msg").attr("class","finished").html("ARREMATADO");i("#galeria_imagens").attr("class","arrematado");i("ul#leilao-"+a.i).removeClass("auction")}}function v(a,b){if(!i("#leilao-"+a.i).parents("li").hasClass("iniciado")){i("#leilao-"+a.i).parents("li").removeClass(" nao_iniciado suspenso ").addClass(" iniciado ");i("#leilao-"+a.i+" div.leilao_inicio").attr("style","display:none");i("#leilao-"+a.i+" .leilao_inicio").remove();i("#leilao-"+a.i+" .leilao_botoes").addClass(" started ")}var c;if(a.dl>a.de)c=a.tl-(b-a.dl);else c=a.tl-(b-a.de);var d=i("#leilao-"+a.i+" span.tempo");if(c>0){if(c<=10){if(c<10)c="0"+c;d.css({color:"#EC0000"})}else d.css({color:"#91BF29"});d.html(c)}}function u(a,b){switch(parseInt(a.s)){case 1:v(a,b);break;case 2:w(a);break;case 3:x(a,b);i("#leilao-"+a.i+" .leilao_data").html(F(a.de,b));break;case 4:y(a,b);i("#leilao-"+a.i+" .leilao_data").html(F(a.de,b));break}C(i("#leilao-"+a.i+" span.user"),a.ul);C(i("#leilao-"+a.i+" strong.preco"),B(a.pa));C(i("#leilao-"+a.i+" #precoleilao span:eq(1)"),B(a.pa));if(i("#leilao-"+a.i).parents("li").length>0&&i("#leilao-"+a.i).parents("li").hasClass("progressivo")){var c=a.vv.split("/");var d=a.iv.split("/");var e=parseInt(a.pa/d[0])*d[1]+parseInt(c[0]);if(e>c[1])e=c[1];C(i("#leilao-"+a.i+" .promo"),B(e))}if(i("ul#leilao-"+a.i).length>0&&i(".produto").hasClass("progressivo")){var c=a.vv.split("/");var d=a.iv.split("/");var e=parseInt(a.pa/d[0])*d[1]+parseInt(c[0]);if(e>c[1])e=c[1];C(i(".produto .promo"),B(e));C(i("#leilao-"+a.i+" #precomercado span:eq(1)"),B(e))}}function t(){if(i(".form-logado").exists())i.ajax({dataType:"json",url:"http://"+location.hostname+"/off/"+A(),type:"GET",cache:false,global:false,timeout:5e3,error:function(){z()},success:function(a){if(a.d){i.each(a.d,function(a,b){i("#leilao-"+b.i+" a.comprar_produto").html(B(b.c));i("#leilao-"+b.i+" #precoleilao span:eq(1)").html(B(b.c))})}}})}function s(){var b=A();if(j){return}i.ajax({dataType:"json",url:"http://"+location.hostname+"/auctions/"+b,type:"GET",timeout:2e3,cache:false,global:false,error:function(){z()},success:function(b){if(b){i.each(b.p,function(a,c){u(c,b.n)});E(i("#clock"),b.n);q(b.et)}if(e>0){e=0;l(a)}}})}function r(){setInterval(function(){i.ajax({dataType:"json",cache:false,global:false,url:"http://"+location.hostname+"/a/sold",timeout:6e3,success:function(a){}})},6e5)}function q(b){if(b.a!=null){if(l(a))g.success("Outros leilões começaram.",true)}else if(b.s!=null){g.success("Alguns leilões terminaram.",true)}}function p(){i("a.comprar_produto").click(function(){var a=i(this).parents(".auction").attr("id").split("-")[1];var b=confirm("Você tem certeza que deseja prosseguir? Ao comprar o produto com desconto, você automaticamente sairá desse leilão.");if(b==true){i.ajax({dataType:"json",url:"http://"+location.hostname+"/compras/compraproduto/id/"+a,type:"POST",cache:false,global:false,ajaxStart:g.start("Carregando..."),success:function(a){if(a.url){i(this).after('<span class="loading"></span>').remove();window.location=a.url}if(a.msg.error)g.error(a.msg.error,true);if(a.msg.success)g.success(a.msg.success,false)}})}})}function o(){i("a.lance").click(function(){var a=i(this).parents(".auction").attr("id").split("-")[1];i.ajax({dataType:"json",url:"http://"+location.hostname+"/bid/"+a,type:"POST",cache:false,global:false,success:function(b){if(b.u){i("strong#quant_lances").html(b.u.l);i("#leilao-"+a+" strong.preco").html(B(b.pa));i("#leilao-"+a+" .user").html(b.u.n);if(b.u.m){i("#leilao-"+a+" a.comprar_produto").html(B(b.u.m));i("ul#leilao-"+a+" #precototal span:eq(1)").html(B(b.u.m));i("ul#leilao-"+a+" #lanceusado span:eq(0)").html("Lance(s) usado(s)("+b.u.d+"):");i("ul#leilao-"+a+" #lanceusado span:eq(1)").html(B(b.u.v));i("ul#leilao-"+a+" #precoleilao span:eq(1)").html(B(b.pa))}}else{g.error(b.e,true)}}})})}function n(){var a=i(".dados").attr("id").split("-")[1];var b=2500;if(i("#leilao-"+a).hasClass("iniciado"))b=1250;setInterval(function(){i.ajax({url:"http://"+location.hostname+"/last/"+a,type:"POST",cache:false,global:false,timeout:2e3,success:function(a){i("div#ultimos-lances").html(a).fadeIn("fast")}})},b)}function m(){var a=false;i(document).click(function(){a=true});setInterval(function(){if(a==false){j=true;i.fn.colorbox({width:"30%",inline:true,open:true,close:false,href:"#message"});i(document).click(function(){j=false;i.fn.colorbox.close()})}a=false},c)}function l(a){if(b!=a){clearInterval(d);d=setInterval(s,b=a);return true}return false}function k(){l(a);m();h=D();r();t();J()}this.auctions=A;this.bid=o;this.loadImagesAuctions=L;this.onLoadMedia=K;this.comprarProduto=p;this.setup=k;this.auction_clock_time=3e4;this.time=false;this.lastBids=n;this.auctionSortable=I;this.agendarLances=H;this.controlTimeOut=m;var a=1e3;var b;var c=3e5;var d=false;var e=0;var f=60;var g=new Notification;var h;var i=jQuery;var j=false}jQuery.fn.exists=function(){return jQuery(this).length>0?true:false}
