window.addEvent('domready', function() {	
	
	if ($('home')) {
		var imgs = $('column_three').getElements('div');
		for (i = 0; i<imgs.length; i++) {
			imgs[i].addEvents({
				'mouseenter': function() {
					this.style.zIndex = '5';
					this.morph({
						'height': '140px',
						'margin-top': '0px',
						'margin-bottom': '0px'
					});
				},
				'mouseleave': function() {
					tmp = this.id.split('_');
					boven = (parseInt(tmp[1]) - 1) * 50;
					onder = 150 - boven;
					this.morph({
						'height': '40px',
						'margin-top': boven+'px',
						'margin-bottom': onder+'px'
					});
					setTimeout("$(tmp[0]+'_'+tmp[1]).style.zIndex = tmp[1]", 400);
				}
			});

		}
	} else if ($('kenmerken')) {
		
		var current = 1;
		
		var li = $('column_one').getElementsByTagName('li');
		for (i = 0; i<li.length; i++) {
			$(li[i].id).addEvent('mouseenter', function() {
					tmp = this.id.split('_');
					$('feature_'+current).className = '';
					this.className = 'active';
					$('tekst_'+current).setStyle('display', 'none');
					$('tekst_'+tmp[1]).setStyle('display', 'block');
					current = tmp[1];
				}
			);
		}
	} else if ($('portfolio')) {
		
		var kolommen = Math.ceil($$('div.site').length / 3);
		var cur = 1;
		
		function slideFolio(dir) {
			/*var tmp = col.split('_');
			col = parseInt(tmp[1]);*/
			
			if (dir == 'prev') {
				if (cur > 1) {
					col = cur - 1;
				} else {
					return false;
				}
			} else if (dir == 'next') {
				if (cur < kolommen) {
					col = cur + 1;
				} else {
					return false;
				}
			}
			
			var x = ((col-1) * -660)
			var folioChange = new Fx.Tween('folio', {duration:1000});
			folioChange.start('left', x);
			cur = col;
			
			return false;
		}
			
		/*var lijst = new Element('ul', {'class': 'nummers'});
		for (i=1; i <= kolommen; i++) {
			var li = new Element('li');
			new Element('a', {'id': 'trigger_'+i, 'events': { 'click': function() { slideFolio(this.id); } } }).set('text', i).inject(li);
			li.inject(lijst);
		}
		lijst.inject('column_one');
		$('trigger_1').addClass('current');*/
		$('prev').addEvent('click', function() { slideFolio('prev'); });
		$('next').addEvent('click', function() { slideFolio('next'); });
	}
	
	var sitemap_slide = new Fx.Slide('inline_sitemap').hide();
	$('inline_sitemap').setStyle('display','block');
	$('tools_sitemap').addEvent('click', function () { sitemap_slide.toggle(); return false; });
	
});
