//--- Zoek object op ID -------------------------------------------------------
function getElement(id) {
	return (document.getElementById) ? document.getElementById(id) : document.all[id];
}


//--- Bepaal de hoogte van een object -----------------------------------------
function getHeight(object) {
	if (object) {
		if (object.clientHeight) {
			return parseInt(object.clientHeight);
		}else if (window.getComputedStyle(object,null).getPropertyValue('height')) {
			return parseInt(window.getComputedStyle(object,null).getPropertyValue('height')) + parseInt(window.getComputedStyle(object,null).getPropertyValue('padding-top')) + parseInt(window.getComputedStyle(object,null).getPropertyValue('padding-bottom'));
		}else{
			return 0;
		}
	}
}

//--- Verwijder spaties uit een text input ------------------------------------
function trim(veld) {
	if (veld.type == "text") {
		var expression = new RegExp(/^\s*|\s*$/g);
		veld.value = veld.value.replace(expression, "");
	}
}

//--- Controleer welke checkboxes zijn geselecteerd ---------------------------
function checkboxValideren(object) {
	var my_waarden = new Array();
	var my_waarden_idx = 0;
	if (object) {
		if (object.length) {
			for (var idx=0; idx < object.length; idx++) {
				if (object[idx].checked) {
					my_waarden[my_waarden_idx] = object[idx].value;
					my_waarden_idx++;
				}
			}
		} else if (object.checked) {
			my_waarden[my_waarden_idx] = object.value;
		}
	}

	return my_waarden;
}

//--- Controleer welke radio button is geselecteerd ---------------------------
function radioValideren(object) {
	my_waarde = false;
	if (object) {
		if (object.length) {
			for (var idx=0; idx < object.length; idx++) {
				if (object[idx].checked) {
					my_waarde = object[idx].value;
					break;
				}
			}
		} else if (object.checked) {
			my_waarde = object.value;
		}
	}

	return my_waarde;
}

//---[ Bepaal de offet voor een nieuw window ]---------------------------------
function getOffset() {
	var offset = new Array();
	offset['x'] = 0;
	offset['y'] = 0;
	if (window.innerHeight) {
		status_height = (window.statusbar.visible) ? 25 : 0;
		offset['y'] = offset['y'] + (window.outerHeight - status_height - window.innerHeight);
	}
	//--- [ Netscape/FireFox ]]------------------------------------------------
	if (window.screenX != null) {
		offset['x'] = offset['x'] + (parent) ? parent.screenX : screenX;
		offset['y'] = offset['y'] + (parent) ? parent.screenY : screenY;
	//--- [ Internet Explorer ]------------------------------------------------
	}else if (window.screenLeft != null) {
		offset['x'] = offset['x'] + (parent) ? parent.screenLeft + 2 : screenLeft + 2 ;
		offset['y'] = offset['y'] + (parent) ? parent.screenTop + 2 : screenTop + 2;
	}
	return offset;
}

//---[ Open een nieuw window ]-------------------------------------------------
function openWindow(url, myHeight, myWidth, scroll) {
	offset = getOffset();
	var n_window = window.open("", "mywindow", "resizable=yes,scrollbars=" + scroll + ",status=0,menubar=no,left=" + offset['x'] + ",top=" + offset['y'] + ",height=" + myHeight + ",width=" + myWidth);
	if (n_window) {
		n_window.resizeTo(myWidth, myHeight);
		if (url != "") { n_window.location = url; }
		if (n_window.focus) { n_window.focus(); }
	}
}

//---[ Pas de grootte van het windows aan ]------------------------------------
function resizeWindow() {
	var myContainer = getElement("container")
	if (myContainer != null) {
		var margin = 0;
		var myHeight = myContainer.offsetHeight;
		var winHeight = document.body.clientHeight;
		if (document.body.currentStyle) {
			margin = parseInt(document.body.currentStyle.marginTop) + parseInt(document.body.currentStyle.marginBottom)
		} else if (window.getComputedStyle) {
			margin = parseInt(window.getComputedStyle(document.body, null).getPropertyValue("margin-top")) + parseInt(window.getComputedStyle(document.body, null).getPropertyValue("margin-bottom"))
		}
		window.resizeBy(0, myHeight - winHeight + margin);
	}
}

//--- Maak een AJAX request ---------------------------------------------------
function createRequest() {
	var request = false;
	try {
		request = new XMLHttpRequest();
	} catch (microsoft1) {
		try {
			request = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (microsoft2) {
			try {
				request = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (failed) {
				request = false;
			}
		}
	}
	return request;
}

//--- Insert a flash movie ----------------------------------------------------
function insertSWF(flashname, width, height) {
//	if (navigator.userAgent.indexOf("Firefox") > -1) {
//		document.write('<embed src="/films/' + flashname + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'"></embed>\n');
//	} else {
	
		//document.write('<object id="Object1" type="application/x-shockwave-flash" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" data="/films/player_flv_mini.swf" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+width+'" height="'+height+'">\n');
		//document.write('<param name="movie" value="/films/player_flv_mini.swf">\n');
		//document.write('<param name="wmmode" value="opaque">\n');
		//document.write('<param name="allowScriptAccess" value="sameDomain">\n');
		//document.write('<param name="quality" value="high">\n');
		//document.write('<param name="menu" value="true">\n');
		//document.write('<param name="autoplay" value="false">\n');
		//document.write('<param name="autoload" value="false">\n');
		//document.write('<param name="FlashVars" value="flv='+flashname+'&width='+width+'&height='+height+'&autoplay=0&autoload=0&buffer=5&playercolor=3d60a5 &loadingcolor=bbbbbb&buttoncolor=ffffff&slidercolor=ffffff">\n');

		////document.write('<embed src="/images/logos/' + flashname + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="216" height="56"></embed>\n');
		//document.write('</object>\n');
		
document.write('<object id="Object1" type="application/x-shockwave-flash" data="/films/player_flv_maxi.swf" width="420" height="236">');
//document.write('<a href="http://www.dvdvideosoft.com/products/dvd/Free-YouTube-to-MP3-Converter.htm">mp3 download</a></noscript>');
document.write('<param name="movie" value="/films/player_flv_maxi.swf" />');
document.write('<param name="wmode" value="opaque" />');
document.write('<param name="allowScriptAccess" value="sameDomain" />');
document.write('<param name="quality" value="high" />');
document.write('<param name="menu" value="true" />');
document.write('<param name="autoplay" value="true" />');
document.write('<param name="autoload" value="false" />');
document.write('<param name="FlashVars" value="configxml=/films/' + flashname + '.xml" />');
document.write('</object>');
//	}

}
