/*	
JavaScript Document
Load SWF file in the designated DIV tag
developed for Launch Pad for Adobe Captivate by KCWebPlaza
http://www.kcwebplaza.com/captivate
version 1.02
*/

function loadSWF(url, targetID, w, h){
	//Check for existing SWF
	if(isObject(targetID)){
		//replace object/element with a new div
		replaceSwfWithEmptyDiv(targetID);
	}
	//Embed SWF, set the required Flash vesion here
	if (swfobject.hasFlashPlayerVersion("8")) {
		var attributes = { data: url, width:w, height :h };
		var params = {};
		params.bgcolor = "#FFFFFF";
		params.salign = "tl";
		params.quality = "best";
		params.scale = "exactfit";
		params.play = "true";
		params.loop = "false";
		params.wmode = "opaque";
		params.seamlesstabbing ="false"; // allow for tab keypress to work in Captivate SWFs
		var obj = swfobject.createSWF(attributes, params, targetID);
	}
	else {
	// if user does not have required flash player version display altcontent div
	swfobject.createCSS("#altcontent", "display:block;");
	}
}
function isObject(targetID){
	var isFound = false;
	var el = document.getElementById(targetID);
	if(el && (el.nodeName === "OBJECT" || el.nodeName === "EMBED")){
		isFound = true;
	}
	return isFound;
}
function replaceSwfWithEmptyDiv(targetID){
	var el = document.getElementById(targetID);
	if(el){
		var div = document.createElement("div");
		el.parentNode.insertBefore(div, el);
		//Remove the SWF
		swfobject.removeSWF(targetID);
		//Give the new DIV the old element's ID
		div.setAttribute("id", targetID);
	}
}