// uses AC_OETags.js

// all parameters (except flexRoot) are names of functions in window scope
function launchDotplot(flexRoot, alignmentsURI, featuresURI, helpURI, sequences, state, featureActionMenu, regionActionMenu, detailedAlignments) {

	// Major version of Flash required
	var requiredMajorVersion = 9;
	// Minor version of Flash required
	var requiredMinorVersion = 0;
	// Minor version of Flash required
	var requiredRevision = 0;
	
	// Version check for the Flash Player that has the ability to start Player Product Install (6.0r65)
	var hasProductInstall = DetectFlashVer(6, 0, 65);
	
	var has7 = DetectFlashVer(7, 0, 0);
	var has8 = DetectFlashVer(8, 0, 0);
	var has9 = DetectFlashVer(9, 0, 0);
	
	// Version check based upon the values defined in globals
	var hasRequestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
	
	// Check to see if a player with Flash Product Install is available and the version does not meet the requirements for playback
	
	if ( hasProductInstall && !hasRequestedVersion ) {
	
		document.write("<font color='red'>You do not have the required version of the flash player installed. If you have administrative rights to your machine, just click ok when prompted and we'll install it for you. If you don't have administrative rights, you'll have to ask your local tech support to install <a href='http://www.adobe.com/products/flashplayer/'>adobe flash player 9</a>.</font>");
	
		// MMdoctitle is the stored document.title value used by the installation process to close the window that started the process
		// This is necessary in order to close browser windows that are still utilizing the older version of the player after installation has completed
		// DO NOT MODIFY THE FOLLOWING FOUR LINES
		// Location visited after installation is complete if installation is required
		var MMPlayerType = (isIE == true) ? "ActiveX" : "PlugIn";
		var MMredirectURL = window.location;
		document.title = document.title.slice(0, 47) + " - Flash Player Installation";
		var MMdoctitle = document.title;
		AC_FL_RunContent(
			"src", flexRoot + "/playerProductInstall",
			"FlashVars", "MMredirectURL="+MMredirectURL+'&MMplayerType='+MMPlayerType+'&MMdoctitle='+MMdoctitle+"",
			"width", "100%",
			"height", "100%",
			"align", "middle",
			"id", "dotplot",
			"quality", "high",
			"bgcolor", "#ffffff",
			"name", "dotplot",
			"allowScriptAccess","sameDomain",
			"type", "application/x-shockwave-flash",
			"pluginspage", "http://www.adobe.com/go/getflashplayer"
		);
	
	} else if (hasRequestedVersion) {
		// if we've detected an acceptable version
		// embed the Flash Content SWF when all tests are passed

		// define the flash vars
		flashvarsDict = {};
		//		flashvarsDict.historyUrl = "history.htm%3F&lconid=" + lc_id;
		flashvarsDict.featuresURI = featuresURI;
		flashvarsDict.sequences = sequences;
		flashvarsDict.state = state;
		flashvarsDict.alignmentsURI = alignmentsURI;
		flashvarsDict.helpURI = helpURI;
		flashvarsDict.featureActionMenu = featureActionMenu;
		flashvarsDict.regionActionMenu = regionActionMenu;
		flashvarsDict.fullBrowserMode = "fullBrowserMode";

		flashvarsDict.detailedAlignments = detailedAlignments == 1 ? 1 : 0;

		// flatten them into a string
		flashvars = "";
		first = true;
		for (var key in flashvarsDict) {
			value = flashvarsDict[key];
			if (first == false) flashvars += "&";
			flashvars += key + "=" + value;
			first = false;
		}

		AC_FL_RunContent(
				"src", flexRoot +"/dotplot",
				"width", "100%",
				"height", "700",
				"align", "middle",
				"id", "dotplot",
				"quality", "high",
				"bgcolor", "#ffffff",
				"name", "dotplot",
				"flashvars", flashvars,
				"allowScriptAccess","sameDomain",
				"type", "application/x-shockwave-flash",
				"pluginspage", "http://www.adobe.com/go/getflashplayer"
		);
		
	} else {  
		document.write("<font color='red'>You do not have the required version of the flash player installed and we are unable to install it automatically. Please download and install <a href='http://www.adobe.com/products/flashplayer/'>adobe flash player 9</a> or ask your local tech support to install it for you.</font>");
	}
	
}
