// Find the current page name, and insert SWF accordingly...
function getSWFName(whichPart){
	var currentPageLoaded=String(this.location);
	var currentFolder;
	var drawMe = "yes";
	var foldersArray = new Array("about","books","tools-and-techniques","services","events","what-we-think","downloads","contact");
	
	// Manipulate the browser address string to get the info we want...
	currentPageLoaded=currentPageLoaded.split("/");
	currentFolder=currentPageLoaded[3];
	currentPageLoaded=currentPageLoaded[currentPageLoaded.length-1].split(".");
	currentPageLoaded=currentPageLoaded[currentPageLoaded.length-2];
	
	// Decide which bit to return...
	if (whichPart == "pageName") {
		var foundFolderName = false;
		for (i=0; i < foldersArray.length; i++) {		
			if (foldersArray[i] == currentFolder) {
				currentFolder = "/swf/left_" + foldersArray[i];
				var foundFolderName = true;
				break;
			}
		}
		if (!foundFolderName) currentFolder = "/swf/left_homepage";
		return currentFolder;
	} else if (whichPart == "YesOrNo") {
		if (currentPageLoaded == "index") drawMe = "yes";
		else drawMe = "no";
		return drawMe;
	} else {
		trace("Error in page Var creation");
	}
}




// Change SWF details here and will be updated for both browser types automatically
var MM_contentVersion = 5;
var GL_swfName = getSWFName("pageName") + ".swf?drawMe=" + getSWFName("YesOrNo");
var GL_swfWidth = "285";
var GL_swfHeight = "400";
var GL_bgColor = "";



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');
}




if ( MM_FlashCanPlay ) {
	document.write('<div style="width:' + GL_swfWidth + 'px; height:' + GL_swfHeight + 'px; position:absolute; top:147px; z-index:5">');
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ');
	document.write('codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ');
	document.write(' width="' + GL_swfWidth + '" ');
	document.write(' height="' + GL_swfHeight + '" ');
	document.write(' id="left_swf" align="">');
	document.write('<param name="movie" value="' + GL_swfName + '">');
	document.write('<param name="menu" value="false">');
	document.write('<param name="quality" value="high">');
	document.write('<param name="bgcolor" value="' + GL_bgColor + '"> ');
	document.write('<param name="wmode" value="transparent">');
	document.write('<embed src="' + GL_swfName + '" ');
	document.write(' menu="false" ');
	document.write(' quality="high" ');
	document.write(' bgcolor="' + GL_bgColor + '" ');
	document.write(' wmode="transparent" ');
	document.write(' width="' + GL_swfWidth + '" ');
	document.write(' height="' + GL_swfHeight + '" ');
	document.write(' name="left_swf" align=""');
	document.write(' type="application/x-shockwave-flash" ');
	document.write(' pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>');
	document.write('</object>');
	document.write('</div>');
} else{
	document.write('[ FLASH NOT INSTALLED ]');
}