var editor = null;
var x      = 0;
var headerfotos = new Array;
var headernr = 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 setOpacity(obj, value) {
	obj.style.opacity = value/10;
	obj.style.filter = 'alpha(opacity=' + value + ')';
}

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 = "/jsf/fckeditor/" ;
        oFCKeditor.Height	= 350;
        oFCKeditor.Config['ToolbarStartExpanded'] = true ;								
        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 (isset('texts')) {
	  fade();
	}
	*/
	
	if (headerfotos.length) {
	  setInterval('headerFoto()', 5000);
	}	
}
function isset(variable_name)
{
try
{
if (typeof(eval(variable_name)) != 'undefined')
if (eval(variable_name) != null)
return true;
} catch(e) { }

return false;
}



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 submenu_open (nr) {
  if (document.getElementById('submenu_' + nr)) {
  	box = document.getElementById('submenu_' + nr);
  	box.style.display = 'block';
  	box.style.width   = document.getElementById('topitem_' + nr).offsetWidth + 1;
  }

	document.getElementById('topimg_' + nr + 'a').style.display = 'none';
	document.getElementById('topimg_' + nr + 'b').style.display = 'block';
}

function submenu_sluit (nr) {
  if (document.getElementById('submenu_' + nr)) {
	  box = document.getElementById('submenu_' + nr);
	  box.style.display = 'none';
  }

	document.getElementById('topimg_' + nr + 'b').style.display = 'none';
	document.getElementById('topimg_' + nr + 'a').style.display = 'block';
}

function weergeefSWF(src, width, height) {
		document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="' + width + '" height="' + height + '">');
		document.write('  <param name="movie" value="' + src + '">');
		document.write('  <param name=quality value=high>');
		document.write('  <param name="allowScriptAccess" value="always" />');
		document.write('  <param name="wmode" value="transparent" /><param name="SCALE" value="exactfit">');
		document.write('  <embed wmode="transparent" src="' + src + '" width="' + width + '" height="' + height + '" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" scale="exactfit"></embed>');
		document.write('</object>');
}

function weergeefLogo() {
		document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="169" height="107">');
		document.write('  <param name="movie" value="' + webadres + '/swf/logo.swf">');
		document.write('  <param name=quality value=high>');
		document.write('  <param name="allowScriptAccess" value="always" />');
		document.write('  <param name="wmode" value="transparent" /><param name="SCALE" value="exactfit">');
		document.write('  <embed wmode="transparent" src="' + webadres + 'img/design/logo.swf" width="169" height="107" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" scale="exactfit"></embed>');
		document.write('</object>');
}

function weergeefLandkaart() {
		document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="205" height="286">');
		document.write('   <param name="movie" value="/swf/kaart.swf">');
		document.write('   <param name="quality" value="high">');
		document.write('  <param name="wmode" value="transparent" />');		
		document.write('   <embed wmode="transparent" src="/swf/kaart.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="205" height="286"></embed>');
		document.write('</object>');
}

function advertentieFotos(fotos) {
		document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="300" height="200" align="right" style="margin: 5px">');
		document.write('  <param name="movie" value="' + webadres + 'swf/fotos.swf">');
		document.write('  <param name=quality value=high>');
		document.write('  <param name="allowScriptAccess" value="always" />');
		document.write('  <param name="wmode" value="transparent" /><param name="SCALE" value="exactfit">');
		document.write('  <param name="FlashVars" value="fotos=' + fotos + '">');
		document.write('  <embed wmode="transparent" flashvars="fotos=' + fotos + '" src="' + webadres + 'swf/fotos.swf" width="300" height="200" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" scale="exactfit"></embed>');
		document.write('</object>');
}

function weergeefVideos(park_id) {
		document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="635" height="331">');
		document.write('          <param name="movie" value="' + webadres + 'videos/list.swf?park=' + park_id + '">');
		document.write('          <param name="quality" value="high">');
		document.write('          <embed src="' + webadres + 'videos/list.swf?park=' + park_id + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="635" height="331"></embed>');
		document.write('        </object>');
}

function naarPark(url) {
  if (url) {
	  document.location.href = url;
	}
}

function openSubmenu(nr) {
  box = document.getElementById('submenu_' + nr);
	box.style.display = 'block';
}

function sluitSubmenu(nr) {
  box = document.getElementById('submenu_' + nr);
	box.style.display = 'none';
}

function controleerNieuwsbrief() {
  box1 = document.getElementById('nieuwsbrief_naam');
  box2 = document.getElementById('nieuwsbrief_email');
	
	if (!box1.value || box1.value == 'Naam') {
	  alert ('Er is geen naam ingevuld.');
	} else if (!box2.value || box2.value == 'E-mail adres') {
	  alert ('Er is geen e-mail adres ingevuld.');
	} else {
	  return true;
	}
	
	return false;	
}

function controleerActieAanmelden() {
  box1 = document.getElementById('actie_naam');
  box2 = document.getElementById('actie_email');
  box3 = document.getElementById('actie_telefoon');
	
	if (!box1.value || !box2.value || !box3.value) {
	  alert('Niet alle velden zijn ingevuld.');
		return false;
	} else {
	  return true;
	}
}

function controleerReactie() {
  box1 = document.getElementById('reageer_naam');
  box2 = document.getElementById('reageer_email');
  box3 = document.getElementById('reageer_titel');
  box4 = document.getElementById('reageer_inhoud');	
	
	if (!box1.value || !box2.value || !box3.value || !box4.value) {
	  alert('Niet alle velden zijn ingevuld.');
		return false;
	} else {
	  return true;
	}
}

function weergeefReserveren() {
		document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="207" height="35">');
		document.write('   <param name="movie" value="/swf/boeknu.swf">');
		document.write('   <param name="quality" value="high">');
		document.write('  <param name="wmode" value="transparent" />');		
		document.write('   <embed wmode="transparent" src="/swf/boeknu.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="207" height="35"></embed>');
		document.write('</object>');
}

function headerFoto() {
  headernr++;

	if (headernr >= headerfotos.length) {
	  headernr = 0;
	}
	
  blendimage('fader', 'headerfoto', '/php/verwerk/bestanden.php?code=' + headerfotos[headernr], 1000);
}

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('foto', 'fotoinhoud', '/php/verwerk/bestanden.php?code=' + src, 1000);
	huidigefoto = nr;
}