var isIEpc = ((navigator.appVersion.indexOf("Win") != -1) && (navigator.userAgent.indexOf("MSIE") != -1));
var ieMac5 = ((navigator.appVersion.indexOf("Mac") != -1) && (navigator.appVersion.indexOf("MSIE 5") != -1));
var isNS = (navigator.appName == "Netscape");
var isNS4mac = ((navigator.appVersion.indexOf("Mac") != -1) && (navigator.appVersion.indexOf("MSIE 4") != -1));
var isIE = (document.all);
var isMacIE = ( (navigator.userAgent.indexOf("IE 4")  > -1) && (navigator.userAgent.indexOf("Mac")  > -1) );
var isIE4pc = ( (navigator.userAgent.indexOf("IE 4")  > -1) && (navigator.userAgent.indexOf("Win")  > -1) );
var isNS6 = ( (parseInt(navigator.appVersion.charAt(0)) == 5) && isNS);
var theCookieName = "financeware";

function setcookie(name,value)
{
	var argv = setcookie.arguments;
	var argc = setcookie.arguments.length;
	var expires = (argc > 2) ? argv[2] : null;
	var path = (argc > 3) ? argv[3] : null;
	var domain=(argc > 4) ? argv[4] : null;
	var secure=(argc > 5) ? argv[5] : false;
	document.cookie=name+"="+escape(value)+((expires==null)?"":(";expires="+expires.togmtstring()))+((path==null) ? "":(";path="+path))+((domain==null)?"":(";domain="+domain))+((secure==true)?";secure" : "");
}


function question()
{
if (confirm("If you have Macromedia Flash4.0 click 'OK'"))
	{
	return "yes";
	}
else
	{
	return "no";
	}
}

function nsHasFlash(){

     if  (navigator.plugins["Shockwave Flash"]){
        	return "yes"
     } else {
		return "no"
		 }

}

function detectFlash(){
	if (isIEpc){
		return ieHasFlash();
	}
	else if (isNS || ieMac5)  {
		return nsHasFlash();
	}
	else {
		return question();

	}
}

if (isIEpc){
	document.writeln("<SCR"+"IPT LANGUAGE=VBScript>");
	document.writeln("function ieHasFlash");
	document.writeln("on error resume next");
	document.writeln("var GotFlash");
	document.writeln("GotFlash = IsObject(CreateObject(\"ShockwaveFlash.ShockwaveFlash.3\"))");
	document.writeln("If GotFlash = True Then");
	document.writeln("ieHasFlash= \"yes\"");
	document.writeln("else");
	document.writeln("ieHasFlash = \"no\"");
	document.writeln("End If");
	document.writeln("end function");
	document.writeln("</SC"+"RIPT>");
}


	function getcookieval(offset)
	{
		var endstr = document.cookie.indexOf(";",offset);
		if (endstr == -1)
			endstr = document.cookie.length;
		return unescape(document.cookie.substring(offset,endstr));
	}

	function getcookie(name)
	{
		var arg = name + "=";
		var alen=arg.length;
		var clen=document.cookie.length;
		var i=0;
		while (i < clen)
			{
			var j=i + alen;
			if (document.cookie.substring(i,j)==arg)
				return getcookieval(j);
			i=document.cookie.indexOf(" ",i)+1;
			if (i==0) break;
			}
		return null;
	}

	function hasFlash() {
		//--this function returns true or false
		//--depending on whether the user's browser
		//--supports flash. Note if IE 4 Mac, a prompt
		//--box will be displayed asking the user.
		//--supported platforms:
		//--   NS3-PC/MAC,NS4-PC/MAC,IE4-PC/MAC,IE5-PC/MAC
		//--
		//----start a testin---
		if (getcookie(theCookieName)==null) {
			theResponse = detectFlash();
			setcookie(theCookieName,theResponse,null,'/');
		}
		flash = getcookie(theCookieName);
		//alert(flash);
		if (flash =="yes") {
			return true;
		} else {
			return false;
		}
	}


	function flashImage(flashName,fheight,fwidth,imageName,iheight,iwidth) {
		//--this places a flash movie if the user's browser has
		//--flash, if not the image passed in 'imagename' is displayed
		//--instead.
		//--box will be displayed asking the user.
		//--   NS3-PC/MAC,NS4-PC/MAC,IE4-PC/MAC,IE5-PC/MAC
		//--
		if (hasFlash()) {
		document.write("<OBJECT classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000 ID="+flashName+" WIDTH="+fwidth+" HEIGHT="+fheight+"><PARAM NAME=movie VALUE=\""+flashName+"\"><PARAM NAME=bgcolor VALUE=#ffffff><PARAM NAME=quality VALUE=high><EMBED src=\""+flashName+"\" quality=high bgcolor=#ffffff  WIDTH="+fwidth+" HEIGHT="+fheight+" TYPE=\"application/x-shockwave-flash\"></EMBED></OBJECT>");

		} else {
			document.write("<img src=\""+imageName+"\" width=\""+iwidth+"\" height=\""+iheight+"\" border=0>");
		}
	}
	
