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++) { 
        var oFCKeditor = new FCKeditor( velden[x] ) ;
        oFCKeditor.BasePath = webadres + "jsf/fckeditor/" ;
        oFCKeditor.Height	= 350;
        oFCKeditor.Config['ToolbarStartExpanded'] = false ;								
        oFCKeditor.ReplaceTextarea();		
		}
	}
}

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

function parsepagina () {
	htmlarealaden ();	
	
	if (document.getElementById('scrollup')) {
	  box = document.getElementById('content');
		
		//alert(box.scrollHeight);
		//alert(box.offsetHeight);
		//alert(box.clientHeight);				
		
		if (box.scrollHeight > 430) {
		  document.getElementById('scrollup').style.display = 'block';
		  document.getElementById('scrolldown').style.display = 'block';			
		}
	}
}

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 berekentotaal (prijs1, prijs2, prijs3) {
  box1 = document.getElementById('totaalprijs');
	box2 = document.getElementById('galafeest');
	box3 = document.getElementById('galadiner');
	box4 = document.getElementById('galatafel');
	
	if (box2.value < 0 || !isNumeric(box2.value)) {
	  box2.value = 0;
	}
	
	if (box3.value < 0 || !isNumeric(box3.value)) {
	  box3.value = 0;
	}
	
	if (box4.value < 0 || !isNumeric(box4.value)) {
	  box4.value = 0;
	}	
	
	nieuwprijs = prijs1 * box2.value + prijs2 * box3.value + prijs3 * box4.value;
	
	box1.innerHTML = '&euro; ' + nieuwprijs;
}


function isNumeric(waarde)
{

for (x = 1;x <= 30;x++) {
  if (waarde == x) {
	  return true;
	}
}

return false;

}










function blendimage(divid, imageid, imagefile, millisec) { 
    var speed = Math.round(millisec / 100); 
    var timer = 0; 
     
    //set the current image as background 
    document.getElementById(divid).style.backgroundImage = "url(" + document.getElementById(imageid).src + ")"; 
     
    //make image transparent 
    changeOpac(0, imageid); 
     
    //make new image 
    document.getElementById(imageid).src = imagefile; 

    //fade in image 
    for(i = 0; i <= 100; i++) { 
        setTimeout("changeOpac(" + i + ",'" + imageid + "')",(timer * speed)); 
        timer++; 
    } 
} 

function changeOpac(opacity, id) { 
    var object = document.getElementById(id).style; 
    object.opacity = (opacity / 100); 
    object.MozOpacity = (opacity / 100); 
    object.KhtmlOpacity = (opacity / 100); 
    object.filter = "alpha(opacity=" + opacity + ")"; 
} 

function veranderFoto(src, nr, klik) {
  if (klik) {
  	fotoPause();	
	}
	
  blendimage('paginafoto', 'fotoinhoud', webadres + 'php/verwerk/bestanden.php?code=' + src, 1000);
	huidigefoto = nr;
}

function volgendeFoto() {
  huidigefoto++;
	
	if (huidigefoto > fotos.length) {
	  huidigefoto = 1;
	}
	
	veranderFoto(fotos[huidigefoto - 1], huidigefoto, 0);
}

function fotoPause() {
  clearInterval(fototimer);
}

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="salign" value="lt" /><param name="scale" value="noscale" /><param name="wmode" value="transparent"><param name="flashvars" value="' + flashvars + '"><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="' + src + '" /><param name="quality" value="high" /><param name="bgcolor" value="#ffffff" />');
   document.write('<embed src="' + src + '" flashvars="' + flashvars + '" salign="lt" scale="noscale" wmode="transparent" quality="high" bgcolor="#ffffff" width="' + width + '" height="' + height + '" id="' + id + '" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
   document.write('</object>');
}

