// --- mbox.js

var mboxCopyright = "Copyright 1996-2011. Adobe Systems Incorporated. All rights reserved.";


/* WDPRO Additions */
// Also see bottom of this file.

var tnt_wdpro = {
    isLameBrowser: false /*@cc_on || @_jscript_version <= 5.7 @*/,
    // tnt_wdpro.aMboxTargets Hashmap [strMboxName: strTargetElement]
    aMboxTargets: [],
    // tnt_wdpro.aMboxTargets Hashmap [strMboxName: nodeMBoxElement]
    aMboxes: [],

    // getElement
    // @desciption returns an element via a selector, such as 'jQuery(".home-panel > .bd div:nth-child(4)").get(0)', or by element id
    // @param strTarget Either a query or an element id
    getElement: function (strTarget){
        if (!!strTarget){
            if (strTarget.indexOf('(') > -1) {
                return new Function('return ' + strTarget)();
            } else {
                return document.getElementById(strTarget);
            }
        } else {
            return null;
        }
    },
    // moveContentOnload
    // @description Exists so IE7- can enumerate the mBoxes and move content into place after the DOM is complete.
    // Called from conditional comments above the tnt_wdpro object declaration.
    moveContentOnload: function (){
        for (var strMboxName in tnt_wdpro.aMboxTargets){
            // Only need to poll for the target element if the mBox offer returned is not the default content and if there is a target speficied.
            if (tnt_wdpro.aMboxes[strMboxName] && tnt_wdpro.aMboxes[strMboxName].className != "mboxDefault" && tnt_wdpro.aMboxTargets[strMboxName]){
                tnt_wdpro.moveContent(strMboxName, tnt_wdpro.getElement(tnt_wdpro.aMboxTargets[strMboxName]));
            }
        }
    },
    // moveContent
    // @description removes content of an element and inserts new content
    // @param strMboxName mBox name used to lookup the target DOM element.
    // @param nodeTarget The node to insert into the DOM. 
    moveContent: function (strMboxName, nodeTarget){
        // Enumerate mBox hashmap to move imported content into targeted location
        if (typeof nodeTarget == 'object'){
            if (nodeTarget.hasChildNodes()){
                while (nodeTarget.childNodes.length >= 1){
                    nodeTarget.removeChild(nodeTarget.firstChild);
                }
            }
            // Put imported content div inside target element
            nodeTarget.appendChild(tnt_wdpro.aMboxes[strMboxName]);
        } else {
            alert('ERROR: tnt_wdpro.moveContent --> nodeTarget should be an object (a DOM node) but it is a ' + typeof nodeTarget);
        }
    },
    // tnt_wdpro.pollTargetElement
    // @description Move content into target element when target appears in the DOM.
    pollTargetElement: function (strMboxName){
        // If the request to Tnt is successfull we want to hide the content
        // to be replaced as soon as possible
        DomReady.ready(function(){
            tnt_wdpro.hideMboxTargetDivs();
        });

        // Only need to poll for the target element if the mBox offer returned is not the default content and if there is a target speficied.
        if (tnt_wdpro.aMboxes[strMboxName] && tnt_wdpro.aMboxes[strMboxName].className != "mboxDefault" && tnt_wdpro.aMboxTargets[strMboxName]){
            var checkForElement, target, intCounter = 0;
                    
            checkForElement = function(){
                intCounter++;
                target = tnt_wdpro.getElement(tnt_wdpro.aMboxTargets[strMboxName]);
                if (target){
                    tnt_wdpro.moveContent(strMboxName, target);
                } else if (intCounter < 20){
                    setTimeout(checkForElement, 50);
                }
            };
            
            checkForElement();
        }
    },

    /**
     *  hideMboxTargetDivs
     *  Hides all divs that are going to get content from Tnt to avoid flicker.
     *  Mbox.js automatically unhides the div when the content is placed
     */
    hideMboxTargetDivs: function()
    {
        if (tnt_wdpro.aMboxTargets)
        {
            var target;
            for (var idx in tnt_wdpro.aMboxTargets)
            {
                if( tnt_wdpro.aMboxTargets.hasOwnProperty(idx) )
                {
                    target = tnt_wdpro.getElement(tnt_wdpro.aMboxTargets[idx]);
                    if (!!target){
                        target.style.visibility = 'hidden';
                    }
                }
            }
        }
    }
};

// domready (http://code.google.com/p/domready/)
(function(){

    var DomReady = window.DomReady = {};

    // Everything that has to do with properly supporting our document ready event. Brought over from the most awesome jQuery. 

    var userAgent = navigator.userAgent.toLowerCase();

    // Figure out what browser is being used
    var browser = {
        version: (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [])[1],
        safari: /webkit/.test(userAgent),
        opera: /opera/.test(userAgent),
        msie: (/msie/.test(userAgent)) && (!/opera/.test( userAgent )),
        mozilla: (/mozilla/.test(userAgent)) && (!/(compatible|webkit)/.test(userAgent))
    };    

    var readyBound = false;	
    var isReady = false;
    var readyList = [];

    // Handle when the DOM is ready
    function domReady() {
        // Make sure that the DOM is not already loaded
        if(!isReady) {
            // Remember that the DOM is ready
            isReady = true;
        
            if(readyList) {
                for(var fn = 0; fn < readyList.length; fn++) {
                    readyList[fn].call(window, []);
                }
            
                readyList = [];
            }
        }
    };

    // From Simon Willison. A safe way to fire onload w/o screwing up everyone else.
    function addLoadEvent(func) {
      var oldonload = window.onload;
      if (typeof window.onload != 'function') {
        window.onload = func;
      } else {
        window.onload = function() {
          if (oldonload) {
            oldonload();
          }
          func();
        }
      }
    };

    // does the heavy work of working through the browsers idiosyncracies (let's call them that) to hook onload.
    function bindReady() {
        if(readyBound) {
            return;
        }

        readyBound = true;

        // Mozilla, Opera (see further below for it) and webkit nightlies currently support this event
        if (document.addEventListener && !browser.opera) {
            // Use the handy event callback
            document.addEventListener("DOMContentLoaded", domReady, false);
        }

        // If IE is used and is not in a frame
        // Continually check to see if the document is ready
        if (browser.msie && window == top) (function(){
            if (isReady) return;
            try {
                // If IE is used, use the trick by Diego Perini
                // http://javascript.nwbox.com/IEContentLoaded/
                document.documentElement.doScroll("left");
            } catch(error) {
                setTimeout(arguments.callee, 0);
                return;
            }
            // and execute any waiting functions
            domReady();
        })();

        if(browser.opera) {
            document.addEventListener( "DOMContentLoaded", function () {
                if (isReady) return;
                for (var i = 0; i < document.styleSheets.length; i++)
                    if (document.styleSheets[i].disabled) {
                        setTimeout( arguments.callee, 0 );
                        return;
                    }
                // and execute any waiting functions
                domReady();
            }, false);
        }

        if(browser.safari) {
            var numStyles;
            (function(){
                if (isReady) return;
                if (document.readyState != "loaded" && document.readyState != "complete") {
                    setTimeout( arguments.callee, 0 );
                    return;
                }
                if (numStyles === undefined) {
                    var links = document.getElementsByTagName("link");
                    for (var i=0; i < links.length; i++) {
                        if(links[i].getAttribute('rel') == 'stylesheet') {
                            numStyles++;
                        }
                    }
                    var styles = document.getElementsByTagName("style");
                    numStyles += styles.length;
                }
                if (document.styleSheets.length != numStyles) {
                    setTimeout( arguments.callee, 0 );
                    return;
                }
            
                // and execute any waiting functions
                domReady();
            })();
        }

        // A fallback to window.onload, that will always work
        addLoadEvent(domReady);
    };

    // This is the public function that people can use to hook up ready.
    DomReady.ready = function(fn, args) {
        // Attach the listeners
        bindReady();

        // If the DOM is already ready
        if (isReady) {
            // Execute the function immediately
            fn.call(window, []);
        } else {
            // Add the function to the wait list
            readyList.push( function() { return fn.call(window, []); } );
        }
    };

    bindReady();

})();

