Array.prototype.pushToCache = pushToCache; var cache = new Array(); var httpRequest = new createXmlHttpRequestObject(); var workerURL = '/en/calendar.php'; var updateInterval = 1000; function pushToCache(strData) { if (pagetype == 'presscenter') workerURL = '/en/calendar.php'; if (pagetype == 'info') workerURL = '/en/company_calendar.php'; this.push(strData); requestData(); } function createXmlHttpRequestObject() { // will store the reference to the XMLHttpRequest object var xmlHttp; // this should work for all browsers except IE6 and older try { // try to create XMLHttpRequest object xmlHttp = new XMLHttpRequest(); } catch(e) { // assume IE6 or older var XmlHttpVersions = new Array("MSXML2.XMLHTTP.6.0", "MSXML2.XMLHTTP.5.0", "MSXML2.XMLHTTP.4.0", "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP", "Microsoft.XMLHTTP"); // try every prog id until one works for (var i=0; i 0) { params = cache.shift(); if (params.length > 0) { params += '&salt=' + Math.random(); httpRequest.open("POST", workerURL, true); httpRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); httpRequest.onreadystatechange = requestRecieved; httpRequest.send(params); } } } else { setTimeout("requestData();", updateInterval); } } catch(e) { alert(e.toString()); } } } // recieve answer function requestRecieved() { // continue if the process is completed if (httpRequest.readyState == 4) { // continue only if HTTP status is "OK" if (httpRequest.status == 200) { try { // process the server's response readRecievedAnswer(); } catch(e) { // display the error message alert(e.toString()); } } else { // display the error message alert(httpRequest.statusText); } } } function readRecievedAnswer() { var response = httpRequest.responseText; var calend_div = document.getElementById('calendar_div'); var calend = document.getElementById('calendar'); var curtain = document.getElementById('calendar_curtain'); calend_div.innerHTML = response + '
 
'; curtain.style.display = 'none'; calend.style.display = 'block'; document.updateTips(); } function requestCalendar(month, year) { var calend = document.getElementById('calendar'); var curtain = document.getElementById('calendar_curtain'); calend.style.display = 'none'; curtain.style.display = 'block'; cache.pushToCache('month=' + month.toString() + '&year=' + year.toString() + '&as=1'); return false; }