function weergeefVideoSpeler() {
	var inhoud = '';
/*
  inhoud += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';
  inhoud += 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="430" height="460">';
  inhoud += '<param name="movie" value="' + webadres + 'swf/player/flvplayer_elite.swf?config=' + webadres + 'swf/player/skin/config.xml" />';
  inhoud += '<param name="quality" value="high" />';
  inhoud += '<param name="wmode" value="transparent" />';
  inhoud += '<param name="allowScriptAccess" value="always" />';
  inhoud += '<param name="allowFullScreen" value="true" />';		
  inhoud += '<param name="FlashVars" value="autoplay=true&flv=' + webadres + 'flv/video.flv" />';
  
  inhoud += '<embed src="' + webadres + 'swf/player/flvplayer_elite.swf?config=' + webadres + 'swf/player/skin/config.xml" quality="high" wmode="transparent" allowFullScreen="true" allowScriptAccess="always"';
  inhoud += 'pluginspage="http://www.macromedia.com/go/getflashplayer"';
  inhoud += 'FlashVars="autoplay=true&flv=' + webadres + 'flv/video.flv"';
  inhoud += 'type="application/x-shockwave-flash" width="100%" height="100%">';
  inhoud += '</embed></object>';
	//inhoud += '<a href="javascript:videoSluiten()">[ sluiten ]</a>';
*/

  inhoud = '<object id="MediaPlayer" width="480" height="459"  type="video/x-ms-wmv" data="mms://213.247.51.221/specials/kooktalk.wmv" >                          <param name="Filename" value="mms://213.247.51.221/specials/kooktalk.wmv" />                          <param name="AnimationAtStart" value="1" />                          <param name="TransparentAtStart" value="0" />                          <param name="ShowControls" value="1" />                          <param name="ShowDisplay" value="0" />                          <param name="ShowStatusbar" value="1" />                          <param name="InvokeURLS" value="0" />                          <param name="PlayCount" value="1" />                          <param name="BufferTime" value="10" />                          <param name="BGCOLOR" value="#000000" />                          <param name="AutoStart" value="1" />                          <param name="Autosize" value="1" />						  <param name="currentposition" value="0" />                      </object>';	
		
	document.write(inhoud);		
}

function weergeefVideoSpeler2() {
	var inhoud = '';

  inhoud += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';
  inhoud += 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="480" height="360">';
  inhoud += '<param name="movie" value="' + webadres + 'swf/player/flvplayer_elite.swf?config=' + webadres + 'swf/player/skin/config.xml" />';
  inhoud += '<param name="quality" value="high" />';
  inhoud += '<param name="wmode" value="transparent" />';
  inhoud += '<param name="allowScriptAccess" value="always" />';
  inhoud += '<param name="allowFullScreen" value="true" />';		
  inhoud += '<param name="FlashVars" value="autoplay=true&flv=' + webadres + 'flv/video-2.flv" />';
  
  inhoud += '<embed src="' + webadres + 'swf/player/flvplayer_elite.swf?config=' + webadres + 'swf/player/skin/config.xml" quality="high" wmode="transparent" allowFullScreen="true" allowScriptAccess="always"';
  inhoud += 'pluginspage="http://www.macromedia.com/go/getflashplayer"';
  inhoud += 'FlashVars="autoplay=true&flv=' + webadres + 'flv/video-2.flv"';
  inhoud += 'type="application/x-shockwave-flash" width="480" height="360">';
  inhoud += '</embed></object>';
	//inhoud += '<a href="javascript:videoSluiten()">[ sluiten ]</a>';


  //inhoud = '<object id="MediaPlayer" width="480" height="459"  type="video/x-ms-wmv" data="mms://213.247.51.221/specials/kooktalk.wmv" >                          <param name="Filename" value="mms://213.247.51.221/specials/kooktalk.wmv" />                          <param name="AnimationAtStart" value="1" />                          <param name="TransparentAtStart" value="0" />                          <param name="ShowControls" value="1" />                          <param name="ShowDisplay" value="0" />                          <param name="ShowStatusbar" value="1" />                          <param name="InvokeURLS" value="0" />                          <param name="PlayCount" value="1" />                          <param name="BufferTime" value="10" />                          <param name="BGCOLOR" value="#000000" />                          <param name="AutoStart" value="1" />                          <param name="Autosize" value="1" />						  <param name="currentposition" value="0" />                      </object>';	
		
	document.write(inhoud);		
}

function scroll_down () {
  box = document.getElementById('content');
	
	box.scrollTop = box.scrollTop + 1;
}

function scroll_up () {
  box = document.getElementById('content');
	
	box.scrollTop = box.scrollTop - 1;
}

function set_scroll_down (type) {
  if (type) {
	 down_timer = setInterval('scroll_down()', 5); 
	} else {
	 clearInterval(down_timer);
	}
}

function set_scroll_up (type) {
  if (type) {
	 up_timer = setInterval('scroll_up()', 5); 
	} else {
	 clearInterval(up_timer);
	}
}

function controleerAanmelding () {
  box = document.getElementById('voorwaarden');
	
	if (box.checked) {
	  return true;
	} else {
	  alert('U bent nog niet akkoord gegaan met de voorwaarden.');
		return false;
	}
}
