/*
 Due to site names like "SearchCIO-Midmarket that have a dash in the we can't use the site name as-is as part of a js variable name
 since "-" is an illegal character. So we swap it out with an underscore when setting all of the on/off switches. The mboxes on
 the page will still have a "-" in them and request them that way, so when we evaluate whether an mbox is on or off we again swap
 out the "-" for an "_", but then request the mbox at Offermatica with the "real" sitename with a dash it in. It was easier to do 
 this than change naming convention of mboxes  on dozens of templates
*/

// Sets MBOX settings. Any null values are considered "off"


// ************************* Core Site Variables*************************
//These variables are defined in a property files @ dev_files/cm_docroot/resources/mbox/mbox_properties.properties
//
//Search Results (Keyword, Browse, and ASRP
//  csynd_allresults_resultsbody_gotolink
//  csynd_allresults_resultsbody_classoverrides
//  mboxEnabled
//  mboxStatus
//
// ************************* FUNCTIONS *************************

function mboxTrackClick(existingMboxName, trackedMboxName){
var url = mboxFactoryDefault.get(existingMboxName).getURL();
url = url.replace("mbox=" + existingMboxName,"mbox=" + trackedMboxName);
url = url.replace("mboxPage=" + mboxFactoryDefault.getPageId(),"mboxPage=" + mboxGenerateId());
(new Image()).src = url;
}


function ttWriteMboxDiv (location) {
	mboxName = location;
	mboxNameSafe = location.replace(/-/,"_");
	mboxStatus = eval(mboxNameSafe);
	if (window.location.search.indexOf('mboxDebug=1') != -1) window.alert("SiteVar=" + mboxEnabled + ";        " + mboxName + "=" + mboxStatus);	
	if ((mboxEnabled == "on") && (mboxStatus == "on")) {
		document.write("<div class='mboxDefault'>");
	}
}

function ttWriteMboxContent (location) {
	mboxName = location;
	mboxNameSafe = location.replace(/-/,"_");
	mboxStatus = eval(mboxNameSafe);
	if ((mboxEnabled == "on") && (mboxStatus == "on")) {
		document.write("</div>");
		mboxCreate(mboxName);
	}
}

