// Flash detect
function flashdetect(version) {
	var playerversion = version;

	if (navigator.appVersion.indexOf("MSIE 4.5") != -1) {
		return true;
	} else {
		var agent = navigator.userAgent.toLowerCase();
		gotflash = 0;

		if (navigator.mimeTypes
			&& navigator.mimeTypes["application/x-shockwave-flash"]
			&& navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin
			&& navigator.plugins
			&& navigator.plugins["Shockwave Flash"]){
			// NS3+ and Opera3+ (support plugin array):  check for Flash plugin in plugin array
			if (navigator.plugins != null && navigator.plugins.length > 0) {
				var flashPlugin = navigator.plugins['Shockwave Flash'];

				if (typeof flashPlugin == 'object') {
					desc = flashPlugin.description;
					startpnt = desc.indexOf('Flash') +6;
					endpnt = desc.indexOf('.');
					gotflash = parseInt((desc.substring(startpnt, endpnt)));
				}
			}
		}
		
		// Check the browser...we're looking for ie/win, but not aol
		var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;    // true if we're on ie
		var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false; // true if we're on windows

		// This is a js1.1 code block, so make note that js1.1 is supported.
		jsVersion = 1.1;

		// Write vbscript detection on ie win. IE on Windows doesn't support regular
		// JavaScript plugins array detection.
		if(isIE && isWin) {
			var WM_startTagFix = '</';
			document.writeln('<script language="VBscript">');
			document.writeln('on error resume next');
			document.writeln('if IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.10")) then gotflash = 10');
			document.writeln('if gotflash < 10 and IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.9")) then gotflash = 9');
			document.writeln('if gotflash < 9 and IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.8")) then gotflash = 8');
			document.writeln('if gotflash < 8 and IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.7")) then gotflash = 7');
			document.writeln('if gotflash < 7 and IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6")) then gotflash = 6');
			document.writeln('if gotflash < 6 and IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5")) then gotflash = 5');
			document.writeln('if gotflash < 5 and IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4")) then gotflash = 4');
			document.writeln('if gotflash < 4 and IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.3")) then gotflash = 3'); 
			document.writeln(WM_startTagFix+'script>');
		}		

		if (gotflash < playerversion) {
			// Flash 4 or later
			return false;
		} else {
		    // Flash 5 or more
			return true;
		} 
	}
} 



function visualizzaflash(url,image,image_big,width,height,bgcolor,playerversion){


flash = ('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" border="0" width="'+ width +'" height="'+ height +'" align="middle"  style="float:center;">');
flash = flash + ('<param name="wmode" value="opaque">');
flash = flash + ('<param name="movie" value="'+ url +'?image='+ image +'&imagebig='+ image_big +'&imgW='+ width +'&imgH=' + height+'">');       
flash = flash + (' <param name="loop" value="false">');
flash = flash + ('<param name="menu" value="false">');
flash = flash + ('<param name="quality" value="high">');    
flash = flash + ('<param name="bgcolor" value="'+ bgcolor +'">');  
flash = flash + ('<embed src="' + url + '?image='+ image +'&imagebig='+ image_big +'&imgW='+ width +'&imgH='+ height +'" width="'+ width +'" height="'+ height +'" loop="false" align="middle" wmode="opaque" menu="false" quality="high" bgcolor="#ffffff" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"> </embed>');  
flash = flash + ('</object>');  

if (flashdetect(playerversion)) document.write(flash);
	else { document.write('<img src="'+ image +'" border="0"  />');  }
	
//document.write(flash); 
//document.write('<img src="'+ image +'" border="0"  />');
}

