<!--

// initialize global variables
var detectableWithVB = false;
var pluginFound = false;

function canDetectPlugins() {
    if( detectableWithVB || (navigator.plugins && navigator.plugins.length > 0) ) {
	   return true;
    } else {
	   return false;
    }
}

function detectFlash() {
    pluginFound = detectPlugin('Shockwave Flash 9')
    if(!pluginFound) pluginFound = detectPlugin('Shockwave Flash 8');
    if(!pluginFound) pluginFound = detectPlugin('Shockwave Flash 7');
    //pluginFound = detectPlugin('Shockwave','Flash');
    // if not found, try to detect with VisualBasic
    if(!pluginFound && detectableWithVB) {
	   pluginFound = detectActiveXControl('ShockwaveFlash.ShockwaveFlash.7');
    }
    // check for redirection
    return pluginFound;
}


function detectQuickTime() {
    pluginFound = detectPlugin('QuickTime');
    // if not found, try to detect with VisualBasic
    if(!pluginFound && detectableWithVB) {
	   pluginFound = detectQuickTimeActiveXControl();
    }
    return pluginFound;
}

function detectRealMedia() {
    pluginFound = detectPlugin('RealPlayer');
    // if not found, try to detect with VisualBasic
    if(!pluginFound && detectableWithVB) {
	   pluginFound = detectActiveXControl('rmocx.RealPlayer G2 Control.1');
    }
    // check for redirection
    return pluginFound;
}

function detectWindowsMedia() {
    //getMozilaPluginsLists();
    pluginFound = detectPlugin('Windows Media Player') || detectPlugin('Windows Media');
    //alert(pluginFound);
    // if not found, try to detect with VisualBasic
    if(!pluginFound && detectableWithVB) {
	   pluginFound = detectMediaplayerActiveXControl(7); //'MediaPlayer.MediaPlayer.1');
    //alert(pluginFound);
    }
    // check for redirection
    return pluginFound;
}


function detectPlugin() {
    // allow for multiple checks in a single pass
    var daPlugins = detectPlugin.arguments;
    // consider pluginFound to be false until proven true
    var pluginFound = false;
    // if plugins array is there and not fake
    if (navigator.plugins && navigator.plugins.length > 0) {
	var pluginsArrayLength = navigator.plugins.length;
	// for each plugin...
	for (pluginsArrayCounter=0; pluginsArrayCounter < pluginsArrayLength; pluginsArrayCounter++ ) {
	    // loop through all desired names and check each against the current plugin name
	    var numFound = 0;
	    for(namesCounter=0; namesCounter < daPlugins.length; namesCounter++) {
		// if desired plugin name is found in either plugin name or description
		if( (navigator.plugins[pluginsArrayCounter].name.indexOf(daPlugins[namesCounter]) >= 0) ||
		    (navigator.plugins[pluginsArrayCounter].description.indexOf(daPlugins[namesCounter]) >= 0) ) {
		    // this name was found
		    numFound++;
		}
	    }
	    // now that we have checked all the required names against this one plugin,
	    // if the number we found matches the total number provided then we were successful
	    if(numFound == daPlugins.length) {
		pluginFound = true;
		// if we've found the plugin, we can stop looking through at the rest of the plugins
		break;
	    }
	}
	//alert(pins);
    }
    return pluginFound;
} // detectPlugin

function writeNoFlash(lg, forPref) {

    if (lg == 'fr') {
        if(!forPref)
   	        document.write("<p style='color: #BF2A21;'>Si vous ne voyez l'animation flash ci-haut veuillez télécharger la derniere version de <a href='http://www.macromedia.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash' target='_blank'>Flash Player</a></p>");
        else
   	        document.write("<p style='color: #BF2A21;'>Vous avez des probl&egrave;mes à voir le film? T&eacute;l&eacute;chargez gratuitement le plugiciel Flash, version 7 ou plus r&eacute;cent [<a href='http://www.macromedia.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash' target='_blank'>ici</a>]</p>");
    } else {
        if(forPref)
    	   document.write("<p style='color: #BF2A21;'>This site uses Macromedia Flash, to view this site as it was intended, please download the latest version from the of  <a href='http://www.macromedia.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash' target='_blank'>Flash Player</a></p>");
        else
    	   document.write("<p style='color: #BF2A21;'>Are you having problems viewing a film? Download the free Flash plug-in, version 7 or more recent, [<a href='http://www.macromedia.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash' target='_blank'>here</a>]</p>");
    }

}

