
window.addEvent('domready', function() {
	if ($('nederland')) {
		$('nederland').addEvent('mouseover:relay(area.MOarea)', function(e, a) {
		    e.stop();
		    $('provincienaam').set('html', a.get('alt'));
		    $('provincienaam').show();
		});
	
		$('nederland').addEvent('mouseout:relay(area.MOarea)', function(e, a) {
	        e.stop();
	        $('provincienaam').hide();
		});
	}
	
	if ($('homezoektekst')) {
		$('homezoektekst').addEvent('focus', function() {
			this.set('value', '');
		});
		$('homezoektekst').addEvent('blur', function() {
			if (this.get('value') == '') {
				this.set('value', 'Bijv. bedrijfsnaam, plaats...');
			}
		});
		
	}
	
	// thumbnails bij projecten die big_image EN popup vervangen
	if ($('popup')) {
        $('popup').addEvent('click', function() {
            this.toggle();
        });

        if ($('project_icons')) {
	        $('project_icons').addEvent('click:relay(a)', function(e, a) {
	            e.stop();
	
	            //var small = a.getElement('IMG').get('src').replace('/icons/', '/thumbs/');
	            var big = $(a.get('rel')).get('src'); 
	            $('big_image').set('src', big);
	            
	            // change classes
	            $$('#project_icons a').each(function(item){
	                item.removeClass('current');
	            });
	            a.addClass('current');
	        });
		}
        
        $('big_image').addEvent('click', function() {
        	var superbig = this.get('src').replace('/thumbs/', '/');
        	$('Bgroot').set('src', superbig);
        	if ($('Bgroot').width > 800) {
        		$('Bgroot').setStyle('width', 800);
        	}
            $('popup').show();
        });
    }
	
});
