try 
{
    var CommuniGator_WebTracking =
    {
        url: '',
        trackingData: '',
        anonymousIdentifier: '',
        debug: false,
        customValue1: '',
        customValue2: '',
        customValue3: '',
        InitialiseTracker: function () {        
            try {
                var convert = false;

                //Get the anonymous identifier and tracking data
                this.anonymousIdentifier = this.GetCookie("anonymousIdentifier");
                this.trackingData = this.GetCookie("trackingData");

                //Check to see if the tracking data from the query string exists and if so set the trackingData and update the cookie
                var tempTrackingData = this.GetQueryStringParameter("gator_td");
                if (tempTrackingData != '') {
                    this.trackingData = tempTrackingData;
                    this.SetCookie("trackingData", this.trackingData, 365);

                    //If an anonymous idenfier has been found then set the convert flag to true, otherwise leave it false
                    if (this.anonymousIdentifier != '') {
                        convert = true;
                    }
                }

                //Store the referrer url
                var referrerUrl = document.referrer;

                //call the InitialiseTracker web service method passing in the trackingData, anonymousIdentifier, convert status flag and the callback method
                $.getJSON(this.url + "/WebTrackingHandler.ashx?trackingData=" + encodeURIComponent(this.trackingData) + "&anonymousIdentifier=" + this.anonymousIdentifier + "&convertAnonymous=" + convert + "&referrerUrl=" + encodeURIComponent(referrerUrl) + "&customValue1=" + encodeURIComponent(this.customValue1) + "&customValue2=" + encodeURIComponent(this.customValue2) + "&customValue3=" + encodeURIComponent(this.customValue3) + "&callback=?",
                            this.InitialiseTracker_Callback);
            } catch (exception) {
                CheckDebugStatusAndDisplayError('Error (InitialiseTracker): ' + exception.message);
            }
        },
        InitialiseTracker_Callback: function (response) {
            try {
                //parse the json object
                var obj = $.parseJSON(response);

                //Store the details returned (both in the object and in cookies)
                CommuniGator_WebTracking.anonymousIdentifier = obj.anonymousIdentifier;
                CommuniGator_WebTracking.SetCookie("anonymousIdentifier", CommuniGator_WebTracking.anonymousIdentifier, 365);
            } catch (err) {
                CheckDebugStatusAndDisplayError('Error (InitialiseTracker_Callback): ' + err.message);
            }
        },
        GetQueryStringParameter: function (name) {
            name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
            var regexS = "[\\?&]" + name + "=([^&#]*)";
            var regex = new RegExp(regexS);
            var results = regex.exec(window.location.href);
            if (results == null)
                return "";
            else
                return decodeURIComponent(results[1].replace(/\+/g, " "));
        },
        GetCookie: function (c_name) {
            if (document.cookie.length > 0) {
                c_start = document.cookie.indexOf(c_name + "=");
                if (c_start != -1) {
                    c_start = c_start + c_name.length + 1;
                    c_end = document.cookie.indexOf(";", c_start);
                    if (c_end == -1) c_end = document.cookie.length;
                    return unescape(document.cookie.substring(c_start, c_end));
                }
            }

            return "";
        },
        SetCookie: function (c_name, value, expiredays) {
            var exdate = new Date();
            exdate.setDate(exdate.getDate() + expiredays);
            document.cookie = c_name + "=" + escape(value) + ((expiredays == null) ? "" : ";expires=" + exdate.toGMTString() + ";path=/");
        }
    }

    function CheckDebugStatusAndDisplayError(message){
        try{
            if(CommuniGator_WebTracking.debug){
                alert(message);
            }
        }catch(err)
        {
        }
    }
}
catch (err) {
    //Do nothing, critical failure
}
