var init = function()	
{	
	// meer config
	jQuery.extend(config, {
		debug		: true,
		googleKey	: 'ABQIAAAAnjLJWT-SSagoYADHzNDy-xRNFVH6dBkQqBr3LeGR8_GVinDy_xSFyZBlU7LTgjKiQ--Hq8XMbFuECA'  //www.degraafschap.nl		  
	});
	
	// standaard onderdelen inladen wanneer de dom ready is
	$(function()	{
		menu.init();
		tabs.init();
		content.init();
		zijbalk.init();
		formulieren.init();
		footer.init();
		banner.init();
		// focus_first();
	});
};



/* --------------------------------	*/
/* debug functie				 	*/
/* debug(str) of $(e).debug()		*/
/* --------------------------------	*/
var debug = function(e)	{
	if(config.debug) 
	{
		if(window.console)	console.log(e);
		else				alert( e.toString() );
	}
};

$.fn.debug = function() { debug(this); };

/* --------------------------------	*/
/* Focus op eerste veld			 	*/
/* focus_first() of $(e).focus_first()  */
/* --------------------------------	*/
var focus_first = function( start_element ) {
	var start_element = (start_element) ? $( start_element ) : $( document );
	
	var elem = $(':enabled:visible input[@type=text],select,textarea', start_element).not('#zoekwaarde').get( 0 );

	if ( elem ) elem.focus();

	return this;
}

$.fn.focus_first = function(){ focus_first( this ) };


/* --------------------------------	*/
/* menu						 		*/
/* --------------------------------	*/
var menu = {};

menu.laatstGeopend = null;
menu.timeoutTime = 1000;
menu.timeout = null;

menu.init = function()
{
	/* hover op li */
	$("#menu>li").hover(
		function() 
		{ 		
			// als laatstegeopend dezelfde is als de huidige, dan de timeout verwijderen
			if($(this).hasClass("hover"))
			{
				clearTimeout(menu.timeout);
			}
			// nieuwe uitschuiven
			else
			{
				$("#menu>li>ul").hide();
				$("#menu>li").not(this).removeClass("hover").removeClass("uitklappen_hover");
				
				$(this).addClass("hover");	
				if($(this).hasClass("uitklappen"))
				{
					$(this).addClass("uitklappen_hover");	
				}
				
				$(">ul", this).hide().slideDown(300);
			}
			
			// selectbox in <ie7 verwijderen
			if($.browser.msie && $.browser.version < 7)	{
				$("select").css({ visibility: 'hidden' });	
			}
		},
		function() 
		{ 
			// timeout zetten om na x aantal sec te sluiten
			menu.laatstGeopend = this;
			
			clearTimeout(menu.timeout);
			menu.timeout = setTimeout(function()
			{
				$(menu.laatstGeopend).removeClass("hover uitklappen_hover"); 
				
				// selectbox in <ie7 tonen
				if($.browser.msie && $.browser.version < 7)	{
					$("select").css({ visibility: 'visible' });	
				}
			}, menu.timeoutTime);
		}
	);
}


