// JavaScript Document
var pag='home';





// GLOBALS
var artikelnr = new Array();
var bekeken = new Array();

window.addEvent('domready', function(){
	initvideomore();
	inithovers();
	});

window.addEvent('load', function(){
	slideshow = new SlideShow('head', 'getSlidesHome.php');
	$('meerschouwblog').setStyle('display' ,'block');
	});

// BEKEKEN
/*
function get_bekeken () {
	str_bekeken = Cookie.read('bekeken');
	if (str_bekeken) {
		bekeken = str_bekeken.split(',');
		}
	artikelkoppen = $('nieuws').getElements('.titel')
	for (i=0; i<artikelkoppen.length; i++) {
		artikelnr[i] = artikelkoppen[i].id;
		}
	for (i=0; i<bekeken.length; i++) {
		nummer = bekeken[i];
		if (!artikelnr.contains(nummer)) bekeken.remove(nummer);
		}
}


window.addEvent('domready', function(){
	//get_bekeken();
	var artikelkoppen = $$('#nieuws .titel');
	for (var i=0; i<artikelkoppen.length; i++) {
		if (bekeken.contains(''+artikelkoppen[i].id))  artikelkoppen[i].getElements('a').setStyle('color', '#666');
		artikelkoppen[i].addEvent('click', function(e){
			new Event(e).stop();
			toonNieuws(this.id);
			if (!bekeken.contains(this.id)) {
				var data = {item: this.getElements('a').innerHTML, soort_item:'nieuws'};
				var url = "log.php";
				//new Ajax(url, {method: 'post', data: data}).request();
				bekeken.include(this.id);
				}
			this.getElements('a').setStyle('color', '#666');
			});
		}
});

window.addEvent('unload', function(){
	//Cookie.write('bekeken', bekeken, {duration: 100})
	});
*/



function initvideomore() {
	var slideschouwblog = new Fx.Slide('meerschouwblog').hide();
	if ($('togglemeerschouwblog')) $('togglemeerschouwblog').addEvent('click', function(){slideschouwblog.toggle()});
}

function inithovers() {
	// binnenkort
	$(document.body).getElements('.vrstitem').addEvent('mouseenter', function() {
		this.morph({'background-color': '#CCC'});
		this.getElement('h2').morph({'color': '#A01'});
		//this.setStyle('backgroundImage', 'url(../images/pijltjerechts.png)');
		})
	$(document.body).getElements('.vrstitem').addEvent('mouseleave', function() {
		this.morph({'background-color': '#060606'});
		this.getElement('h2').morph({'color': '#FFF'});
		//this.setStyle('backgroundImage', 'none');
		})
	$(document.body).getElements('.blok').addEvent('click', function() {
		window.location.href = this.getElement('a').getProperty('href');
		})
	
	// nieuws
	$(document.body).getElements('.nieuws .item').addEvent('mouseenter', function() {
		//this.setStyle('backgroundImage', 'url(../images/pijltjerechts.png)');
		this.morph({'background-color': '#EEE'});
		this.getElement('.kort').morph({'color': '#111'});
		})
	$(document.body).getElements('.nieuws .item').addEvent('mouseleave', function() {
		//this.setStyle('backgroundImage', 'none');
		this.morph({'background-color': '#FFF'});
		this.getElement('.kort').morph({'color': '#555'});
		})
	$(document.body).getElements('.nieuws .item').addEvent('click', function(e) {
		e.stop();
		//window.location.href = this.getElement('a').getProperty('href');
		toonNieuws(this.id);
		})
	
	// video
	$(document.body).getElements('#video .item').addEvent('mouseenter', function() {
		this.morph({'background-color': '#ACF'});
		//this.getElement('a').morph({'color': '#000'});
		})
	$(document.body).getElements('#video .item').addEvent('mouseleave', function() {
		//this.morph({'background-color': '#E0EBFF'});
		this.morph({'background-color': '#E8F0FF'});
		//this.getElement('a').morph({'color': '#05A'});
		})
	$(document.body).getElements('#video .item').addEvent('click', function(e) {
		e.stop();										
		window.location.href = this.getElement('a').getProperty('href');
		})
	$(document.body).getElements('#video .meer').addEvent('mouseenter', function() {
		this.morph({'background-color': '#ACF'});
		})
	$(document.body).getElements('#video .meer').addEvent('mouseleave', function() {
		this.morph({'background-color': '#E0EBFF'});
		})
	
	// wijzigingen
	$('wijzigingen').addEvent('click', function(e) {
		e.stop();
		toonNieuws('n320');
		})
	
	$('wijzigingen').addEvent('mouseenter', function(e) {
		this.morph({'background-color': '#FFF'});
		})
	$('wijzigingen').addEvent('mouseleave', function(e) {
		this.morph({'background-color': '#F0F0F0'});
		})
		
	// socialmedia
	$(document.body).getElements('#socialmedia img').addEvent('mouseenter', function() {
		this.morph({'width': '32', 'height': '32'});
		})
	$(document.body).getElements('#socialmedia img').addEvent('mouseleave', function() {
		this.morph({'width': '26', 'height': '26'});
		})

}



/*

// THEATERMAIL
window.addEvent('domready', function(){
	$('email').addEvent('keypress', function(e) {
		//e = new Event(e).stop();
		//if (e.key == 'enter') $('TMailaanmelden').fireEvent('click');
		});
	$('TMailaanmelden').addEvent('click', function(e) {
		e = new Event(e).stop();
		var atpos = $('email').value.indexOf("@");
		var dotpos = $('email').value.lastIndexOf(".");
		if (atpos<1 || dotpos-atpos<2) {
			$('aanmeldresultaat').set('html', 'Vul hieronder uw e-mailadres in.');
			}
		else {
			new Request.HTML({'url':'aanmelden.php', update: $('aanmeldresultaat')}).get({'adres':$('email').value});
			}
		});
	$('email').addEvent('click', function(e) {
		e = new Event(e).stop();
		if ($('email').value == 'uw e-mailadres') $('email').value = '';
		});
	});



// THEATERMAGAZINE
window.addEvent('domready', function(){
	$('TMagaanvragen').addEvent('click', function(e) {
		e = new Event(e).stop();
		if ( ($('tmagemail').value == '') || ($('tmagnaam').value == '') ) {
			$('TMagtekst').set('html', "<span style='color:#C00; font-weight:bold'>Vul hieronder uw gegevens in.</span>");
			}
		else {
			new Request.HTML({'url':'TMagaanvragen.php', update: $('TMagform')}).get({'email':$('tmagemail').value, 'naam':$('tmagnaam').value, 'straat':$('tmagstraat').value, 'plaats':$('tmagplaats').value});
			}
		});
	});

*/