//$Id: flsh_nav.js,v 1.7 2004/12/01 21:29:29 daver Exp $
//$Source: /bbsrc/web/jscommon/flsh_nav.js,v $
//$Revision: 1.7 $

var FlashMode = 0;
var FlashVer = 0;
if (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"] && navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin) {
	if (navigator.plugins && navigator.plugins["Shockwave Flash"] && (FlashVer = navigator.plugins["Shockwave Flash"].description.indexOf(".")) != - 1) {
		var versionString = navigator.plugins["Shockwave Flash"].description.substring(FlashVer-1,FlashVer);
		FlashVer = parseInt( versionString );
		if ( FlashVer >= 5 ) {
			FlashMode = 1;
		}
	}
}
else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 && (navigator.userAgent.indexOf("Windows 95")>=0 || navigator.userAgent.indexOf("Windows 98")>=0 || navigator.userAgent.indexOf("Windows NT")>=0 )) {
	document.write('<SCRIPT LANGUAGE=VBScript\> \n');
	document.write('on error resume next \n');
	document.write('For i = 9 To 1 Step -1 \n');
	document.write('FlashMode = IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & i)) \n');
	document.write('If FlashMode Then \n');
	document.write('FlashVer = CStr(i) \n');
	document.write('Exit For \n');
	document.write('End If \n');
	document.write('Next \n');
	document.write('</SCRIPT\> \n');
}

function setCookie(MODE) {
	if ( MODE == 'on')
		document.cookie="FLASHMODE=off; expires=Wednesday, 09-Nov-99 23:12:40 GMT";
	else
		document.cookie="FLASHMODE=off";
}

function getCookie(Name) {
	var search = Name + "=";
	if (document.cookie.length > 0) {
		offset = document.cookie.indexOf(search) ;
		if (offset != -1) { 
			offset += search.length;
			end = document.cookie.indexOf(";", offset);
			if (end == -1) 
				end = document.cookie.length;
			return unescape(document.cookie.substring(offset, end));
		} 
	}
}

function PutNav(choice){
	if (typeof getCookie('FLASHMODE') == "undefined" && FlashMode) {
		var navbar = '<OBJECT ALIGN="" id="Primary_nav" HEIGHT="49" WIDTH="770" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">'
		+ '<PARAM VALUE="http://www.bloomberg.com/Primary_nav.swf?currentSection='
		+ choice + '" NAME="movie"><PARAM VALUE="high" NAME="quality"><PARAM VALUE="#333333" NAME="bgcolor">'
		+ '<EMBED PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer" TYPE="application/x-shockwave-flash" ALIGN="" NAME="nav_102902" HEIGHT="49" WIDTH="770" FlashVars="currentSection=' + choice + '" bgcolor="#333333" quality="high" src="http://www.bloomberg.com/Primary_nav.swf?currentSection=' + choice + '">'
		+ '</EMBED></OBJECT>';
		document.write(navbar); 
	} else {    
		document.write('<img class="nav" usemap="#nonflash" alt="" border="0" src="http://images.bloomberg.com/nav/nonflash_' + choice + '.gif">');
	}
}

function PutNav_JP(choice){
	if (typeof getCookie('FLASHMODE') == "undefined" && FlashMode) {
		var navbar = '<OBJECT ALIGN="" id="Primary_nav_jp" HEIGHT="49" WIDTH="770" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">'
		+ '<PARAM VALUE="http://www.bloomberg.co.jp/Primary_nav_jp.swf?currentSection='
		+ choice + '" NAME="movie"><PARAM VALUE="high" NAME="quality"><PARAM VALUE="#333333" NAME="bgcolor">'
		+ '<EMBED PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer" TYPE="application/x-shockwave-flash" ALIGN="" NAME="nav_102902" HEIGHT="49" WIDTH="770" FlashVars="currentSection=' + choice + '" bgcolor="#333333" quality="high" src="http://www.bloomberg.co.jp/Primary_nav_jp.swf?currentSection=' + choice + '">'
		+ '</EMBED></OBJECT>';
		document.write(navbar); 
	} else {    
		document.write('<img class="nav" usemap="#nonflash_jp" alt="" border="0" src="http://images.bloomberg.com/japan/nav/nonflash_' + choice + '_jp.gif">');
	}
}

