var active_tab = 'google';
function tab(id)
{
	if(active_tab != id)	
	{
		$(active_tab+'_tab').className = 'tab';	
		$(id+'_tab').className = 'tab_active';
		$(active_tab).style.display = 'none';
		$(id).style.display = 'block';
		active_tab = id; 
	}
}
var active_radio = 'ro_player';
function tab_radio(id)
{
	if(active_tab != id)	
	{
		$(active_radio+'_tab').className = 'tab';	
		$(id+'_tab').className = 'tab_active';
		$(active_radio).style.display = 'none';
		$(id).style.display = 'block';
		active_radio = id; 
	}
}
var active_weer = 'buienradar';
function tab_weer(id)
{
	if(active_tab != id)	
	{
		$(active_weer+'_tab').className = 'tab';	
		$(id+'_tab').className = 'tab_active';
		$(active_weer).style.display = 'none';
		$(id).style.display = 'block';
		active_weer = id; 
	}
}
var active_verkeer = 'files';
function tab_verkeer(id)
{
	if(active_tab != id)	
	{
		$(active_verkeer+'_tab').className = 'tab';	
		$(id+'_tab').className = 'tab_active';
		$(active_verkeer).style.display = 'none';
		$(id).style.display = 'block';
		active_verkeer = id; 
	}
}
var active_media = 'refoweb';
function tab_media(id)
{
	if(active_media != id)	
	{
		$(active_media+'_tab').className = 'tab';	
		$(id+'_tab').className = 'tab_active';
		$(active_media).style.display = 'none';
		$(id).style.display = 'block';
		active_media = id; 
	}
}
var active_mail = 'marktplaats';
function tab_mail(id)
{
	if(active_mail != id)	
	{
		$(active_mail+'_tab').className = 'tab';	
		$(id+'_tab').className = 'tab_active';
		$(active_mail).style.display = 'none';
		$(id).style.display = 'block';
		active_mail = id; 
	}
}
var active_other = 'nieuwsbrief';
function tab_other(id)
{
	if(active_other != id)	
	{
		$(active_other+'_tab').className = 'tab';	
		$(id+'_tab').className = 'tab_active';
		$(active_other).style.display = 'none';
		$(id).style.display = 'block';
		active_other = id; 
	}
}
var active_rss = 'cip2';
function tab_rss(id)
{
	if(active_rss != id)	
	{
		$(active_rss+'_tab').className = 'tab';	
		$(id+'_tab').className = 'tab_active';
		$(active_rss).style.display = 'none';
		$(id).style.display = 'block';
		active_rss = id; 
	}
}

var active_nieuws = 'laatstenieuws';
function tab_nieuws(id)
{
	if(active_nieuws != id)	
	{
		$(active_nieuws+'_tab').className = 'tab';	
		$(id+'_tab').className = 'tab_active';
		$(active_nieuws).style.display = 'none';
		$(id).style.display = 'block';
		active_nieuws = id; 
	}
}

var active_refojobs = 'vac_overzicht';
function tab_refojobs(id)
{
	if(active_refojobs != id)	
	{
		$(active_refojobs+'_tab').className = 'tab';	
		$(id+'_tab').className = 'tab_active';
		$(active_refojobs).style.display = 'none';
		$(id).style.display = 'block';
		active_refojobs = id; 
	}
}



function cSlider(frame, elements, visible, slides, axxis, dimension, prev, next) {

	this.initialiseer = function() 
	{
		fade = true;
		fade_active = 1;
		action = true;
		this.position = visible;
		
		switch(axxis)
		{
			case 'y':
				$(frame).style.height = (dimension * elements) + 'px'; 
			break;
			case 'x':
				$(frame).style.width = (dimension * elements) + 'px';
			break;
		}		
	}

	this.move = function(direction)
	{
		if(action)
		{
			move = false;
			switch(direction)
			{
				case 'next':
					if(elements < (this.position + slides))
					{
						move = -(dimension * (elements - this.position));
						this.position = elements;
					}
					else
					{
						move = -(dimension * slides);
						this.position = this.position + slides;
					}
				break;
				case 'prev':
					if(visible > (this.position - slides))
					{
						move = (dimension * (this.position - visible));
						this.position = visible;
					}
					else
					{
						move = (dimension * slides);
						this.position = this.position - slides;
					}
				break;
				default:
					if(direction == this.position)
					{
						if(direction != elements)
						{
							move = -(dimension);
							this.position = this.position + 1;
						}
					}	
					else if(direction == (this.position - (visible - 1)))
					{
						if(direction > 1)
						{
							move = dimension;
							this.position = this.position - 1;
						}
					}
				break;
			}
			if(move)
			{
				new Effect.MoveBy(frame, (axxis == 'y' ? move : 0), (axxis == 'x' ? move : 0), 
				{ 
					duration: (slides * 0.5), 
					beforeStart: function() { 
						action = false; 
					},
					afterFinish: function() { 
						action = true; 
					}
				});
			}
		}
	}
	
	this.fade = function(foto)
	{
		if(fade)
		{
			fade = false;
			fade_old = fade_active;
			fade_active++;
			if(fade_active > 2)
			{
				fade_active = 1;	
			}
			
			preload = new Image(); 
			preload.src = foto;
			$('foto'+fade_active).src = foto;
			
			new Effect.Opacity('foto'+fade_old,  
			{
				duration: 1,
				from: 1, 
				to: 0
			});
		
			new Effect.Opacity('foto'+fade_active,  
			{
				delay: 0.8,
				duration: 1,
				from: 0, 
				to: 1,
				beforeStart: function() { $('foto'+fade_active).setOpacity(0); $('foto'+fade_active).show(); },
				afterFinish: function() { fade = true; }
			});		
		}
	}
	
}
function countLink(id) {

	var sUrl = "action/countlink";

	new Ajax.Request(
		sUrl, { 
		method: 'post', 
		postBody: 'id=' + id,
		onSuccess: 
		function(r) { 
			//alert(r.responseText);
		}
	});

}

function countBanner(id)
{
	var sUrl = "action/countbanner";

	new Ajax.Request(
		sUrl, { 
		method: 'post', 
		postBody: 'id=' + id,
		onSuccess: 
		function(r) { 
			//alert(r.responseText);
		}
	});
}
