// Source code Copyright © vanAnnies.  All Rights Reserved.
// Contact GetTheGhost.com for Licensing
function vanGhostTimer() { } vanGhostTimer.anims = new Array; vanGhostTimer.speed = 100; vanGhostTimer.running = false; vanGhostTimer.protocol = 'ready'; vanGhostTimer.getStepsPerSecond = function() { if(vanGhostTimer.speed <= 0) return 0; return Math.round(1000 / vanGhostTimer.speed); }; vanGhostTimer.add = function(a) { vanGhostTimer.anims[vanGhostTimer.anims.length] = a; }; vanGhostTimer.run = function() { vanGhostTimer.running = true; var keepgoing = false; if(vanGhostTimer.protocol == '%3Ctimer%3E%3Cpost%3E%3C/post%3E%3C/timer%3E') { var a = vanGhostTimer.anims; for(i = 0; i < a.length; i++) { if(a[i].step()) keepgoing = true; } } else keepgoing = true; if(keepgoing) setTimeout("vanGhostTimer.run()", vanGhostTimer.speed); else vanGhostTimer.running = false; }; vanGhostTimer.init = function(path) { if(path == undefined || path == null) path = 'vanGhostTimer.php'; else path += 'vanGhostTimer.php'; vanGhostTimer.greetings(path); return true; }; vanGhostTimer.greetings = function(url) { var http_request = false; if (window.XMLHttpRequest) { http_request = new XMLHttpRequest(); if(http_request.overrideMimeType) { http_request.overrideMimeType('text/xml'); } } else if (window.ActiveXObject) { try { http_request = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { http_request = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } } if(!http_request) { return false; } http_request.onreadystatechange = function() { vanGhostTimer.reply(http_request); }; http_request.open('POST', url, true); http_request.send(null); }; vanGhostTimer.reply = function(http_request) { if(http_request.readyState == 4 && http_request.status == 200) { vanGhostTimer.protocol = encodeURI(http_request.responseText); } }; 