// JavaScript Document Show SWF - swfobject required
//Support function: checks to see if target
//element is an object or embed element

function isObject(targetID){

   var isFound = false;
   var el = document.getElementById(targetID);
   
   if(el && (el.nodeName === "OBJECT" || el.nodeName === "EMBED")){
   
      isFound = true;
   
   }
   
   return isFound;
}

//Support function: creates an empty
//element to replace embedded SWF object

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);
      
   }
   
}


function loadSWF(url, targetID, xmlFile){

   //Check for existing SWF
   if(isObject(targetID)){
   
      //replace object/element with a new div
      replaceSwfWithEmptyDiv(targetID);
      
   }
     
   //Embed SWF
   if (swfobject.hasFlashPlayerVersion("7")) {
   
   	  theWidth = "100%";
	  theHeight = "100%";
	  var attributes = { data: url, width: theWidth, height: theHeight };
      var params = { allowFullScreen: true, allowScriptAccess: 'sameDomain', salign: 'lt', width: theWidth, height: theHeight, bgcolor: '#000000', menu: true, flashvars: 'variabile=' + xmlFile + '' };
      var obj = swfobject.createSWF(attributes, params, targetID);
	  //document.write('variabile=' + xmlFile + '');
   
   }
   
}