function getBaseDomain()
{
  var domain = document.domain;
  var ifirst= domain.indexOf(".");
  domain=domain.substring(ifirst+1);		
  return domain;
}

// for netcrm the appdomain is netsuite, perform this replacement.
function getAppDomain()
{
  var domain = getBaseDomain();
  var iCRM=domain.indexOf("netcrm");
  if (iCRM != -1)
        domain=domain.substring(0,iCRM)+"netsuite"+domain.substring(iCRM+6);
  return domain;
}


function getQueryParameter(param)
{
  var idx = document.URL.indexOf(param+"=");
  if (idx != -1)
  {
    var sidx = idx+param.length+1;
    var len = document.URL.substring(sidx).indexOf("&");
    if (len == -1)
      return document.URL.substring(sidx);
    else
      return document.URL.substring(sidx, sidx+len);
  }
  else
    return null;
}

function getCookie(name)
{
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0)
      return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}

function setCookie(name, value, expires, path, domain, secure)
{
  if (value == "")
  {
  	value = null;
  	expires = new Date();
  }

  var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires.toGMTString() : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
  document.cookie = curCookie;
}

function setCookieFromParam(name)
{
  var value = getQueryParameter(name);
  //set the cookie to expire 10 years from the day it is set
  var expiresDate = new Date(new Date().getTime() + (10 * 365 * 1000 * 3600 * 24));

  if (value != null)
    setCookie(name, value, expiresDate, "/", getBaseDomain(), null);
  return value;  
}

//sets the cookie and returns the partner code
function setPartnerCookie()
{
  var partner = getQueryParameter("partner");
  //set the cookie to expire 10 years from the day it is set
  var expiresDate = new Date(new Date().getTime() + (10 * 365 * 1000 * 3600 * 24));
  if(partner == null)
     partner = getQueryParameter("affiliateid");

  if (partner != null)
    setCookie("partner", partner, expiresDate, "/", getBaseDomain(), null);

   return partner;
}

//JS function to extract the partnercode from cookies
function getPartnerCode()
{
    // check for the partner code from the query parameters, return if
    // return that value if we retreived the partner code
    var partner = setPartnerCookie();
    if(partner != null)
       return partner;

    //partner will replace the overloaded visitorCookie going forward
    partner = getCookie("partner");

    // visitorCookie is deprecated going forward so we want to extract the partner code (if one exists)
    // and re-cookie with partner
    if(partner == null)
    {
       
       partner = getCookie("visitorCookie");
       if(partner != null && partner.length > -1)
       {
            var vCookieVals = partner.split(",");
            partner = vCookieVals[1];
            //document.cookie = "visitorCookie; path=/portal/; domain="www.<%=NLConfig.getSystemDomain()%>"; expires=Fri, 02-Jan-1970 00:00:00";
            //    setCookie("visitorCookie", null, null, , "www.<%=NLConfig.getSystemDomain()%>", secure)
            if(partner != null && partner != "")
               setCookie("partner", partner, "/", null, getBaseDomain(), null)
       }
    }

    //return null if no partner code exists for consistency's sake
    if(partner == "")
       partner = null;

    return partner;
}

// the following cookies all for the standard parameters that we're interested in if available.
function setleadformparams()
{
    var partner = getPartnerCode();
    setCookieFromParam("promocode");
    setCookieFromParam("osb");
    setCookieFromParam("id");
    setCookieFromParam("email");
	
	// this represents the add medium.
	setCookieFromParam("custentity210");
	
	// this represents scompid for the referring partner.
	// id of corresponding custom field in ns is custentity_ref_comp_id
	setCookieFromParam("origin");
	
	return partner;
}

function writecobrandimage(defaultImage)
{
    // use the Std. NetSuite logo as the default if no image is specified
    if (defaultImage == null) {defaultImage="http://www.netsuite.com/portal/images/pages/logo_netsuite.gif";}
    
    
    var partner = setleadformparams();  
    
    if(partner != null)
    {
        var imageurl = "http://content."+getAppDomain()+"/app/crm/common/nlcorp/partnercobrand.nl?image=" + partner + "_30.gif";
        document.write("          <TD WIDTH='100%' HEIGHT='69'>\n");
        document.write("          <TABLE WIDTH='375' BORDER='0' CELLSPACING='0' CELLPADDING='0'>\n");
        document.write("            <TR HEIGHT='10'>\n");
        document.write("              <TD ROWSPAN='3' WIDTH='173' HEIGHT='69'><A HREF='http://www.netsuite.co.jp/portal/jp/index.html'><IMG SRC='" + defaultImage + "' ALT='NetSuite Business Software: Accounting, CRM, Ecommerce, ERP, Inventory' HEIGHT='69' WIDTH='173' BORDER='0'></A></TD>\n");
        document.write("              <TD ROWSPAN='3' WIDTH='16' HEIGHT='69'><IMG SRC='http://www.netsuite.com/portal/images/pages/spacer.gif' ALT='' HEIGHT='69' WIDTH='16' BORDER='0'></TD>\n");
        document.write("              <TD WIDTH='10' HEIGHT='10'><IMG SRC='http://www.netsuite.com/portal/images/pages/spacer.gif' ALT='' HEIGHT='10' WIDTH='10' BORDER='0'></TD>\n");
        document.write("              <TD ROWSPAN='3' WIDTH='175' HEIGHT='69'><img src='" + imageurl + "' height=30 width=175 vspace=7 border=0></TD>\n");
        document.write("            </TR>\n");
        document.write("            <TR HEIGHT='49'>\n");
        document.write("              <TD WIDTH='1' HEIGHT='49' BACKGROUND='http://www.netsuite.com/portal/images/pages/dots_vert.gif'><IMG SRC='http://www.netsuite.com/portal/images/pages/spacer.gif' ALT='' HEIGHT='49' WIDTH='1' BORDER='0'></TD>\n");
        document.write("            </TR>\n");
        document.write("            <TR HEIGHT='10'>\n");
        document.write("              <TD WIDTH='1' HEIGHT='10'><IMG SRC='http://www.netsuite.com/portal/images/pages/spacer.gif' ALT='' HEIGHT='10' WIDTH='1' BORDER='0'></TD>\n");
        document.write("            </TR>\n");
        document.write("          </TABLE>\n");
        document.write("        </TD>\n");
    }
    else
    {
        document.write("<TD WIDTH='100%' HEIGHT='69'><A HREF='http://www.netsuite.co.jp/portal/jp/index.html'><IMG SRC='" + defaultImage + "' ALT='NetSuite Business Software: Accounting, CRM, Ecommerce, ERP, Inventory' HEIGHT='69' WIDTH='173' BORDER='0'></A></TD>\n");
    }

    return true;
}


