//nu-wel.nl (c)
$(document).ready(function() {
				$("a.poplight[href^='\#'], .popupblok a[href^='\#']").click(function(e){
					e.preventDefault();
					document.location.hash=this.href.substr(this.href.indexOf('#')+1);
				})
				$('a.poplight[href^=#]').click(function() {
					var popID = $(this).attr('rel');
					var popURL = $(this).attr('href');
					var query= popURL.split('?');
					var dim= query[1].split('&');
					var popWidth = dim[0].split('=')[1];
					$('#' + popID).fadeIn().css({ 'width': Number( popWidth ) }).prepend('<a href="#" class="close"><img src="images/close.png" class="btn_close" alt="Close" /></a>');
					var popMargTop = ($('#' + popID).height() + 80) / 2;
					var popMargLeft = ($('#' + popID).width() + 80) / 2;
					$('#' + popID).css({ 
						'margin-top' : -popMargTop,
						'margin-left' : -popMargLeft
					});
					$('body').append('<div id="fade"></div>');
					$('#fade').css({'filter' : 'alpha(opacity=80)'}).fadeIn();
					return false;
				});
				$('a.close, #fade').live('click', function() {
					$('#fade , .popupblok').fadeOut(function() {
						$('#fade, a.close').remove();  
				}); 
					return false;
				});
				$("ul#footernav li:last, ul#hoofdnav li:last").addClass("noborder");
				var topPaneelOpties = {
					topPadding: 10
				};
				$windowheight = $(window).height();
				if($windowheight > '500'){
					$(".stick").topPaneel(topPaneelOpties);
					$.fn.fadeSliderToggle = function(settings) {
						 settings = $.extend({
							speed:500,
							easing : "swing"
						}, settings)
						
						caller = this
						if($(caller).css("display") == "none"){
							$(caller).animate({
								opacity: 1,
								height: 'toggle'
							}, settings.speed, settings.easing);
						}else{
							$(caller).animate({
								opacity: 0,
								height: 'toggle'
							}, settings.speed, settings.easing);
						}
					};
				};
				$("#brandhoofdimg img, .brandhoofddesc").hide();
				$("#brandhoofdimg img, .brandhoofddesc").delay(300).fadeTo(500, 1.0);
				$(".sidebalk.close").click(function(){
					$(this).fadeOut(200);
					$(".brands").delay(400).slideDown(300, function() {
						$(this).removeClass("hidden");
					});
				});		
				$("ul.thumbs img").delay(1000).afbeeldingload({
					opvulling:"../images/empty.gif",
					effect:"fadeIn"
				});	
				$("a[rel='gallery']").colorbox({
					transition:"elastic",
					scrolling:false,
					opacity:0.4
				});
				$("a[rel='gallery2']").colorbox({
					transition:"elastic",
					scrolling:false,
					opacity:0.4
				});	
				$("a.fotopopup[rel='foto']").colorbox({
					transition:"elastic",
					scrolling:false,
					maxHeight:"70%",
					maxWidth:"70%",
					opacity:0.4
				});										
				$(function(){
					$('#brandhoofdimg').slides({
						preload: true,
						preloadImage: '../images/loader.gif',
						play: 6000,
						pause: 1000,
						hoverPause: true,
						effect: 'fade',
						fadeSpeed: 550,
						animationStart: function(current){
							$('.brandhoofddesc').animate({
								bottom:-35
							},100);
							if (window.console && console.log) {
								console.log('animationStart on slide: ', current);
							};
						},
						animationComplete: function(current){
							$('.brandhoofddesc').animate({
								bottom:0
							},200);
							if (window.console && console.log) {
								console.log('animationComplete on slide: ', current);
							};
						},
						slidesLoaded: function() {
							$('.brandhoofddesc').animate({
								bottom:0
							},200);
						}
					});
				});
				$.fn.fadeSliderToggle = function(settings) {
					 settings = $.extend({
						speed:500,
						easing : "swing"
					}, settings)
					
					caller = this
					if($(caller).css("display") == "none"){
						$(caller).animate({
							opacity: 1,
							height: 'toggle'
						}, settings.speed, settings.easing);
					}else{
						$(caller).animate({
							opacity: 0,
							height: 'toggle'
						}, settings.speed, settings.easing);
					}
				}; 
				$('.showmap').click(function(){
					$('#googlemaps').fadeSliderToggle(300)
						return false;
				});
				$(".tabmember").hide();
				$("ul#membertabs li:first").addClass("active").show();
				$(".tabmember:first").show();
				
				$("ul#membertabs li").click(function() {
					$("ul#membertabs li").removeClass("active");
					$(this).addClass("active");
					$(".tabmember").hide();
					var activeTab = $(this).find("a").attr("href");
					$(activeTab).fadeIn();
					return false;
				});
});
