var editor = null;
var x      = 0;

function popUp(URL, breed, hoog) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=0,width=" + breed + ",height=" + hoog + ",left=150,top=150');");
}

function popUpcontent(name, inhoud, breed, hoog) {
  var generator=window.open(name,'popup','height=' + hoog + ',width=' + breed + 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,left=150,top=150');
  generator.document.write('<html><head><title>' + name + '</title><link rel="stylesheet" href="/css/site_popup.css" type="text/css"/></head><body>');
  generator.document.write(inhoud);
  generator.document.write('</body></html>');
  generator.document.close();
}

function htmlarealaden () {
	if (typeof (velden) == "object") {
		for (x=0; x < velden.length; x++) { 
			editor = new HTMLArea(velden[x]);
			editor.config.pageStyle = "@import url(" + webadres + "css/paginas/htmlarea.css);";
/*
	        editor.config.btnList["my-hilite"] =
	 	[ "Vraag invoegen", // tooltip
	 	  webadres + "jsf/htmlarea/images/ed_paste.gif", // image
	 	  "insertHTML('<div class=\"vraag\"></div>')", // action
		  false // disabled in text mode
	 	];
	    editor.config.toolbar.push(["linebreak", "my-hilite"]); // add the new button to the toolbar
		*/

			editor.generate();
		}
	}
}

function putfocus (formInst, elementInst) {
	if (document.forms.length > 0) {
		document.forms[formInst].elements[elementInst].focus();
		document.forms[formInst].elements[elementInst].select();
	}
}

function parsepagina () {
	htmlarealaden ();
}

window.onload = parsepagina;

function in_array(my_array,my_value){
	caseSensitive = in_array.arguments.length<3?0:in_array.arguments[2];

	for(i=0;i<my_array.length;i++){
		if((caseSensitive==0?my_array[i]:my_array[i].toUpperCase())==(caseSensitive==0?my_value:my_value.toUpperCase())){
			return true;
		}
	}

	return false;
}

function hasOptions(obj) {if (obj!=null && obj.options!=null) { return true; }	return false;}
function swapOptions(obj,i,j) {	var o = obj.options;	var i_selected = o[i].selected;	var j_selected = o[j].selected;	var temp = new Option(o[i].text, o[i].value, o[i].defaultSelected, o[i].selected);var temp2= new Option(o[j].text, o[j].value, o[j].defaultSelected, o[j].selected);	o[i] = temp2;o[j] = temp;o[i].selected = j_selected;o[j].selected = i_selected;}
function moveOptionUp(obj) {if (!hasOptions(obj)) { return; }	for (i=0; i<obj.options.length; i++) {if (obj.options[i].selected) {if (i != 0 && !obj.options[i-1].selected) { swapOptions(obj,i,i-1);	obj.options[i-1].selected = true;}}} volgordeclasses ();}
function moveOptionDown(obj) {if (!hasOptions(obj)) { return; }	for (i=obj.options.length-1; i>=0; i--) {if (obj.options[i].selected) {if (i != (obj.options.length-1) && ! obj.options[i+1].selected) { swapOptions(obj,i,i+1);	obj.options[i+1].selected = true; }}} volgordeclasses ();}
function submitForm(url, veld) { var	list = document.getElementById(veld); 	var velden = '';	for (i = 0; i <= list.options.length - 1; i++) { 	velden = velden + '_SPLIT_' + list.options[i].value;}	window.location.href = url + velden; }
function volgordeclasses () {
	list		= document.getElementById('volgorde');
	var	kleur	= 'nee';

	for (i = 0; i <= list.options.length - 1; i++) {
		if (kleur == 'ja') {
			list.options[i].className = 'een';
			kleur = 'nee';
		} else {
			list.options[i].className = 'twee';
			kleur = 'ja';
		}

		if (typeof(volgordetitel) == "object") {
			for (a=0;a < volgordetitel.length;a++) {
				if (volgordetitel[a] == list.options[i].value) {
						list.options[i].style.color = 'red';
				}
			}
		}
	}
}

function weergeefSWF(src, width, height, id, flashvars) {
   document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="' + width + '" height="' + height + '" id="' + id + '" align="middle">');
   document.write('<param name="wmode" value="transparent"><param name="flashvars" value="' + flashvars + '"><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="' + webadres + 'swf/' + src + '" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" />');
   document.write('<embed src="' + webadres + 'swf/' + src + '" flashvars="' + flashvars + '" quality="high" bgcolor="#ffffff" width="' + width + '" height="' + height + '" name="' + id + '" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
   document.write('</object>');
}

function swfMovie (movie) {
  document.write('<object type="application/x-shockwave-flash" data="' + webadres + 'flv/flvplayer.swf" width="450" height="337"><param name="movie" value="' + webadres + 'flv/flvplayer.swf"><param name="flashvars" value="file=' + movie + '"></object>');
}

function zichtbaar(box) {
  box = document.getElementById(box);
	
	if (box.style.display == 'block') {
	  box.style.display = 'none';
	} else {
	  box.style.display = 'block';
	}
}
