// javascript functions voor hanneke en wendy
// marco legemaate (cc) designserver 2008

var obj = { name: 'A nice demo' };

function menu(e) {
  var myE = Event.element(e);
  if (myE.ancestors()[0].tagName.toLowerCase() == 'a') {
	// niks doen bij mouseover als het plaatje al actief staat
	// check of documentnaam ongelijk is aan anker href
	if ( myE.ancestors()[0].href != document.location.href ) {
		if ( arguments[1] ) {
			myE.src = '/graphics/menu/'+myE.id+'_hit.gif';
		} else {
			myE.src = '/graphics/menu/'+myE.id+'.gif';
		}
	}
  }
  // var tag = Event.element(e).tagName.toLowerCase();
  // var data = $A(arguments);
  // data.shift();
  // alert(this.name + '\nClick on a ' + tag + '\nOther args: ' + data.join(', '));
}

function locatieklik (e) {
	var myE = Event.element(e);
	$$('.locatielink').invoke( 'setStyle', {color: '#8a8f43'} );
	$( myE.id ).setStyle( {color: 'white'} );
	myE.blur();
	$$('.locatie').invoke( 'hide' );
	$( myE.id + 'div').show();
	return false;
}

function sluitknopklik(e) {
	$$('.locatie').invoke( 'hide' );
	$$('.locatielink').invoke( 'setStyle', {color: 'white'} );
}

Event.observe(window, 'load', function() {
	Event.observe( $('menubalk') , 'mouseover', menu.bindAsEventListener('over', 1) );
	Event.observe( $('menubalk') , 'mouseout', menu.bindAsEventListener('out',0) );
	$$('a.locatielink').each(function(s) {
  		Event.observe( s , 'click', locatieklik.bindAsEventListener('out',0) );
		});
	$$('.sluitknop').each(function(s) {
  		Event.observe( s , 'click', sluitknopklik.bindAsEventListener('out',0) );
		});
});
