
function includeFlash(frameFile,elPath,iconPath,movie,version,showMenu,w,h,bgColor,showDiv,altImgPath,wmode,allowFullScreen,playerDownloadLink){
  var bgColor = bgColor.replace(/#/g, "");
	var thisDiv = window.document.getElementById(showDiv);
	var popframeName = "popframe_"+showDiv;
	var movieFolderPath = movie.slice(0,movie.lastIndexOf("/")+1);
	var aHtml = elPath+"/multimedia_show.cfm?thisFullMoviePath="+movie;
	if(frameFile != '')
		aHtml = frameFile;
	thisDiv.style.display='';
	if(getFlashDetectVersion(version)== true){
		//get the FlashVariables and write m into a String
		if(window['jsArray'+showDiv][0].myname != ""){
			myFlashparams = '';
			for (i in window['jsArray'+showDiv]){
			 	if(window['jsArray'+showDiv][i].myname != ""){
				 	if(i > 0){
				 		myFlashparams = myFlashparams + "&";
			 		}
			 		//add param if not undefined
			 		if(window['jsArray'+showDiv][i].myname){
						myFlashparams = myFlashparams + window['jsArray'+showDiv][i].myname+ "=" + window['jsArray'+showDiv][i].myvalue;
					}
				}
	   	}
		 movie = movie + "?"+myFlashparams;
		}
    //default style: background color should be transparent, even for the internet explorer
    var tFrameStyle = " style=\"background-color: transparent; filter: chroma(color=#FFFFFF);\"";
    if (bgColor != "") {
      //if there’s a bg color defined, use that
      tFrameStyle = " style=\"background-color:#"+bgColor+";\"";
    }
		thisDiv.innerHTML="<iframe"+tFrameStyle+" frameborder=\"0\" scrolling=\"no\" hspace=\"0\" vspace=\"0\" align=\"left\" onLoad=\"writeMe('"+popframeName+"','"+movie+"','"+version+"','"+showMenu+"','"+w+"','"+h+"','"+bgColor+"','"+wmode+"','"+allowFullScreen+"');\" id="+"\""+popframeName+"\" name="+"\""+popframeName+"\" src="+"\""+aHtml+"\" width="+w+"\" height="+h+"\"></iframe>";
		thisDiv.style.width = w;
		thisH = parseInt(h);
		thisDiv.style.height = thisH;
	}else{
		myNewHTML = "<div style=\"width:"+w+"px;height:"+h+"px;text-align:center;padding:0;background-color:#"+bgColor+";\"><a href="+playerDownloadLink+" target=\"_blank\"><img  src="+altImgPath+" alt=\"Get FlashPlayer\" name=\"flashalt\" border=\"0\" /></a></div>";
		thisDiv.innerHTML= myNewHTML;
		thisDiv.style.textAlign="center";	
		thisDiv.style.backgroundColor=bgColor;
	}
}

function popupFlash(frameFile,elPath,iconPath,movie,version,showMenu,w,h,bgColor,headerBGcolor,borderColor,borderWidth,showDiv,xPos,yPos,altImgPath,wmode,allowFullScreen,playerDownloadLink){
  var bgColor = bgColor.replace(/#/g, "");
  var thisDiv = window.document.getElementById(showDiv);
	var popframeName = "popframe_"+showDiv;
	var movieFolderPath = movie.slice(0,movie.lastIndexOf("/")+1);
	var aHtml = elPath+"/multimedia_show.cfm?thisFullMoviePath="+movie;
	if(frameFile != '')
		aHtml = frameFile;
	thisDiv.style.display='';
	if(getFlashDetectVersion(version)== true){
		//get the FlashVariables and write m into a String
		if(window['jsArray'+showDiv]){
			if(window['jsArray'+showDiv][0].myname != ""){
				myFlashparams = '';
				for (i in window['jsArray'+showDiv]){
				 	if(window['jsArray'+showDiv][i].myname != ""){
					 	if(i > 0){
					 		myFlashparams = myFlashparams + "&";
				 		}
				 		//add param if not undefined
				 		if(window['jsArray'+showDiv][i].myname){
							myFlashparams = myFlashparams + window['jsArray'+showDiv][i].myname+ "=" + window['jsArray'+showDiv][i].myvalue;
						}
					}
		   	}
			 movie = movie + "?"+myFlashparams;
			}
		}
    //default style: background color should be transparent, even for the internet explorer
    var tFrameStyle = " style=\"background-color:transparent; filter:chroma(color=#FFFFFF);\"";
    if (bgColor != "") {
      //if there’s a bg color defined, use that
      tFrameStyle = " style=\"background-color:#"+bgColor+";\"";
    }
		thisDiv.innerHTML="<div style=\"width:"+w+"px;height:16px;text-align:right;padding:0;background-color:"+headerBGcolor+";\"><a href=\"javascript:void(0);dropMe('"+showDiv+"');\"><img src="+iconPath+" alt=\"close me\" name=\"closer\" id=\"closer\" border=\"0\" align=\"middle\"\/></a></div><iframe"+tFrameStyle+" frameborder=\"0\" scrolling=\"No\" hspace=\"0\" vspace=\"0\" align=\"left\" onLoad=\"writeMe('"+popframeName+"','"+movie+"','"+version+"','"+showMenu+"','"+w+"','"+h+"','"+bgColor+"','"+wmode+"','"+allowFullScreen+"');\" id=\""+popframeName+"\" name=\""+popframeName+"\" src=\""+aHtml+"\" width=\""+w+"\" height=\""+h+"\"></iframe>";
		thisDiv.style.width = w;
		thisH = parseInt(h) + 16;// 16 is the Height of our Header-<div>
		thisDiv.style.height = thisH;
		thisBorderStyle = "solid "+ borderColor + " " + borderWidth +"px";
		thisDiv.style.border = thisBorderStyle;
	}else{
		myNewHTML = "<div style=\"width:"+w+"px;height:16px;text-align:right;padding:0;background-color:"+headerBGcolor+";\"><a href=\"javascript:void(0);dropMe('"+showDiv+"');\"><img  src="+iconPath+" alt=\"close me\" name=\"closer\" id=\"closer\" border=\"0\" align=\"middle\"\/></a></div>";
		myNewHTML += "<a href="+playerDownloadLink+" target=\"_blank\"><img  src="+altImgPath+" alt=\"Get FlashPlayer\" name=\"flashalt\" border=\"0\" align=\"middle\" /></a>";
		thisDiv.innerHTML= myNewHTML;
		thisDiv.style.textAlign="center";	
		thisDiv.style.backgroundColor=headerBGcolor;
	}
	thisDiv.style.position = "absolute";
	thisDiv.style.left = xPos + "px";
	thisDiv.style.top = yPos + "px";
}

function dropMe(dropDiv){
	var thisDiv = document.getElementById(dropDiv);
	thisDiv.style.display='none';
	var popframeName = "popframe_"+dropDiv;
	var thisFrame= window.document.getElementById(popframeName);
	thisFrame.contentWindow.document.body.innerHTML="";
}

function writeMe(popframeName,movie,version,showMenu,w,h,bgColor,wmode,allowFullScreen){
  var bgColor = bgColor.replace(/#/g, "");
	var thisFrame = window.document.getElementById(popframeName);
	var thisFlashObject = popframeName.replace(/popframe_/g, "flashObject_");
	var newdiv = thisFrame.contentWindow.document.createElement("div");
	newdiv.innerHTML = "<div id=\"img\" style=\"position: relativ; background-color:#"+bgColor+"; left:200px; top:200px;\"><object id="+thisFlashObject+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http:\/\/download.macromedia.com\/pub\/shockwave\/cabs\/flash\/swflash.cab#version="+version+"\" width=\""+w+"\" height=\""+h+"\"><param name=\"menu\" value="+showMenu+"><param name=\"wmode\" value=\""+wmode+"\" /><param name=\"allowFullScreen\" value=\""+allowFullScreen+"\" /><param name=\"movie\" value=\""+movie+"\"><param name=\"quality\" value=\"high\"><param name=\"bgcolor\" value=\"#"+bgColor+"\" /><embed src=\""+movie+"\" menu="+showMenu+" quality=\"high\" pluginspage=\"http:\/\/www.macromedia.com\/go\/getflashplayer\" type=\"application\/x-shockwave-flash\" wmode="+wmode+" allowFullScreen="+allowFullScreen+" bgcolor=\"#"+bgColor+"\" width=\""+w+"\" height=\""+h+"\"><\/embed><\/object><\/div>";
	var container = thisFrame.contentWindow.document.getElementById('flashDiv');
	container.appendChild(newdiv);
	}

function getFlashDetectVersion(version){
  var FlashDetectPlayerVersion = new makeFlashDetectVersion(0,0,0);
	if(navigator.plugins && navigator.mimeTypes.length){
		var x = navigator.plugins["Shockwave Flash"];
		if(x && x.description) {
			FlashDetectPlayerVersion = new makeFlashDetectVersion(x.description.replace(/([a-z]|[A-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split("."));
		}
	}else if (window.ActiveXObject){
	   try {
   	   var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
   		FlashDetectPlayerVersion = new makeFlashDetectVersion(axo.GetVariable("$version").split(" ")[1].split(","));
	   } catch (e) {}
	}
	if(FlashDetectPlayerVersion["major"]>=version){
		return true;
	}else{
		return false;
	}
}

makeFlashDetectVersion = function(arrVersion){
	this.major = parseInt(arrVersion[0]) || 0;
	this.minor = parseInt(arrVersion[1]) || 0;
	this.rev = parseInt(arrVersion[2]) || 0;
}
