﻿function write_flash(flash_file, flash_width, flash_height) {
	flash_file = flash_file.replace("client_pepgis.swf", "client_pepgis_10011501.swf");
	flash_file = flash_file.replace("indexdown.swf", "indexdown_071202.swf");

	if (flash_file.indexOf('client_pepgis') != -1)
		id = "mapabc";
	else
		id = "flash";

	// Major version of Flash required
	var requiredMajorVersion = 8;
	// 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);
	// Version check based upon the values defined in globals
	var hasReqestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
	// Alter messages
	var alternateContent = '为了能够正常浏览和使用贝多网站<BR>'
	+ '需要Flash播放器，并且版本至少为'+requiredMajorVersion+'.'+requiredMinorVersion+'.'+requiredRevision+'<BR>'
	+ '<a href=http://www.adobe.com/go/getflash/>获取最新的Flash插件</a><BR>';

	// Check to see if a player with Flash Product Install is available and the version does not meet the requirements for playback
	if ( hasProductInstall && !hasReqestedVersion ) {
		versionStr = GetSwfVer();
		versionArray = [0,0,0,0];
		if (versionStr == -1 ) {
		} else if (versionStr != 0) {
			if(isIE && isWin && !isOpera) {
				// Given "WIN 2,0,0,11"
				tempArray         = versionStr.split(" "); 	// ["WIN", "2,0,0,11"]
				tempString        = tempArray[1];			// "2,0,0,11"
				versionArray      = tempString.split(",");	// ['2', '0', '0', '11']
			} else {
				versionArray      = versionStr.split(".");
			}
		}
		var message = '您当前安装的Flash Player版本('+versionArray[0]+'.'+versionArray[1]+'.'+versionArray[2]+')比较旧。<br/>'
					+ alternateContent;
	    document.write(message);
	} else if (hasReqestedVersion) {
		// if we've detected an acceptable version
		// embed the Flash Content SWF when all tests are passed
		document.write('<object id="' + id + '" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+flash_width+'" height="'+flash_height+'">');
	    document.write('<param name="movie" value="' + encodeURI(flash_file) + '"/>');
	    document.write('<param name="quality" value="high"/>');
		document.write('<param name="wmode" value="Opaque"/>');
	    document.write('<embed name="'+ id +'" src="'+encodeURI(flash_file)+'" wmode="Opaque" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+flash_width+'" height="'+flash_height+'"></embed>');
	    document.write('</object>');
	} else {  // flash is too old or we can't detect the plugin
		document.write(alternateContent);  // insert non-flash content
	}
}

function flashLoadComplete() {
	if (OnFlashLoaded != undefined)
		eval("OnFlashLoaded()");
}

write_flash(flash_file, flash_width, flash_height);