

/* FLASH CHECK */

var requiredVersion = 5; // version the user needs to view site (max is 6, min is 2)
var useRedirect = false; // "true" loads new flash or non-flash page into browser
		        // "false" embeds movie or alternate html code into current page
var flash2Installed = false;	// boolean. true if flash 2 is installed
var flash3Installed = false;	// boolean. true if flash 3 is installed
var flash4Installed = false;	// boolean. true if flash 4 is installed
var flash5Installed = false;	// boolean. true if flash 5 is installed
var flash6Installed = false;	// boolean. true if flash 6 is installed
var maxVersion = 6;		// highest version we can actually detect
var actualVersion = 0;		// version the user really has
var hasRightVersion = false;	// boolean. true if it's safe to embed the flash movie in the page
var jsVersion = 1.0;		// the version of javascript supported


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(){
  if (navigator.plugins){	// does navigator.plugins exist?
    if (navigator.plugins["Shockwave Flash 2.0"] 	// yes>> then is Flash 2
	|| navigator.plugins["Shockwave Flash"]){		// or flash 3+ installed?

	  var isVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
	  var flashDescription = navigator.plugins["Shockwave Flash" + isVersion2].description;
	  var flashVersion = parseInt(flashDescription.charAt(flashDescription.indexOf(".") - 1));

	  flash2Installed = flashVersion == 2;
	  flash3Installed = flashVersion == 3;
	  flash4Installed = flashVersion == 4;
	  flash5Installed = flashVersion == 5;
	  flash6Installed = flashVersion == 6;
    }
  }
  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 {	// user doesn't have a new enough version.
    if (useRedirect) {		// if the redirection option is on, load the appropriate alternate page
      if(jsVersion > 1.0) {	// need javascript1.1 to do location.replace
	window.location.replace((actualVersion >= 2) ? upgradePage : noFlashPage);
      } else {
	window.location = (actualVersion >= 2) ? upgradePage : noFlashPage;
      }
    }
  }
}

function writeFlash(s,w,h,b,v) {
  var alternateContent = 'Om deze site optimaal te bekijken is versie '+requiredVersion+' van de Macromedia Flash plugin benodigd. U kunt deze installeren door <A TARGET="_blank" HREF="http://www.macromedia.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash&P5_Language=English">hier te klikken</A>'
  var flashContent = '<OBJECT CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" WIDTH="'+w+'" HEIGHT="'+h+'" CODEBASE="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab">'
  + '<PARAM NAME="MOVIE" VALUE="'+s+'">'
  + '<PARAM NAME="PLAY" VALUE="true">'
  + '<PARAM NAME="LOOP" VALUE="false">'
  + '<PARAM NAME="QUALITY" VALUE="high">'
  + '<PARAM NAME="MENU" VALUE="false">'
  + '<PARAM NAME=bgcolor VALUE='+b+'>'
  + '<EMBED SRC="'+s+'" WIDTH="'+w+'" HEIGHT="'+h+'" PLAY="true" LOOP="false" QUALITY="high" MENU="false" BGCOLOR="'+b+'" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></EMBED>'
  + '<NOEMBED>' + alternateContent + '</NOEMBED></OBJECT>';

  if (hasRightVersion) {
    document.write(flashContent);
  } else {
    document.write(alternateContent);
  }
}
