    // Changes
    // - Removed non-flash menu functions
    // - Removed other branding colors

function writeTopNav(selected) {
   var topnav_html = createTopNav(selected);
   document.write(topnav_html);
}

function createTopNav(selected){
	var flashVars = new Array();
	
	//get the text colors based on the current body class
	if (selected) {
		var brandColor = selected;
	} else {
		var brandColor = (document.body.className ? document.body.className : 'default');
	}
	var bgColor2 = null;
	var bgColor = "FFFFFF";
        
	//define default colors
	if(brandColor == 'default'){
		//set general colors for branded topnav
		offStateColor = "feffff";
		rollOverColor = "025e69";
		lineColor = "9d9d9d";
        activeLineColor = "025e69";
	}
	
	if (bgColor2) {
		bgColor = bgColor2;
	}
	
	//set and combine the flashVars.
	flashVars[flashVars.length] = "xmlLocation=" + escape(xmlLocation);

	flashVars[flashVars.length] = "currTopLoc=" + escape(currTopLoc);
	flashVars[flashVars.length] = "currSubLoc=" + escape(currSubLoc);
	
	flashVars[flashVars.length] = "offStateColor=" + escape(offStateColor);
	flashVars[flashVars.length] = "rollOverColor=" + escape(rollOverColor);
	flashVars[flashVars.length] = "lineColor=" + escape(lineColor);

	flashVars[flashVars.length] = "bgColor=" + escape(bgColor);

	if(typeof(activeLineColor) != 'undefined'){
		flashVars[flashVars.length] = "activeLineColor=" + escape(activeLineColor);
	}
	flashVars[flashVars.length] = "cc=" + escape(cc);
	flashVars[flashVars.length] = "lc=" + escape(lc);
	flashVars[flashVars.length] = "embedfonts=" + embedFonts();
	flashVars[flashVars.length] = "clipAlign=" + clipAlign;
	var isMSIE		= navigator.appName.indexOf("Microsoft") != -1;
	flashVars[flashVars.length] = "ismsie=" + isMSIE;        
	
	//*write dummy flash object with codebase if flash version < 7
	if(typeof(flashVersion) != "undefined"){
		if(flashVersion < 7){
			codebase = ' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"';
		}
	}
	
	var flashID = "topnavflash";
	if (selected) {
		flashID += selected;
	}
	return createFlashTags(topnavSwf,'52','990',flashVars.join("&"),'center',wmode,'none','#' + bgColor, flashID);
}

function getParam(paramName){
	//returns the value of the requested querystring parameter
	var docLoc = document.location.href;
	var indexOfHash = docLoc.indexOf('#');
	if (indexOfHash != -1) {
		docLoc = docLoc.substr(0, indexOfHash);
	}

	var qString = '';
	var params = new Array();

	if(docLoc.indexOf("?") != -1){
		qString = docLoc.split("?");
		qString = qString[1];
	}


	if(qString.indexOf("&") != -1){
		params = qString.split("&");
	}
	else if(qString.indexOf("=") != -1){
		params[params.length] = qString;
	}

	for(var i=0; i<params.length; i++){
		param = params[i].split("=");
		if(param[0] == paramName){
			return param[1];
		}
	}

	return '';
}

function embedFonts(){
	//returns false if no embedded fonts may be used in Flash.
	var lc = getParam("lc");
	var noEmbedArr = ["el", "bg", "hk", "ar", "zh", "zs", "tw", "id", "th", "vi", "sk", "ru", "gr", "he", "uk", "tr", "sr", "si", "ro", "pl", "hu", "he", "hr", "cs", "sl", "lt"];
	
	for (var x in noEmbedArr){
		if(lc == noEmbedArr[x]){
			return false;
		}
	}

	return true;	
}

