/* RSLite - Simple non-concurrent remote scripting calls. send one string, receive one string created by Brent Ashley version: 1.01 last modified 9/10/02 - Marc Barrot Specify path attribute in cookie, for Mozilla's sake. You may use and distribute this code freely, just keep this header information intact. */ function RSLiteObject(){ this.interval = 500; this.attempts = 3; this.i = new Image(); this.call = function ( page, parm ){ parm = (parm != null)? parm : ''; var d = new Date(); document.cookie = 'RSLite=x; expires=Fri, 31 Dec 1999 23:59:59 GMT; path=/;'; this.i.src = page + '?u=' + d.getTime() + '&p=' + parm; setTimeout( "RSLite.receive(1);", this.interval ); } this.receive = function ( attempt ){ var response = null; var aCookie = document.cookie.split("; "); for (var i=0; i < aCookie.length; i++){ var aCrumb = aCookie[i].split("="); if (aCrumb[0] == 'RSLite') response = aCrumb[1]; } if ( response != null ){ this.callback( unescape(response.replace(/\+/g,' ')) ); } else { if (attempt < this.attempts){ setTimeout( "RSLite.receive( " + (attempt+1) +" );",this.interval); } else { this.failure(); } } } this.callback = function( response ){ alert(response); } this.failure = function(){ alert( "RSLite timed out"); } } var RSLite;