﻿var mboxCopyright = "&copy; 1996-2008. Omniture, Inc. All rights reserved."; 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 + 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) { p(A, h); } } }; mboxFactory = function (B, b, C) { this.D = false; this.B = B; this.C = C; this.E = new mboxList(); mboxFactories.put(C, this); this.F = 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.G = this.F && mboxGetPageParameter('mboxDisable') == null; var H = C == 'default'; this.I = new mboxCookieManager('mbox' + (H ? '' : ('-' + C)), (function () { return mboxCookiePageDomain(); })()); this.G = this.G && this.I.isEnabled() && this.I.getCookie('disable') != 'true'; if (this.isAdmin()) { this.enable(); } this.J = mboxGenerateId(); this.K = new mboxSession(this.J, 'mboxSession', 'session', 31 * 60, this.I); this.L = new mboxPC('PC', 2592000, this.I); this.w = new mboxUrlBuilder(B, b); this.M(this.w, H); this.N = new Date().getTime(); this.O = this.N; var P = this; this.addOnLoad(function () { P.O = new Date().getTime(); }); if (this.F) { this.addOnLoad(function () { P.D = true; P.getMboxes().each(function (Q) { Q.setFetcher(new mboxAjaxFetcher()), Q.finalize(); }); }); this.limitTraffic(100, 10368000); if (this.G) { this.R(); this.S = new mboxSignaler(function (T, c) { return P.create(T, c); }, this.I); } } }; mboxFactory.prototype.isEnabled = function () { return this.G; }; mboxFactory.prototype.isSupported = function () { return this.F; }; mboxFactory.prototype.disable = function (U) { if (typeof U == 'undefined') { U = 60 * 60; } if (!this.isAdmin()) { this.G = false; this.I.setCookie('disable', 'true', U); } }; mboxFactory.prototype.enable = function () { this.G = true; this.I.deleteCookie('disable'); }; mboxFactory.prototype.isAdmin = function () { return document.location.href.indexOf('mboxEnv') != -1; }; mboxFactory.prototype.limitTraffic = function (V, U) { }; mboxFactory.prototype.addOnLoad = function (p) { if (window.addEventListener) { window.addEventListener('load', p, false); } else if (document.addEventListener) { document.addEventListener('load', p, false); } else if (document.attachEvent) { window.attachEvent('onload', p); } }; mboxFactory.prototype.getEllapsedTime = function () { return this.O - this.N; }; mboxFactory.prototype.getEllapsedTimeUntil = function (W) { return W - this.N; }; mboxFactory.prototype.getMboxes = function () { return this.E; }; mboxFactory.prototype.get = function (T, X) { return this.E.get(T).getById(X || 0); }; mboxFactory.prototype.update = function (T, c) { if (!this.isEnabled()) { return; } if (this.E.get(T).length() == 0) { throw "Mbox " + T + " is not defined"; } this.E.get(T).each(function (Q) { Q.getUrlBuilder().addParameter('mboxPage', mboxGenerateId()); Q.load(c); }); }; mboxFactory.prototype.create = function (T, c, Y) { if (!this.isSupported()) { return null; } var e = this.w.clone(); e.addParameter('mboxCount', this.E.length() + 1); e.addParameters(c); var X = this.E.get(T).length(); var Z = this.C + '-' + T + '-' + X; var _; if (Y) { _ = new mboxLocatorNode(Y); } else { if (this.D) { throw 'The page has already been loaded, can\'t write marker'; } _ = new mboxLocatorDefault(Z); } try { var P = this; var ab = 'mboxImported-' + Z; var Q = new mbox(T, X, e, _, ab); if (this.G) { Q.setFetcher(this.D ? new mboxAjaxFetcher() : new mboxStandardFetcher()); } Q.setOnError(function (bb, n) { Q.setMessage(bb); if (n == 'standard') { Q.activate(); if (!Q.isActivated()) { P.disable(); window.location.reload(false); } } else { throw bb; } }); this.E.add(Q); } catch (cb) { this.disable(); throw 'Failed creating mbox "' + T + '", the error was: ' + cb; } return Q; }; mboxFactory.prototype.getCookieManager = function () { return this.I; }; mboxFactory.prototype.getPageId = function () { return this.J; }; mboxFactory.prototype.getPCId = function () { return this.L; }; mboxFactory.prototype.getSessionId = function () { return this.K; }; mboxFactory.prototype.getSignaler = function () { return this.S; }; mboxFactory.prototype.getUrlBuilder = function () { return this.w; }; mboxFactory.prototype.M = function (e, H) { e.addParameter('mboxHost', document.location.hostname).addParameter('mboxSession', this.K.getId()); if (!H) { e.addParameter('mboxFactoryId', this.C); } if (this.L.getId() != null) { e.addParameter('mboxPC', this.L.getId()); } e.addParameter('mboxPage', this.J); var db = this.I.getCookie('edge'); if (db != null) { e.addParameter('edge', db); } e.setUrlProcessAction(function (e) { e += '&mboxURL=' + encodeURIComponent(document.location); var eb = encodeURIComponent(document.referrer); if (e.length + eb.length < 2000) { e += '&mboxReferrer=' + eb; } e += '&mboxVersion=' + mboxVersion; return e; }); }; mboxFactory.prototype.fb = function () { return ""; }; mboxFactory.prototype.R = function () { document.write('<style>.' + 'mboxDefault' + ' { visibility:hidden; }</style>'); }; mboxSignaler = function (gb, I) { this.I = I; var hb = I.getCookieNames('signal-'); for (var j = 0; j < hb.length; j++) { var ib = hb[j]; var jb = I.getCookie(ib).split('&'); var Q = gb(jb[0], jb); Q.load(); I.deleteCookie(ib); } }; mboxSignaler.prototype.signal = function (kb, T) { this.I.setCookie('signal-' + kb, mboxShiftArray(arguments).join('&'), 45 * 60); }; mboxList = function () { this.E = new Array(); }; mboxList.prototype.add = function (Q) { if (Q != null) { this.E[this.E.length] = Q; } }; mboxList.prototype.get = function (T) { var lb = new mboxList(); for (var j = 0; j < this.E.length; j++) { var Q = this.E[j]; if (Q.getName() == T) { lb.add(Q); } } return lb; }; mboxList.prototype.getById = function (mb) { return this.E[mb]; }; mboxList.prototype.length = function () { return this.E.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.E.length; j++) { p(this.E[j]); } }; mboxLocatorDefault = function (g) { this.g = 'mboxMarker-' + g; document.write('<div id="' + this.g + '" style="visibility:hidden;display:none"></div>'); }; mboxLocatorDefault.prototype.locate = function () { var nb = document.getElementById(this.g); while (nb != null) { if (nb.nodeType == 1) { if (nb.className == 'mboxDefault') { return nb; } } nb = nb.previousSibling; } return null; }; mboxLocatorDefault.prototype.force = function () { var ob = document.createElement('div'); ob.className = 'mboxDefault'; var pb = document.getElementById(this.g); pb.parentNode.insertBefore(ob, pb); return ob; }; mboxLocatorNode = function (qb) { this.nb = qb; }; mboxLocatorNode.prototype.locate = function () { return typeof this.nb == 'string' ? document.getElementById(this.nb) : this.nb; }; mboxLocatorNode.prototype.force = function () { return null; }; mboxCreate = function (T) { var Q = mboxFactoryDefault.create(T, mboxShiftArray(arguments)); if (Q) { Q.load(); } return Q; }; mboxDefine = function (Y, T) { var Q = mboxFactoryDefault.create(T, mboxShiftArray(mboxShiftArray(arguments)), Y); return Q; }; mboxUpdate = function (T) { mboxFactoryDefault.update(T, mboxShiftArray(arguments)); }; mbox = function (g, rb, w, sb, ab) { this.tb = null; this.ub = 0; this._ = sb; this.ab = ab; this.vb = null; this.wb = new mboxOfferContent(); this.ob = null; this.w = w; this.message = ''; this.xb = new Object(); this.yb = 0; this.rb = rb; this.g = g; this.zb(); w.addParameter('mbox', g).addParameter('mboxId', rb); this.Ab = function () { }; this.Bb = function () { }; }; mbox.prototype.getId = function () { return this.rb; }; mbox.prototype.zb = 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 lb = new Array(); for (var j = 0; j < c.length; j++) { if (c[j].name.indexOf('mbox') != 0) { lb[lb.length] = c[j].name + '=' + c[j].value; } } return lb; }; mbox.prototype.setOnLoad = function (p) { this.Bb = p; return this; }; mbox.prototype.setMessage = function (bb) { this.message = bb; return this; }; mbox.prototype.setOnError = function (Ab) { this.Ab = Ab; return this; }; mbox.prototype.setFetcher = function (Cb) { if (this.vb) { this.vb.cancel(); } this.vb = Cb; return this; }; mbox.prototype.getFetcher = function () { return this.vb; }; mbox.prototype.load = function (c) { if (this.vb == null) { return this; } this.setEventTime("load.start"); this.cancelTimeout(); this.ub = 0; var w = (c && c.length > 0) ? this.w.clone().addParameters(c) : this.w; this.vb.fetch(w); var P = this; this.Db = setTimeout(function () { P.Ab('Fetch of mbox timed out', P.vb.getType()); }, 15000); this.setEventTime("load.end"); return this; }; mbox.prototype.loaded = function () { this.cancelTimeout(); if (!this.activate()) { var P = this; setTimeout(function () { P.loaded(); }, 100); } }; mbox.prototype.activate = function () { if (this.ub) { return this.ub; } this.setEventTime('activate' + ++this.yb + '.start'); if (this.show()) { this.cancelTimeout(); this.ub = 1; } this.setEventTime('activate' + this.yb + '.end'); return this.ub; }; mbox.prototype.isActivated = function () { return this.ub; }; mbox.prototype.setOffer = function (wb) { if (wb && wb.show && wb.setOnLoad) { this.wb = wb; } else { throw 'Invalid offer'; } return this; }; mbox.prototype.getOffer = function () { return this.wb; }; mbox.prototype.show = function () { this.setEventTime('show.start'); var lb = this.wb.show(this); this.setEventTime(lb == 1 ? "show.end.ok" : "show.end"); return lb; }; mbox.prototype.showContent = function (Eb) { if (Eb == null) { return 0; } if (this.ob == null || !this.ob.parentNode) { this.ob = this.getDefaultDiv(true); if (this.ob == null) { return 0; } } if (this.ob != Eb) { this.Fb(this.ob); this.ob.parentNode.replaceChild(Eb, this.ob); this.ob = Eb; } this.Gb(Eb); this.Bb(); return 1; }; mbox.prototype.hide = function () { this.setEventTime('hide.start'); var lb = this.showContent(this.getDefaultDiv()); this.setEventTime(lb == 1 ? 'hide.end.ok' : 'hide.end.fail'); return lb; }; mbox.prototype.finalize = function () { this.setEventTime('finalize.start'); this.cancelTimeout(); if (this.getDefaultDiv() == null) { if (this._.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.Db) { clearTimeout(this.Db); } if (this.vb != null) { this.vb.cancel(); } }; mbox.prototype.getDiv = function () { return this.ob; }; mbox.prototype.getDefaultDiv = function (Hb) { var ob = this._.locate(); if (ob != null) { this.Ib = ob; } return Hb ? ob : this.Ib; }; mbox.prototype.setEventTime = function (Jb) { this.xb[Jb] = (new Date()).getTime(); }; mbox.prototype.getEventTimes = function () { return this.xb; }; mbox.prototype.getImportName = function () { return this.ab; }; mbox.prototype.getURL = function () { return this.w.buildUrl(); }; mbox.prototype.getUrlBuilder = function () { return this.w; }; mbox.prototype.Kb = function (ob) { return ob.style.display != 'none'; }; mbox.prototype.Gb = function (ob) { this.Lb(ob, true); }; mbox.prototype.Fb = function (ob) { this.Lb(ob, false); }; mbox.prototype.Lb = function (ob, Mb) { ob.style.visibility = Mb ? "visible" : "hidden"; ob.style.display = Mb ? "block" : "none"; }; mboxOfferContent = function () { this.Bb = function () { }; }; mboxOfferContent.prototype.show = function (Q) { var lb = Q.showContent(document.getElementById(Q.getImportName())); if (lb == 1) { this.Bb(); } return lb; }; mboxOfferContent.prototype.setOnLoad = function (Bb) { this.Bb = Bb; }; mboxOfferAjax = function (Eb) { this.Eb = Eb; this.Bb = function () { }; }; mboxOfferAjax.prototype.setOnLoad = function (Bb) { this.Bb = Bb; }; mboxOfferAjax.prototype.show = function (Q) { var Nb = document.createElement('div'); Nb.id = Q.getImportName(); Nb.innerHTML = this.Eb; var lb = Q.showContent(Nb); if (lb == 1) { this.Bb(); } return lb; }; mboxOfferDefault = function () { this.Bb = function () { }; }; mboxOfferDefault.prototype.setOnLoad = function (Bb) { this.Bb = Bb; }; mboxOfferDefault.prototype.show = function (Q) { var lb = Q.hide(); if (lb == 1) { this.Bb(); } return lb; }; mboxCookieManager = function mboxCookieManager(g, Ob) { this.g = g; this.Ob = Ob == '' || Ob.indexOf('.') == -1 ? '' : '; domain=' + Ob; this.Pb = 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, U) { if (typeof g != 'undefined' && typeof h != 'undefined' && typeof U != 'undefined') { var Qb = new Object(); Qb.name = g; Qb.value = escape(h); Qb.expireOn = Math.ceil(U + new Date().getTime() / 1000); this.Pb.put(g, Qb); this.saveCookies(); } }; mboxCookieManager.prototype.getCookie = function (g) { var Qb = this.Pb.get(g); return Qb ? unescape(Qb.value) : null; }; mboxCookieManager.prototype.deleteCookie = function (g) { this.Pb.remove(g); this.saveCookies(); }; mboxCookieManager.prototype.getCookieNames = function (Rb) { var Sb = new Array(); this.Pb.each(function (g, Qb) { if (g.indexOf(Rb) == 0) { Sb[Sb.length] = g; } }); return Sb; }; mboxCookieManager.prototype.saveCookies = function () { var Tb = new Array(); var Ub = 0; this.Pb.each(function (g, Qb) { Tb[Tb.length] = g + '#' + Qb.value + '#' + Qb.expireOn; if (Ub < Qb.expireOn) { Ub = Qb.expireOn; } }); var Vb = new Date(Ub * 1000); document.cookie = this.g + '=' + Tb.join('|') + '; expires=' + Vb.toGMTString() + '; path=/' + this.Ob; }; mboxCookieManager.prototype.loadCookies = function () { this.Pb = new mboxMap(); var Wb = document.cookie.indexOf(this.g + '='); if (Wb != -1) { var Xb = document.cookie.indexOf(';', Wb); if (Xb == -1) { Xb = document.cookie.indexOf(',', Wb); if (Xb == -1) { Xb = document.cookie.length; } } var Yb = document.cookie.substring(Wb + this.g.length + 1, Xb).split('|'); var Zb = Math.ceil(new Date().getTime() / 1000); for (var j = 0; j < Yb.length; j++) { var Qb = Yb[j].split('#'); if (Zb <= Qb[2]) { var _b = new Object(); _b.name = Qb[0]; _b.value = Qb[1]; _b.expireOn = Qb[2]; this.Pb.put(_b.name, _b); } } } }; mboxSession = function (ac, bc, ib, cc, I) { this.bc = bc; this.ib = ib; this.cc = cc; this.I = I; this.dc = false; this.rb = typeof mboxForceSessionId != 'undefined' ? mboxForceSessionId : mboxGetPageParameter(this.bc); if (this.rb == null || this.rb.length == 0) { this.rb = I.getCookie(ib); if (this.rb == null || this.rb.length == 0) { this.rb = ac; this.dc = true; } } I.setCookie(ib, this.rb, cc); }; mboxSession.prototype.getId = function () { return this.rb; }; mboxSession.prototype.forceId = function (ec) { this.rb = ec; this.I.setCookie(this.ib, this.rb, this.cc); }; mboxPC = function (ib, cc, I) { this.ib = ib; this.cc = cc; this.I = I; this.rb = typeof mboxForcePCId != 'undefined' ? mboxForcePCId : I.getCookie(ib); if (this.rb != null) { I.setCookie(ib, this.rb, cc); } }; mboxPC.prototype.getId = function () { return this.rb; }; mboxPC.prototype.forceId = function (ec) { if (this.rb != ec) { this.rb = ec; this.I.setCookie(this.ib, this.rb, this.cc); return true; } return false; }; mboxGetPageParameter = function (g) { var lb = null; var fc = new RegExp(g + "=([^\&]*)"); var gc = fc.exec(document.location); if (gc != null && gc.length >= 2) { lb = gc[1]; } return lb; }; mboxSetCookie = function (g, h, U) { return mboxFactoryDefault.getCookieManager().setCookie(g, h, U); }; mboxGetCookie = function (g) { return mboxFactoryDefault.getCookieManager().getCookie(g); }; mboxCookiePageDomain = function () { var Ob = (/([^:]*)(:[0-9]{0,5})?/).exec(document.location.host)[1]; var hc = /[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/; if (!hc.exec(Ob)) { var ic = (/([^\.]+\.[^\.]{3}|[^\.]+\.[^\.]+\.[^\.]{2})$/).exec(Ob); if (ic) { Ob = ic[0]; } } return Ob ? Ob : ""; }; mboxShiftArray = function (jc) { var lb = new Array(); for (var j = 1; j < jc.length; j++) { lb[lb.length] = jc[j]; } return lb; }; mboxGenerateId = function () { return (new Date()).getTime() + "-" + Math.floor(Math.random() * 999999); }; if (typeof mboxVersion == 'undefined') { var mboxVersion = 34; var mboxFactories = new mboxMap(); var mboxFactoryDefault = new mboxFactory('mbox12.offermatica.com', 'guitarcenter', 'default'); }; mboxDebugActionsProto = function () { this.kc = new Object(); this.lc = new function () { this.show = function () { } }; }; mboxDebugActionsProto.prototype.register = function (g, p) { this.kc[g] = p; }; mboxDebugActionsProto.prototype.registerDefault = function (p) { this.lc = p; }; mboxDebugActionsProto.prototype.show = function (g) { var p = this.kc[g] ? this.kc[g] : this.lc; (new p()).show(); }; if (typeof mboxDebugActions == 'undefined') { mboxDebugActions = new mboxDebugActionsProto(); }; mboxDebugActionDefault = function () { }; mboxDebugActionDefault.prototype.show = function () { var window = new mboxDebugWindow("Debug"); window.putPageStart(); window.put(" <b>Mbox Debug Window (version: " + mboxVersion + ")</b><br/>"); window.put("<p/>"); window.put("<b>Page</b>: " + document.location); window.put("<br/><b>Referrer</b>: " + document.referrer); window.put(" <ul>"); var G = mboxFactoryDefault.isEnabled(); window.put(' <li>Enabled: <span style="color:' + (G ? 'green' : 'red') + '"><b>' + G + '</b></span></li>'); window.put(" <li>Cookies: '" + document.cookie + "'</li></ul>"); mboxFactories.each(function (g, mc) { var nc = 1; window.put("<hr/><ul><li><b>Factory</b>: <i>'" + g + "'</i></li><ul>"); window.put("<li><i>pageId</i>: " + mc.getPageId() + "</li>"); window.put("<li><i>mboxPC</i>: " + mc.getPCId().getId() + "</li>"); window.put("<li><i>sessionId</i>: " + mc.getSessionId().getId() + "</li>"); window.put("<hr/>"); mc.getMboxes().each(function (Q) { window.put(" <li>" + nc++ + ". '<a href=\"" + Q.getURL() + "\">" + Q.getName() + "</a>'"); window.put(" <ul>"); if (Q.getId() != 0) { window.put("<li> <b>id</b>: " + Q.getId() + "</li>"); } if (Q.getParameters().length > 0) { window.put(" <li><b>parameters</b>: '" + Q.getParameters().join(", ") + "'</li>"); } window.put("<li><i>" + Q.getURL() + "</i></li>"); if (Q.message != '') { window.put(' <li><span style="color: red"><b>Error: ' + Q.message + '</b></span></li>'); } if (Q.getDefaultDiv() == null) { window.put(' <li><span style="color: red">' + '<b>Error: cannot find mbox in dom</b></span></li>'); } window.put(" </ul>"); window.put(" </li>"); }); window.put(" </ul>"); window.put(" </ul>"); }); window.put(" <hr/>"); window.putCloseButton(); window.putPageEnd(); }; mboxDebugActions.registerDefault(mboxDebugActionDefault); mboxDebug = function (oc, pc, mc) { this.qc = oc; this.p = null; this.I = mc.getCookieManager(); var rc = mboxGetPageParameter(pc); if (rc == null) { rc = this.I.getCookie(this.qc); } if (rc != null) { if (rc.indexOf("x") == 0) { document.write('<' + 'scr' + 'ipt language="Javascript1.2" src="' + 'http://admin12.offermatica.com/admin/mbox/mbox_debug_' + rc + '.jsp?clientCode=guitarcenter' + '&mboxServerHost=mbox12.offermatica.com"><' + '\/scr' + 'ipt>'); } if (!mc.isSupported()) { alert("mbox functionality is not supported on this browser"); this.disable(); } mc.addOnLoad(function () { mboxDebugActions.show(rc); }); this.I.setCookie(this.qc, rc, 45 * 60); } else { this.disable(); } }; mboxDebug.prototype.disable = function () { this.I.deleteCookie(this.qc); }; mboxDebugWindow = function (g) { this.g = g + " " + document.location.hostname; var sc = /\W/g; var tc = this.g.replace(sc, '_'); this.vc = window.open("", "mboxDebugWindow" + tc, "width=600,height=300,resizable,scrollbars=yes,toolbar=yes"); if (this.vc == null) { alert("Unable to open debug window.\nAre you blocking popups?\n"); } }; mboxDebugWindow.prototype.put = function (wc) { if (this.vc == null) { return; } try { this.vc.document.writeln(wc); this.vc.scrollBy(0, 1000); } catch (e) { alert("Unable to write to the current mboxDebug window.\n" + "Please close any open debug window"); this.vc = null; } }; mboxDebugWindow.prototype.putCloseButton = function () { this.put("<a href=\"javascript:mboxDebugWindowClose()\">" + "click here to close debug window</a>"); }; mboxDebugWindow.prototype.putPageStart = function () { this.put("<html><head>" + " <title>" + this.g + "</title>" + " <" + "scr" + "ipt>" + " function mboxDebugWindowClose() {" + " try {" + " window.opener.mboxDebugger.disable();" + " } catch(e) {" + " alert('Could not disable debug mode.\\n'" + " + 'Browse to a page containing an mbox and\\n'" + " + 'click on close link.');" + " }" + " window.close();" + " }" + " <" + "\/scr" + "ipt>" + " </head>" + " <body>"); }; mboxDebugWindow.prototype.putPageEnd = function () { this.put("</body></html>"); if (this.vc != null) { this.vc.document.close(); } }; if (typeof mboxDebugger == 'undefined') { mboxDebugger = new mboxDebug("debug", "mboxDebug", mboxFactoryDefault); }
