/* core.js file */

function setNavItems(gNav,secNav){
	if(gNav == "onXM" || gNav == "whatIs" || gNav == "shopXM"){
		document.getElementById(gNav + "_A").className = "current";
	}
	if(secNav != ""){
		document.getElementById("subnav_" + secNav + "_A").className = "current";
	}
}


// Embed Flash Simplify

function embedFlash(width,height,allowScriptAccess,movie,bgcolor,flashvars)
{
	document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="'+width+'" HEIGHT="'+height+'">\n');
	document.write('<param name="allowScriptAccess" value="'+allowScriptAccess+'" />\n');
	document.write('<param name="movie" value="'+movie+'" />\n');
	document.write('<param name="quality" value="high" />\n');
	document.write('<param name="bgcolor" value="'+bgcolor+'" />\n');
	document.write('<PARAM NAME="menu" VALUE="false"/>\n');	
	document.write('<PARAM NAME="FlashVars" VALUE="'+flashvars+'"/>\n');	
	document.write('<embed src="'+movie+'" quality="high" bgcolor="'+bgcolor+'" width="'+width+'" height="'+height+'" align="middle" allowScriptAccess="'+allowScriptAccess+'" menu="false" FlashVars="'+flashvars+'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"/>\n');
    document.write('</object>\n');
}

function recallFlashDate(date){
	var urlStr = "/onxm/this-week-on-xm.xmc?day=" + date;
	window.location = urlStr;
}

// function to match heights to two divs that are next to each other
function matchHeights(arr) {
	var maxHeight = 0;
	var curHeight = 0;
	for(i=0;i<arr.length;i++) {
		curHeight = document.getElementById(arr[i]).offsetHeight;
		if(curHeight > maxHeight) {
			maxHeight = curHeight;
		}
	}
	maxHeight = maxHeight - 10;
	for(i=0;i<arr.length;i++) {
		document.getElementById(arr[i]).style.height = maxHeight + "px";
	}
}

var lastDiv = "";
function showDiv(divName) {
	// hide last div
	if (lastDiv) {
		document.getElementById(lastDiv).className = "displayNone";
	}
	//if value of the box is not nothing and an object with that name exists, then change the class
	if (divName && document.getElementById(divName)) {
		document.getElementById(divName).className = "displayBlock";
		lastDiv = divName;
	}
}



try{
	document.execCommand("BackgroundImageCache",false,true);
}catch(err){}



/*  jsa - 12/10/09 */
function trackLinkWithAccount(linkName,accountCode) {	
	if(linkName != null && linkName.length > 0) {
		var linkTracker = _gat._getTracker(accountCode);
		linkTracker._initData();
		linkTracker._trackPageview(linkName);
	}
	return;
}

