/** */ var RedSheriffCounter = { rsClickCid: 'it_Matrix-it_0', rsClickUrl: document.location.href, TIMEOUT_INSTANTLY: -1, TIMEOUT_OFF: 0, TIMEOUT_30: 30, TIMEOUT_300: 300, TIMEOUT_900: 900, rsClickTimeout: this.TIMEOUT_OFF, rsClickTimeoutID: undefined, rsDiffAutoRefreshUrl: false, /* Class constructor */ RedSheriffCounter: function(_rsClickCid, _rsClickUrl, _rsDiffAutoRefreshUrl, _rsClickTimeout) { if ( _rsClickCid ) this.rsClickCid = _rsClickCid; if ( _rsClickUrl ) this.rsClickUrl = _rsClickUrl; if ( _rsDiffAutoRefreshUrl ) this.rsDiffAutoRefreshUrl = _rsDiffAutoRefreshUrl; if ( _rsClickTimeout ) this.rsClickTimeout = _rsClickTimeout; if ( this.rsDiffAutoRefreshUrl ) this.elaborateUrl(); }, /* */ doCall: function() { /* var rs_pixel = new Image(); rs_pixel.src = 'http://server-it.imrworldwide.com/cgi-bin/count?cid=' + this.rsClickCid + '&url=' + this.rsClickUrl.replace("http%3A//","http://") + '&rnd=' + Math.floor(1000000 * Math.random()); */ var rs_pixel = document.getElementById('imgRS'); if(!rs_pixel) { rs_pixel = document.createElement('IMG'); rs_pixel.id = 'imgRS'; document.body.appendChild(rs_pixel); } rs_pixel.src='http://server-it.imrworldwide.com/cgi-bin/count?cid=' + this.rsClickCid + '&url=' + this.rsClickUrl.replace("http%3A//","http://") + '&rnd=' + Math.floor(1000000 * Math.random());; this.callOmniture(); this.manageTimeout(); }, callOmniture : function(){ if( typeof (mtx_fn_tp) != 'undefined'){ mtx_fn_tp(); } }, /* */ start: function() { this.manageTimeout(); if ( this.rsClickTimeout == this.TIMEOUT_INSTANTLY ) { this.doCall(); } }, manageTimeout: function() { if ( this.rsClickTimeout > 0 ) { var objRSCounter = this; var doCallPointer = function() { return objRSCounter.doCall(); }; this.rsClickTimeoutID = setTimeout(doCallPointer, this.rsClickTimeout * 1000); } }, /* */ stop: function() { if ( !this.rsClickTimeoutID ) { clearTimeout( this.rsClickTimeoutID ); this.rsClickTimeoutID = null; } }, /* */ elaborateUrl: function() { var separator; this.rsClickUrl.indexOf('?') != -1 ? separator='&' : separator='?'; if ( this.rsClickTimeout < this.TIMEOUT_300 ) { this.rsClickUrl = escape(this.rsClickUrl + separator + 'refresh_cens'); } else { this.rsClickUrl = escape(this.rsClickUrl + separator + 'refresh_ce'); } //this.rsClickUrl = this.rsClickUrl.replace("http%3A", "http:"); } } /* Gestione dell'evento onLoad */ if ( window.addEventListener ) { window.addEventListener('load', onloadRedSheriffFunctions, false); } else { window.attachEvent('onload', onloadRedSheriffFunctions); } /** USAGE: This code has to be inserted into the client page. Be care: you must keep the order of the declaration code. Source html: */