function checkBoxes()
{
	var checkboxes = $$('.checkbox');
	
	checkboxes.each(function(el, i) {
		$(el).observe('click', function(e){
			$(el).addClassName('checked');
			$(el).down('input').value = 1;
			checkboxes.each(function(other, j) {
				 if(j != i)
				 {
					 $(other).removeClassName('checked');
					 $(other).down('input').value = 0;
				 }
			 });
		});
	});
}
Event.observe(window, 'load', checkBoxes);


function choiceBoxes()
{
	var choiceboxes = $$('.choice');
	
	choiceboxes.each(function(el, i) {
		$(el).observe('click', function(e){
			if($(el).hasClassName('checked'))
			{
				$(el).removeClassName('checked');
				$(el).down('input').value = 0;
			}
			else
			{
				$(el).addClassName('checked');
				$(el).down('input').value = 1;
			}
		});
	});
}
Event.observe(window, 'load', choiceBoxes);

var bSlider = true; 
function choiceBoxesSlide()
{
	var choiceboxes = $$('.choiceslide');
	var extra_inputs = $$('.anders');
	
	choiceboxes.each(function(el, i) {
		$(el).observe('click', function(e){
			if($(el).hasClassName('checked'))
			{
				if(bSlider) {
					$(el).removeClassName('checked');
					$(el).down('input').value = 0;
					
					extra_inputs.each(function(el,i){
						$(el).removeClassName('label');						   
					});
					
					new Effect.SlideUp($(el).id+'content', { 
						beforeStart : function() { 
							bSlider = false; 
						}, 
						duration: 0.5,
						afterFinish : function() { 
							bSlider = true;
						}
					});
				}
			}
			else
			{
				if(bSlider) {
					$(el).addClassName('checked');
					$(el).down('input').value = 1;
					
					extra_inputs.each(function(el,i){
						$(el).addClassName('label');						   
					});
					
					new Effect.SlideDown($(el).id+'content', { 
						beforeStart : function() { 
							bSlider = false; 
						}, 
						duration: 0.5,
						afterFinish : function() { 
							bSlider = true;
						}				
					});
				}
			}
		});
	});
}
Event.observe(window, 'load', choiceBoxesSlide);

var active_tab = 'laatste_nieuws';

function tab(id,zindex) {
	
	if(active_tab != id) {
		
		// tab aanpassen
		$(active_tab).className = 'subtab';	
		$(active_tab).style.zIndex = zindex;	
		$(id).className = 'subtab_active';
		$(id).style.zIndex = 70;
		
		// content aanpassen
		$(active_tab+'_content').style.display = 'none';
		$(id+'_content').style.display = 'block';
		active_tab = id; 
	}
	
}

/*	SLIDER

Hieronder staan alle parameters beschreven voor de slider:

parameter 1 = id van het slider frame
parameter 2 = aantal items
parameter 3 = breedte / hoogte per item
parameter 4 = id van de knop vorige
parameter 5 = id van de knop volgende
parameter 6 = items sliden per klik
parameter 7 = aantal items zichtbaar
parameter 8 = x of y as voor horizontaal of verticaal scrollen

*/	

var bSlide	  = true;
var sHuidig	  = 1;
var clsSlider = function(frame, items, width, prev, next, slide, views, as, time) {
	
	this.initialiseer = function() {
		width = parseInt(width);
		items = parseInt(items);
		slide = parseInt(slide);
		views = parseInt(views);
		time  = 0.1;
		x_yas = as;
		$(frame).style.width = ((width * items) + 5) + 'px';
		this.size = (x_yas == 'y' ? parseInt(($(frame).style.top != '' ? $(frame).style.top : 0)) : parseInt(($(frame).style.left != '' ? $(frame).style.left : 0)));
		this.mngButton(0);
	}
	
	this.mngButton = function(timeout) {
		setTimeout(function() {
			this.size = (x_yas == 'y' ? parseInt(($(frame).style.top != '' ? $(frame).style.top : 0)) : parseInt(($(frame).style.left != '' ? $(frame).style.left : 0)));;
			this.size += (items <= views ? 0 : (items * width));
			bSlide = true;
		}, timeout);
	}
	
	this.move = function(direction) {
		if(direction == 'next') {
			position = -(width * slide);
		} else if(direction == 'prev') {
			position = (width * slide);
		}
		if(bSlide) {
			new Effect.MoveBy(frame, 
			(x_yas == 'y' ? position : 0), 
			(x_yas == 'x' ? position : 0), { 
				duration: (slide * time), 
				beforeStart: function() { 
					bSlide = false 
					
					if(direction == 'next') {
						
						$(next+'_layer').show();
						$(next+'_button').src = 'images/template/btn_down_inactive.gif';
						$(prev+'_layer').hide();
						$(prev+'_button').src = 'images/template/btn_up.gif';						
						
					} else if(direction == 'prev') {
						
						$(prev+'_layer').show();
						$(prev+'_button').src = 'images/template/btn_up_inactive.gif';
						$(next+'_layer').hide();
						$(next+'_button').src = 'images/template/btn_down.gif';
											
					}
				},
				afterFinish: function() {
				}
			});
			this.mngButton(slide * (time * 1000));
		}
	}
}
