/*********************************************************************

 *

 * Built to add to a modified 2000 Macromedia Flash Dispatcher -- a scriptable detector for Flash Player

 * This takes an object I build in the Dispatcher and creates diagnostics screens for display.

 * The original Dispatcher redirects to other locations. This version retains the info and displays it.

 * Dave Stacey

 *********************************************************************/



var gScreenItems = new Object();

var gDispatchVars = new Object();



///////////////////////////////////////////////

///////// DS Functions

/////////////////////////////////////////////////



// Build the gScreenItems object with all the text for the screen.

// Then write out the screen table

function DS_ScreenOutput_Flash(pPlayerStatus)

{

	///// setup the object which holds all of the screen variable items ///////

	gScreenItems =  new DS_ScreenSetup_Flash(pPlayerStatus)

	writeFinalDiagnostics();



}



function writeFinalDiagnostics()

{

	Flashhtml = GetFlashHTML("access/javascript/detectRevision.swf","60","15")

	

	///////////// Final READOUT 

		// Check Mark Graphic

		var htm = ' <tr> <td>' + gScreenItems.markStatusSym + ' </td> ';

		

		// add Logo

		htm += ' <td>' + gScreenItems.flashLogo + ' </td> ';

		

		// add Title

		htm += ' <td valign=\"top\">  <strong>Macromedia Flash Player</strong> <br /> ' ;

		

		// add diagnostics Text

		htm += ' <a href=\" ' + gScreenItems.FlashURLPath + "\" target=\"_blank\"  title= " + gScreenItems.commentText + ">" + gScreenItems.commentText  + "</a>" +  Flashhtml + "<br />"  ;

		

		// add Requirements text

		htm += gScreenItems.Technical_Message ;

		

		// add MoreInfo text

		//htm +=  gScreenItems.More_Info + "</td>" + "</tr>" 

		

	document.write( htm )

}





function GetFlashHTML(url,width,height)

{

	// if Flash exists, display the swf to show the revision info from within Flash.

	if ( gScreenItems.PlayerStatus == "playerGood" || gScreenItems.PlayerStatus == "playerUgrade"  ) {

		var htm = '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';

		htm += '  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" ';

		htm += ' WIDTH=' + width + ' HEIGHT=' + height + '>';

		htm += ' <PARAM NAME=movie VALUE="' + url + '"> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#FFFFFF>  '; 

		htm += ' <EMBED src="' + url + '" quality=high bgcolor=#FFFFFF  ';

		htm += ' swLiveConnect=FALSE WIDTH=' + width + ' HEIGHT=' + height;

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

		htm += ' </EMBED></OBJECT>';

	} else {

		var htm = ""

	}

	

	return htm;

}





function DS_ScreenSetup_Flash(pPlayerStatus)

{

	var returnObj = new  Object();

	

	returnObj.contentURL = gDispatchVars.contentURL ;

	returnObj.contentVersion = gDispatchVars.contentVersion ;

	returnObj.upgradeURL = gDispatchVars.upgradeURL ;

	returnObj.installURL = gDispatchVars.installURL ;

	returnObj.altURL = gDispatchVars.altURL ;

	returnObj.version = gDispatchVars.version ;

	returnObj.revision = gDispatchVars.revision ;

	returnObj.implementation = gDispatchVars.implementation ;

	returnObj.versionWhole = gDispatchVars.versionWhole ;

	returnObj.PlayerStatus = pPlayerStatus ;

	

	returnObj.Technical_Message = "";

	returnObj.markCheckMark = '<' + 'img src="access/images/MarkCheck32.gif" alt="checkmark" />';

	returnObj.markCrossMark = '<' + 'img src="access/images/MarkCross32.gif" alt="xmark" />';

	returnObj.markQuestMark = '<' + 'img src="access/images/MarkQuest.gif" alt="Qmark" />';

	returnObj.flashLogo = '<'+'img src="access/images/icon_fl.gif" alt="Flash Logo" />';

	returnObj.markStatusSym = "missing graphic";

	returnObj.commentText = "";

	returnObj.FlashURLPath = "http://www.macromedia.com/support/flashplayer/";

				

	returnObj.More_Info = ' <a href= " http://www.macromedia.com/support/flash/ts/documents/playerfaq.htm#fixall " target="_blank" title=" Technical info. " > Click here for more technical info.</a> ';

				

	

	switch(pPlayerStatus)

	{

		case "playerGood" :

			//---------//  VERSION is GOOD

			returnObj.markStatusSym = returnObj.markCheckMark;

			returnObj.commentText = " You have Flash " + gDispatchVars.implementation + "." ;

			returnObj.FlashURLPath = "http://www.macromedia.com/support/flashplayer/"

			// Took out... ( + " " + gDispatchVars.version ) because the version returned was sometimes unreliable.

			

			htm = ' Check your version of Flash.';

			htm += ' It should be greater than or equal to ' + gDispatchVars.contentVersion ;

			htm += '. If you have an old version you should';

			htm += ' <a href= " http://www.macromedia.com/support/flash/ts/documents/playerfaq.htm#remove " target="_blank"  title=  "remove Flash" > remove Flash</a> ';

			htm += ' and ';

			htm += ' <a href= " http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash " target="_blank"  title=  "reinstall Flash" > reinstall</a> ';

			htm += ' the latest version.'			

			returnObj.Technical_Message = htm ;

			

			break;

			

		case "playerUgrade":

			//---------// OLD VERSION - UPGRADE

			returnObj.markStatusSym = returnObj.markCrossMark;

			returnObj.commentText = " Upgrade Flash " + gDispatchVars.implementation + " " + gDispatchVars.version + "." ;

			returnObj.Technical_Message = " You have an old version of Flash. Our content uses version " + gDispatchVars.contentVersion + "."

			returnObj.FlashURLPath = gDispatchVars.upgradeURL

			break;

			

		case "playerInstall":

			//-------------// Manual INSTALL

			returnObj.markStatusSym = returnObj.markCrossMark;

			returnObj.commentText = " Install Flash ";

			returnObj.Technical_Message = " You need to install the latest version of Flash. " 

			returnObj.FlashURLPath = gDispatchVars.installURL

			break;

			

		case "playerAlternative":

			//-------------// Set for Alternative Content

			returnObj.markStatusSym = markCrossMark;

			returnObj.commentText = "  Alternative content ";

			returnObj.Technical_Message = " You can use this alternative non-Flash content. "

			returnObj.FlashURLPath = gDispatchVars.altURL

			break;		

	}



	return returnObj;

}



function gDispatchVars_Add( contentURL, contentVersion, upgradeURL, installURL, altURL, version, revision, implementation, versionWhole )

{

	gDispatchVars.contentURL = contentURL ;

	gDispatchVars.contentVersion = contentVersion ;

	gDispatchVars.upgradeURL = upgradeURL ;

	gDispatchVars.installURL = installURL ;

	gDispatchVars.altURL = altURL ;

	gDispatchVars.version = version ;

	gDispatchVars.revision = revision ;

	gDispatchVars.implementation = implementation ;

	gDispatchVars.versionWhole = versionWhole ;

	

	//if (arguments.length < 5)

		// WARNING

}



/////////////////////////////////////////////////////////////////

/////////////////    END OF DS Functions   ///////////////////////

//////////////////////////////////////////////////////////////////

