/*
	IE-only fixes for EOLAS "click to activate" nuisance with Flash objects

	1) createMovieObj()  - plays FLV files in viewer
	2) createSWFObj()    - plays general SWF files
	3) doRhysInterview() - plays Rhys Jones audio MP3 in XSPF player

   
	For Movie viewer, use thus to add the object to a page: 
	   <script type="text/javascript">var movie='FileName'</script>
	   <script src="path/to/fixFlash.js"></script>

	NB: 'FileName' has no .flv (or .swf) extension)

	FLV movie use requires these files in the same directory:
	   - FileName.flv
	   - FLVPlayer_Progressive.swf
	   - clearSkin_3.swf
*/

if (window.movie){
   createMovieObj(movie);
}

if (window.swf){
   createSWFObj(swf);
}

function createMovieObj(movieName){

	var strMovie =
	'<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" '+
	'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#v..." '+
	'width="512" height="288"> '+
	'<param name="movie" value="FLVPlayer_Progressive.swf"> '+
	'<param name="salign" value="lt"> '+
	'<param name="quality" value="high"> '+
	'<param name="scale" value="noscale"> '+
	'<param name="FlashVars"  value="&skinName=clearSkin_3&streamName='+ movieName +'&autoPlay=true&autoRewind=false"> '+
	'<embed src="FLVPlayer_Progressive.swf" '+
	' flashvars="&skinName=clearSkin_3&streamName='+ movieName +'&autoPlay=true&autoRewind=false" '+
	' quality="high" scale="noscale" width="512" height="288" name="FLVPlayer" '+
	' salign="LT" type="application/x-shockwave-flash" '+
	' pluginspage="http://www.macromedia.com/go/getflashplayer"> '+
	'</object> ';

     document.write(strMovie);
}

function createSWFObj(swfName){

	var strSWF = 
	'<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" '+
	'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" '+
	'width="500"  '+
	'height="375"  '+
	'id="commercial"> ' +
	'<param name="movie" value="'+ swfName +'.swf"> '+
	'<param name="quality" value="best">'  +
	'<embed src="'+ swfName +'.swf" quality="best" width="500" height="375" '+
	'type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"> '+
	'</object>';

	document.write(strSWF);
}

function doRhysInterview(){

   // Plays supplied mp3 interview with Rhys Jones using 
   // free XSPF Flash player button from http://musicplayer.sourceforge.net/.

   // Requires various other include files as per mp3player directory

   // To use, drop the following into the HTML content where the 'Play' arrow should go:
   //    <script type="text/javascript" src="/flash/fixFlash.js"></script>
   //    <script type="text/javascript">doRhysInterview()</script>

   var strPlayerURL = 'http://www.warnergoodman.co.uk/rhysjones/mp3player/musicplayer.swf';
   var strMP3URL    = 'http://www.warnergoodman.co.uk/rhysjones/mp3player/Rhys1.mp3';
   var BGColor      = 990033 ;
   var height       = 17;
   var width        = 17;

   var strParams = 'song_url=' + strMP3URL + ' &amp;b_fgcolor=' + BGColor;

   var strRhys = '<object type="application/x-shockwave-flash" ' +
                 'height="' + height + '" width="' + width + '" ' +
                 'data="' + strPlayerURL + '?' + strParams + '">' +
	             '<param value="' + strPlayerURL + '?' + strParams + '"' +
	             'name="movie"></object>'

	document.write(strRhys);
}
