/*
ver. 1
pc & mac compatible
ie 4+ ns 4+ (incl. 6)

NOTE: In order for this script to function flash_detect.js is needed
*/

var requiredVersion = 6;
var flashVersion = getFlashVersion();

function sniffer(){
	for (x=0;x<arguments.length;x+=4){
	
		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\#version\=6\,0\,0\,0\">'
			+ '<param name=\"movie\" value=\"' 
			+ arguments[x] //flash movie parameter
			+ '.swf\">'
			+ '<param name=\"play\" value=\"true\">'
			+ '<param name=\"loop\" value=\"true\">'
			+ '<embed src=\"' 
			+ arguments[x] //flash movie parameter
			+ '.swf\"'
			+ ' width=\"'
			+ arguments[x+2] //width parameter
			+ '\"' 
			+ ' height=\"'
			+ arguments[x+3] //height parameter
			+ '\"' 
			+ ' play=\"true\" loop=\"true\" '
			+ ' type=\"application\/x-shockwave-flash\"'
			+ ' pluginspage=\"http:\/\/www.macromedia.com\/go\/getflashplayer\">'
			+ '<\/embed>'
			+ '<\/object>'
		
		var imgembed= '<img src=\"' 
			+ arguments[x+1] //img parameter
			+ '\"'
			+ ' width=\"'
			+ arguments[x+2] //width parameter
			+ '\"' 
			+ ' height=\"'
			+ arguments[x+3] //height parameter
			+ '\"' 
			+ ' border=\"0\" alt=\"\">'
			
		if (flashVersion >= requiredVersion) {
			//alert('You have Flash ' + requiredVersion + ' (or a higher version) installed on the current browser.');
			restring = flashembed;
			//restring = imgembed;
		}
		else if (flashVersion > 0) {
			//alert('The version of Flash installed on the current browser is below version ' + requiredVersion + '.');
			restring = imgembed;
		}
		else if (flashVersion == 0) {
			//alert('You don\'t have Flash installed on the current browser.');
			restring = imgembed;
		}
		else if (flashVersion == flashVersion_DONTKNOW || flashVersion == null) {
			//alert('This browser does not support Javascript-based Flash detection.');
			restring = imgembed;
		}
	}
	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 = img
arg3 = width
arg4 = height
*/
