/*
DETECT FLASH PLUGIN
*/

var detectableWithVB = false;

function hasFlash() {
    var pluginFound = false;
    pluginFound = detectPlugin( 'Flash' );

    // Sinon essai avec le monstre IE
    if( !pluginFound && detectableWithVB ) {
	    pluginFound = detectActiveXControl( 'ShockwaveFlash.ShockwaveFlash.1' );
    }

    return pluginFound;
}

function detectPlugin( name ) {
    var pluginFound = false;

    // if plugins array is there and not fake
    if( navigator.plugins && navigator.plugins.length > 0) {
	    var pLen = navigator.plugins.length;

    	// for each plugin...
	    for ( ind=0; ind < pLen; ind++ ) {
 		    if( navigator.plugins[ ind ].name.indexOf( name ) >= 0 ) {
		      pluginFound = true;
		      break;
		    }
	    }
	  }

    return pluginFound;
}

function showHide( elem_name, show ) {
  elem = document.getElementById( elem_name );
  if( show == 1 ) {
      elem.style.display='block';
  } else {
      elem.style.display='none';
  }
}


function selectAnim() {
  
  if (hasFlash()){
    showHide( 'flashAnim', 1 );
    showHide( 'imgAnim', 0 );
  }
  else {
    showHide( 'flashAnim', 0 );
    showHide( 'imgAnim', 1 );
  }
  
}


// Here we write out the VBScript block for MSIE Windows
if ((navigator.userAgent.indexOf('MSIE') != -1) && (navigator.userAgent.indexOf('Win') != -1)) {
    document.writeln('<script language="VBscript">');

    document.writeln('\'do a one-time test for a version of VBScript that can handle this code');
    document.writeln('detectableWithVB = False');
    document.writeln('If ScriptEngineMajorVersion >= 2 then');
    document.writeln('  detectableWithVB = True');
    document.writeln('End If');

    document.writeln('\'this next function will detect most plugins');
    document.writeln('Function detectActiveXControl(activeXControlName)');
    document.writeln('  on error resume next');
    document.writeln('  detectActiveXControl = False');
    document.writeln('  If detectableWithVB Then');
    document.writeln('     detectActiveXControl = IsObject(CreateObject(activeXControlName))');
    document.writeln('  End If');
    document.writeln('End Function');

    document.writeln('</scr' + 'ipt>');
}