function redirecttologin()
{
    var redirect = getCookie("loginredirect");
    var noredirect = getQueryParameter("noredirect");

	// cmk 3/9/2005 -- need to explicitly send them to the secure pages
    if(noredirect == null && redirect != null)
        document.location = "https://system.netsuite.com/pages/customerlogin.jsp?country=US";

    return true;
}



function gotoform(formid)
{
    document.location = 'http://shopping.'+getAppDomain()+'/internal/portal/formredirect.nl?formid=' + formid;
    return true;
}

function gototestdrive()
{
   document.location = 'http://testdrive.'+getAppDomain()+'/internal/trial/testdrivelogin.nl';
   return true;
}

function selectAndGo(newLoc)
{
    newPage = newLoc.options[newLoc.selectedIndex].value;
    if(newPage != "")
        window.location.href = newPage;
}
function openTourWindow()
{
  tour = window.open('/portal/popuptour.nl','Tour','scrollbars=yes,resizable=yes,width=820,height=508');
  tour.focus();
}
function closeAndGoTo(url)
{
  opener.location = url;
  window.close();
}

function populateEmailFromCookie()
{
	var cookieVal = "";
	if (document.cookie.indexOf("OSBuserName=") > -1)
	{
		thisCookie = document.cookie.split("; ");
		for(i=0; i<thisCookie.length; i++)
		{
			if("OSBuserName" == thisCookie[i].split("=")[0])
			{
				cookieVal = thisCookie[i].split("=")[1];
				document.forms[0].elements['email'].value = cookieVal;
				document.forms[0].elements['rememberme'].checked = "T";
				document.forms[0].elements['password'].focus();
				return;
			}
		}
	}
	else
	{
		document.forms[0].elements['email'].focus();
	}
}

function hasFlash()
{
    if ((navigator.appName == "Microsoft Internet Explorer" &&
                navigator.appVersion.indexOf("Mac") == -1 &&
                navigator.appVersion.indexOf("3.1") == -1) ||
                (navigator.plugins && navigator.plugins["Shockwave Flash"])
                || navigator.plugins["Shockwave Flash 2.0"])
    {
        return true;
    }
    else
    {
        return false;
    }
}



/********
 * displays flash content or alternate
 * content is flash not detected. 
********/

function getSecureFlash(width, height, file, loop, alternate, classid)
{
	if (MM_FlashCanPlay)
	{
		var oeTags = '<OBJECT CLASSID="' + classid + '"'
         + 'WIDTH="' + width + '" HEIGHT="' + height + '"'
		 + 'CODEBASE="https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab">'
         + '<PARAM NAME="MOVIE" VALUE="' + file + '">'
         + '<PARAM NAME="PLAY" VALUE="true">'
         + '<PARAM NAME="LOOP" VALUE="' + loop + '">'
         + '<PARAM NAME="QUALITY" VALUE="high">'
         + '<PARAM NAME="MENU" VALUE="false">'
         + '<EMBED SRC="' + file + '"'
         + 'WIDTH="' + width + '" HEIGHT="' + height + '"'
         + 'PLAY="true"'
         + 'LOOP="' + loop + '"'
         + 'QUALITY="high"'
         + 'MENU="false"'
         + 'TYPE="application/x-shockwave-flash"'
		 + 'PLUGINSPAGE="https://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">'
         + '</EMBED>'
         + '</OBJECT>';
		document.write(oeTags);
	}
	else
	{
		var alternateContent = '<IMG SRC="' + alternate + '" HEIGHT="' + height + '" WIDTH="' + width + '" BORDER="0">'
		document.write(alternateContent);
	}
}

/********
 * displays flash content or alternate
 * content is flash not detected. 
********/

function getFlash(width, height, file, loop, alternate, classid, usemap)
{
	if (MM_FlashCanPlay)
	{
		var curProtocol = "http:";
		if (null != top.location.protocol && top.location.protocol=='https:')
		{
			curProtocol = "https:";
		}
		var oeTags = '<OBJECT CLASSID="' + classid + '"'
         + 'WIDTH="' + width + '" HEIGHT="' + height + '"'
         + 'CODEBASE="' + curProtocol + '//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0">'
         + '<PARAM NAME="MOVIE" VALUE="' + file + '">'
         + '<PARAM NAME="PLAY" VALUE="true">'
         + '<PARAM NAME="LOOP" VALUE="' + loop + '">'
         + '<PARAM NAME="QUALITY" VALUE="high">'
         + '<PARAM NAME="MENU" VALUE="false">'
         + '<EMBED SRC="' + file + '"'
         + 'WIDTH="' + width + '" HEIGHT="' + height + '"'
         + 'PLAY="true"'
         + 'LOOP="' + loop + '"'
         + 'QUALITY="high"'
         + 'MENU="false"'
         + 'TYPE="application/x-shockwave-flash"'
         + 'PLUGINSPAGE="' + curProtocol + '//www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">'
         + '</EMBED>'
         + '</OBJECT>';
		document.write(oeTags);
	}
	else
	{

		var alternateContent = '<IMG SRC="' + alternate + '" HEIGHT="' + height + '" WIDTH="' + width + '" BORDER="0" usemap="' +usemap+ '">'

		document.write(alternateContent);
	}
}

/********
 * Image rollovers for global navigation
********/

function globalNavOver(image_name) {
	image_name.src = "/web-common/assets/rt_blu_arrow.gif";
}

function globalNavOut(image_name) {
	image_name.src = "/web-common/assets/1x1_spacer.gif";
}

/********
 * Image swaping (mouseover) for the Web site
********/

function swapImage(daImage, daSrc){
var objStr, obj;
    if(document.images){
        if (typeof(daImage) == 'string') {
            objStr = 'document.' + daImage;
            obj = eval(objStr);
            obj.src = daSrc;
        } else if ((typeof(daImage) == 'object') && daImage && daImage.src) {
            daImage.src = daSrc;
        }
    }
}

