var mboxCopyright = "Copyright 2003-2006 Offermatica Corporation. All Rights Reserved.";mboxCreate = function(a ) { if (!mboxEnv.isSupported()) { return; } var b = new Array(); b[0] = 'mbox=' + a; for (var c = 1; c < arguments.length; c++) { b[c] = arguments[c]; } b[b.length] = "mboxCount=" + ++mboxCount; var d = new mbox(a, b); d.put(); return d;};mbox = function mbox(e, b) { this.f = mboxBuildURL(b); this.g = null; this.h = 0; this.i = null; this.j = new mboxOfferContent(); this.k = this.show; this.error = null; this.l = new Object(); this.m = 0; if (mboxs[e]) { var n = "multiple mboxes called: '" + e + '"'; this.setError(n); mboxs[e].setError(n); e = e + "-dup-" + Math.floor(Math.random() * 999999); } this.e = e; mboxs[e] = this;};mbox.prototype.getName = function() { return this.e;};mbox.prototype.parameters = function() { return mboxGetParamsFromQueryString(this.f);};mbox.prototype.setError = function(n) { this.error = n; this.o = this.putNothing; this.k = this.hide;};mbox.prototype.put = function() { if (mboxEnv.isEnabled()) { this.setEventTime("put.start"); document.write( '<div id="' + this.getMarkerName() + '" style="visibility:hidden;display:none">' + '<' + 'scr' + 'ipt language="JavaScript">' + 'mboxs["' + this.e + '"].startTimeout(15000);' + '<' + '\/scr' + 'ipt>' + '<' + 'scr' + 'ipt src="' + this.f + '" language="JavaScript"><' + '\/scr' + 'ipt>' + '</div>'); this.setEventTime("put.end"); } else { document.write('<div id="' + this.getMarkerName() + '"></div>'); }};mbox.prototype.putNothing = function() { document.write('<div id="' + this.getMarkerName() + '"></div>');};mbox.prototype.activate = function() { if (this.h) { return this.h; } this.setEventTime('activate' + ++this.m + '.start'); if (this.k()) { this.cancelTimeout(); this.h = 1; } this.setEventTime('activate' + this.m + '.end'); return this.h;};mbox.prototype.isActivated = function() { return this.h;};mbox.prototype.setActivateAction = function(p) { this.k = p;};mbox.prototype.setOffer = function(j) { this.j = j;};mbox.prototype.getOffer = function() { return this.j;};mbox.prototype.show = function() { this.setEventTime('show.start'); var q = this.j.show(this); this.setEventTime(q == 1 ? "show.end.ok" : "show.end"); return q;};mbox.prototype.showContent = function(r) { if (r == null) { return 0; } var s = this.getDefaultDiv(); if (s != null && s.parentNode.replaceChild) { s.parentNode.replaceChild(r, s); } else { var t = document.getElementById(this.getMarkerName()); if (t == null) { return 0; } if (s != null) { mboxMakeDivInvisible(s); } mboxMakeDivVisible(t); } mboxMakeDivVisible(r); return 1;};mbox.prototype.hide = function() { this.setEventTime('hide.start'); var t = document.getElementById(this.getMarkerName()); if (t != null) { t.style.visibility = "hidden"; t.style.display = "none"; } var s = this.getDefaultDiv(); if (s != null) { s.style.visibility = "visible"; s.style.display = "block"; this.setEventTime('hide.end.ok'); return 1; } this.setEventTime('hide.end.fail'); return 0;};mbox.prototype.finalize = function() { this.setEventTime('finalize.start'); this.cancelTimeout(); if (!this.activate()) { this.hide(); this.setEventTime('finalize.end.hide'); } this.setEventTime('finalize.end.ok');};mbox.prototype.startTimeout = function(u) { this.g = setTimeout('mboxCheckTimeoutById("' + this.e + '")', u);};mbox.prototype.cancelTimeout = function() { if (this.g != null) { clearTimeout(this.g); }};mbox.prototype.getImportDiv = function() { return document.getElementById(this.getImportName());};mbox.prototype.getDefaultDiv = function() { if (this.i != null) { return this.i; } var v = document.getElementById(this.getMarkerName()); while (v != null) { if ((v.nodeType == 1) && (v.nodeName == "DIV")) { if (v.className.indexOf('mboxMarker-') > 0) { return null; } else if (v.className == 'mboxDefault') { this.i = v; return v; } } v = v.previousSibling; } return null;};mbox.prototype.setActivateAction = function(action) { this.k = action;};mbox.prototype.getMarkerName = function() { return 'mboxMarker-' + this.e;};mbox.prototype.getImportName = function() { return 'mboxImported-' + this.e;};mbox.prototype.setEventTime = function(w) { this.l[w] = (new Date()).getTime();};mbox.prototype.getEventTimes = function() { return this.l;};mbox.prototype.getURL = function() { return this.f;};mboxMakeDivVisible = function(x) { x.style.visibility = "visible"; x.style.display = "block";};mboxMakeDivInvisible = function(x) { x.style.visibility = "hidden"; x.style.display = "none";};mboxGetParamsFromQueryString = function(url) { var y = new Object(); var z = url.indexOf("?"); if (z == -1 || z == (url.length - 1)) { return y; } var A = url.substring(z + 1); var B = A.split("&"); for (var c = 0; c < B.length; c++) { var C = B[c].split("="); if (C.length < 2 || C[0] == "" || C[1] == "") { continue; } else { y[C[0]] = C[1]; } } return y;};mboxOfferContent = function() {};mboxOfferContent.prototype.show = function(D) { var r = D.getImportDiv(); return D.showContent(r);};mboxOfferDefault = function() {};mboxOfferDefault.prototype.show = function(D) { return D.hide();};mboxParametersClient = function() { return "";};mboxBuildURL = function(b) { var q = mboxServerURL; q += "?" + b[0]; for (var c = 1; c < b.length; c++) { q += "&" + b[c]; } if (document.location.protocol == "https:") { q = q.replace("http:", "https:") } q += "&mboxHost=" + document.location.hostname; if (q.indexOf('mboxSession') == -1) { q += "&mboxSession=" + mboxSessionId.getId(); } q += "&mboxPC=" + mboxPCId.getId(); q += "&mboxPage=" + mboxPageId; q += "&mboxURL=" + escape(document.location); var E = escape(document.referrer); if (q.length + E.length < 2000) { q += "&mboxReferrer=" + E; } return q + "&mboxVersion=" + mboxVersion;};mboxIsSupported = function() { return true;};mboxEnvironment = function(F) { this.G = mboxIsSupported() && document.getElementById && (window.attachEvent || document.addEventListener || window.addEventListener); this.H = this.G; if (mboxGetPageParameter(F) != null) { this.H = false; } if (!mboxCookies.isEnabled()) { this.H = false; } if (mboxCookies.getCookie('disable') == "true") { this.H = false; } if (this.isAdmin()) { this.enable(); }};mboxEnvironment.prototype.isEnabled = function() { return this.H;};mboxEnvironment.prototype.isSupported= function() { return this.G;};mboxEnvironment.prototype.disable = function(u) { if (typeof duration == 'undefined') { u = 60 * 60; } if (!this.isAdmin()) { this.H = false; mboxCookies.setCookie('disable', "true", u); }};mboxEnvironment.prototype.enable = function() { this.H = true; mboxCookies.deleteCookie('disable');};mboxEnvironment.prototype.isAdmin = function() { return document.location.href.indexOf( 'mboxEnv') != -1;};mboxEnvironment.prototype.limitTraffic = function(I, u) { if (I == 100) { return; } var J = false; if (mboxCookies.getCookie('traffic') == 'true') { J = true; } if (this.isAdmin()) { J = true; mboxCookies.setCookie('level', I, u); mboxCookies.setCookie('traffic', J, u); } else if ( parseInt(mboxCookies.getCookie('level')) != I) { J = (Math.random() * 100) <= I; mboxCookies.setCookie('level', I, u); mboxCookies.setCookie('traffic', J, u); } if (J) { this.enable(); } else { this.disable(); }};mboxCookieManager = function mboxCookieManager(K, L) { this.K = K; if (L.indexOf(".") == -1) { L = ""; } this.L = L == "" ? "" : "; domain=" + L; this.loadCookies();};mboxCookieManager.prototype.isEnabled = function() { this.setCookie('check', "true", 60); this.loadCookies(); return this.getCookie('check') == "true";};mboxCookieManager.prototype.setCookie = function(K, M, u) { if (typeof K != 'undefined' && typeof M != 'undefined' && typeof u != 'undefined') { this.N[K] = { name:K, value:escape(M), expireOn:Math.ceil(u + new Date().getTime() / 1000) }; this.saveCookies(); }};mboxCookieManager.prototype.getCookie = function(K) { var O = this.N[K]; if (typeof O == 'undefined' || O == null) { return null; } return unescape(O.value);};mboxCookieManager.prototype.deleteCookie = function(K) { var P = new Object(); for (O in this.N) { if (O != K) { P[O] = this.N[O]; } } this.N = P; this.saveCookies();};mboxCookieManager.prototype.getCookieNames = function(Q) { var R = new Object(); for (O in this.N) { if (O.indexOf(Q) == 0) { R[R.length] = O; } } return R;};mboxCookieManager.prototype.saveCookies = function() { var S = new Array(); var T = 0; for (O in this.N) { if (this.N[O] != null) { S[S.length] = this.N[O].name + "#" + this.N[O].value + "#" + this.N[O].expireOn; if (T < this.N[O].expireOn) { T = this.N[O].expireOn; } } } var U = new Date(T * 1000); document.cookie = this.K + "=" + S.join("|") + "; expires=" + U.toGMTString() + "; path=/" + this.L;};mboxCookieManager.prototype.loadCookies = function() { this.N = new Object(); var V = document.cookie.indexOf(this.K + "="); if (V != -1) { var W = document.cookie.indexOf(";", V); if (W == -1) { W = document.cookie.indexOf(",", V); if (W == -1) { W = document.cookie.length; } } var X = document.cookie.substring( V + this.K.length + 1, W).split("|"); var Y = Math.ceil(new Date().getTime() / 1000); for (var c = 0; c < X.length; c++) { var O = X[c].split("#"); if (Y <= O[2]) { this.N[O[0]] = {name:O[0], value:O[1], expireOn:O[2]} } } }};mboxSetCookie = function(K, M, u) { mboxCookies.setCookie(K, M, u);};mboxGetCookie = function(K) { return mboxCookies.getCookie(K);};mboxActivateById = function(e) { mboxs[e].activate();};mboxCheckTimeoutById = function(e) { mboxs[e].activate(); if (!mboxs[e].isActivated()) { mboxEnv.disable(); window.location.reload(false); }};mboxCheckAll = function() { for (var D in mboxs) { mboxs[D].finalize(); }}; mboxSetupSignal = function(Z, a ) { var b = new Array(); for (var c = 1; c < arguments.length; c++) { b[c - 1] = arguments[c]; } mboxCookies.setCookie("signal-" + Z, b.join("&"), 45 * 60);};mboxSignal = function() { var _ = mboxCookies.getCookieNames( "signal-"); for (ab in _) { var bb = mboxCookies.getCookie(_[ab]); var b = bb.split("&"); var a = b[0]; b[0] = 'mbox=' + a; b[b.length] = "mboxCount=" + --mboxSignalCount; var cb = new mbox(a, b); cb.put(); mboxCookies.deleteCookie(_[ab]); }}; mboxDefaultContentDisplayNone = function() { document.write("<style>." + 'mboxDefault' + " { visibility:hidden; }</style>");};mboxSession = function(db, eb, fb, gb) { this.eb = eb; this.fb = fb; this.gb = gb; this.hb = false; this.e = mboxGetPageParameter(this.eb); if (this.e == null || this.e.length == 0) { this.e = mboxCookies.getCookie('session'); if (this.e == null || this.e.length == 0) { this.e = db; this.hb = true; } } mboxCookies.setCookie( 'session', this.e, gb);};mboxSession.prototype.getId = function() { return this.e;};mboxPC = function(db, fb, gb) { this.fb = fb; this.gb = gb; this.e = mboxCookies.getCookie(this.fb); if (this.e == null || this.e.length == 0) { this.e = db; }};mboxPC.prototype.getId = function() { mboxCookies.setCookie('PC', this.e, this.gb); return this.e;};mboxPC.prototype.forceId = function(ib) { if (this.e != ib) { this.e = ib; mboxCookies.setCookie(this.fb, this.e, this.gb); return true; } return false;};mboxGenerateId = function() { return (new Date()).getTime() + "-" + Math.floor(Math.random() * 999999);};mboxGetPageParameter = function(K) { var q = null; var jb = new RegExp(K + "=([^\&]*)"); var kb = jb.exec(document.location); if (kb != null && kb.length >=2) { q = kb[1]; } return q;};mboxCookieIsEnabled = function() { mboxCookies.setCookie('check', "true", 60); return mboxCookies.getCookie('check') == "true";};mboxSafeBodyOnload = 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); }};mboxCookiePageDomain = function() { var L = (/([^:]*)(:[0-9]{0,5})?/).exec(document.location.host)[1]; var lb = /[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/; if (!lb.exec(L)) { var mb = (/([^\.]+\.[^\.]{3}|[^\.]+\.[^\.]+\.[^\.]{2})$/).exec(L); if (mb) { L = mb[0]; } } return L ? L: "";};mboxCookieDomain = function() { return mboxCookiePageDomain();};if (typeof mboxVersion == 'undefined') { var mboxVersion = 22; var mboxServerURL = "http://mbox3.offermatica.com/m2/graceconstruction/mbox/standard"; var mboxCookies = new mboxCookieManager("mbox", mboxCookieDomain()); var mboxPageId = mboxGenerateId(); var mboxSessionId = new mboxSession(mboxPageId, 'mboxSession', 'session', 31 * 60); var mboxPCId = new mboxPC(mboxPageId, 'PC', 63072000); var mboxs = new Object(); var mboxCount = 0; var mboxSignalCount = 0; var mboxEnv = new mboxEnvironment('mboxDisable'); var mboxPageStartTime = new Date().getTime(); var mboxPageEndTime = mboxPageStartTime; mboxSafeBodyOnload(new Function("mboxPageEndTime = new Date().getTime()")); if (mboxEnv.isSupported()) { mboxSafeBodyOnload(mboxCheckAll); mboxEnv.limitTraffic(100, 10368000); if (mboxEnv.isEnabled()) { mboxSignal(); mboxDefaultContentDisplayNone(); } } }; mboxDisplayDebugInfo = function() { mboxDebugger.show();};mboxDebug = function(nb, ob, pb) { this.qb = nb; this.p = null; var rb = mboxGetPageParameter(ob); if (rb == null) { rb = mboxCookies.getCookie(this.qb); } if (rb != null) { if (rb.indexOf("x") == 0) { this.p = new mboxDebugActionNone(); document.write('<' + 'scr' + 'ipt language="Javascript1.2" src=' + '"http://admin3.offermatica.com/admin/mbox/mbox_debug_' + rb + '.jsp"' + '><' + '\/scr' + 'ipt>'); } else if (rb.indexOf("log") == 0) { this.p = new mboxDebugActionLog(rb); } else if (rb == "reset") { rb = null; } else { this.p = new mboxDebugActionDefault(); } } if (this.p != null) { if (pb.isSupported()) { mboxSafeBodyOnload(mboxDisplayDebugInfo) } else { alert("mbox functionality is not supported on this browser"); this.disable(); } } if (rb != null) { mboxCookies.setCookie(this.qb, rb, 45 * 60); } else { this.disable() }};mboxDebug.prototype.isEnabled = function() { return this.p != null;};mboxDebug.prototype.disable = function() { mboxCookies.deleteCookie(this.qb);};mboxDebug.prototype.setShowAction = function(p) { this.p = p;};mboxDebug.prototype.show = function() { if (this.p != null) { this.p.show(); }};mboxDebugActionLog = function(rb) { this.rb = rb; this.sb = (new Date()).getTime();};mboxDebugActionLog.prototype.show = function() { var tb = (new Date()).getTime(); var ub = new mboxDebugWindow("Debug Log"); ub.putPageStart(); ub.put("<img src='http://mbox3.offermatica.com/admin/images/spacer.gif" + "?mboxDebug=" + this.rb + "&mboxClient=graceconstruction" + "&mboxPageLoadTime=" + (tb - this.sb) + "&mboxCount=" + mboxCount + "&mboxSignalCount=" + mboxSignalCount + "'>"); ub.put("<br />"); ub.putCloseButton(); ub.putPageEnd();};mboxDebugActionNone = function() {};mboxDebugActionNone.prototype.show = function() { alert("Debug mode not defined" + "\n('x-mode' not supported when debug is remote in mbox.js)");};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(" <ul>"); if (mboxEnv.isEnabled()) { window.put("  <li>Enabled: true</li>"); } else { window.put( '  <li>Enabled: <span style="color:red"><b>false</b></span></li>'); } window.put("  <li>Cookies enabled: " + mboxCookieIsEnabled() + "</li>"); window.put("  <li>Page URL: '" + document.location + "'</li>"); window.put("  <li>Cookies: '" + document.cookie + "'</li>"); for (a in mboxs) { window.put("  <li>mbox: '" + a + "'"); window.put("   <ul>"); if (mboxs[a].error != null) { window.put('   <li><span style="color: red"><b>Error: ' + mboxs[a].error + '</b></span></li>'); } var t = document.getElementById(mboxs[a].getMarkerName()); if (t == null) { window.put('    <li><span style="color: red">' + '<b>Error: can not find mbox in dom</b></span></li>'); } else { window.put("    <li>has mboxDefault content div tags: " + (mboxs[a].getDefaultDiv() != null) + "</li>"); } window.put('    <li><a href="' + mboxs[a].getURL() + '">' + mboxs[a].getURL() + '</a></li>'); window.put("   </ul>"); window.put("  </li>"); } window.put(" </ul>"); window.putCloseButton(); window.putPageEnd();};mboxDebugWindow = function(K) { this.K = K + " " + document.location.hostname; var vb = /\W/g; var wb = this.K.replace(vb, '_'); this.ub = window.open("", "mboxDebugWindow" + wb, "width=600,height=300,resizable,scrollbars=yes,toolbar=yes"); if (this.ub == null) { alert("Unable to open Offermatica's mboxDebugWindow Window.\n" + "Are you blocking popups?\n"); return; }};mboxDebugWindow.prototype.put = function(yb) { if (this.ub == null) { return; } try { this.ub.document.writeln(yb); this.ub.scrollBy(0, 1000); } catch (e) { alert("Unable to write to the current mboxDebug window.\n" + "Please close any open debug window"); this.ub = 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.K + "</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.ub != null) { this.ub.document.close(); }};if (typeof mboxDebugger == 'undefined') { mboxDebugger = new mboxDebug("debug", "mboxDebug", mboxEnv);} 