///// Flash 8 detectie.

function flashDetect(){

	///// Flash 8 detectie.
	var flashversie = -1;

	if(typeof window.ActiveXObject != 'undefined' && navigator.platform.indexOf('Win') != -1){

		try{

			var flash_obj = new ActiveXObject('ShockwaveFlash.ShockwaveFlash.8');
			flashversie = 8;

		} catch (e){

			flashversie = -1;
		}

		flash_obj = null;

	} else {
		if(navigator.plugins){

			var flash_obj = navigator.plugins['Shockwave Flash'];

			if (flash_obj && typeof flash_obj.description == 'string'){

				var versienummer = flash_obj.description.match( /([0-9]+)/ );
				flashversie = versienummer? parseInt(versienummer[0]): flashversie;
			}
		}
	}

	return flashversie;
}

///// Sluiten popup en herladen opener.

function schrijfObject(movie_name,flash_width,flash_height,flashcontainer,flash_vars,flash_id,flash_name){

//	if(flash_vars == null || flash_vars == 'undefined' || flash_vars == "0") {
//		var flash_vars = "player_flashvars=http://www.rtl.nl|rtlnieuws_flashvars|http://www.rtl.nl/(/actueel/rtlnieuws/services/articleview/)/components/actueel/rtlnieuws/site_breed/service/nieuwsminuut_player_uitleg.xml";
//	}

    if(!flash_id || flash_id == ''){
     flash_id = "new_id" + Math.floor(Math.random() * 10000);
    }

    if(!flash_name || flash_name == ''){
     flash_name = "new_id" + Math.floor(Math.random() * 10000);
    }

	if(flashDetect() >= 8){

		document.getElementById(flashcontainer).innerHTML =
				'<obj'+'ect classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="' + flash_width + '" height="' + flash_height + '" id="' + flash_id + '" align="middle">' +
				'<par'+'am name="allowScriptAccess" value="always" />' +
				'<par'+'am name="movie" value="' + movie_name + '" />' +
				'<par'+'am name="quality" value="high" />' +
				'<par'+'am name="wmode" value="transparent" />' +
				'<par'+'am name="bgcolor" value="#ffffff" />' +
				'<par'+'am name="flashvars" value="' + flash_vars + '" />' +
				'<emb'+'ed sr'+'c="' + movie_name + '" quality="high" bgcolor="#ffffff" flashvars="' + flash_vars + '" width="' + flash_width + '" height="' + flash_height + '" id="' + flash_name + '"  align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="transparent" />' +
				'<\/obj'+'ect>';
	} else {

		if(flash_width > 200) {
               		document.getElementById(flashcontainer).innerHTML =
				'<h2'+' style="font-family: Verdana, Arial; font-weight: bold; color: #FFF; margin: 5px;">Wij hebben niet kunnen detecteren of u over de Flash 8 player beschikt.<\/h2>' +
				'<p'+' style="font-family: Verdana, Arial; font-weight: bold; font-size: 11px; color: #FFF; margin: 5px; margin-top: 8px;">' +
				'U kunt de nieuwste Flash player downloaden bij <a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" target="_blank" style="color: #E74C01; font-weight:bold;">Adobe<\/a>.' +
				'<\/p>';
                } else {
       		        document.getElementById(flashcontainer).innerHTML =
				'<p'+' style="font-family: Verdana, Arial; font-weight: bold; font-size: 11px; color: #000; margin: 5px; margin-top: 8px;">' +
				'Geen Flash-plugin gevonden' +
				'<\/p>';
		}
	}
}