//getFlash//
if(typeof dontDetectFlash == 'undefined') dontDetectFlash = false;
if(!dontDetectFlash){
	var MM_contentVersion = 5;
	var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
	if ( plugin ) {
			var words = navigator.plugins["Shockwave Flash"].description.split(" ");
		    for (var i = 0; i < words.length; ++i)
		    {
			if (isNaN(parseInt(words[i])))
			continue;
			var MM_PluginVersion = words[i]; 
		    }
		var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
	}
	else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 
	   && (navigator.appVersion.indexOf("Win") != -1)) {
		document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n'); //FS hide this from IE4.5 Mac by splitting the tag
		document.write('on error resume next \n');
		document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n');
		document.write('</SCR' + 'IPT\> \n');
	}
}


<!--main menu start-->

<!--
var timeout         = 500;
var closetimer		= 0;
var ddmenuitem      = 0;

// open hidden layer
function mopen(id)
{	
	// cancel close timer
	mcancelclosetime();

	// close old layer
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';

	// get new layer and show it
	ddmenuitem = document.getElementById(id);
	ddmenuitem.style.visibility = 'visible';

}
// close showed layer
function mclose()
{
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
}

// go close timer
function mclosetime()
{
	closetimer = window.setTimeout(mclose, timeout);
}

// cancel close timer
function mcancelclosetime()
{
	if(closetimer)
	{
		window.clearTimeout(closetimer);
		closetimer = null;
	}
}

// close layer when click-out
document.onclick = mclose; 
// -->

<!--main menu end -->


<!--pull-down start -->

<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
//-->

<!--pull-down end -->

<!--popup start -->
<!--

function openPopup(url) {
	remoteWindow = window.open(url,"mynewWindow","toolbar=1,location=0,directories=0,status=0,menubar=1,scrollbars=1,resizable=1,width=650,height=500");
}

//-->
<!--popup end -->

