var tStamp = '1231321903000'; var badday = 'false'; var oneMinute = 60 * 1000; var oneHour = oneMinute * 60; var tStamp = Date.UTC(2009, 0, 7, 09, 51, 0, 0); var tTime = Date.UTC(2009, 0, 7, 19, 0, 0, 0); function timeUntil(target) { var diff = target - tStamp; return Math.floor(diff); } function delCountdown1() { var ms = timeUntil(tTime); var output1 = ""; var hrs, mins; if (ms > oneMinute) { hrs = Math.floor(ms/oneHour); ms -= oneHour * hrs; mins = Math.floor(ms/oneMinute); if (hrs > 0) { output1 += hrs; output1 += (hrs > 1) ? 'Hours ' : 'Hour '; } output1 += mins; output1 += (mins > 1) ? 'Mins' : 'Min'; } else { output1 +='Ended for the day'; } return output1; } function updateDelCountdown() { if (badday=='true') { document.getElementById('delivery_countdown1').innerHTML= 'Not Available Today'; } else { document.getElementById('delivery_countdown1').innerHTML= delCountdown1(); /*setTimeout("updateDelCountdown()", oneMinute); tStamp += oneMinute; setTimeout("updateDelCountdown()", oneMinute);*/ } } /* Edited version of: to serve IE7 with XMLHttpRequest instead of ActiveX */ var xmlhttp=false; if (!xmlhttp && typeof XMLHttpRequest!='undefined') { try { xmlhttp = new XMLHttpRequest(); } catch (e) { xmlhttp=false; } } /*@cc_on @*/ /*@if (@_jscript_version >= 5) // JScript gives us Conditional compilation, we can cope with old IE versions. // and security blocked creation of the objects. if (!xmlhttp){ try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { xmlhttp = false; } } } @end @*/ if (!xmlhttp && window.createRequest) { try { xmlhttp = window.createRequest(); } catch (e) { xmlhttp=false; } } function getNewContent(){ xmlhttp.open('GET','http://www.computersupermarket.com/phplive/testStatus.php?l=admin&x=1&deptid=1&pagex=http://www.computersupermarket.com?unique=1226489302734&refer=&text='); xmlhttp.onreadystatechange = updateNewContent; xmlhttp.send(null); return false; } function updateNewContent(){ if(xmlhttp.readyState != 4 || xmlhttp.status!=200)return; document.getElementById('chatMessage').innerHTML = xmlhttp.responseText; } /*setInterval(getNewContent,600);*/ function onloadbody() { /*getNewContent();*/ updateDelCountdown(); } function clearSearch() { if (document.getElementById('searchText').value=='Search') { document.getElementById('searchText').value = ''; } }