/* FLASH CHECK */
/* updated for Flash 10 */

var requiredVersion = 8; 
var useRedirect = false; 
           
var flash2Installed = false;  
var flash3Installed = false;  
var flash4Installed = false;  
var flash5Installed = false;  
var flash6Installed = false;
var flash7Installed = false;
var flash8Installed = false;
var flash9Installed = false;
var flash10Installed = false;			// toegevoegd

var maxVersion = 10;   
var actualVersion = 0;    
var hasRightVersion = false;  
var jsVersion = 1.0;    

var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;   // true if we're on ie
var isWin = (navigator.appVersion.indexOf("Windows") != -1) ? true : false; // true if we're on windows

jsVersion = 1.1;

function detectFlash(version){
  if (version != null) 
  {
    requiredVersion = version;
  }
  if (navigator.plugins) {  // does navigator.plugins exist?
    if (navigator.plugins["Shockwave Flash 2.0"]  
  || navigator.plugins["Shockwave Flash"]){   

    var isVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
    var flashDescription = navigator.plugins["Shockwave Flash" + isVersion2].description;
/* gewijzigd */
	if(parseInt(flashDescription.charAt(flashDescription.indexOf(".") - 2)) != ' ') {
		var flashVersion = parseInt(flashDescription.charAt(flashDescription.indexOf(".") - 2)+''+flashDescription.charAt(flashDescription.indexOf(".") - 1));
	} else {
		var flashVersion = parseInt(flashDescription.charAt(flashDescription.indexOf(".") - 1));
	}
/* gewijzigd */
	flash2Installed = flashVersion == 2;
    flash3Installed = flashVersion == 3;
    flash4Installed = flashVersion == 4;
    flash5Installed = flashVersion == 5;
    flash6Installed = flashVersion == 6;
    flash7Installed = flashVersion == 7;
    flash8Installed = flashVersion == 8;
    flash9Installed = flashVersion == 9;
    flash10Installed = flashVersion == 10;			// toegevoegd
    }
  }
  for (var i = 2; i <= maxVersion; i++) {
    if (eval("flash" + i + "Installed") == true) actualVersion = i;
  }
  if(navigator.userAgent.indexOf("WebTV") != -1) actualVersion = 2;
  if (actualVersion >= requiredVersion) {
    hasRightVersion = true;
    if (useRedirect) {
      if(jsVersion > 1.0) {
        window.location.replace(flashPage);
      } else {
  window.location = flashPage;
      }
    }
  } else {  
    if (useRedirect) {    
      if(jsVersion > 1.0) { 
  window.location.replace((actualVersion >= 2) ? upgradePage : noFlashPage);
      } else {
  window.location = (actualVersion >= 2) ? upgradePage : noFlashPage;
      }
    }
  }
}
 

function writeFlash(swf,breedte,hoogte,akleur,fvar) {
  var alternatieveContent = '<div aling="center" class="flashcheck">Voor het deelnemen aan deze test heb je <a target="_blank" href="https://www.macromedia.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash&P5_Language=Dutch">Adobe Flash plugin</a> versie ' + requiredVersion + ' (of hoger) nodig.<br>Je kunt deze gratis downloaden via de <a target="_blank" href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash">Adobe website</a></div>'
  var flashContent = '<OBJECT CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" WIDTH="'+breedte+'" ID="imageslider" HEIGHT="'+hoogte+'" CODEBASE="https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" style="z-index:0;">'
  + '<PARAM NAME="MOVIE" VALUE="'+swf+'">'
  + '<PARAM NAME="PLAY" VALUE="true">'
  + '<PARAM NAME="ID" VALUE="imageslider">'
  + '<PARAM NAME="LOOP" VALUE="false">'
  + '<PARAM NAME="WMODE" VALUE="transparent">'
  + '<PARAM NAME="QUALITY" VALUE="best">'
  + '<PARAM NAME="MENU" VALUE="false">'
  + '<PARAM NAME="SCALE" value="noscale">'
  + '<PARAM NAME="flashVars" value="'+fvar+'">'
  + '<PARAM NAME=bgcolor VALUE="'+akleur+'">'
  + '<EMBED SRC="'+swf+'" flashVars="'+fvar+'" WIDTH="'+breedte+'" HEIGHT="'+hoogte+'" PLAY="true" ID="unive" NAME="unive" LOOP="false" WMODE="transparent" QUALITY="best" MENU="false" TYPE="application/x-shockwave-flash" PLUGINSPAGE="https://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED>'
  + '<NOEMBED>' + alternatieveContent + '</NOEMBED></OBJECT>';

  if (hasRightVersion) {
    document.write(flashContent);
  } else {
    document.write(alternatieveContent);
  }
}