NAV_PREF = "navpref";
	  
T = true;
F = false;
webtv = (navigator.userAgent.indexOf('WebTV') > 0);
ie = (document.all) ? T : F;
ie5 = (ie) && (navigator.userAgent.indexOf('MSIE 5') > 0);
nav6 = ((document.getElementById) && (!ie )) ? T : F;
nav4 =  (navigator.appName.indexOf('Netscape') == 0) && (navigator.appVersion.indexOf('4.') == 0);
nav = nav4 || nav6;
mac = navigator.appVersion.indexOf("Mac") > 0 ? T : F;


function jsCBDisFlashInstalled()
{
	if (nav || ie5 && mac)
	{
		if ( navigator.mimeTypes != null &&
		     navigator.mimeTypes["application/x-shockwave-flash"] &&
		     navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin )
		{
			var version = navigator.plugins["Shockwave Flash"].description;
			version = version.charAt(version.indexOf('.')-1);
            
			return parseInt(version) >= 6;
		}
	}
	if( typeof checkAdobeIE=='function')
	{
		//
		//  Call a VBScript function to do the check.
		//
		return checkFlashIE();
	}

	return true;
}


function jsCBDWriteFlashHtml(id, chartName, path, width, height, altHtml)
{
    document.write( jsCBDGetFlashHtml(id, chartName, path, width, height, altHtml) );
}

function jsCBDGetFlashHtml(id, chartName, path, width, height, altHtml )
{
	if ( jsCBDisFlashInstalled() )
	{
		if ( ie && !mac)
		{
			// If IE use object html
			return _cbdGetFlashObjectHtml(id, chartName, path, width, height);
		}
		else
		{
			// If IE on MAC , Netscape, WebTv or something else use embed html
			return _cbdGetFlashEmbedHtml(id, chartName, path, width, height);
		}   
	}
	else
	{
       		return altHtml != null ? altHtml : "";
	}
}

function _cbdGetFlashObjectHtml(id, chartName, path, width, height)
{
	var objHtml = "<OBJECT\n" +
				"classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'\n" +
				"id='" + id + "'\n" +
				"name='" + chartName+ "'\n" +
				"WIDTH='" + width + "'\n" +
				"HEIGHT='" + height + "'>\n" +
				"<PARAM NAME=movie VALUE='" + path + chartName + "'>\n" +
				"<PARAM NAME=quality VALUE=high>\n" +
				"</OBJECT>\n";

	return objHtml;
}

function _cbdGetFlashEmbedHtml(id, chartName, path, width, height)
{
	var embHtml =  "<EMBED\n" +
				"id='" + id + "'\n" +
				"name='" + chartName + "'\n" +
				"quality=high\n" +
				"WIDTH='" + width + "'\n" +
				"HEIGHT='" + height + "'\n" +
				"TYPE='application/x-shockwave-flash'\n" +
				"src='" + path + chartName + "'\n" +
				"</EMBED>\n";
	
	return embHtml;
}

function isCSS2()
{
	return document.getElementById != null;
}


function showPic(url)
{
	params = "scrollbars=yes,resizable=yes,width=" + (screen.width - 50) + ",height=" + (screen.height -50 ) + ",top=0,left=0";
	window.open(url, "picDetail", params);
}


function setCookie (name, value, expires, path, domain)
{
	var expStr = ((expires == null) ? "" : ("; expires=" + expires.toGMTString()));
	var pathStr = ((path == null) ? "" : ("; path=" + path));
	var domainStr = ((domain == null) ? "" : ("; domain=" + domain));
	document.cookie = name + "=" + escape(value) + expStr + pathStr + domainStr;
}

function getCookie (name)
{
	var result = null;
	var myCook = " " + document.cookie+ ";";
	var search = " " + name + "=";
	var start = myCook.indexOf(search);
	var end;
	if (start != -1)
	{
		start += search.length;
		//
		// skip past name
		//
		end = myCook.indexOf(";", start);
		result = unescape (myCook.substring(start, end));
	}
	return result;
}