function writeNoQuickTime(lg, forPref) {

    if (lg == 'fr') {
        if(!forPref)
       	    document.write("<p style='color: #BF2A21;'>Si vous ne voyez l'animation QuickTime ci-haut veuillez télécharger la derniere version de <a href='http://www.apple.com/quicktime/download/' target='_blank'>QuickTime</a></p>");
        else
       	    document.write("<p style='color: #BF2A21;'>Vous avez des probl&egrave;mes à voir le film? T&eacute;l&eacute;chargez gratuitement le plugiciel QuickTime, version 7 ou plus r&eacute;cent [<a href='http://www.apple.com/quicktime/download/' target='_blank'>ici</a>]</p>");
    } else {
        if(forPref)
        	document.write("<p style='color: #BF2A21;'>This site uses QuickTime, to view this site as it was intended, please download the latest version from the of  <a href='http://www.apple.com/quicktime/download/' target='_blank'>Apple QuickTime</a></p>");
        else
        	document.write("<p style='color: #BF2A21;'>Are you having problems viewing a film? Download the free QuickTime plug-in, version 7 or more recent, [<a href='http://www.apple.com/quicktime/download/' target='_blank'>here</a>]</p>");
    }

}

function writeNoRealMedia(lg, forPref) {

    if (lg == 'fr') {
        if(!forPref)
   	        document.write("<p style='color: #BF2A21;'>Si vous ne voyez l'animation Real Media ci-haut veuillez télécharger la derniere version de <a href='http://www.real.com/international/' target='_blank'>Real Media Player</a></p>");
        else
   	        document.write("<p style='color: #BF2A21;'>Vous avez des probl&egrave;mes à voir le film? T&eacute;l&eacute;chargez gratuitement le plugiciel Real Media Player [<a href='http://www.real.com/international/' target='_blank'>ici</a>]</p>");
    } else {
        if(forPref)
    	   document.write("<p style='color: #BF2A21;'>This site uses Real Media Player, to view this site as it was intended, please download the latest version from the <a href='http://www.real.com/international/' target='_blank'>Real Media Player</a></p>");
        else
    	   document.write("<p style='color: #BF2A21;'>Are you having problems viewing a film? Download the free Real Media Player plug-in, [<a href='http://www.real.com/international/' target='_blank'>here</a>]</p>");
    }

}

function writeNoWindowsMedia(lg, forPref) {

    if (lg == 'fr') {
        if(!forPref)
   	        document.write("<p style='color: #BF2A21;'>Si vous ne voyez l'animation Windows Media ci-haut veuillez télécharger la derniere version de <a href='http://www.microsoft.com/downloads/Browse.aspx?displaylang=fr&categoryid=4' target='_blank'>Windows Media Player</a></p>");
        else
   	        document.write("<p style='color: #BF2A21;'>Vous avez des probl&egrave;mes à voir le film? T&eacute;l&eacute;chargez gratuitement le plugiciel Windows Media Player [<a href='http://www.microsoft.com/downloads/Browse.aspx?displaylang=fr&categoryid=4' target='_blank'>ici</a>]</p>");
    } else {
        if(forPref)
    	   document.write("<p style='color: #BF2A21;'>This site uses Windows Media Player, to view this site as it was intended, please download the latest version from the <a href='http://www.microsoft.com/downloads/Browse.aspx?displaylang=en&categoryid=4' target='_blank'>Windows Media Player</a></p>");
        else
    	   document.write("<p style='color: #BF2A21;'>Are you having problems viewing a film? Download the free Windows Media Player plug-in, [<a href='http://www.microsoft.com/downloads/Browse.aspx?displaylang=en&categoryid=4' target='_blank'>here</a>]</p>");
    }

}

