// Copyright Acro Media Inc. 1998-2005, www.acromediainc.com



var hasFlash = 0;



// check with objects first

if (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"] && navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin) {

	if (navigator.plugins && navigator.plugins["Shockwave Flash"]){

		hasFlash = 1;

	}

}

// check with IE objects

else if (navigator.userAgent && (navigator.userAgent.indexOf("MSIE")>=0)){

	if((navigator.userAgent.indexOf("Windows 95") != -1) || (navigator.userAgent.indexOf("Windows 98") != -1) || (navigator.userAgent.indexOf("Windows NT") != -1)) {

		with(document){

			writeln('<SCRIPT LANGUAGE=VBScript\>');

			writeln('on error resume next');

			writeln('hasFlash = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash")))');

			writeln('<\/SCRIPT\>');

		}

	}

	// give Macs one last chance - Mac IE 4.5 cannot detect flash, but is guaranteed to have it.

	else if((navigator.userAgent.indexOf("Mac") != -1) && (parseFloat(navigator.appVersion) >= 4)){

		hasFlash = 1;

	}

}



// Setup Cookie

function setCookie(name, value, expires, path, domain, secure) {

	var curCookie = name + "=" + escape(value) +

			((expires) ? "; expires=" + expires.toGMTString() : "") +

			((path) ? "; path=" + path : "") +

			((domain) ? "; domain=" + domain : "") +

			((secure) ? "; secure" : "");

        document.cookie = curCookie;

}



function getCookie(name) {

	var dc = document.cookie;

	var prefix = name + "=";

	var begin = 0 + dc.indexOf(prefix);

	if (begin == -1){

		return 0;

	}

	begin += prefix.length;

	var end = 0 + document.cookie.indexOf(";", begin);

	if (end == -1){

		end = dc.length;

	}

	return unescape(dc.substring(begin, end));

}





//First function run.

function playFlash(cookieType){

	var expires = new Date();

	(cookieType == "dontReset") ? expires.setTime(expires.getTime() + 3E11) : expires = 0;

	if(getCookie("playhomepageflash") == 'no'){

		flashFile = 1;

	} else {

		setCookie("playhomepageflash", 'no', expires);

		flashFile = 0;

	}

}



//Flash drawing code

//writes the flash to the page

function drawFlash(src, width, height, bg, wmode){

		document.writeln('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://active.macromedia.com/flash/cabs/swflash.cab#version=5,0,0,0" ID=movie WIDTH='+width+' HEIGHT='+height+' ALIGN=top>');

		document.writeln('<PARAM NAME=movie VALUE="'+ src +'">');

		document.writeln('<PARAM NAME=loop VALUE=false>');

		document.writeln('<PARAM NAME=quality VALUE=high>');

		document.writeln('<PARAM NAME=menu VALUE=false>');

		if (wmode) document.writeln('<PARAM NAME=wmode value=transparent>');

		document.writeln('<PARAM NAME=bgcolor VALUE=#'+bg+'>');

		document.writeln('<EMBED SRC='+ src);

		document.writeln(' swLiveConnect=false ID=movie');

		document.writeln(' WIDTH='+ width +' HEIGHT='+ height +' ALIGN=top');

		document.writeln(' LOOP=false QUALITY=high MENU=false BGCOLOR=#'+bg);

		if (wmode) document.writeln(' WMODE=transparent');

		document.writeln(' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">');

		document.writeln('</EMBED></OBJECT>');	

}