var opendiv_bar;

function flexarea_show(part) {
	var flexcontent = $('extra').getElementsBySelector('[class="flexcontent"]');
	flexcontent.each(function (content) {
		var currentpart = content.id.replace("flexcontent-", "");
		if (part == currentpart) {
			$('flexhead-' + currentpart).addClassName('open');
			content.style.display = 'block';
		} else {
			$('flexhead-' + currentpart).removeClassName('open');
			content.style.display = 'none';
		}
	})
}

function zorgprogramma_on(zp) {
	zp.style.background = "url(/images/parnassia/zp_overview_over.gif)";
}

function zorgprogramma_off(zp) {
	zp.style.background = "url(/images/parnassia/zp_overview_normal.gif)";
}

function printpage() {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open('/print', '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=800, height=530');");
}

function zorgprogrammaitem_showhide(item) {

	var elementList = document.getElementsByClassName("headeractive");
	elementList.each(function(el) {
		$(el.id).removeClassName('headeractive');
		$(el.id).addClassName('headernonactive');
		var textbox = el.id;
		textbox = textbox.replace("_href", "");
		$(textbox).style.display = 'none';
	});

	if(!$(item + '_href').hasClassName('headeractive')) {
		$(item + '_href').addClassName('headeractive');
		$(item + '_href').removeClassName('headernonactive');
		$(item).style.display = 'block';
	} else {
		$(item + '_href').addClassName('headernonactive');
		$(item + '_href').removeClassName('headeractive');
		$(item).style.display = 'none';
	}
}

function mediaplayer_mute_unmute() {
	if (mplayer.is_muted()) {
		$('ico_mute').src = '/images/parnassia/mplayer/volume-onoff.gif';
	} else {
		$('ico_mute').src = '/images/parnassia/mplayer/mute.gif';
	}
	mplayer.mute_unmute();
}

function external_site_change(dropdown) {
	var site = dropdown.options[dropdown.selectedIndex].value;
	if (site != "") {
		window.location.href = site;
	}
}

function open_div(div, url) {
	if ($('voorziening_url') != undefined) {
		$('voorziening_url').removeClassName('active');
		$('voorziening_div').style.display = 'none';
	}

	if ($('foto_url') != undefined) {
		$('foto_url').removeClassName('active');
		$('foto_div').style.display = 'none';
	}

	if ($('film_url') != undefined) {
		$('film_url').removeClassName('active');
		$('film_div').style.display = 'none';
	}

	if ($('locatie_url') != undefined) {
		$('locatie_url').removeClassName('active');
		$('locatie_div').style.display = 'none';
	}

	if (opendiv_bar != div) {
		$(url).addClassName('active');
		$(div).style.display = 'block';
		opendiv_bar = div;
	} else {
		opendiv_bar = undefined;
	}
}

function loadexperience(xp_path) {
	new Ajax.Request('/Ajax?module=ParnassiaExperience&method=Get_Experience&xp_path=' + xp_path, {
		method:'get',
		onSuccess: function(transport){
			var json = transport.responseText.evalJSON();

			$('xp_intro').innerHTML = json.intro;
			$('xp_link').href = json.link;

			$('ervaar_container').innerHTML = "<div id=\"ervaar_parnassia\" onclick=\"location.href='"+json.link+"'\"><span></span></div>";

			$('xp_video1').src = (json.video1_image != undefined) ? json.video1_image :'/images/spcr.gif';
			$('xp_videolink1').href =  json.video1_link;

			$('xp_video2').src = (json.video2_image != undefined) ? json.video2_image :'/images/spcr.gif';
			$('xp_videolink2').href =  json.video2_link;

			$('xp_video3').src = (json.video3_image != undefined) ? json.video3_image :'/images/spcr.gif';
			$('xp_videolink3').href =  json.video3_link;

			$('xp_video4').src = (json.video4_image != undefined) ? json.video4_image :'/images/spcr.gif';
			$('xp_videolink4').href =  json.video4_link;

			// set backgroundimage
			if (json.bgimage != undefined) {
				$('main_content_home').style.backgroundImage="url('" + json.bgimage + "')";
			} else {
				$('main_content_home').style.backgroundImage="url('/images/spcr.gif')";
			}

			// change color of links (back to normal)
			var linkset = $$('li.xpselector');
			linkset.each(function(item) {
				item.style.color = 'white';
			});

			// set the link active
			$('xpcar_' + xp_path).style.color = '#839EB2';
		}
	});
}