/* --------------------------------	*/
/* tabs						 		*/
/* --------------------------------	*/
var tabs = {};

	tabs.fn = {};
	
	tabs.init = function()
	{
		// linkjes
		$("#container a[href^=#]").click(function() {
			return tabs.naarTab( $(this).attr("href") );			
		});
		
		// formulieren
		$("form").submit(function() {
			action = $(this).attr("action");
			if(action && action.match(/^#/))	{
				return tabs.naarTab(action);	
			}
		});
		
		// via url
		if(document.location.hash != "")	{
			tabs.naarTab( document.location.hash );	
		}
	};
	
	tabs.naarTab = function( id )
	{
		// bestaat er wel iets met deze id?
		if($(id).length)
		{
			tab_holder = $(id).parent();
			
			// alle li's deactiveren
			$(">ul.tabs li", tab_holder).each(function()	{
				$(this).removeClass("actief");										  
			});
				
			// li actief maken
			$(">ul.tabs li", tab_holder).each(function()
			{
				if($("a", this).attr("href") == id)
				{
					$(this).addClass("actief");
				}
				else
				{
					$(this).removeClass("actief");
				}
			});
				
			// inhouden verbergen
			$(">.tab_content", tab_holder).hide();
				
			// inhoud id ophalen en weergeven
			$(id, tab_holder).show(); 
				
			// is er een functie beschikbaar met de id van de tab?
			// tabs.fn.IDTAB = function() { alert('koala'); };	
			try	{ tabs.fn[ id.substring(1) ](); } 
			catch(e) { }
			
			return false;		
		}
	};


/* --------------------------------	*/
/* zijbalk						 	*/
/* --------------------------------	*/
var zijbalk = {};
zijbalk.init = function()
{
	zijbalk.zoeken();
}


	/* --------------------------------	*/
	/* zijbalk slideshow			 	*/
	/* --------------------------------	*/
	zijbalk.slideshow = function()
	{
        if ($("#menu li.actief>a").length == 0)
        {
            var actieve_class = '';
        }
        else
        {
            var actieve_class = $("#menu li.actief>a")[0].className;
        }
		
		switch(actieve_class)
		{
			case 'club':
			case 'contact':	
			case 'kaartverkoop':
			case 'nieuws':	
			case 'selectie':
			case 'supporters':
			case 'voetbalcollege':
			case 'zakelijk':		
				var pagina = actieve_class; 
				break;
				
			default:		
				var pagina = "content"; 
				break;
		}
				
		$("#zijbalk>img:first").jmedia({ 
			version		: "8,0",
			elemType	: "div",
			elemClass	: "slideshow"
		}, 
		{
			src			: config.submap + "/fla/slideshow.swf",
			width		: 300,
			height		: 262,
			quality		: "best",
			wmode		: "opaque",
			flashVars	: "height=262&width=300&linkfromdisplay=none&transition=blocks&screencolor=0x00A1E5&shownavigation=false&file=" + config.submap + "/fla/zijbalk/images.php?pagina=" + pagina			
		});	
	}


	/* --------------------------------	*/
	/* zijbalk zoeken				 	*/
	/* --------------------------------	*/
	zijbalk.zoeken = function()
	{
		$("#zijbalk form.zoeken").submit(function()	{
			if($("input:text", this).val() == "")	{
				alert("Je dient een trefwoord in te vullen");
				return false;
			}
		});
	}
	
	/* --------------------------------	*/
	/* voetbalacademie wedstrijden	 	*/
	/* --------------------------------	*/
	// een 'Graafschap' call om de wedstrijden dynamisch in te laden :)
	function switch_wedstrijd(wedstrijd)	{
	    $("#zijbalk_wedstrijd").load(config.submap + "/voetbalacademie/wedstrijd/" + wedstrijd + "/", null, tabs.fn.tab_wedstrijden_klikbaar_maken);
	}

	tabs.fn.tab_wedstrijden = function()	{
	    document.location = config.submap + '/voetbalacademie/a1/wedstrijden/' + document.getElementById("wedstrijd_links_id_wedstrijd").value + '/details.html';
	}


	tabs.fn.tab_wedstrijden_klikbaar_maken = function() {
	    $("#zijbalk_wedstrijd_klikbaar").click(tabs.fn.tab_wedstrijden);
	}


	$(document).ready(function() {
		tabs.fn.tab_wedstrijden_klikbaar_maken();
		
	    $("#stemmen").click(function() {
	        if ($("#pollantwoorden > li > input:checked").length == 0)
	        {
	            alert("Kies een antwoord om op te stemmen.");
	            return false;
	        }
	    });
	});

	
/* --------------------------------	*/
/* zakelijk						 	*/
/* --------------------------------	*/
var zakelijk = {};
zakelijk.videospeler = function()
{
	$("#zakelijk .videoplayerzakelijk").jmedia({ 
		version		: "8,0",
		elemType	: "div",
		elemClass	: "videoplayerzakelijk"
	}, 
	{
		src			: "http://regioz.nl/media/player.swf",
		width		: 304,
		height		: 180,
		quality		: "best",
		wmode		: "opaque",
		flashVars	: "height=180&width=304&file=cpmp/regioz/rz_ep_006.mp4&autostart=false&streamer=rtmp://fl1.streamzilla.jet-stream.nl:80/VOD&image=http://regioz.nl/imgs/rz_ep_006.jpg&link=http://regioz.nl/index.php%3FelementId%3Drz_ep_006%26filmpje%3Drz_ep_006%26panel%3Delevatorpitches%26img%3Drz_ep_006%26autostart%3Dtrue&logo=http://www.regioz.nl/imgs/regioz_weblogo.png",
		allowfullscreen : "true"
	});
}

/* --------------------------------	*/
/* content						 	*/
/* --------------------------------	*/
var content = {};
content.init = function()
{	
	content.tabellen();

    $("span.drukversie").attr('title', 'Wordt weergegeven in het gedrukte Sponsorvademecum').css('cursor', 'help');
}

content.tabellen = function()
{
	// hover class
	$("table.tabel tbody tr").hover(
		function() { $(this).addClass("hover");	},
		function() { $(this).removeClass("hover");	}
	);	
}

content.sifr = function()
{
	$("#midden h2:first").jmedia({
		version		: "6,0",
		mode		: "sifr"
	}, {
		src			: config.submap + "/fla/titel.swf",
		quality		: "best",
		bgcolor		: "#00a1e4",
		wmode		: "transparent",
		flashVars	: "&textcolor=#ffffff"
	});
}

content.terug = function()
{
    history.back(-1);
}


/* --------------------------------	*/
/* footer						 	*/
/* --------------------------------	*/
var footer = {};
footer.init = function()
{
	$("#footer p.dran a").jmedia({ 
		version		: "8,0",
		elemType	: "span",
		elemClass	: "flash"
	}, 
	{
		src			: config.submap + "/fla/dran.swf",
		width		: 311,
		height		: 50,
		quality		: "best",
		wmode		: "transparent",
		bgcolor		: "#00a1e4",
		flashVars	: "&submap=" + config.submap
	});		
}



/* --------------------------------	*/
/* formulieren					 	*/
/* --------------------------------	*/
var formulieren = {};
formulieren.init = function()
{
	if($.browser.msie)
	{
		$("input, textarea")	// op selectbox werkt niet lekker, dus die eruit
			.focus(function()	{	$(this).addClass("focus");	})
			.blur(function()	{	$(this).removeClass("focus");	});
	}
}


/* formulier naar ajaxform omzetten	*/
$.fn.formNaarAjax = function( p )	
{
	// kijken of de parameter een functie of object is
	if(typeof(p) == 'function')
	{
		onComplete = p;	
	}
	else if(typeof(p) == 'object')
	{
		onComplete 	= p.onComplete;
		onSubmit 	= p.onSubmit;			
	}
		
	var form = this;
	
	// veld toevoegen om te checken of het een ajaxform is
	form.append('<input type="hidden" name="ajaxFormulier" value="ja" />'); 

	$(form).submit(function() 	
	{ 	
		// als er onsubmit functie is die even uitvoeren
		if(typeof(onSubmit) == 'function')	{
			if(onSubmit())	{
				$.post(form.attr("action"), $(this).serialize(), onComplete);
			}
		}
		// gewoon submitten
		else	{
			$.post(form.attr("action"), $(this).serialize(), onComplete);
		}
		
		// formulier niet echt versturen, maar via ajax dus
		return false;
	});
}



/* --------------------------------	*/
/* banner						 	*/
/* --------------------------------	*/
var banner = {
	
	init	: function()
	{	
		banner.skyscraper();
	},
	
	skyscraper	: function()
	{
		if(config.pagina != "frontpage" && config.pagina != "dialog")
		{

			zetPositie = function()	
			{
				if($(window).width() < 1025)
				{
					$("body > .skyscraper").hide();
				}
				else
				{
					offset = $("#container").offset({ lite: true });
					$("body > .skyscraper").css("left", (offset.left + 994 + 10)).show();
				}
			}
			
			zetPositie();
			$(window).resize(zetPositie);
		}
	}
	
};


/* --------------------------------	*/
/* block een element		 		*/
/* --------------------------------	*/
/*
$.fn.block = function()	
{
	blocker = $("#container").append('<div class="blocker"></div>');
	
	blocker.css({ top: o.top, left: o.left });
};

$.fn.unblock = function()
{
		
};
*/



/* --------------------------------	*/
/* fixpng					 		*/
/* --------------------------------	*/
$.fn.fixpng = function()	
{
	if($.browser.msie && $.browser.version < 8)	
	{
		return this.each(function()
		{
			bg = $(this).css("backgroundImage");
			url = bg.substr(5, parseInt(bg.length) - 2);
				
			$(this).css({
				filter		:	"progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=scale src=\"" + url,
				background	:	"none"
			});
		});
	}
};


/* --------------------------------	*/
/* dimensions 1.2					*/
/* --------------------------------	*/
(function($){

	$.dimensions = {
		version: '1.2'
	};
	
	// Create innerHeight, innerWidth, outerHeight and outerWidth methods
	$.each( [ 'Height', 'Width' ], function(i, name){
		
		// innerHeight and innerWidth
		$.fn[ 'inner' + name ] = function() {
			if (!this[0]) return;
			
			var torl = name == 'Height' ? 'Top'    : 'Left',  // top or left
				borr = name == 'Height' ? 'Bottom' : 'Right'; // bottom or right
			
			return this.is(':visible') ? this[0]['client' + name] : num( this, name.toLowerCase() ) + num(this, 'padding' + torl) + num(this, 'padding' + borr);
		};
		
		// outerHeight and outerWidth
		$.fn[ 'outer' + name ] = function(options) {
			if (!this[0]) return;
			
			var torl = name == 'Height' ? 'Top'    : 'Left',  // top or left
				borr = name == 'Height' ? 'Bottom' : 'Right'; // bottom or right
			
			options = $.extend({ margin: false }, options || {});
			
			var val = this.is(':visible') ? 
					this[0]['offset' + name] : 
					num( this, name.toLowerCase() )
						+ num(this, 'border' + torl + 'Width') + num(this, 'border' + borr + 'Width')
						+ num(this, 'padding' + torl) + num(this, 'padding' + borr);
			
			return val + (options.margin ? (num(this, 'margin' + torl) + num(this, 'margin' + borr)) : 0);
		};
	});
	
	// Create scrollLeft and scrollTop methods
	$.each( ['Left', 'Top'], function(i, name) {
		$.fn[ 'scroll' + name ] = function(val) {
			if (!this[0]) return;
			
			return val != undefined ?
			
				// Set the scroll offset
				this.each(function() {
					this == window || this == document ?
						window.scrollTo( 
							name == 'Left' ? val : $(window)[ 'scrollLeft' ](),
							name == 'Top'  ? val : $(window)[ 'scrollTop'  ]()
						) :
						this[ 'scroll' + name ] = val;
				}) :
				
				// Return the scroll offset
				this[0] == window || this[0] == document ?
					self[ (name == 'Left' ? 'pageXOffset' : 'pageYOffset') ] ||
						$.boxModel && document.documentElement[ 'scroll' + name ] ||
						document.body[ 'scroll' + name ] :
					this[0][ 'scroll' + name ];
		};
	});
	
	$.fn.extend({
		position: function() {
			var left = 0, top = 0, elem = this[0], offset, parentOffset, offsetParent, results;
			
			if (elem) {
				// Get *real* offsetParent
				offsetParent = this.offsetParent();
				
				// Get correct offsets
				offset       = this.offset();
				parentOffset = offsetParent.offset();
				
				// Subtract element margins
				offset.top  -= num(elem, 'marginTop');
				offset.left -= num(elem, 'marginLeft');
				
				// Add offsetParent borders
				parentOffset.top  += num(offsetParent, 'borderTopWidth');
				parentOffset.left += num(offsetParent, 'borderLeftWidth');
				
				// Subtract the two offsets
				results = {
					top:  offset.top  - parentOffset.top,
					left: offset.left - parentOffset.left
				};
			}
			
			return results;
		},
		
		offsetParent: function() {
			var offsetParent = this[0].offsetParent;
			while ( offsetParent && (!/^body|html$/i.test(offsetParent.tagName) && $.css(offsetParent, 'position') == 'static') )
				offsetParent = offsetParent.offsetParent;
			return $(offsetParent);
		}
	});
	
	function num(el, prop) {
		return parseInt($.curCSS(el.jquery?el[0]:el,prop,true))||0;
	};
	
})(jQuery);



/* --------------------------------	*/
/* dialoogvenster met a.j.a.x..		*/
/* --------------------------------	*/
var dialog = {};

	dialog.collectie = null;
	
	dialog.bepaalType = function( url )
	{
		url_parts = url.split(".");
		extensie = url_parts[url_parts.length-1].lowercase();
		
		if(extensie == ("jpg" || "gif" || "png"))
		{
			dialog.img( url );
		}
	}

	// dielog openen
	dialog.url	 	= function(url, w, h)		{	if(!w) { w=0; } if(!h) { h=0; } dialog.weergeven( url, w, h, "ajax");		}
	dialog.iframe 	= function(url, w, h)		{	if(!w) { w=0; } if(!h) { h=0; } dialog.weergeven( url, w, h, "iframe");		}
	dialog.html		= function(html, w, h)		{	if(!w) { w=0; } if(!h) { h=0; } dialog.weergeven( html, w, h, "html");		}
	dialog.img 		= function(src)	
	{	
		var imgLoader = new Image();  
		imgLoader.onload = function()	{
			dialog.weergeven( src, imgLoader.width, imgLoader.height, "img");	
		}
		imgLoader.src = src;
	}

	// sluiten
	dialog.sluiten = function( miliseconds )
	{
		if(!miliseconds)	{
			$("#dialog_blocker").hide();
			$("#dialog").fadeOut(400);
			dialog.geopend = false;	
			
			$("select").css("visibility", "visible");
		}
		else	{
			setTimeout("dialog.sluiten()", miliseconds );
		}
	}
	
	dialog.geopend = false;	
	dialog.weergeven = function( src, width, height, type )
	{
		$("select").css("visibility", "hidden");
		
		// als er nog geen dialog toe is gevoegd deze toevoegen
		if($("#dialog").length === 0)
		{
			$("#container").append('<div id="dialog_blocker"></div> <div id="dialog"><table cellspacing="0"><tr><td width="72" height="70" class="header_links"></td><td height="70" class="header_midden"></td><td width="72" height="70" class="header_rechts"><div class="sluiten"><a class="sluiten" href="#" title="Sluiten">Sluiten</a></div></td></tr><tr><td width="72" class="content_links">&nbsp;</td><td class="content_midden"><div class="content">&nbsp;</div></td><td width="72" class="content_rechts">&nbsp;</td></tr><tr><td width="72" height="70" class="footer_links">&nbsp;</td><td height="70" class="footer_midden">&nbsp;</td><td width="72" height="70" class="footer_rechts">&nbsp;</td></tr></table></div>');
			
			// voor ie6 en ie7 even de achtergrond repareren (png...)
			$("#dialog td").fixpng();
			
			// dialog sluiten link
			$("#dialog a.sluiten").click(function()	{
				dialog.sluiten();
				return false;
			});
			
			// sluiten bij escape toets
			$(document).keydown(function(e) {
				if((e.which == 27) && dialog.geopend) 
					dialog.sluiten();
			});	
			
			// sluiten door op de achtergrond te klikken
			// $("#dialog_blocker").click(dialog.sluiten);
		}
		
		$("#dialog_blocker").css("opacity", "0").height($("#container").height()).show();
		
		// breedtes opslaan
		oWidth = width;
		oHeight = height;
	
		// niet geopend, breedtes aanpassen
		if(dialog.geopend === false)
		{
			if(width)	{
				width = width + 140;
				$("#dialog").css({ 
					left	: (($("#container").width() - width) / 2) + "px", 
					width	: width + "px"
				});
			}
			
			if(height)	{
				height = height + 140;
				$("#dialog").height(height);	
			}

			$("#dialog")
				.css("top", $(document).scrollTop())
				.fadeIn(400 );
			$("#dialog .content").html('');
			
			// geopend dus
			dialog.geopend = true;
		}
		
		// wel geopend, misschien hoogte/breedte anders?
		else
		{
			if(width)	{
				width = width + 140;
				$("#dialog").animate({ 
					left	: (($("#container").width() - width) / 2) + "px", 
					width	: width + "px"
				});
			}
			
			if(height)	{
				height = height + 140;
				$("#dialog").animate({ height: height });	
			}				
		}
		
		// aan de hand van het type de inhoud bepalen
		switch(type)
		{
			// ajax
			case 'ajax':
				$("#dialog .content").html('<div class="melding">Bezig met laden... Een ogenblik geduld.</div>');
				
				$.ajax({
					url		: src,
					cache	: false,
					success	: function(html)	{
						if(dialog.geopend)	{
							$("#dialog .content").slideUp(200, function()	{
								$("#dialog .content").html(html).show('normal', function(){
									$("#dialog .content").focus_first();
								});
							});
						}
					}
				});
				
				break;
			
			// iframe
			case 'iframe':
				$("#dialog .content").html('<iframe frameborder="0" width="100%" height="500" src="' + src + '"></iframe>');
				
				$("#dialog .content iframe").focus_first();
				break;
			
			// img
			case 'img':
				$("#dialog .content").html('<img class="img" src="' + src + '" width="' + oWidth + '" height="' + oHeight + '" />');
				break;
			
			// html
			case 'html':
				$("#dialog .content").html( src );
				break;
		}
		
		return false;
	}

$.fn.dialog = function()
{
	dialog.collectie = this;
	
	$(dialog.collectie).each(function()
	{
		$(this).click(function()
		{
			//eval("dialog." + dialog.bepaalType(this.href) +"('"+ this.href +"');";					   
		});
	});
};


/* --------------------------------	*/
/* flash object	plaatsen			*/
/* --------------------------------	*/
$.fn.flash = function(options)
{
	// opties
	defaults = {
		quality		: "best",
		wmode		: "opaque",
		flashVars	: {}
	};
	
	o = $.extend(defaults, options);
	o.flashVars = $.param(o.flashVars);
	
	$(this).jmedia({ 
		version		: "7,0",
		elemType	: this.tagName,
		elemClass	: $(this).attr("class")
	}, o);	
	
	return this;
};
	
/* --------------------------------	*/
/* shop															*/
/* --------------------------------	*/
// een 'Graafschap' call om door de producten in de shop te bladeren
function switch_shop()
{
    $("#shop_holder").load(config.submap + "/shop/degraafschap/");
}
	

/* --------------------------------	*/
/* carrousel						*/
/* --------------------------------	*/
/*
	$(".thumbs").carrousel();
	
	opbouw als dit;

	<div class="thumbs">
		<a class="nav_links" href="#" title="Naar links">&lt;</a>
		<ul>
			<li>....</li>
			<li>....</li>
		</ul>
		<a class="nav_rechts" href="#" title="Naar rechts">&gt;</a>
	</div>	
*/


$.fn.carrousel = function( options )
{
	// opties
	var defaults = {
		nav_links			: "a.nav_links",
		nav_rechts			: "a.nav_rechts",
		items_per_scroll	: 1
	}
	
	var o = $.extend(defaults, options);
	
	
	// items
	var container = $(this);
	
	var container_width = container.width();
	var items_width = haalItemsBreedte();
	var item_width 	= $("li:first", container).outerWidth();
	
	
	$("ul", container).width(items_width);
	
	// begin waarde van de margin
	var init_marginLeft = parseInt($("ul", container).css("margin-left").replace("px", "")); 
	
	
	// ie bugje, right is altijd 1 px te weinig, ff fixxen!
	if($.browser.msie && $.browser.version == 6) 
		$(o.nav_rechts).css("right", -1);
	
	
	// navigatie acties maken
	$(o.nav_links, container).click(function() 	{ doeScroll("links"); return false; });
	$(o.nav_rechts, container).click(function() { doeScroll("rechts"); return false; });
	
	
	// navigatie togglen
	toggleNav();

	
	// haal breedte van alle items bij elkaar
	function haalItemsBreedte()
	{
		var breedte = 0;
		$("li", container).each(function() { 
			breedte += $(this).outerWidth(); 
		});
		
		return breedte;
	}
	
	
	// scrollen
	var bezig_met_scroll = false;	// om meerdere clicks te kunnen
	function doeScroll( richting )
	{
		// als de knop disabled is niks doen
		if(!$(o['nav_' + richting]).hasClass("disabled") && !bezig_met_scroll)
		{
			bezig_met_scroll = true;
			
			if(richting == "rechts")	richting = "-=";
			else						richting = "+=";
			
			$("ul", container).animate({ marginLeft : richting + (item_width * o.items_per_scroll) }, function() { toggleNav(); bezig_met_scroll = false; });
		}
	}
	
	
	// navigatie activeren/disablen
	function toggleNav()
	{
		// marginleft bepalen
		marginLeft = parseInt($("ul", container).css("margin-left").replace("px", ""));		
		
		// hoeveel is zichtbaar?
		visible = (container_width - items_width - marginLeft);
		
		if(visible < 0 && marginLeft < 0)
		{
			$(o.nav_links).removeClass("disabled");
			$(o.nav_rechts).removeClass("disabled");
		}
		
		else if(visible < 0 && marginLeft > 0)
		{
			$(o.nav_links).addClass("disabled");
			$(o.nav_rechts).removeClass("disabled");
		}
		
		else if(container_width > items_width)
		{
			$(o.nav_links).addClass("disabled");
			$(o.nav_rechts).addClass("disabled");
		}
		else
		{
			$(o.nav_links).removeClass("disabled");
			$(o.nav_rechts).addClass("disabled");
		}
	}
}	

// Zet de hoogte van iframe op hoog genoeg zodat de content past
autoIframe = function (frameId)
{
	try
	{
		frame = document.getElementById(frameId);
		innerDoc = (frame.contentDocument) ? frame.contentDocument : frame.contentWindow.document;
		frame.height = innerDoc.body.scrollHeight + 20;
	}
	catch(err)
	{
		alert(err.message);
	}
}

// Bij uitloggen de gebruiker vragen of de opgeslagen gebruiker verwijderd moet worden
function uitloggen()
{
	if (confirm("Bij het uitloggen ook de opgeslagen gebruiker verwijderen?"))
	{
		window.location = '?status=4';
	}
	else{
		window.location = '?status=6';
	}

}