function createFlashTags(movie,height,width, flashVars, alignment, wmode, menu, backgroundcolor, id) {
	//defaults
	wmode			= (wmode == undefined ? 'opaque' : wmode);
	menu			= (menu == undefined ? 'false' : menu);
	alignment		= (alignment == undefined ? 'false' : alignment);
	id				= (id == undefined ? 'false' : id);
	flashVars		= (flashVars == undefined ? '' : flashVars);
	backgroundcolor	= (backgroundcolor == undefined ? '' : backgroundcolor);
	var flashversion= getFlashVersion(10);
	var HTML 		= '';
	var isIE		= navigator.appVersion.toLowerCase().indexOf("msie");
	var isSafari	= navigator.appVersion.toLowerCase().indexOf("safari");
	
	if(id != false){
		var idAttribute = 'id="'+id+'"';
	} else {
		var idAttribute = '';
	}
	
	var classId = '';
	if(isIE != -1){
		//IE7 might act weird if this is not set...
		classId = 'classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" ';
	}
	var codebase = '';
	
	if(flashVersion == -1){
		codebase = ' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0"';
	}
	
	HTML += '<object type="application/x-shockwave-flash" '+classId+' '+codebase+' data="'+movie+'" width="'+width+'" height="'+height+'" '+idAttribute+'>';
	HTML += '	<param name="movie" value="'+movie+'" />';
	HTML += '	<param name="menu" value="'+menu+'" />';
	HTML += '	<param name="flashVars" value="' + flashVars + '" />';
	HTML += '	<param name="wmode" value="'+wmode+'" />';
	
	// If wmode is opaque and a backgroundcolor has been defined
	if(backgroundcolor != '' && wmode != 'transparent') {
		HTML += '	<param name="bgcolor" value="' + backgroundcolor + '" />';
	}
	
	HTML += '</' + 'object>';

	return HTML;
}

var flashVersion = 0;
function getFlashVersion(maxVersion){
	var flashVersion_DONTKNOW = -1;
	var flashVersion = 0;
	var latestFlashVersion = (maxVersion == null) ? 10 : maxVersion;
	var agent = navigator.userAgent.toLowerCase();
	
	// FF1.0 >
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		var flashPlugin = navigator.plugins['Shockwave Flash'];
		if (typeof flashPlugin == 'object') {
			var splits = '';
            if (splits = flashPlugin.description.split('.')) {
            	flashVersion = (splits[0].substring((splits[0].length-1),splits[0].length)) * 1;
            }
		}
	} else if (agent.indexOf("msie") != -1) {
		flashVersion = getIEFlashVersion();
		/*if(flashVersion != -1){
			flashVersion = flashVersion.substr(4,1);
		}*/
   } else {
		flashVersion = flashVersion_DONTKNOW;
	}
	return flashVersion;
}

function getIEFlashVersion(){
	var flash_versions = 10;
	var version;
	var axo;
	var e;
	// NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry
	
	for (x = 2; x <= flash_versions; x++) {
		try {
 			axo = eval("new ActiveXObject('ShockwaveFlash.ShockwaveFlash." + x + "');");
			if (axo) {
				
				version = x;
			}
		}
		catch(e) { }
	}

	if (!version) {
		try {
			// version will be set for 6.X players only
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
			version = "WIN 6,0,21,0";
			axo.AllowScriptAccess = "always";
			version = axo.GetVariable("$version");
		} catch (e) {
		}
	}
	if (!version) {
		try {
			// version will be set for 4.X or 5.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = axo.GetVariable("$version");
		} catch (e) {
		}
	}
	if (!version) {
		try {
			// version will be set for 3.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = "WIN 3,0,18,0";
		} catch (e) {
		}
	}
	if (!version) {
		try {
			// version will be set for 2.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			version = "WIN 2,0,0,11";
		} catch (e) {
			version = -1;
		}
	}
	
	return version;
}
var flashVersion_DONTKNOW = -1;
/*
*	End flash detect
*/
function emailFriend(url)

{

    var newWindow = window.open(url,'emailWindow','toolbar=yes,location=no,menubar=yes,resizable=yes,scrollbars=yes,width=550, height=500, left=100, top=25');

}