if (mobilise == undefined) { var mobilise = function () {}; }
if (mobilise.ninemsn == undefined) { mobilise.ninemsn = function () {}; }
if (mobilise.ninemsn.gomobile == undefined) { 

mobilise.ninemsn.gomobile = function () 
{
    var _DEFAULT_SUITE = "msnportalaumobile";

    this.getRandomNumber = function(min, max)
    {
        return (min + Math.floor(Math.random() * (max - min)));
    }

    this.setTrackingUrl = function(hostSiteName, productName, action, suiteNames)
    {
        var prefix = "gomobile";
        var propVal = prefix + ":" + hostSiteName + "-" + productName + "-" + action;
        var suiteVal = (suiteNames) ? suiteNames : _DEFAULT_SUITE;
        var s = s_gi(suiteVal);
        s.linkTrackVars = 'prop8';
        s.linkTrackEvents = 'None';
        s.prop8 = propVal;
        s.tl(this, 'o', 'gomobile');
    }

    this.setTrackingUrlOnLoad = function(hostSiteName, productName, sendFlag, suiteNames)
    {
        var oldonload = window.onload;
        var fnWrapper = function() { 
            var gomobileObj = new mobilise.ninemsn.gomobile();
            gomobileObj.setTrackingUrl(hostSiteName, productName, sendFlag, suiteNames); 
        }

    	if (typeof window.onload != 'function') 
        {
    		window.onload = fnWrapper;
    	} else 
        {
    		window.onload = function() 
            {
    			oldonload();
                fnWrapper();
    		}
    	}
    }

    // sets up timer to check if page has been loaded, once it is, track
    // the entry and terminate the timer
    var _timerId = 0;
    var _stopTimer = false;

    this.setTrackingUrlTimer = function(hostSiteName, productName, sendFlag, suiteNames)
    {
        var timerPeriod = 1000;

        if (!this._stopTimer)
        {
            if (window.s_gi == undefined)
            {
                var instance = this;
                setTimeout(function()
                    {
                        instance.setTrackingUrlTimer(hostSiteName, productName, sendFlag, suiteNames);
                    }, timerPeriod);
            }
            else
            {
                this.setTrackingUrl(hostSiteName, productName, sendFlag, suiteNames);
                _stopTimer = true;
            }
        }
        else 
        {
            clearTimeout(_timerId);
        }
    }
}; 

}
