var Pujas={version:'1.0',urlEncode:function(o){if(!o){return""}var buf=[];for(var key in o){var ov=o[key],k=encodeURIComponent(key);var type=typeof ov;if(type=='undefined'){buf.push(k,"=&")}else if(type!="function"&&type!="object"){buf.push(k,"=",encodeURIComponent(ov),"&")}else if(Ext.isArray(ov)){if(ov.length){for(var i=0,len=ov.length;i<len;i++){buf.push(k,"=",encodeURIComponent(ov[i]===undefined?'':ov[i]),"&")}}else{buf.push(k,"=&")}}}buf.pop();return buf.join("")}};var yacerro=false;var cheaqueando=new Array();var rdirec=false;var CounDowns=new Array();var serverTime="";function DESCUENTA(id){var ob=document.getElementById(id)||null;if(ob!=null){if(typeof ob.timestamp=='undefined'||typeof ob.timestamp==undefined)ob.timestamp=ob.innerHTML;if(parseInt(ob.timestamp)=='NaN')return;clearTimeout(ob.timer);var rest_days=Math.floor(ob.timestamp/86400);var h=ob.timestamp-(rest_days*86400);var rest_hours=Math.floor(h/3600);var m=ob.timestamp-((rest_days*86400)+(rest_hours*3600));var rest_minutes=Math.floor(m/60);var rest_secounds=ob.timestamp-((rest_days*86400)+(rest_hours*3600)+(rest_minutes*60));var count=(rest_days<10?'0'+rest_days:rest_days)+" : "+(rest_hours<10?'0'+rest_hours:rest_hours)+" : "+(rest_minutes<10?'0'+rest_minutes:rest_minutes)+" : "+(rest_secounds<10?'0'+rest_secounds:rest_secounds);var clase=(rest_days==0&&rest_hours==0&&rest_minutes<=1)?"headtime timefinishing":"headtime";if(isNaN(rest_days))return;ob.innerHTML='<font class="'+clase+'" face="Verdana" >DD&nbsp; HH&nbsp; MM&nbsp; SS</font><br><span>'+count+'</span>';ob.parentNode.className=clase;if(ob.timestamp==0){ob.innerHTML="FINALIZANDO..</br><img border=0 src='"+global_site+"images/indicator_snake.gif'>";ob.timestamp=undefined;clearTimeout(ob.timer);ob.timer=null;Ext.Ajax.request({url:global_site+'index.php',success:function(r){var resp=Ext.decode(r.responseText);if(resp.closed==0){ob.innerHTML="APLAZANDO..</br><img border=0 src='"+global_site+"images/indicator_snake.gif'>";var timertemp=null;ob.timestamp=parseInt(resp.extendTime);ob.parentNode.className='MinitimeCount';clearTimeout(timertemp);ob.timer=setTimeout("if(typeof DESCUENTA=='function'){DESCUENTA(\""+ob.id+"\")}",1000)}else{ob.innerHTML="Ganador:<b> "+resp.name+'</b>';if(resp.winme==1){Ext.Msg.alert('Enhorabuena! <b>'+resp.name+'</b>','Acabas de ganar una subasta!.');yacerro=true}}},params:{cmd_ajax:'finish_chech',id:ob.id.split('tdown')[1]}});return}else{ob.timestamp--}if(ob.style.visibility!='visible')ob.style.visibility="visible";if(ob.timestamp<0){ob.innerHTML="FINALIZADA";clearTimeout(ob.timer)}else{ob.timer=setTimeout("if(typeof DESCUENTA=='function'){DESCUENTA(\""+ob.id+"\")}",1000)}}}function CD_Init(){var c=new Array();for(var i=0;i<CounDowns.length;i++)if(c.indexOf(CounDowns[i])==-1)c.push(CounDowns[i]);CounDowns=c;if(rdirec)return;var strTagPrefix="countdown";var objElem=false;for(var i=0;i<=CounDowns.length;++i){{var strTagId=strTagPrefix+CounDowns[i];var existe=document.getElementById(strTagId)||null;if(existe!=null){r=retardodecarga||null;var ob=document.getElementById(strTagId)||null;if(r!=null&&ob!=null){ob.innerHTML=parseInt(ob.innerHTML)-r}existe.timer=setTimeout("if(typeof DESCUENTA=='function'){DESCUENTA(\""+strTagId+"\")}",1000)}}}}