<!--mbox start -->
<!--
var mboxCopyright = "&copy; 2004-2007 Offermatica &trade; Corporation";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() { };mboxFactory = function(y, b) { this.z = new mboxList(); this.A = 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.B = this.A; if (mboxGetPageParameter('mboxDisable') != null) { this.B = false; } if (!mboxCookies.isEnabled()) { this.B = false; } if (mboxCookies.getCookie('disable') == 'true') { this.B = false; } if (this.isAdmin()) { this.enable(); } this.C = mboxGenerateId(); this.D = new mboxSession(this.C, 'mboxSession', 'session', 31 * 60); this.E = new mboxPC(this.C, 'PC', 63072000); this.w = new mboxUrlBuilder(y, b); this.F(); this.G = new Date().getTime(); this.H = this.G; var I = this; this.addOnLoad(function() { I.H = new Date().getTime(); }); if (this.A) { this.addOnLoad(function() { I.getMboxes().each(function(J) { J.finalize(); }); }); this.limitTraffic(100, 10368000); if (this.B) { this.K(); this.L = new mboxSignaler(function(M, c) { return I.create(M, c); }); } }};mboxFactory.prototype.isEnabled = function() { return this.B;};mboxFactory.prototype.isSupported = function() { return this.A;};mboxFactory.prototype.disable = function(N) { if (typeof duration == 'undefined') { N = 60 * 60; } if (!this.isAdmin()) { this.B = false; mboxCookies.setCookie('disable', 'true', N); }};mboxFactory.prototype.enable = function() { this.B = true; mboxCookies.deleteCookie('disable');};mboxFactory.prototype.isAdmin = function() { return document.location.href.indexOf( 'mboxEnv') != -1;};mboxFactory.prototype.limitTraffic = function(O, N) {};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.H - this.G;};mboxFactory.prototype.getEllapsedTimeUntil = function(P) { return P - this.G;};mboxFactory.prototype.getMboxes = function() { return this.z;};mboxFactory.prototype.get = function(M, Q) { return this.z.get(M).getById(Q || 0);};mboxFactory.prototype.update = function(M, c) { if (!this.isEnabled()) { return; } if (this.z.get(M).length() == 0) { throw "Mbox " + M + " is not defined"; } this.z.get(M).each(function(J) { J.setFetcher(new mboxAjaxFetcher()); J.getUrlBuilder() .addParameter('mboxRandomRequestId', mboxGenerateId()); J.load(c); });};mboxFactory.prototype.create = function(M, c) { if (!this.isSupported()) { return null; } var e = this.w.clone(); e.addParameter("mboxCount", this.z.length() + 1); e.addParameters(c); try { var I = this; var R = new mbox(M, this.z.get(M).length(), e); R.setOnError(function(S, n) { R.setMessage(S); if (n == 'standard') { R.activate(); if (!R.isActivated()) { I.disable(); window.location.reload(false); } } else { throw S; } }); R.setFetcher(new mboxStandardFetcher()); this.z.add(R); } catch (T) { this.disable(); throw 'Failed creating mbox, the error was: ' + T; } return R;};mboxFactory.prototype.getPageId = function() { return this.C;};mboxFactory.prototype.getPCId = function() { return this.E;};mboxFactory.prototype.getSessionId = function() { return this.D;};mboxFactory.prototype.getSignaler = function() { return this.L;};mboxFactory.prototype.getUrlBuilder = function() { return this.w;};mboxFactory.prototype.F = function() { var e = this.w; e.addParameter('mboxHost', document.location.hostname) .addParameter('mboxSession', this.D.getId()) .addParameter('mboxPC', this.E.getId()) .addParameter('mboxPage', this.C); var U = mboxCookies.getCookie('edge'); if (U != null) { e.addParameter('edge', U); } e.setUrlProcessAction(function(e) { e += '&mboxURL=' + escape(document.location); var V = escape(document.referrer); if (e.length + V.length < 2000) { e += '&mboxReferrer=' + V; } e += '&mboxVersion=' + mboxVersion; return e; });};mboxFactory.prototype.W = function() { return "";};mboxFactory.prototype.K = function() { document.write('<style>.' + 'mboxDefault' + ' { visibility:hidden; }</style>');};mboxSignaler = function(X) { var Y = mboxCookies.getCookieNames('signal-'); for (var j = 0; j < Y.length; j++) { var Z = Y[j]; var _ = mboxCookies.getCookie(Z).split('&'); var J = X(_[0], _); J.put(); J.load(); mboxCookies.deleteCookie(Z); }};mboxSignaler.prototype.signal = function(ab, M ) { mboxCookies.setCookie('signal-' + ab, mboxShiftArray(arguments).join('&'), 45 * 60);};mboxList = function() { this.z = new Array();};mboxList.prototype.add = function(J) { if (J != null) { this.z[this.z.length] = J; }};mboxList.prototype.get = function(M) { var bb = new mboxList(); for (var j = 0; j < this.z.length; j++) { var J = this.z[j]; if (J.getName() == M) { bb.add(J); } } return bb;};mboxList.prototype.getById = function(cb) { return this.z[cb];};mboxList.prototype.length = function() { return this.z.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.z.length; j++) { p(this.z[j]); }};mboxUpdate = function(M ) { mboxFactoryDefault.update(M, mboxShiftArray(arguments));};mboxCreate = function(M ) { var J = mboxFactoryDefault.create(M, mboxShiftArray(arguments)); if (J) { J.put(); if (mboxFactoryDefault.isEnabled()) { J.load(); } } return J;};mbox = function(g, db, w) { this.eb = null; this.fb = 0; this.gb = null; this.hb = new mboxOfferContent(); this.ib = this.getDefaultDiv(); this.w = w; this.message = ''; this.jb = new Object(); this.kb = 0; this.db = db; this.g = g; this.lb(); this.mb = new mboxStandardFetcher(); w.addParameter('mbox', g) .addParameter('mboxId', db); this.nb = function() {}; this.ob = function() {};};mbox.prototype.getId = function() { return this.db;};mbox.prototype.lb = 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.parameters = function() { return this.w.getParameters();};mbox.prototype.setOnLoad = function(p) { this.ob = p; return this;};mbox.prototype.setMessage = function(S) { this.message = S; return this;};mbox.prototype.setOnError = function(nb) { this.nb = nb; return this;};mbox.prototype.setFetcher = function(pb) { this.mb.cancel(); this.mb = pb; return this;};mbox.prototype.getFetcher = function() { return this.mb;};mbox.prototype.put = function() { document.write('<div id="' + this.getMarkerName() + '" style="visibility:hidden;display:none"></div>');};mbox.prototype.load = function(c) { this.setEventTime("load.start"); this.cancelTimeout(); var w = (c && c.length > 0) ? this.w.clone().addParameters(c) : this.w; this.mb.fetch(w); var I = this; this.qb = setTimeout(function() { I.nb('Fetch of mbox timed out', I.mb.getType()); }, 15000); this.setEventTime("load.end");};mbox.prototype.activate = function() { if (this.fb) { return this.fb; } this.setEventTime('activate' + ++this.kb + '.start'); if (this.show()) { this.cancelTimeout(); this.fb = 1; } this.setEventTime('activate' + this.kb + '.end'); return this.fb;};mbox.prototype.isActivated = function() { return this.fb;};mbox.prototype.setOffer = function(hb) { if (hb && hb.show && hb.setOnLoad) { this.hb = hb; } else { throw 'Invalid offer'; } return this;};mbox.prototype.getOffer = function() { return this.hb;};mbox.prototype.show = function() { this.setEventTime('show.start'); var bb = this.hb.show(this); this.setEventTime(bb == 1 ? "show.end.ok" : "show.end"); return bb;};mbox.prototype.showContent = function(rb) { if (rb == null) { return 0; } if (this.ib == null) { this.ib = this.getDefaultDiv(); if (this.ib == null) { return 0; } } this.sb(this.ib); this.ib.parentNode.replaceChild(rb, this.ib); this.ib = rb; this.tb(rb); this.ob(); return 1;};mbox.prototype.hide = function() { this.setEventTime('hide.start'); var bb = this.showContent(this.getDefaultDiv()); this.setEventTime(bb == 1 ? 'hide.end.ok' : 'hide.end.fail'); return bb;};mbox.prototype.finalize = function() { this.setEventTime('finalize.start'); this.cancelTimeout(); if (this.getDefaultDiv() == null) { this.gb = document.createElement('div'); this.gb.className = 'mboxDefault'; var ub = document.getElementById(this.getMarkerName()); ub.parentNode.insertBefore(this.gb, ub); this.setMessage('No default content, an empty one has been added'); } if (!this.activate()) { this.hide(); this.setEventTime('finalize.end.hide'); } this.setEventTime('finalize.end.ok');};mbox.prototype.cancelTimeout = function() { if (this.qb) { clearTimeout(this.qb); } this.mb.cancel();};mbox.prototype.getDiv = function() { return this.ib;};mbox.prototype.getDefaultDiv = function() { if (this.gb != null) { return this.gb; } var vb = document.getElementById(this.getMarkerName()); while (vb != null) { if ((vb.nodeType == 1) && (vb.nodeName == "DIV")) { if (vb.className.indexOf('mboxMarker-') > 0) { return null; } else if (vb.className == 'mboxDefault') { this.gb = vb; return vb; } } vb = vb.previousSibling; } return null;};mbox.prototype.getMarkerName = function() { return 'mboxMarker-' + this.g + '-' + this.db;};mbox.prototype.setEventTime = function(wb) { this.jb[wb] = (new Date()).getTime();};mbox.prototype.getEventTimes = function() { return this.jb;};mbox.prototype.getURL = function() { return this.w.buildUrl();};mbox.prototype.getUrlBuilder = function() { return this.w;};mbox.prototype.xb = function(ib) { return ib.style.display != 'none';};mbox.prototype.tb = function(ib) { this.yb(ib, true);};mbox.prototype.sb = function(ib) { this.yb(ib, false);};mbox.prototype.yb = function(ib, zb) { ib.style.visibility = zb ? "visible" : "hidden"; ib.style.display = zb ? "block" : "none";};mboxOfferContent = function() { this.ob = function() {};};mboxOfferContent.prototype.show = function(J) { var bb = J.showContent(document.getElementById( this.Ab(J))); if (bb == 1) { this.ob(); } return bb;};mboxOfferContent.prototype.setOnLoad = function(ob) { this.ob = ob;};mboxOfferContent.prototype.Ab = function(J) { return 'mboxImported-' + J.getName() + '-' + J.getId();};mboxOfferAjax = function(rb) { this.rb = rb; this.ob = function() {};};mboxOfferAjax.prototype.setOnLoad = function(ob) { this.ob = ob;};mboxOfferAjax.prototype.show = function(J) { var Bb = document.createElement('div'); Bb.id = 'mboxImported-' + J.getName() + '-' + J.getId(); Bb.innerHTML = this.rb; var bb = J.showContent(Bb); if (bb == 1) { this.ob(); } return bb;};mboxOfferDefault = function() {};mboxOfferDefault.prototype.setOnLoad = function(ob) { };mboxOfferDefault.prototype.show = function(J) { return J.hide();};mboxCookieManager = function mboxCookieManager(g, Cb) { this.g = g; this.Cb = Cb == '' || Cb.indexOf('.') == -1 ? '' : '; domain=' + Cb; this.loadCookies();};mboxCookieManager.prototype.isEnabled = function() { this.setCookie('check', 'true', 60); this.loadCookies(); return this.getCookie('check') == 'true';};mboxCookieManager.prototype.setCookie = function(g, h, N) { if (typeof g != 'undefined' && typeof h != 'undefined' && typeof N != 'undefined') { var cb = this.Db.length; for (var j = 0; j < this.Db.length; j++) { if (this.Db[j].name == g) { cb = j; break; } } var Eb = new Object(); Eb.name = g; Eb.value = escape(h); Eb.expireOn = Math.ceil(N + new Date().getTime() / 1000); this.Db[cb] = Eb; this.saveCookies(); }};mboxCookieManager.prototype.getCookie = function(g) { for (var j = 0; j < this.Db.length; j++) { var Eb = this.Db[j]; if (Eb.name == g) { return unescape(Eb.value); } } return null;};mboxCookieManager.prototype.deleteCookie = function(g) { var Fb = new Array(); for (var j = 0; j < this.Db.length; j++) { var Eb = this.Db[j]; if (Eb.name != g) { Fb[Fb.length] = Eb; } } this.Db = Fb; this.saveCookies();};mboxCookieManager.prototype.getCookieNames = function(Gb) { var Hb = new Array(); for (var j = 0; j < this.Db.length; j++) { var Eb = this.Db[j]; if (Eb.name.indexOf(Gb) == 0) { Hb[Hb.length] = Eb.name; } } return Hb;};mboxCookieManager.prototype.saveCookies = function() { var Ib = new Array(); var Jb = 0; for (var j = 0; j < this.Db.length; j++) { var Eb = this.Db[j]; Ib[Ib.length] = Eb.name + '#' + Eb.value + '#' + Eb.expireOn; if (Jb < Eb.expireOn) { Jb = Eb.expireOn; } } var Kb = new Date(Jb * 1000); document.cookie = this.g + '=' + Ib.join('|') + '; expires=' + Kb.toGMTString() + '; path=/' + this.Cb;};mboxCookieManager.prototype.loadCookies = function() { this.Db = new Array(); var Lb = document.cookie.indexOf(this.g + '='); if (Lb != -1) { var Mb = document.cookie.indexOf(';', Lb); if (Mb == -1) { Mb = document.cookie.indexOf(',', Lb); if (Mb == -1) { Mb = document.cookie.length; } } var Nb = document.cookie.substring( Lb + this.g.length + 1, Mb).split('|'); var Ob = Math.ceil(new Date().getTime() / 1000); for (var j = 0; j < Nb.length; j++) { var Eb = Nb[j].split('#'); if (Ob <= Eb[2]) { var Pb = new Object(); Pb.name = Eb[0]; Pb.value = Eb[1]; Pb.expireOn = Eb[2]; this.Db[this.Db.length] = Pb; } } }};mboxSession = function(Qb, Rb, Z, Sb) { this.Rb = Rb; this.Z = Z; this.Sb = Sb; this.Tb = false; this.db = typeof mboxForceSessionId != 'undefined' ? mboxForceSessionId : mboxGetPageParameter(this.Rb); if (this.db == null || this.db.length == 0) { this.db = mboxCookies.getCookie(Z); if (this.db == null || this.db.length == 0) { this.db = Qb; this.Tb = true; } } mboxCookies.setCookie(Z, this.db, Sb);};mboxSession.prototype.getId = function() { return this.db;};mboxSession.prototype.forceId = function(Ub) { this.db = Ub; mboxCookies.setCookie(this.Z, this.db, this.Sb);};mboxPC = function(Qb, Z, Sb) { this.Z = Z; this.Sb = Sb; this.db = typeof mboxForcePCId != 'undefined' ? mboxForcePCId : mboxCookies.getCookie(Z); if (this.db == null || this.db.length == 0) { this.db = Qb; } mboxCookies.setCookie(Z, this.db, Sb);};mboxPC.prototype.getId = function() { return this.db;};mboxPC.prototype.forceId = function(Ub) { if (this.db != Ub) { this.db = Ub; mboxCookies.setCookie(this.Z, this.db, this.Sb); return true; } return false;};mboxGetPageParameter = function(g) { var bb = null; var Vb = new RegExp(g + "=([^\&]*)"); var Wb = Vb.exec(document.location); if (Wb != null && Wb.length >= 2) { bb = Wb[1]; } return bb;};mboxSetCookie = function(g, h, N) { return mboxCookies.setCookie(g, h, N);};mboxGetCookie = function(g) { return mboxCookies.getCookie(g);};mboxCookiePageDomain = function() { var Cb = (/([^:]*)(:[0-9]{0,5})?/).exec(document.location.host)[1]; var Xb = /[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/; if (!Xb.exec(Cb)) { var Yb = (/([^\.]+\.[^\.]{3}|[^\.]+\.[^\.]+\.[^\.]{2})$/).exec(Cb); if (Yb) { Cb = Yb[0]; } } return Cb ? Cb: "";};mboxShiftArray = function(Zb) { var bb = new Array(); for (var j = 1; j < Zb.length; j++) { bb[bb.length] = Zb[j]; } return bb;};mboxGenerateId = function() { return (new Date()).getTime() + "-" + Math.floor(Math.random() * 999999);};if (typeof mboxVersion == 'undefined') { var mboxVersion = 28; var mboxCookies = new mboxCookieManager("mbox", (function() { return mboxCookiePageDomain(); })()); var mboxFactoryDefault = new mboxFactory('mbox5.offermatica.com', 'netsuite');};mboxDisplayDebugInfo = function() { mboxDebugger.show();};mboxCookieIsEnabled = function() { mboxCookies.setCookie('check', "true", 60); return mboxCookies.getCookie('check') == "true"};mboxDebug = function(_b, ac, bc) { this.cc = _b; this.p = null; var dc = mboxGetPageParameter(ac); if (dc == null) { dc = mboxCookies.getCookie(this.cc); } if (dc != null) { if (dc.indexOf("x") == 0) { this.p = new mboxDebugActionNone(); document.write('<' + 'scr' + 'ipt language="Javascript1.2" src=' + '"http://admin5.offermatica.com/admin/mbox/mbox_debug_' + dc + '.jsp?mboxServerHost=mbox5.offermatica.com&clientCode=netsuite&' + 'session=' + mboxCookies.getCookie('session') + '"><' + '\/scr' + 'ipt>'); } else if (dc.indexOf("log") == 0) { this.p = new mboxDebugActionLog(dc); } else if (dc == "reset") { dc = null; } else { this.p = new mboxDebugActionDefault(); } } if (this.p != null) { if (bc.isSupported()) { bc.addOnLoad(mboxDisplayDebugInfo); } else { alert("mbox functionality is not supported on this browser"); this.disable(); } } if (dc != null) { mboxCookies.setCookie(this.cc, dc, 45 * 60); } else { this.disable() }};mboxDebug.prototype.isEnabled = function() { return this.p != null;};mboxDebug.prototype.disable = function() { mboxCookies.deleteCookie(this.cc);};mboxDebug.prototype.setShowAction = function(p) { this.p = p;};mboxDebug.prototype.show = function() { if (this.p != null) { this.p.show(); }};mboxDebugActionLog = function(dc) { this.dc = dc; this.ec = (new Date()).getTime();};mboxDebugActionLog.prototype.show = function() { var fc = (new Date()).getTime(); var gc = new mboxDebugWindow("Debug Log"); gc.putPageStart(); gc.put("<img sr" + "c='" + document.location.protocol + "//mbox5.offermatica.com/ima" + "ges/log.gif" + "?mboxDebug=" + this.dc + "&mboxClient=netsuite" + "&mboxPageLoadTime=" + (fc - this.ec) + "'/>"); gc.put("<br />"); gc.putCloseButton(); gc.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 (mboxFactoryDefault.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>"); mboxFactoryDefault.getMboxes().each(function(J) { var Q = J.getName(); window.put("  <li>mbox: '" + Q + "'"); window.put("   <ul>"); if (J.message != '') { window.put('   <li><span style="color: red"><b>Error: ' + J.message + '</b></span></li>'); } var ub = document.getElementById(J.getMarkerName()); if (ub == null) { window.put('    <li><span style="color: red">' + '<b>Error: can not find mbox in dom</b></span></li>'); } window.put('    <li><a href="' + J.getURL() + '">' + J.getURL() + '</a></li>'); window.put("   </ul>"); window.put("  </li>"); }); window.put(" </ul>"); window.putCloseButton(); window.putPageEnd();};mboxDebugWindow = function(g) { this.g = g + " " + document.location.hostname; var hc = /\W/g; var ic = this.g.replace(hc, '_'); this.gc = window.open("", "mboxDebugWindow" + ic, "width=600,height=300,resizable,scrollbars=yes,toolbar=yes"); if (this.gc == null) { alert("Unable to open Offermatica's mboxDebugWindow Window.\n" + "Are you blocking popups?\n"); }};mboxDebugWindow.prototype.put = function(kc) { if (this.gc == null) { return; } try { this.gc.document.writeln(kc); this.gc.scrollBy(0, 1000); } catch (e) { alert("Unable to write to the current mboxDebug window.\n" + "Please close any open debug window"); this.gc = 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.gc != null) { this.gc.document.close(); }};if (typeof mboxDebugger == 'undefined') { mboxDebugger = new mboxDebug("debug", "mboxDebug", mboxFactoryDefault);}

//-->
<!--mbox end -->
<!-- baynote starts -->

var BaynoteJSVersion="$Revision: 1.24 $";var BN_READY_SIGNAL="ReadySignal";if(typeof(baynote_globals)=="undefined")var baynote_globals=new Object();baynote_globals.waitForReady=false;function BNLog(){this.timeBase=new Date().getTime();this.lines=new Array();this.lastLine="";this.repCount=0;}
BNLog.prototype.log=function(str){if(str==this.lastLine){++this.repCount;return;}
if(this.repCount>0){this.lines.push("___ ABOVE REPEATED "+this.repCount+" TIME"+((this.repCount>1)?"S":""));}
this.lastLine=str;this.repCount=0;var elapsed=new Date().getTime()-this.timeBase
this.lines.push(elapsed+": "+str);}
BNLog.prototype.toString=function(){if(this.repCount>0){this.lines.push("___ ABOVE REPEATED "+this.repCount+" TIME"
+((this.repCount>1)?"S":""));this.lastLine="";this.repCount=0;}
return this.lines.join("\n");}
if(typeof(bnLog)=="undefined"){var bnLog=new BNLog();}
function BNCriticalSectionQueue(){this.waitList=new Object();this.lastId=0;}
BNCriticalSectionQueue.prototype.issueId=function(){return++this.lastId;}
BNCriticalSectionQueue.prototype.enqueue=function(id,item){this.waitList[id]=item;}
BNCriticalSectionQueue.prototype.getWaiter=function(id){return(id==null)?null:this.waitList[id];}
BNCriticalSectionQueue.prototype.firstWaiter=function(){return this.getWaiter(this.nextWaiterKeyAfter(null));}
BNCriticalSectionQueue.prototype.nextWaiterAfter=function(id){return this.getWaiter(this.nextWaiterKeyAfter(id));}
BNCriticalSectionQueue.prototype.nextWaiterKeyAfter=function(id){for(var currKey in this.waitList){if(typeof(this.waitList[currKey])!="object")continue;if(id==null)return currKey;if(id==currKey)id=null;}
return null;}
BNCriticalSectionQueue.prototype.nextPredecessor=function(target,start){for(var currWaiter=start;currWaiter!=null;currWaiter=this.nextWaiterAfter(currWaiter.id)){if(currWaiter.enter||(currWaiter.number!=0&&(currWaiter.number<target.number||(currWaiter.number==target.number&&currWaiter.id<target.id)))){return currWaiter;}}
return null;}
function BNCriticalSection(csQueue){this.csQueue=csQueue;this.debug=1;}
BNCriticalSection.prototype.enter=function(enterFunc){this.enterFunc=enterFunc;this.id=this.csQueue.issueId();this.csQueue.enqueue(this.id,this);this.enter=true;this.number=(new Date()).getTime();this.enter=false;this.attempt(this.csQueue.firstWaiter());}
BNCriticalSection.prototype.leave=function(){if(this.debug)bnLog.log("LEAVE "+this.id);this.number=0;}
BNCriticalSection.prototype.attempt=function(start){var nextReady=this.csQueue.nextPredecessor(this,start);if(nextReady!=null){if(this.debug)bnLog.log("WAIT "+this.id);var me=this;return setTimeout(function(){me.attempt(nextReady);},50);}
if(this.debug)bnLog.log("ENTER "+this.id);this.enterFunc();}
function BNResourceManager(){this.csQueue=new BNCriticalSectionQueue();this.critSec=null;this.debug=1;this.resources=new Object();this.waiting=new Object();}
BNResourceManager.prototype.getResource=function(rId){return this.resources[rId];}
BNResourceManager.prototype.loadResource=function(rId,rAddress,rType){if(typeof(this.resources[rId])!="undefined")return;this.resources[rId]=null;var critSec=new BNCriticalSection(this.csQueue);critSec.enter(function(){bnResourceManager.inject(rId,rAddress,rType,critSec);});}
BNResourceManager.prototype.inject=function(rId,rAddress,rType,critSec){this.critSec=critSec;if(this.debug)bnLog.log("INJECT "+this.critSec.id+" ("+rId+")");if(!rType||rType=="script"){var scriptTag1=document.createElement("script");scriptTag1.language="javascript";scriptTag1.src=rAddress;var head=document.getElementsByTagName("head");head[0].appendChild(scriptTag1);}
else if(rType=="img"){var img=document.createElement("IMG");var handler=function(){bnResourceManager.registerAndAddResource(rId,img);};if(img.addEventListener)img.addEventListener("load",handler,false);else if(img.attachEvent)img.attachEvent("onload",handler);else img["onload"]=handler;img.src=rAddress;}
else alert("Unexpected resource type to loadResource: "+rType);}
BNResourceManager.prototype.waitForResource=function(rId,callbackCode,rAddress,rType){with(this){if(getResource(rId)){this.runCallback(callbackCode);}
else{if(typeof(waiting[rId])=="undefined")waiting[rId]=new Array();var waitingList=waiting[rId];waitingList[waitingList.length]=callbackCode;if(rAddress)this.loadResource(rId,rAddress,rType);}}}
BNResourceManager.prototype.wakeUpWaiting=function(rId){with(this){var waitingList=waiting[rId];if(!waitingList)return;for(var i=0;i<waitingList.length;i++){if(waitingList[i]){var codeToEval=waitingList[i];waitingList[i]=null;if(this.debug&&codeToEval)bnLog.log("CALLBACK "+rId+": "+codeToEval);this.runCallback(codeToEval);}}}}
BNResourceManager.prototype.registerAndAddResource=function(rId,resource){if(this.debug)bnLog.log("REGISTER "+(this.critSec?this.critSec.id:"")+" ("+rId+")");this.resources[rId]=resource;this.wakeUpWaiting(rId);this.critSec.leave();setTimeout("bnResourceManager.wakeUpWaiting('"+rId+"')",5000);}
BNResourceManager.prototype.registerResource=function(rId){this.registerAndAddResource(rId,true);}
BNResourceManager.prototype.runCallback=function(callback){if(typeof(callback)=="string")eval(callback);else if(typeof(callback)=="function")callback();else alert("Invalid callback, type="+typeof(callback));}
if(typeof(bnResourceManager)=="undefined"){var bnResourceManager=new BNResourceManager();}
function BNSystem(){this.testServer=null;}
BNSystem.prototype.getCookieValue=function(cookieName,cookieSubDomain){if(!cookieSubDomain)cookieSubDomain=baynote_globals.cookieSubDomain;if(cookieSubDomain)cookieName+=("-"+cookieSubDomain);var sRE="(?:; )?"+cookieName+"=([^;]*);?";var oRE=new RegExp(sRE);if(oRE.test(document.cookie)){return decodeURIComponent(RegExp["$1"]);}else{return null;}}
BNSystem.prototype.setCookie=function(cookieName,cookieValue,cookiePath,cookieExpires,cookieDomain,cookieSubDomain){cookieValue=encodeURIComponent(cookieValue);if(cookieExpires=="NEVER"){var nowDate=new Date();nowDate.setFullYear(nowDate.getFullYear()+500);cookieExpires=nowDate.toGMTString();}
else if(cookieExpires=="SESSION")cookieExpires="";if(cookiePath!="")cookiePath=";Path="+cookiePath;if(cookieExpires!="")cookieExpires=";expires="+cookieExpires;if(!cookieDomain)cookieDomain=(baynote_globals.cookieDomain)?baynote_globals.cookieDomain:"";if(cookieDomain!="")cookieDomain=";domain="+cookieDomain;if(!cookieSubDomain)cookieSubDomain=baynote_globals.cookieSubDomain;if(cookieSubDomain)cookieName+=("-"+cookieSubDomain);var cookieStr=cookieName+"="+cookieValue+cookieExpires+cookiePath+cookieDomain;if(cookieStr.length>4096)return false;document.cookie=cookieStr;return true;}
BNSystem.prototype.removeCookie=function(cookieName,cookieDomain){this.setCookie(cookieName,"","/","Mon, 1 Jan 1990 00:00:00",cookieDomain);}
BNSystem.prototype.getURLParam=function(name,url){if(!url)var url=window.location.href;var regex=new RegExp("[\\?&]"+name+"=([^&#]*)");var match=regex.exec(url);if(!match)return null;else return match[1];}
BNSystem.prototype.getTestServer=function(){if(this.testServer!=null)return this.testServer;var testServer=this.getURLParam("bn_test");if(testServer)this.setCookie("bn_test",testServer,"/","SESSION");else if(testServer=="")this.removeCookie("bn_test");else{testServer=this.getCookieValue("bn_test");if(!testServer)testServer="";}
this.testServer=testServer;return testServer;}
if(typeof(bnSystem)=="undefined"){var bnSystem=new BNSystem();}
if(typeof(BNTag)=="undefined"){function BNTag(previousTag){if(previousTag){this.id=previousTag.id+1;this.server=previousTag.server;this.customerId=previousTag.customerId;this.code=previousTag.code;}
else this.id=0;this.attrs=new Object();this.docAttrs=new Object();this.css=new Object();}}
BNTag.prototype.getCommonResourceId=function(){return"Common";}
BNTag.prototype.getCommonResourceAddress=function(tag){return(this.server+"/baynote/tags2/common.js");}
BNTag.prototype.getFailsafeResourceId=function(){return"Failsafe";}
BNTag.prototype.getFailsafeResourceAddress=function(){return(this.server+"/baynote/customerstatus2?customerId="+this.customerId+"&code="+this.code+"&x="+this.id+(new Date().getTime()));}
BNTag.prototype.show=function(parentElemId){if(this.id==0)document.write("<span id='bn_placeholder_global'></span>");this.placeHolderId="bn_placeholder"+this.id;var placeHolderType;if(this.placeHolderElement)placeHolderType=this.placeHolderElement;else placeHolderType=this.popup?"span":"div";if(parentElemId){var placeHolder=document.createElement(placeHolderType);placeHolder.id=this.placeholderId;document.getElementById(parentElemId).appendChild(placeHolder);}
else document.write("<"+placeHolderType+" id='"+this.placeHolderId+"'></"+placeHolderType+">");window["bn_tags"][this.id]=this;var testServer=bnSystem.getTestServer();if(testServer){var reValidTestServer=new RegExp("^https?://[^/]*\.baynote\.(com|net)(:\d+)?(/.*)?");if(reValidTestServer.test(testServer))this.server=testServer;else alert("Ignoring invalid test server \""+testServer+"\"");}
this.showWhenReady(this);baynote_tag=new BNTag(this);}
BNTag.prototype.showWhenReady=function(tag){if(baynote_globals.waitForReady&&!bnResourceManager.getResource(BN_READY_SIGNAL)){bnResourceManager.waitForResource(BN_READY_SIGNAL,function(){tag.showWhenReady(tag);});return;}
var failsafeId=this.getFailsafeResourceId();if(!bnResourceManager.getResource(failsafeId)){bnResourceManager.waitForResource(failsafeId,function(){tag.showWhenReady(tag);},this.getFailsafeResourceAddress(),"img");return;}
var commonId=this.getCommonResourceId();if(!bnResourceManager.getResource(commonId)){bnResourceManager.waitForResource(commonId,function(){tag.showWhenReady(tag);},this.getCommonResourceAddress(),"script");return;}
bnTagManager.show(tag.id);}
BNTag.prototype.noshow=function(){window["bn_tags"][this.id]=this;baynote_tag=new BNTag(this);}
BNTag.prototype.getParam=function(name,defaultValue){var value=this[name];if(typeof(value)=="undefined"||value==null)return defaultValue;else return value;}
if(typeof(baynote_tag)=="undefined"){window["bn_tags"]=new Array();var baynote_tag=new BNTag(null);}
function bnReadySignal(){bnResourceManager.registerResource(BN_READY_SIGNAL);}
function bnCall(resName,methodName,methodArg){var resource=bnResourceManager.getResource(resName);if(!resource){bnResourceManager.waitForResource(resName,function(){bnCall(resName,methodName,methodArg);});return;}
if(typeof(resource)!="object"){return;}
var method=resource[methodName];if(typeof(method)!="function"){return;}
method.call(resource,methodArg);}
//-->
<!-- baynote ends -->
<!-- baynote-guide starts -->
function show_baynote_guide(pagetype) {
	var bn_location_href = window.location.href;
	if (bn_location_href.indexOf("https://") == 0) {
		baynote_tag.server = "https://netsuite-www.baynote.net";
	} else {
		baynote_tag.server = "http://netsuite-www.baynote.net";
	}
	baynote_tag.customerId = "netsuite";
	baynote_tag.code = "www";
	baynote_tag.type="guide";

	if(pagetype == "ContentGuide"){
		baynote_tag.guide = "ContentGuide";
		baynote_tag.listSize = 5;
	}

	baynote_tag.show();
	bnResourceManager.waitForResource("GLResults0", "baynote_waitForGuide(1)");
}

function baynote_isNotEmpty(name) {
	return (typeof(name) != "undefined") && (name != null) && (name != "");
}

function getElementsByClassName(oElm, strTagName, strClassName){
	var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);
	var arrReturnElements = new Array();
	strClassName = strClassName.replace(/\-/g, "\\-");
	var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)");
	var oElement;
	for(var i=0; i<arrElements.length; i++){
		oElement = arrElements[i];
		if(oRegExp.test(oElement.className)){
			arrReturnElements.push(oElement);
		}
	}
	return (arrReturnElements)
}

function baynote_waitForGuide(bn_wait_count) {
           var bn_results = getElementsByClassName(document, "a", "bn_g_result_link");
           if(baynote_isNotEmpty(bn_results)){
                for(var i=0; i<bn_results.length; i++){
					var tmpHref = bn_results[i].getAttribute("href");
					if((bn_results[i].innerHTML).match(/- NetSuite .*/)){
						bn_results[i].innerHTML = bn_results[i].innerHTML.replace(/(.*)- NetSuite .*/, "$1");
					}
				}
			}
           else if(bn_wait_count < 10){
                 bn_wait_count++;
                 setTimeout("baynote_waitForGuide("+bn_wait_count+")", 200);
            }
}
<!-- baynote-guide ends -->


