// =============================================================
//  Detección de soporte para Macromedia Flash
//  Autor: Cristian Rodriguez ( cristian.rodriguez@neoris.com )
//  17/5/2002
// =============================================================




// ** Creación de objeto y variables globales en VBS para IE *************************************
document.write('<SCRIPT LANGUAGE=VBScript\>');
document.write('on error resume next \n');
document.write('	pluginFlash = false   \n');
document.write('	For i=10 To 1 step -1   \n');
document.write('		set objFlash = CreateObject("ShockwaveFlash.ShockwaveFlash."&i)\n')
document.write('		pluginFlash = (IsObject(objFlash))  \n');
document.write('		If pluginFlash Then  \n');
document.write('			pluginVersion = i   \n');
document.write('			Exit For   \n');
document.write('		End if   \n');
document.write('	Next   \n');
document.write('</SCRIPT\> \n');
			




function detectFlash(versionRequerida){

	// Determinación del Browser y plataforma
	browser		=	navigator.appVersion;
	plataforma	=	navigator.platform.toUpperCase();
	onWindows	=	plataforma.indexOf('WIN') != -1 ;
	onMAC		=	plataforma.indexOf('MAC') != -1 ;
	msNS4x		=	(document.layers && onWindows);
	msIE		=	(document.all && onWindows);
	msNS6		=	((document.getElementById && !document.all) && onWindows)
	macNS4x		=	(document.layers && onMAC);
	macIE		=	(document.all && onMAC);
	macNS6		=	((document.getElementById && !document.all) && onMAC)
	
	var flashStatus	= false;
	var anyVersion	= false ;
	
	if (versionRequerida =='' || versionRequerida == null){ versionRequerida = 0 ;anyVersion = true}
																				//si no se especifíca por 
																				//parámetro una versión, se 
																				//testeará que exista 
																				//CUALQUIER versión

	// ** Test en NS  ***********************************************************************
	if (msNS4x || msNS6 || macNS4x || macNS6 || macIE ){
	
		if (navigator.plugins['Shockwave Flash']){	//existe el plug-in
			
			if(anyVersion){ flashStatus = true ; }	//NO se requiere una versión específica
			
			else{									//SI se requiere una versión específica
													//se testea la versión instalada
					
				descriptor		=	navigator.plugins["Shockwave Flash"].description ; 
				arrayDescriptor	=	descriptor.split(" ");
				versionActual	=	arrayDescriptor[2] ;
				intVersion		=	parseInt(versionActual);
				revision		=   arrayDescriptor[4].substring(1,5)
				
				flashStatus = (intVersion >= versionRequerida)? true:false;
			}
		}
		
	}
	
	// ** Test en IE  ** (Basado en la deteccion  VBS )*****************************************
	if(msIE ){
		if(pluginFlash){
			flashStatus = (pluginVersion >= versionRequerida)? true:false;
		}
	}

return flashStatus

}

