minPlayer = 4;

function Flash_checkForPlugIn()
{
var plugin = (navigator.mimeTypes &&
navigator.mimeTypes["application/x-shockwave-flash"]) ?
navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
if (plugin) {
var pluginversion = parseInt(plugin.description.substring(plugin.description.indexOf(".")-1)) 
if(pluginversion >= minPlayer) {return true;}
}
return false;
}

if(supportedBrowser && IE)
{
document.write(
		'<script language=VBScript>' + '\n' +
		'Function Flash_checkForActiveX()' + '\n' +
			'Dim hasPlayer, playerversion' + '\n' +
			'hasPlayer = false' + '\n' +
			'playerversion = 10' + '\n' +
			'Do While playerversion >= minPlayer' + '\n' +
				'On Error Resume Next' + '\n' +
				'hasPlayer = (IsObject(CreateObject(\"ShockwaveFlash.ShockwaveFlash.\" & playerversion & \"\")))' + '\n' +
				'If hasPlayer = true Then Exit Do' + '\n' +
				'playerversion = playerversion - 1' + '\n' +
			'Loop' + '\n' +
			'Flash_checkForActiveX = hasPlayer' + '\n' +
		'End Function' + '\n' +
		'<\/script>'
		);
}

function Flash_embedSWF(srcURL, altURL, sName, iWidth, iHeight, sBase) {
	if (!Flash_checkForMinPlayer()){
		return "<img src='" + altURL + "' name='" + sName + "' width='" + iWidth + "' height='" + iHeight + "'>";
	}else{
		return Flash_buildMovieString(srcURL, sName, iWidth, iHeight, sBase);
	}
}

function Flash_embedSWForScript(srcURL, altURL, sName, iWidth, iHeight, sBase) {
	if (!Flash_checkForMinPlayer()){
		return "<div id=\"divContainer\"></div><script language=\"JavaScript\" src=" + altURL + "></script>";
	}else{
		return Flash_buildMovieString(srcURL, sName, iWidth, iHeight, sBase);
	}
}

function Flash_conditionalMovie(srcURL, sName, iWidth, iHeight, sBase){
	if (Flash_checkForMinPlayer()){
		document.write(Flash_buildMovieString(srcURL, sName, iWidth, iHeight, sBase));
	}
}

function Flash_conditionalContent(sContentForFlash, sContentForNonFlash){
	if (!Flash_checkForMinPlayer()){
		document.write(sContentForNonFlash);
	}else{
		document.write(sContentForFlash);
	}
}

function Flash_buildMovieString(srcURL, sName, iWidth, iHeight, sBase){
	var sReturn = "";
	sReturn = "<object name='" + sName + "' classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='" + iWidth + "' height='" + iHeight + "'>";
	sReturn = sReturn + "<param name='movie' value='" + srcURL + "'>";
	sReturn = sReturn + "<param name='quality' value='high'>";
	if(sBase != ""){
		sReturn = sReturn + "<param name='base' value='" + sBase + "'>";
	}
	sReturn = sReturn + "<embed name='" + sName + "' src='" + srcURL + "' width='" + iWidth + "' height='" + iHeight + "' base='" + sBase + "' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash'></embed>";
	sReturn = sReturn + "</object>";
	return sReturn;
}

function Flash_checkForMinPlayer(){
	//if(NN || SAF || OP || FX){
	if(NN  || MAC){
		return Flash_checkForPlugIn();
	}else if(IE){
		return Flash_checkForActiveX();
	}
	//none of above, return false;
	return false;
}


function movieReady(sName){
	var oMovie = getMovie(sName);
	if (	(oMovie != null) && (typeof(oMovie) != "undefined")){
		if(oMovie.tagName.toUpperCase() == "EMBED" || oMovie.tagName.toUpperCase() == "OBJECT"){
			return oMovie.PercentLoaded() == 100;
		}
	}else{
		return false;
	}
}

function getMovie(sName){
	try{
		if (NN){
			var oMovObj = window[sName];
		} else {
			var oMovObj = document[sName];
		}

		if (oMovObj != null){
			if(oMovObj.length>0){
				var tempObj = null;
				for(i=0;i<oMovObj.length;i++){
					if(NN){
						if (oMovObj[i].tagName.toUpperCase() == "EMBED"){
							tempObj = oMovObj[i];
						}
					}else{
						if (oMovObj[i].tagName.toUpperCase() == "OBJECT"){
							tempObj =  oMovObj[i];
						}				
					}
				}
				oMovObj = tempObj;
			}
		}

		return oMovObj;

	}catch(e){
		alert("Embed object error: " + e);
		return null;
	}
}

function isArray(obj) {
   if (obj.constructor.toString().indexOf("Array") == -1)
      return false;
   else
      return true;
}