/* End WDPRO Additions */



mboxUrlBuilder = function(a, b) {
 this.a = a;
 this.b = b;
 this.c = new Array();
 this.d = function(e) { return e; };
 this.f = null;
};


mboxUrlBuilder.prototype.addParameter = function(g, h) {
 var i = new RegExp('(\'|")');
 if (i.exec(g)) {
 throw "Parameter '" + g + "' contains invalid characters";
 }

 for (var j = 0; j < this.c.length; j++) {
 var k = this.c[j];
 if (k.name == g) {
 k.value = h;
 return this;
 }
 }
 var l = new Object();
 l.name = g;
 l.value = h;
 this.c[this.c.length] = l;
 return this;
};


mboxUrlBuilder.prototype.addParameters = function(c) {
 if (!c) {
 return this;
 }
 for (var j = 0; j < c.length; j++) {
 var m = c[j].indexOf('=');
 if (m == -1 || m == 0) {
 continue;
 }
 this.addParameter(c[j].substring(0, m),
 c[j].substring(m + 1, c[j].length));
 }
 return this;
};

mboxUrlBuilder.prototype.setServerType = function(n) {
 this.o = n;
};

mboxUrlBuilder.prototype.setBasePath = function(f) {
 this.f = f;
};


mboxUrlBuilder.prototype.setUrlProcessAction = function(p) {
 this.d = p;
};

mboxUrlBuilder.prototype.buildUrl = function() {
 var q = this.f ? this.f :
 '/m2/' + this.b + '/mbox/' + this.o;

 var r = document.location.protocol == 'file:' ? 'http:' :
 document.location.protocol;

 var e = r + "//" + this.a + q;

 var s = e.indexOf('?') != -1 ? '&' : '?';
 for (var j = 0; j < this.c.length; j++) {
 var k = this.c[j];
 e += s + encodeURIComponent(k.name) + '=' +
 encodeURIComponent(k.value);
 s = '&';
 }
 return this.t(this.d(e));
};


mboxUrlBuilder.prototype.getParameters = function() {
 return this.c;
};

mboxUrlBuilder.prototype.setParameters = function(c) {
 this.c = c;
};

mboxUrlBuilder.prototype.clone = function() {
 var u = new mboxUrlBuilder(this.a, this.b);
 u.setServerType(this.o);
 u.setBasePath(this.f);
 u.setUrlProcessAction(this.d);
 for (var j = 0; j < this.c.length; j++) {
 u.addParameter(this.c[j].name,
 this.c[j].value);
 }
 return u;
};

