function ping( url, cb ) { if ( url.indexOf( "?" ) >= 0 ) { url += "&rnd=" + Math.random(); } else { url += "?rnd=" + Math.random(); } var req = getXmlRequest(); if ( req ) { if ( cb ) { req.onreadystatechange = function() { if ( req.readyState == 4 ) { cb( req.responseText ); } }; } req.open( "GET", url, true ); req.send(); } } function getXmlRequest() { var r = null; if ( window.ActiveXObject ) { r = new ActiveXObject( "Msxml2.XMLHTTP" ); if ( r == null ) { r = new ActiveXObject("Microsoft.XMLHTTP"); } } else if ( window.XMLHttpRequest ) { r = new XMLHttpRequest; } return r; }