// 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('     Set obj = CreateObject(activeXControlName)');
    document.writeln('     detectActiveXControl = IsObject(obj)');
    document.writeln('  End If');
    document.writeln('End Function');

    document.writeln('\'and the following function handles MediaPlayer && minimum version');
    document.writeln('Function detectMediaplayerActiveXControl(minVer)');
    document.writeln('  on error resume next');
    document.writeln('  detectMediaplayerActiveXControl = False');
    document.writeln('  If detectableWithVB Then');
    document.writeln('     Set obj = CreateObject("MediaPlayer.MediaPlayer.1")');
    document.writeln('     If IsObject(obj) Then');
    document.writeln('        Set obj = CreateObject("WMPlayer.OCX")');
    document.writeln('        If IsObject(obj) Then');
    document.writeln('           wmVersion = obj.versionInfo');
    document.writeln('           if IsNumeric(Left(wmVersion,Len(CStr(minVer)))) Then');
    document.writeln('             if CInt(Left(wmVersion,Len(CStr(minVer)))) >= minVer Then');
    document.writeln('                detectMediaplayerActiveXControl = True');
    document.writeln('             ElseIf IsNumeric(Left(wmVersion, 2)) Then');
    document.writeln('                detectMediaplayerActiveXControl = (CInt(Left(wmVersion,2)) >= minVer)');
    document.writeln('             End If');
    document.writeln('           End If');
    document.writeln('        End If');
    document.writeln('     End If');
    document.writeln('  End If');
    document.writeln('  Set obj = Nothing');
    document.writeln('End Function');

    document.writeln('\'and the following function handles QuickTime');
    document.writeln('Function detectQuickTimeActiveXControl()');
    document.writeln('  on error resume next');
    document.writeln('  detectQuickTimeActiveXControl = False');
    document.writeln('  If detectableWithVB Then');
    document.writeln('    detectQuickTimeActiveXControl = False');
    document.writeln('    hasQuickTimeChecker = false');
    document.writeln('    Set hasQuickTimeChecker = CreateObject("QuickTimeCheckObject.QuickTimeCheck.1")');
    document.writeln('    If IsObject(hasQuickTimeChecker) Then');
    document.writeln('      If hasQuickTimeChecker.IsQuickTimeAvailable(0) Then ');
    document.writeln('        detectQuickTimeActiveXControl = True');
    document.writeln('      End If');
    document.writeln('    End If');
    document.writeln('  End If');
    document.writeln('End Function');

    document.writeln('</scr' + 'ipt>');
}

function setPlayerFormatTo(id) {
  opt = playerGetElementById(id);
  opt.checked = true;
}
function playerGetElementById(id){
	if (document.getElementById) {
		return (document.getElementById(id));
	} else if (document.all) {
		return (document.all[id]);
	} else {
		if ((navigator.appname.indexOf("Netscape") != -1) && parseInt(navigator.appversion == 4)) {
			return (document.layers[id]);
		}
	}
}

function getMozilaPluginsLists() {
  // if plugins array is there and not fake
  if (navigator.plugins && navigator.plugins.length > 0) {
    var pluginsArrayLength = navigator.plugins.length;
    var pins = '';
    // for each plugin...
    for (pluginsArrayCounter=0; pluginsArrayCounter < pluginsArrayLength; pluginsArrayCounter++ ) {
      // loop through all plugin name & description
  		pins += "<font style='font-size: 10px;'>" + navigator.plugins[pluginsArrayCounter].name + "[" + navigator.plugins[pluginsArrayCounter].filename + "]" + "<br>";
  		pins += navigator.plugins[pluginsArrayCounter].description + "<br></font>";
  		for(var i = 0; i<navigator.plugins[pluginsArrayCounter].length; i++) {
  		  pins += "<font style='font-size: 10px; color: red;'>" + navigator.plugins[pluginsArrayCounter][i].type + " : </font><font style='font-size: 10px; color: blue;'> " + navigator.plugins[pluginsArrayCounter][i].description + "<br></font>";
      }
  		pins += "<br>";
    }
  	document.write(pins);
  }
    //alert(pins);
} // getMozilaPluginsLists

function getEmbedObject(embedId) {
  try {
    if(typeof(eval('document.' + embedId)) != 'undefined') {
      oRm = eval('document.' + embedId);
    } else {
      if(document.embeds[embedId]) {
        oRm = document.embeds[embedId];
      } else {
        oRm = nfbGetElementById(embedId);
      }
    }
  }catch (e) {
    oRm = nfbGetElementById(embedId);
  }
  return oRm;
}

function nfbGetElementById(id){
	if (document.getElementById) {
		return (document.getElementById(id));
	} else if (document.all) {
		return (document.all[id]);
	} else {
		if ((navigator.appname.indexOf("Netscape") != -1) && parseInt(navigator.appversion == 4)) {
			return (document.layers[id]);
		}
	}
}

function removeObjectTag(str) {
  var $ret = '';
  aStr = str.split('<');
  for(var i = 0; i < aStr.length; i++) {
    if(!aStr[i].match(/[\/]*(object|param).*>/gi) && !aStr[i] == '')
      $ret += '<' + aStr[i];
  }
    return $ret;
}
function removeEmbedTag(str) {
  var $ret = '';
  aStr = str.split('<');
  for(var i = 0; i < aStr.length; i++) {
    if(!aStr[i].match(/[\/]*embed(.*)*>/gi) && !aStr[i] == ''){
      $ret += '<' + aStr[i];
    }
  }
  return $ret;
}

// -->


