/* Flash Content Replacer for Rearview 

Any images enclosed in a tag with the id="flashcontent" will be swapped
for a .swf with the same filename and dimensions of the image.  Both flash
and image must be in the ../Images/ directory

Call it with <body onload="foo();"> (so it works cross-browser)

 */
function foo() { try { 
var hasRightVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
if(hasRightVersion) {
	//alert(hasRightVersion);
  if (document.getElementById("flashcontent")){ 
	  try {
        var filename = document.getElementById("flashcontent").getElementsByTagName("img")[0].src;
        var temp = filename.split('/').pop();
        var filename = temp.split('.').shift();
        var width = document.getElementById("flashcontent").getElementsByTagName("img")[0].width;
        var height = document.getElementById("flashcontent").getElementsByTagName("img")[0].height;
		var align = document.getElementById("flashcontent").getElementsByTagName("img")[0].align;
		var checkIDExists = document.getElementById("flashcontent");	
	} catch (err) {}
		if (checkIDExists) {
			
            var oeTags = '<div style="'+align+':0px; _float:'+align+'; width:'+width+'; height:'+height+';display:inline;"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'
            + 'width="'+width+'" height="'+height+'"'
            + 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab">'
            + '<param name="movie" value="/IsolatedStorage/c95a35dd-8264-4678-9c61-2f0829c2cd5d/ContentAssets/Media/Flash/'+filename+'.swf" /><param name="quality" value="high" /> <param name="wmode" value="transparent">'
            + '<embed src="/IsolatedStorage/c95a35dd-8264-4678-9c61-2f0829c2cd5d/ContentAssets/Media/Flash/'+filename+'.swf" quality="high" '
            + 'width="'+width+'" height="'+height+'" name="'+filename+'" align="left"'
            + 'play="true"'
            + 'loop="false"'
            + 'quality="high"'
			+ 'scale="noscale" wmode="transparent"'
            + 'allowScriptAccess="sameDomain"'
            + 'type="application/x-shockwave-flash"'
            + 'pluginspage="http://www.macromedia.com/go/getflashplayer">'
            + '<\/embed>'
            + '<\/object></div>';
            // document.write(oeTags);   // embed the flash movie
            document.getElementById("flashcontent").innerHTML = oeTags;
        }
        
    }	
	
/*} else {  // flash is too old or we can't detect the plugin
   // Spacer image remains in place
  // alert("This page contains Flash content newer than your browser.  Upgrade, fool!");
}*/}} catch(errr) {}

}
/*
function fixFlash () {
 if (navigator.appName == "Microsoft Internet Explorer") {

  //Array of elements to be replaced
  var arrElements = new Array(3);
  arrElements[0] = "object";
  arrElements[1] = "embed";
  arrElements[2] = "applet";
 
  //Loop over element types
  for (n = 0; n < arrElements.length; n++) {
  
   //set object for brevity
   replaceObj = document.getElementsByTagName(arrElements[n]);
   
   //loop over element objects returned
   for (i = 0; i < replaceObj.length; i++ ) {
   
    //set parent object for brevity
    parentObj = replaceObj[i].parentNode;
    
    //grab the html inside of the element before removing it from the DOM
    newHTML = parentObj.innerHTML;
    
    //remove element from the DOM
    parentObj.removeChild(replaceObj[i]);
    
    //stick the element right back in, but as a new object
    parentObj.innerHTML = newHTML;
   
    }
   }
  }
}*/