/*
aphrodite@amxnetwork.com
22.04.2002

ver. 1
pc & mac compatible
ie 4+ ns 4+ (incl. 6)

NOTE: In order for this script to function flash_detect.js is needed

updated phil.bignell@arnoldinteractive
19.09.2003

now allows optional alt tag.
only processes a single set of args
*/

var requiredVersion = 5;
var flashVersion = getFlashVersion();

function sniffer(){
	//for (x=0;x<arguments.length;x+=5){ 
	if (arguments.length >= 4){	//need at least 4 args.
		var x=0;
		var flashembed = '<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\"'
			+ ' width=\"'
			+ arguments[x+2] //width parameter
			+ '\"' 
			+ ' height=\"'
			+ arguments[x+3] //height parameter
			+ '\"' 
			+ ' codebase=\"http:\/\/download.macromedia.com\/pub\/shockwave\/cabs\/flash\/swflash.cab\">'
			+ '<param name=\"movie\" value=\"' 
			+ arguments[x] //flash movie parameter
			+ '.swf\">'
			+ '<param name=\"bgcolor\" value=\"#ffffff\">'
			+ '<param name=\"play\" value=\"true\">'
			+ '<param name=\"loop\" value=\"true\">'
			+ '<param name=\"quality\" value=\"high\">'
			+ '<param name=\"menu\" value=\"false\">'
			+ '<embed src=\"' 
			+ arguments[x] //flash movie parameter
			+ '.swf\"'
			+ ' width=\"'
			+ arguments[x+2] //width parameter
			+ '\"' 
			+ ' height=\"'
			+ arguments[x+3] //height parameter
			+ '\"' 
			+ ' play=\"true\" loop=\"true\" quality=\"high\" menu=\"false\" bgcolor=\"#ffffff\" '
			+ ' type=\"application\/x-shockwave-flash\"'
			+ ' pluginspace=\"http:\/\/www.macromedia.com\/shockwave\/download\/index.cgi\?P1_Prod_Version=ShockwaveFlash\">'
			+ '<\/embed>'
			+ '<\/object>'
		
		var alt_string;
		if (arguments.length>4){
			alt_string=arguments[x+4];
		}else{
			alt_string="";
		}
		
		var gifembed= '<img src=\"' 
			+ arguments[x+1] //gif parameter
			+ '\"'
			+ ' width=\"'
			+ arguments[x+2] //width parameter
			+ '\"' 
			+ ' height=\"'
			+ arguments[x+3] //height parameter
			+ '\"' 
			+ ' border=\"0\" alt=\"'
			+ alt_string //alt tag parameter
			+'\">'
			
		var bplatform = navigator.platform; //Stores platform, (eg. "MacPPC","Win32")
		if (browserIE5 && bplatform =="MacPPC"){
			//restring = gifembed;
			restring = flashembed;
		}
		else if (flashVersion >= requiredVersion) {
			//alert('You have Flash ' + requiredVersion + ' (or a higher version) installed on the current browser.');
			restring = flashembed;
			//restring = gifembed; //uncomment to test the img versions
		}
		else if (flashVersion > 0) {
			//alert('The version of Flash installed on the current browser is below version ' + requiredVersion + '.');
			restring = gifembed;
		}
		else if (flashVersion == 0) {
			//alert('You don\'t have Flash installed on the current browser.');
			restring = gifembed;
		}
		else if (flashVersion == flashVersion_DONTKNOW || flashVersion == null) {
			//alert('This browser does not support Javascript-based Flash detection.');
			restring = gifembed;
		}
	}
	return restring;
}

/*
<script language="javascript" type="text/javascript">document.write(sniffer('swf','img',width,height));</script>
sniffer(arg1, arg2, arg3, arg4)

arg1 = flash movie
arg2 = gif
arg3 = width
arg4 = height
arg5 = alt (optional)


*/