mboxUrlBuilder.prototype.t = function(v) {
 return v.replace(/\"/g, '&quot;').replace(/>/g, '&gt;');
};


mboxStandardFetcher = function() { };

mboxStandardFetcher.prototype.getType = function() {
 return 'standard';
};

mboxStandardFetcher.prototype.fetch = function(w) {
 w.setServerType(this.getType());

 document.write('<' + 'scr' + 'ipt src="' + w.buildUrl() +
 '" language="JavaScript"><' + '\/scr' + 'ipt>');
};

mboxStandardFetcher.prototype.cancel = function() { };


mboxAjaxFetcher = function() { };

mboxAjaxFetcher.prototype.getType = function() {
 return 'ajax';
};

mboxAjaxFetcher.prototype.fetch = function(w) {
 w.setServerType(this.getType());
 var e = w.buildUrl();

 this.x = document.createElement('script');
 this.x.src = e;

 document.body.appendChild(this.x);
};

mboxAjaxFetcher.prototype.cancel = function() { };


mboxMap = function() {
 this.y = new Object();
 this.z = new Array();
};

mboxMap.prototype.put = function(A, h) {
 if (!this.y[A]) {
 this.z[this.z.length] = A;
 }
 this.y[A] = h;
};

mboxMap.prototype.get = function(A) {
 return this.y[A];
};

mboxMap.prototype.remove = function(A) {
 this.y[A] = undefined;
};

mboxMap.prototype.each = function(p) {
 for (var j = 0; j < this.z.length; j++ ) {
 var A = this.z[j];
 var h = this.y[A];
 if (h) {
 var B = p(A, h);
 if (B === false) {
 break;
 }
 }
 }
};


mboxFactory = function(C, b, D) {
 this.E = false;
 this.C = C;
 this.D = D;
 this.F = new mboxList();

 mboxFactories.put(D, this);

 
 
 this.G =
 typeof document.createElement('div').replaceChild != 'undefined' &&
 (function() { return true; })() &&
 typeof document.getElementById != 'undefined' &&
 typeof (window.attachEvent || document.addEventListener ||
 window.addEventListener) != 'undefined' &&
 typeof encodeURIComponent != 'undefined';
 this.H = this.G &&
 mboxGetPageParameter('mboxDisable') == null;

 var I = D == 'default';
 
 
 
 this.J = new mboxCookieManager(
 'mbox' +
 (I ? '' : ('-' + D)),
 (function() { return mboxCookiePageDomain(); })());

 
 
 this.H = this.H && this.J.isEnabled() &&
 (this.J.getCookie('disable') == null);
 
 if (this.isAdmin()) {
 this.enable();
 }

 this.K();
 this.L = mboxGenerateId();
 this.M = mboxScreenHeight();
 this.N = mboxScreenWidth();
 this.O = mboxBrowserWidth();
 this.P = mboxBrowserHeight();
 this.Q = mboxScreenColorDepth();
 this.R = mboxBrowserTimeOffset();
 this.S = new mboxSession(this.L,
 'mboxSession',
 'session', 31 * 60, this.J);
 this.T = new mboxPC('PC',
 1209600, this.J);

 this.w = new mboxUrlBuilder(C, b);
 this.U(this.w, I);

 this.V = new Date().getTime();
 this.W = this.V;

 var X = this;
 this.addOnLoad(function() { X.W = new Date().getTime(); });
 if (this.G) {
 
 
 this.addOnLoad(function() {
 X.E = true;
 X.getMboxes().each(function(Y) {
 Y.setFetcher(new mboxAjaxFetcher());
 Y.finalize(); });
 });

 this.limitTraffic(100, 10368000);

 if (this.H) {
 this.Z();
 this._ = new mboxSignaler(function(ab, c) {
 return X.create(ab, c);
 }, this.J);
 }

 }
};





mboxFactory.prototype.isEnabled = function() {
 return this.H;
};


mboxFactory.prototype.getDisableReason = function() {
 return this.J.getCookie('disable');
};


mboxFactory.prototype.isSupported = function() {
 return this.G;
};


mboxFactory.prototype.disable = function(bb, cb) {
 if (typeof bb == 'undefined') {
 bb = 60 * 60;
 }

 if (typeof cb == 'undefined') {
 cb = 'unspecified';
 }

 if (!this.isAdmin()) {
 this.H = false;
 this.J.setCookie('disable', cb, bb);
 }
};

mboxFactory.prototype.enable = function() {
 this.H = true;
 this.J.deleteCookie('disable');
};

mboxFactory.prototype.isAdmin = function() {
 return document.location.href.indexOf('mboxEnv') != -1;
};


mboxFactory.prototype.limitTraffic = function(db, bb) {

};


mboxFactory.prototype.addOnLoad = function(eb) {

 
 
 
 

 if (this.isDomLoaded()) {
 eb();
 } else {
 var fb = false;
 var gb = function() {
 if (fb) {
 return;
 }
 fb = true;
 eb();
 };

 this.hb.push(gb);

 if (this.isDomLoaded() && !fb) {
 gb();
 }
 }
};

mboxFactory.prototype.getEllapsedTime = function() {
 return this.W - this.V;
};

mboxFactory.prototype.getEllapsedTimeUntil = function(ib) {
 return ib - this.V;
};


mboxFactory.prototype.getMboxes = function() {
 return this.F;
};


mboxFactory.prototype.get = function(ab, jb) {
 return this.F.get(ab).getById(jb || 0);
};


mboxFactory.prototype.update = function(ab, c) {
 if (!this.isEnabled()) {
 return;
 }
 if (!this.isDomLoaded()) {
 var X = this;
 this.addOnLoad(function() { X.update(ab, c); });
 return;
 }
 if (this.F.get(ab).length() == 0) {
 throw "Mbox " + ab + " is not defined";
 }
 this.F.get(ab).each(function(Y) {
 Y.getUrlBuilder()
 .addParameter('mboxPage', mboxGenerateId());
 Y.load(c);
 });
};


mboxFactory.prototype.create = function(
 ab, c, kb) {

 if (!this.isSupported()) {
 return null;
 }
 var e = this.w.clone();
 e.addParameter('mboxCount', this.F.length() + 1);
 e.addParameters(c);

 var jb = this.F.get(ab).length();
 var lb = this.D + '-' + ab + '-' + jb;
 var mb;

 if (kb) {
 mb = new mboxLocatorNode(kb);
 } else {
 if (this.E) {
 throw 'The page has already been loaded, can\'t write marker';
 }
 mb = new mboxLocatorDefault(lb);
 }

 try {
 var X = this;
 var nb = 'mboxImported-' + lb;
 var Y = new mbox(ab, jb, e, mb, nb);
 if (this.H) {
 Y.setFetcher(
 this.E ? new mboxAjaxFetcher() : new mboxStandardFetcher());
 }

 Y.setOnError(function(ob, n) {
 Y.setMessage(ob);
 Y.activate();
 if (!Y.isActivated()) {
 X.disable(60 * 60, ob);
 window.location.reload(false);
 }


 });
 this.F.add(Y);
 } catch (pb) {
 this.disable();
 throw 'Failed creating mbox "' + ab + '", the error was: ' + pb;
 }

 var qb = new Date();
 e.addParameter('mboxTime', qb.getTime() -
 (qb.getTimezoneOffset() * 60000));

 return Y;
};

mboxFactory.prototype.getCookieManager = function() {
 return this.J;
};

mboxFactory.prototype.getPageId = function() {
 return this.L;
};

mboxFactory.prototype.getPCId = function() {
 return this.T;
};

mboxFactory.prototype.getSessionId = function() {
 return this.S;
};

mboxFactory.prototype.getSignaler = function() {
 return this._;
};

mboxFactory.prototype.getUrlBuilder = function() {
 return this.w;
};

mboxFactory.prototype.U = function(e, I) {
 e.addParameter('mboxHost', document.location.hostname)
 .addParameter('mboxSession', this.S.getId());
 if (!I) {
 e.addParameter('mboxFactoryId', this.D);
 }
 if (this.T.getId() != null) {
 e.addParameter('mboxPC', this.T.getId());
 }
 e.addParameter('mboxPage', this.L);
 e.addParameter('screenHeight', this.M);
 e.addParameter('screenWidth', this.N);
 e.addParameter('browserWidth', this.O);
 e.addParameter('browserHeight', this.P);
 e.addParameter('browserTimeOffset', this.R);
 e.addParameter('colorDepth', this.Q);


 e.addParameters(this.rb().split('&'));


 e.setUrlProcessAction(function(e) {

 e += '&mboxURL=' + encodeURIComponent(document.location);
 var sb = encodeURIComponent(document.referrer);
 if (e.length + sb.length < 2000) {
 e += '&mboxReferrer=' + sb;
 }

 e += '&mboxVersion=' + mboxVersion;
 return e;
 });
};

mboxFactory.prototype.rb = function() {
 return "host="+window.location;
};


mboxFactory.prototype.Z = function() {
 document.write('<style>.' + 'mboxDefault'
 + ' { visibility:hidden; }</style>');
};

mboxFactory.prototype.isDomLoaded = function() {
 return this.E;
};

mboxFactory.prototype.K = function() {
 if (this.hb != null) {
 return;
 }
 this.hb = new Array();

 var X = this;
 (function() {
 var tb = document.addEventListener ? "DOMContentLoaded" : "onreadystatechange";
 var ub = false;
 var vb = function() {
 if (ub) {
 return;
 }
 ub = true;
 for (var i = 0; i < X.hb.length; ++i) {
 X.hb[i]();
 }
 };

 if (document.addEventListener) {
 document.addEventListener(tb, function() {
 document.removeEventListener(tb, arguments.callee, false);
 vb();
 }, false);

 window.addEventListener("load", function(){
 document.removeEventListener("load", arguments.callee, false);
 vb();
 }, false);

 } else if (document.attachEvent) {
 if (self !== self.top) {
 document.attachEvent(tb, function() {
 if (document.readyState === 'complete') {
 document.detachEvent(tb, arguments.callee);
 vb();
 }
 });
 } else {
 var wb = function() {
 try {
 document.documentElement.doScroll('left');
 vb();
 } catch (xb) {
 setTimeout(wb, 13);
 }
 };
 wb();
 }
 }

 if (document.readyState === "complete") {
 vb();
 }

 })();
};


mboxSignaler = function(yb, J) {
 this.J = J;
 var zb =
 J.getCookieNames('signal-');
 for (var j = 0; j < zb.length; j++) {
 var Ab = zb[j];
 var Bb = J.getCookie(Ab).split('&');
 var Y = yb(Bb[0], Bb);
 Y.load();
 J.deleteCookie(Ab);
 }
};


mboxSignaler.prototype.signal = function(Cb, ab ) {
 this.J.setCookie('signal-' +
 Cb, mboxShiftArray(arguments).join('&'), 45 * 60);
};


mboxList = function() {
 this.F = new Array();
};

mboxList.prototype.add = function(Y) {
 if (Y != null) {
 this.F[this.F.length] = Y;
 }
};


mboxList.prototype.get = function(ab) {
 var B = new mboxList();
 for (var j = 0; j < this.F.length; j++) {
 var Y = this.F[j];
 if (Y.getName() == ab) {
 B.add(Y);
 }
 }
 return B;
};

mboxList.prototype.getById = function(Db) {
 return this.F[Db];
};

mboxList.prototype.length = function() {
 return this.F.length;
};


mboxList.prototype.each = function(p) {
 if (typeof p != 'function') {
 throw 'Action must be a function, was: ' + typeof(p);
 }
 for (var j = 0; j < this.F.length; j++) {
 p(this.F[j]);
 }
};





mboxLocatorDefault = function(g) {
 this.g = 'mboxMarker-' + g;

 document.write('<div id="' + this.g +
 '" style="visibility:hidden;display:none">&nbsp;</div>');
};

mboxLocatorDefault.prototype.locate = function() {
 var Eb = document.getElementById(this.g);
 while (Eb != null) {
 
 if (Eb.nodeType == 1) {
 if (Eb.className == 'mboxDefault') {
 return Eb;
 }
 }
 Eb = Eb.previousSibling;
 }

 return null;
};

mboxLocatorDefault.prototype.force = function() {
 
 var Fb = document.createElement('div');
 Fb.className = 'mboxDefault';

 var Gb = document.getElementById(this.g);
 Gb.parentNode.insertBefore(Fb, Gb);

 return Fb;
};

mboxLocatorNode = function(Hb) {
 this.Eb = Hb;
};

mboxLocatorNode.prototype.locate = function() {
 return typeof this.Eb == 'string' ?
 document.getElementById(this.Eb) : this.Eb;
};

mboxLocatorNode.prototype.force = function() {
 return null;
};


mboxCreate = function(ab ) {
 var Y = mboxFactoryDefault.create( ab, mboxShiftArray(arguments));

 if (Y) {
 Y.load();
 }
 return Y;
};


mboxDefine = function(kb, ab ) {
 var Y = mboxFactoryDefault.create(ab,
 mboxShiftArray(mboxShiftArray(arguments)), kb);

 return Y;
};

mboxUpdate = function(ab ) {
 mboxFactoryDefault.update(ab, mboxShiftArray(arguments));
};


mbox = function(g, Ib, w, Jb, nb) {
 this.Kb = null;
 this.Lb = 0;
 this.mb = Jb;
 this.nb = nb;
 this.Mb = null;

 this.Nb = new mboxOfferContent();
 this.Fb = null;
 this.w = w;

 
 this.message = '';
 this.Ob = new Object();
 this.Pb = 0;

 this.Ib = Ib;
 this.g = g;

 this.Qb();

 w.addParameter('mbox', g)
 .addParameter('mboxId', Ib);

 this.Rb = function() {};
 this.Sb = function() {};

 this.Tb = null;
};

mbox.prototype.getId = function() {
 return this.Ib;
};

mbox.prototype.Qb = function() {
 if (this.g.length > 250) {
 throw "Mbox Name " + this.g + " exceeds max length of "
 + "250 characters.";
 } else if (this.g.match(/^\s+|\s+$/g)) {
 throw "Mbox Name " + this.g + " has leading/trailing whitespace(s).";
 }
};

mbox.prototype.getName = function() {
 return this.g;
};


mbox.prototype.getParameters = function() {
 var c = this.w.getParameters();
 var B = new Array();
 for (var j = 0; j < c.length; j++) {
 
 if (c[j].name.indexOf('mbox') != 0) {
 B[B.length] = c[j].name + '=' + c[j].value;
 }
 }
 return B;
};


mbox.prototype.setOnLoad = function(p) {
 this.Sb = p;
 return this;
};

mbox.prototype.setMessage = function(ob) {
 this.message = ob;
 return this;
};


mbox.prototype.setOnError = function(Rb) {
 this.Rb = Rb;
 return this;
};

mbox.prototype.setFetcher = function(Ub) {
 if (this.Mb) {
 this.Mb.cancel();
 }
 this.Mb = Ub;
 return this;
};

mbox.prototype.getFetcher = function() {
 return this.Mb;
};


mbox.prototype.load = function(c) {
 if (this.Mb == null) {
 return this;
 }

 this.setEventTime("load.start");
 this.cancelTimeout();
 this.Lb = 0;

 var w = (c && c.length > 0) ?
 this.w.clone().addParameters(c) : this.w;
 this.Mb.fetch(w);

 var X = this;
 this.Vb = setTimeout(function() {
 X.Rb('browser timeout', X.Mb.getType());
 }, 15000);

 this.setEventTime("load.end");

 return this;
};


mbox.prototype.loaded = function() {
 this.cancelTimeout();
 if (!this.activate()) {
 var X = this;
 setTimeout(function() { X.loaded(); }, 100);
 }
	
	/* WDPRO Additions */
	// Put returned content div into global hasmap
	tnt_wdpro.aMboxes[this.getName()] = this.getDiv();
	if (tnt_wdpro.isLameBrowser !== true){
		tnt_wdpro.pollTargetElement(this.getName());
	}
	/* End WDPRO Additions */
};


mbox.prototype.activate = function() {
 if (this.Lb) {
 return this.Lb;
 }
 this.setEventTime('activate' + ++this.Pb + '.start');
 if (this.show()) {
 this.cancelTimeout();
 this.Lb = 1;
 }
 this.setEventTime('activate' + this.Pb + '.end');
 return this.Lb;
};


mbox.prototype.isActivated = function() {
 return this.Lb;
};


mbox.prototype.setOffer = function(Nb) {
 if (Nb && Nb.show && Nb.setOnLoad) {
 this.Nb = Nb;
 } else {
 throw 'Invalid offer';
 }
 return this;
};

mbox.prototype.getOffer = function() {
 return this.Nb;
};


mbox.prototype.show = function() {
 this.setEventTime('show.start');
 var B = this.Nb.show(this);
 this.setEventTime(B == 1 ? "show.end.ok" : "show.end");

 return B;
};


mbox.prototype.showContent = function(Wb) {
 if (Wb == null) {
 
 return 0;
 }
 
 
 if (this.Fb == null || !this.Fb.parentNode) {
 this.Fb = this.getDefaultDiv();
 if (this.Fb == null) {
 
 return 0;
 }
 }

 if (this.Fb != Wb) {
 this.Xb(this.Fb);
 this.Fb.parentNode.replaceChild(Wb, this.Fb);
 this.Fb = Wb;
 }

 this.Yb(Wb);

 this.Sb();

 
 return 1;
};


mbox.prototype.hide = function() {
 this.setEventTime('hide.start');
 var B = this.showContent(this.getDefaultDiv());
 this.setEventTime(B == 1 ? 'hide.end.ok' : 'hide.end.fail');
 return B;
};


mbox.prototype.finalize = function() {
 this.setEventTime('finalize.start');
 this.cancelTimeout();

 if (this.getDefaultDiv() == null) {
 if (this.mb.force() != null) {
 this.setMessage('No default content, an empty one has been added');
 } else {
 this.setMessage('Unable to locate mbox');
 }
 }

 if (!this.activate()) {
 this.hide();
 this.setEventTime('finalize.end.hide');
 }
 this.setEventTime('finalize.end.ok');
};

mbox.prototype.cancelTimeout = function() {
 if (this.Vb) {
 clearTimeout(this.Vb);
 }
 if (this.Mb != null) {
 this.Mb.cancel();
 }
};

mbox.prototype.getDiv = function() {
 return this.Fb;
};


mbox.prototype.getDefaultDiv = function() {
 if (this.Tb == null) {
 this.Tb = this.mb.locate();
 }
 return this.Tb;
};

mbox.prototype.setEventTime = function(Zb) {
 this.Ob[Zb] = (new Date()).getTime();
};

mbox.prototype.getEventTimes = function() {
 return this.Ob;
};

mbox.prototype.getImportName = function() {
 return this.nb;
};

mbox.prototype.getURL = function() {
 return this.w.buildUrl();
};

mbox.prototype.getUrlBuilder = function() {
 return this.w;
};

mbox.prototype._b = function(Fb) {
 return Fb.style.display != 'none';
};

mbox.prototype.Yb = function(Fb) {
 this.ac(Fb, true);
};

mbox.prototype.Xb = function(Fb) {
 this.ac(Fb, false);
};

mbox.prototype.ac = function(Fb, bc) {
 Fb.style.visibility = bc ? "visible" : "hidden";
 Fb.style.display = bc ? "block" : "none";
};

mboxOfferContent = function() {
 this.Sb = function() {};
};

mboxOfferContent.prototype.show = function(Y) {
 var B = Y.showContent(document.getElementById(Y.getImportName()));
 if (B == 1) {
 this.Sb();
 }
 return B;
};

mboxOfferContent.prototype.setOnLoad = function(Sb) {
 this.Sb = Sb;
};


mboxOfferAjax = function(Wb) {
 this.Wb = Wb;
 this.Sb = function() {};
};

mboxOfferAjax.prototype.setOnLoad = function(Sb) {
 this.Sb = Sb;
};

mboxOfferAjax.prototype.show = function(Y) {
 var cc = document.createElement('div');

 cc.id = Y.getImportName();
 cc.innerHTML = this.Wb;

 var B = Y.showContent(cc);
 if (B == 1) {
 this.Sb();
 }
 return B;
};


mboxOfferDefault = function() {
 this.Sb = function() {};
};

mboxOfferDefault.prototype.setOnLoad = function(Sb) {
 this.Sb = Sb;
};

mboxOfferDefault.prototype.show = function(Y) {
 var B = Y.hide();
 if (B == 1) {
 this.Sb();
 }
 return B;
};

mboxCookieManager = function mboxCookieManager(g, dc) {
 this.g = g;
 
 this.dc = dc == '' || dc.indexOf('.') == -1 ? '' :
 '; domain=' + dc;
 this.ec = new mboxMap();
 this.loadCookies();
};

mboxCookieManager.prototype.isEnabled = function() {
 this.setCookie('check', 'true', 60);
 this.loadCookies();
 return this.getCookie('check') == 'true';
};


mboxCookieManager.prototype.setCookie = function(g, h, bb) {
 if (typeof g != 'undefined' && typeof h != 'undefined' &&
 typeof bb != 'undefined') {
 var fc = new Object();
 fc.name = g;
 fc.value = escape(h);
 
 fc.expireOn = Math.ceil(bb + new Date().getTime() / 1000);
 this.ec.put(g, fc);
 this.saveCookies();
 }
};

mboxCookieManager.prototype.getCookie = function(g) {
 var fc = this.ec.get(g);
 return fc ? unescape(fc.value) : null;
};

mboxCookieManager.prototype.deleteCookie = function(g) {
 this.ec.remove(g);
 this.saveCookies();
};

mboxCookieManager.prototype.getCookieNames = function(gc) {
 var hc = new Array();
 this.ec.each(function(g, fc) {
 if (g.indexOf(gc) == 0) {
 hc[hc.length] = g;
 }
 });
 return hc;
};

mboxCookieManager.prototype.saveCookies = function() {

 var ic = new Array();
 var jc = 0;
 this.ec.each(function(g, fc) {
 ic[ic.length] = g + '#' + fc.value + '#' +
 fc.expireOn;
 if (jc < fc.expireOn) {
 jc = fc.expireOn;
 }
 });

 var kc = new Date(jc * 1000);
 document.cookie = this.g + '=' + ic.join('|') +
 
 '; expires=' + kc.toGMTString() +
 '; path=/' + this.dc;

};

mboxCookieManager.prototype.loadCookies = function() {
 this.ec = new mboxMap();
 var lc = document.cookie.indexOf(this.g + '=');
 if (lc != -1) {
 var mc = document.cookie.indexOf(';', lc);
 if (mc == -1) {
 mc = document.cookie.indexOf(',', lc);
 if (mc == -1) {
 mc = document.cookie.length;
 }
 }
 var nc = document.cookie.substring(
 lc + this.g.length + 1, mc).split('|');

 var oc = Math.ceil(new Date().getTime() / 1000);
 for (var j = 0; j < nc.length; j++) {
 var fc = nc[j].split('#');
 if (oc <= fc[2]) {
 var pc = new Object();
 pc.name = fc[0];
 pc.value = fc[1];
 pc.expireOn = fc[2];
 this.ec.put(pc.name, pc);
 }
 }
 }
};


mboxSession = function(qc, rc, Ab, sc,
 J) {
 this.rc = rc;
 this.Ab = Ab;
 this.sc = sc;
 this.J = J;

 this.tc = false;

 this.Ib = typeof mboxForceSessionId != 'undefined' ?
 mboxForceSessionId : mboxGetPageParameter(this.rc);

 if (this.Ib == null || this.Ib.length == 0) {
 this.Ib = J.getCookie(Ab);
 if (this.Ib == null || this.Ib.length == 0) {
 this.Ib = qc;
 this.tc = true;
 }
 }

 J.setCookie(Ab, this.Ib, sc);
};


mboxSession.prototype.getId = function() {
 return this.Ib;
};

mboxSession.prototype.forceId = function(uc) {
 this.Ib = uc;

 this.J.setCookie(this.Ab, this.Ib, this.sc);
};


mboxPC = function(Ab, sc, J) {
 this.Ab = Ab;
 this.sc = sc;
 this.J = J;

 this.Ib = typeof mboxForcePCId != 'undefined' ?
 mboxForcePCId : J.getCookie(Ab);
 if (this.Ib != null) {
 J.setCookie(Ab, this.Ib, sc);
 }

};


mboxPC.prototype.getId = function() {
 return this.Ib;
};


mboxPC.prototype.forceId = function(uc) {
 if (this.Ib != uc) {
 this.Ib = uc;
 this.J.setCookie(this.Ab, this.Ib, this.sc);
 return true;
 }
 return false;
};

mboxGetPageParameter = function(g) {
 var B = null;
 var vc = new RegExp(g + "=([^\&]*)");
 var wc = vc.exec(document.location);

 if (wc != null && wc.length >= 2) {
 B = wc[1];
 }
 return B;
};

mboxSetCookie = function(g, h, bb) {
 return mboxFactoryDefault.getCookieManager().setCookie(g, h, bb);
};

mboxGetCookie = function(g) {
 return mboxFactoryDefault.getCookieManager().getCookie(g);
};

mboxCookiePageDomain = function() {
 var dc = (/([^:]*)(:[0-9]{0,5})?/).exec(document.location.host)[1];
 var xc = /[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/;

 if (!xc.exec(dc)) {
 var yc =
 (/([^\.]+\.[^\.]{3}|[^\.]+\.[^\.]+\.[^\.]{2})$/).exec(dc);
 if (yc) {
 dc = yc[0];
 }
 }

 return dc ? dc: "";
};

mboxShiftArray = function(zc) {
 var B = new Array();
 for (var j = 1; j < zc.length; j++) {
 B[B.length] = zc[j];
 }
 return B;
};

mboxGenerateId = function() {
 return (new Date()).getTime() + "-" + Math.floor(Math.random() * 999999);
};

mboxScreenHeight = function() {
 return screen.height;
};

mboxScreenWidth = function() {
 return screen.width;
};

mboxBrowserWidth = function() {
 return (window.innerWidth) ? window.innerWidth :
 document.documentElement ? document.documentElement.clientWidth :
 document.body.clientWidth;
};

mboxBrowserHeight = function() {
 return (window.innerHeight) ? window.innerHeight :
 document.documentElement ? document.documentElement.clientHeight :
 document.body.clientHeight;
};

mboxBrowserTimeOffset = function() {
 return -new Date().getTimezoneOffset();
};

mboxScreenColorDepth = function() {
 return screen.pixelDepth;
};

if (typeof mboxVersion == 'undefined') {
 var mboxVersion = 40;
 var mboxFactories = new mboxMap();
 var mboxFactoryDefault = new mboxFactory('disney.tt.omtrdc.net', 'disney',
 'default');
};

if (mboxGetPageParameter("mboxDebug") != null ||
 mboxFactoryDefault.getCookieManager()
 .getCookie("debug") != null) {
 setTimeout(function() {
 if (typeof mboxDebugLoaded == 'undefined') {
 alert('Could not load the remote debug.\nPlease check your connection'
 + ' to Test&amp;Target servers');
 }
 }, 60*60);
 document.write('<' + 'scr' + 'ipt language="Javascript1.2" src='
 + '"http://admin5.testandtarget.omniture.com/admin/mbox/mbox_debug.jsp?mboxServerHost=disney.tt.omtrdc.net'
 + '&clientCode=disney"><' + '\/scr' + 'ipt>');
};




mboxScPluginFetcher = function(b, Ac) {
 this.b = b;
 this.Ac = Ac;
};


mboxScPluginFetcher.prototype.Bc = function(w) {
 w.setBasePath('/m2/' + this.b + '/sc/standard');
 this.Cc(w);

 var e = w.buildUrl();
 e += '&scPluginVersion=1';
 return e;
};


mboxScPluginFetcher.prototype.Cc = function(w) {
 var Dc = [
 "dynamicVariablePrefix","visitorID","vmk","ppu","charSet",
 "visitorNamespace","cookieDomainPeriods","cookieLifetime","pageName",
 "currencyCode","variableProvider","channel","server",
 "pageType","transactionID","purchaseID","campaign","state","zip","events",
 "products","linkName","linkType","resolution","colorDepth",
 "javascriptVersion","javaEnabled","cookiesEnabled","browserWidth",
 "browserHeight","connectionType","homepage","pe","pev1","pev2","pev3",
 "visitorSampling","visitorSamplingGroup","dynamicAccountSelection",
 "dynamicAccountList","dynamicAccountMatch","trackDownloadLinks",
 "trackExternalLinks","trackInlineStats","linkLeaveQueryString",
 "linkDownloadFileTypes","linkExternalFilters","linkInternalFilters",
 "linkTrackVars","linkTrackEvents","linkNames","lnk","eo" ];

 for (var j = 0; j < Dc.length; j++) {
 this.Ec(Dc[j], w);
 }

 for (var j = 1; j <= 75; j++) {
 this.Ec('prop' + j, w);
 this.Ec('eVar' + j, w);
 this.Ec('hier' + j, w);
 }
};

mboxScPluginFetcher.prototype.Ec = function(g, w) {
 var h = this.Ac[g];
 if (typeof(h) === 'undefined' || h === null || h === '') {
 return;
 }
 w.addParameter(g, h);
};

mboxScPluginFetcher.prototype.cancel = function() { };


mboxStandardScPluginFetcher = function(b, Ac) {
 mboxScPluginFetcher.call(this, b, Ac);
};
mboxStandardScPluginFetcher.prototype = new mboxScPluginFetcher;

mboxStandardScPluginFetcher.prototype.getType = function() {
 return 'standard';
};

mboxStandardScPluginFetcher.prototype.fetch = function(w) {
 w.setServerType(this.getType());
 var e = this.Bc(w);

 document.write('<' + 'scr' + 'ipt src="' + e +
 '" language="JavaScript"><' + '\/scr' + 'ipt>');
};


mboxAjaxScPluginFetcher = function(b, Ac) {
 mboxScPluginFetcher.call(this, b, Ac);
};
mboxAjaxScPluginFetcher.prototype = new mboxScPluginFetcher;

mboxAjaxScPluginFetcher.prototype.fetch = function(w) {
 w.setServerType(this.getType());
 var e = this.Bc(w);

 this.x = document.createElement('script');
 this.x.src = e;

 document.body.appendChild(this.x);
};

mboxAjaxScPluginFetcher.prototype.getType = function() {
 return 'ajax';
};



function mboxLoadSCPlugin(Ac) {
 if (!Ac) {
 return null;
 }
 Ac.m_tt = function(Ac) {

 var Fc = Ac.m_i('tt');

 Fc.H = true;
 Fc.b = 'disney';

 
 Fc['_t'] = function() {
 if (!this.isEnabled()) {
 return;
 }

 var Y = this.Hc();
 if (Y) {
 
 
 var Ub = mboxFactoryDefault.isDomLoaded() ?
 new mboxAjaxScPluginFetcher(this.b, this.s) :
 new mboxStandardScPluginFetcher(this.b, this.s);
 Y.setFetcher(Ub);
 Y.load();
 }
 };

 Fc.isEnabled = function() {
 return this.H && mboxFactoryDefault.isEnabled();
 };

 Fc.Hc = function() {
 var ab = this.Ic();
 var Fb = document.createElement('DIV');
 return mboxFactoryDefault.create(ab, new Array(), Fb);
 };

 Fc.Ic = function() {
 var Jc = this.s.events && this.s.events.indexOf('purchase') != -1;
 return 'SiteCatalyst: ' + (Jc ? 'purchase' : 'event');
 };
 };

 return Ac.loadModule('tt');
};


/* WDPRO Additions */

/*@cc_on @*/
// For Internet Explorer 7 and below
/*@if (@_jscript_version <= 5.7)
mboxFactoryDefault.addOnLoad(tnt_wdpro.moveContentOnload);
/*@end @*/

/* End WDPRO Additions */

// --- end of mbox.js

// atob function decodes a base-64 encoded string
// atob comes with Firefox, Safari and Chrome, but we define it here so other browsers
// can use it too
if (!window.atob) {
    window.atob = function (input) {
        var output = [],
            chr1, chr2, chr3,
            enc1, enc2, enc3, enc4,
            i = 0,
            next = function () {
                return "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(input.charAt(i++));
            };

        // remove all characters that are not A-Z, a-z, 0-9, +, /, or =
        input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");

        while (i < input.length) {
            enc1 = next();
            enc2 = next();
            enc3 = next();
            enc4 = next();

            chr1 = (enc1 << 2) | (enc2 >> 4);
            chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
            chr3 = ((enc3 & 3) << 6) | enc4;

            output.push(String.fromCharCode(chr1));

            if (enc3 != 64) {
                output.push(String.fromCharCode(chr2));
            }
            if (enc4 != 64) {
                output.push(String.fromCharCode(chr3));
            }
        }

        return output.join('');
    };
}

// Use WDPRO namespace for Analytics Framework
var WDPRO = window.WDPRO || {};
WDPRO.Analytics = WDPRO.Analytics || {};

(function(A)
{
    /**
     *  loadScript
     *  function to load JS files asynchronously with callback function
     *  based on:
     *  http://www.nczonline.net/blog/2009/07/28/the-best-way-to-load-external-javascript/
     *  just made the callback optional
     *
     *  @param  string  url.- URL of the script to load
     *  @param  object  callback.- Function to execute after script has been
     *                  loaded
     *
     *  @return boolean true on success
     */
    var loadScript = function (url, callback)
    {
        var script = document.createElement("script");
        script.type = "text/javascript";

        if (script.readyState) // IE
        {
            script.onreadystatechange = function()
            {
                if (script.readyState == "loaded"
                        || script.readyState == "complete")
                {
                    script.onreadystatechange = null;
                    if (callback)
                    {
                        callback();
                    }
                }
            };
        }
        else // Other browsers (No IE)
        {
            script.onload = function()
            {
                if (callback)
                {
                    callback();
                }
            };
        }

        script.src = url;
        document.getElementsByTagName("head")[0].appendChild(script);
    };

    /**
     *  URL to load jQuery 
     */
    var jqueryPath = 'http://wdw.wdpromedia.com/analytics/framework/0.5.0/jquery-alternative.js';

    /**
     *  loadJquery
     *  Loads jQuery
     *
     *  @param  object  callback.- Function to execute after loaded
     *
     *  @return boolean true
     */
    var loadJquery = function(callback)
    {
            if (!window.jQuery)
            {
                loadScript(jqueryPath, callback);
            }
            else if (callback)
            {
                callback();
            }
            return true;
    };

    var initializeFramework = function()
    {
        /**
         *  Framework for easy implementation of Analytics solutions among all WDPRO sites
         */
        A.Framework = {
            /**
             *  JS object containing Analytics model
             */
            'analyticsModel': null,

            /**
             *  getAnalyticsModelFromBody
             *  Gets model from data-analytics attribute of the body, parses it and stores it
             *  on A.Framework.analyticsModel
             *
             *  @return boolean true on success
             */
            'getAnalyticsModelFromBody': function()
            {
                var encodedModel = $('body').attr('data-analytics');
                if (!encodedModel)
                {
                    A.Framework.analyticsModel = null;
                    return true;
                }

                try
                {
                    var decodedModel = atob(encodedModel);
                    
                    A.Framework.analyticsModel =  ($.parseJSON)? $.parseJSON(decodedModel) : decodedModel.parseJSON(decodedModel);
                    
                }catch(err){}
                return true;
            },

            /**
             *  hideTestElements
             *  Hides all elements that are going to be updated for content testing
             *
             *  @return boolean true on success, false on error
             */
            'hideTestElements': function()
            {
                // Make sure the analyticsModel exists
                if (!A.Framework.analyticsModel)
                {
                    return true;
                }

                var tests = A.Framework.analyticsModel.contentTests;
                if (!tests)
                {
                    return true;
                }

                // Hide the element with a css rule because it is possible
                // that the element is not in the DOM yet
                var elementsIds = new Array();
                for (var i = 0; i < tests.length; i++)
                {
                    // Don't do anything if contentTestHTMLTargetElement was not provided
                    var elementId = tests[i].contentTestHTMLTargetElement;
                    if (!elementId)
                    {
                        continue;
                    }

                    elementsIds.push('#' + elementId);
                }

                if (0 < elementsIds.length)
                {
                    $('head').append(
                            '<style type="text/css" rel="stylesheet">'
                                + elementsIds.join(',')
                                + ' { visibility: hidden; }'
                            + '</style>');
                }

                return true;
            },

            /**
             *  testContent
             *  Runs all the content testing from current page
             *
             *  @return boolean true on success
             */
            'testContent': function()
            {
                var runTests = function()
                {
                    // if analytics model hasn't been loaded then load it
                    if (!A.Framework.analyticsModel)
                    {
                        A.Framework.getAnalyticsModelFromBody();
                    }

                    // If there is no model then there is nothing to do
                    if (!A.Framework.analyticsModel
                            || !A.Framework.analyticsModel.contentTests)
                    {
                        return true;
                    }

                    A.Framework.hideTestElements();

                    // Wait for domready to run mboxUpdate
                    $(function()
                    {
                        var tests = A.Framework.analyticsModel.contentTests;

                        for (var i = 0; i < tests.length; i++)
                        {
                            // Don't do anything if contentTestHTMLTargetElement or
                            // contentTestModuleName were not provided
                            var elementId = tests[i].contentTestHTMLTargetElement;
                            var mboxName = tests[i].contentTestModuleName;
                            if (!elementId || !mboxName)
                            {
                                continue;
                            }

                            var model = A.Framework.analyticsModel;
                            var parameters = new Array();
                            $.each(model, function(index, value)
                            {
                                // Arrays are handled differently
                                if ('object' == typeof value)
                                {
                                    if ('contentTests' == index)
                                    {
                                        // This is equivalent to the continue
                                        // statement in a for loop
                                        return true;
                                    }

                                    if ('products' != index)
                                    {
                                        // If the value of this index is an array
                                        // we will concatenate the values with
                                        // a pipe(|)
                                        var paramValue = value.join('|');
                                        parameters.push(index + '=' + paramValue);
                                    }
                                    else
                                    {
                                        // The products index is an array
                                        // of objects so we need to first
                                        // iterate the array and then the
                                        // object properties
                                        for (var k = 0; k < value.length; k++)
                                        {
                                            $.each(value[k], function(idx, val)
                                            {
                                                if ('string' === typeof val)
                                                {
                                                    parameters.push(idx + '=' + val);
                                                }
                                            });
                                        }
                                    }
                                }
                                else
                                {
                                    if ('string' === typeof value)
                                    {
                                        parameters.push(index + '=' + value);
                                    }
                                }
                            });

                            try
                            {
                                mboxDefine(elementId, mboxName);
                                parameters.unshift(mboxName);
                                mboxUpdate.apply(this, parameters);
                            } catch(err){}

                            /**
                             *  mbox.js will automatically make mboxes visible
                             *  after trying to update them. Even if the server
                             *  is down or there are not campaigns set up
                             */
                        }
                    });
                };

                // If body is not available this script was probably run from the
                // head, so we will need to wait for the DOM to be ready
                //if (0 == $('body').length)
                //{
                    $(function()
                    {
                        runTests();
                    });
                //}
                /*else
                {
                    runTests();
                }*/
            }
        };

        // This version of the framework only does content testing so, as soon as
        // the framework is loaded we will run the tests for the current page
        A.Framework.testContent();
    };

    // Initialize the framework after jQuery has been loaded
    loadJquery(initializeFramework);
})(WDPRO.Analytics);

