window.addEvent('domready', function() {


	var Nieuws = new Fx.Slide('meer-nieuws');
	Nieuws.hide();
	
	$$('.nieuws-archief').addEvent('click', function(e){
		e = new Event(e);
		Nieuws.toggle();
		e.stop();
	});
	
 	var list = $$('input.beweeg');
 	
	list.each(function(e) {
		e.addEvent('focus', function(){
			var fx = new Fx.Styles(e, {duration:400, wait:false});
	
			fx.start({
			'background-color': '#F4DFAE',
			'width': '100px'
			});

		});
		e.addEvent('blur', function(){
		var fx = new Fx.Styles(e, {duration:400, wait:false});
	
		fx.start({
			'background-color': '#EFE2C2',
			'width': '30px'
		});
	
		});
	});


	var accordion = new Accordion('h2.atStart', 'div.atStart', {
		opacity: false,
		onActive: function(toggler, element){
			toggler.setStyle('color', '#fff');
			toggler.setStyle('background', '#1072D4 url(images/box-content-repeat.gif) repeat-x');
			toggler.setStyle('font-weight', 'bold');
		},
	 
		onBackground: function(toggler, element){
			toggler.setStyle('color', '#fff');
			toggler.setStyle('background', '#3E89A8');
			toggler.setStyle('font-weight', 'normal');
		}
	}, $('accordion'));
	
		
		
	var TipsFade = new Tips($$('.portfolio-tip'), {
	initialize:function(){
		this.fx = new Fx.Style(this.toolTip, 'opacity', {duration: 500, wait: false}).set(0);
	},
	onShow: function(toolTip) {
		this.fx.start(1);
	},
	onHide: function(toolTip) {
		this.fx.start(0);
	}
});

	
});

function load(url, update) {
	update = $(update);
	
	fadeIn(update, 0,7);
	var myAjax = new Ajax(url, {update: $(update)}, {method: 'get'});
	myAjax.request();
	
}
 	


function fade(el, time, fadeIn, complete) {
	fadeIn = fadeIn ? true : false;
	time = time ? time * 1000 : 500;
	fullOpacity = (/Gecko/.test(navigator.userAgent) || /Konqueror|Safari|KHTML/.test(navigator.userAgent)) ?
	0.999999 : 1;
	el = $(el);
	
	if (complete) {
		var fdr = new Fx.Style(el, 'opacity', {onComplete: complete, duration: time});
	} else {
		var fdr = new Fx.Style(el, 'opacity', {duration: time});
	}
	if (fadeIn == true) {
		el.style.visibility = 'hidden';
		el.style.display = '';
		fdr.custom(0,fullOpacity);
	}else {
		fdr.custom(fullOpacity,0);
	}
}
function fadeOut(el, fadeTimeInSeconds, onComplete) {
	fade(el, fadeTimeInSeconds, false, onComplete);
}
function fadeIn(el, fadeTimeInSeconds) {
	fade(el, fadeTimeInSeconds, true);
}
