function addEventToObject(e,a,d){var b=e[a];e[a]=(typeof e[a]!="function")?d:function(){b();
d()}}function intComma(e){var d="",f=String(e),a=f.length-1,h,b,g=f.indexOf(".")-1;
if(g<0){g=a}for(b=0;b<=a;b++){d+=(h=f.charAt(b));if((b<g)&&((g-b)%3==0)&&(h!="-")){d+=","
}}return d}function ajaxRequest(a,d){if(window.XMLHttpRequest){var b=new XMLHttpRequest();
if(d){b.onreadystatechange=function(){d(b)}}b.open("GET",a,true);if(browser.isSafari){b.setRequestHeader("If-Modified-Since","Wed, 15 Nov 1995 00:00:00 GMT")
}b.send(null)}else{if(window.ActiveXObject){isIE=true;try{var b=new ActiveXObject("Msxml2.XMLHTTP")
}catch(f){b=new ActiveXObject("Microsoft.XMLHTTP")}if(b){if(d){b.onreadystatechange=function(){d(b)
}}b.open("GET",a,true);b.send()}}}}var c,ci,initDate,curDate,curDateElapsed,curCountElapsed,preDate,dateDiff,timeoutID;
var initCount=curCount=preCount=addCount=tempCount=countDiff=rate=0;var XMLHttpRequests=0;
var update=5;var incr=100;var refresh=60000;var safariBugFixCounter=null;var countTimer=null;
function initializeProcessReqChange(a){if(a.readyState==4){if(a.status==200){setCounters(a);
if(XMLHttpRequests<1||!countTimer){runCountdown()}XMLHttpRequests+=1}else{clearTimeout(countTimer);
countTimer=null}}document.body.style.cursor="default";return true}function setCounters(a){preCount=parseInt(a.responseXML.getElementsByTagName("count")[1].childNodes[0].nodeValue);
if(preCount==initCount||initCount==0){initCount=parseInt(a.responseXML.getElementsByTagName("count")[0].childNodes[0].nodeValue);
initDate=new Date(a.responseXML.getElementsByTagName("count")[0].getAttribute("timestamp"));
preDate=new Date(a.responseXML.getElementsByTagName("count")[1].getAttribute("timestamp"));
countDiff=initCount-preCount;dateDiff=parseInt(initDate.valueOf()-preDate.valueOf());
rate=countDiff/dateDiff;rate=rate*0.8;curDate=new Date();curDateElapsed=curDate.valueOf()-initDate.valueOf();
curCountElapsed=curDateElapsed*rate;curCount=initCount+curCountElapsed}}function runCountdown(){addCount=rate*incr;
curCount+=addCount;c.innerHTML=(curCount<1000000000)?intComma(Math.floor(curCount)):"1,000,000,000+";
if(ci){ci.innerHTML=(curCount<1000000000)?intComma(Math.floor(curCount)):"1,000,000,000+"
}document.getElementById("thismustbehere").value=curCount;countTimer=setTimeout(runCountdown,incr)
}function doCountdown(){ajaxRequest("/itms_counter.xml",initializeProcessReqChange);
var a=setTimeout(doCountdown,refresh)}function initCountdown(){c=document.getElementById("countdown");
ci=(document.getElementById("countdown2"))?document.getElementById("countdown2"):null;
if((browser.isIE==true)&&(browser.isMac==true)){var b=(document.getElementById("counter"))?document.getElementById("counter"):null;
var a='<a href="/it/itunes/1billion/"><img src="http://images.apple.com/it/home/2006/images/promoitms1billionupgrade.jpg" width="368" height="120" border="0" alt="iTunes Music Store 1 Billion Song Countdown."></a>';
b.innerHTML=a}else{doCountdown()}}addEventToObject(window,"onload",initCountdown);

