// Vervang 'TheSans'-class tekst met tekst gegenereerd door Cufon

   Cufon.replace('* > .thesans');
   Cufon.replace('* thesans');
   Cufon.replace('* > .thesans_selected');
   Cufon.replace('* thesans_selected');
   Cufon.replace('* > .thesans_boot_unselected');
   Cufon.replace('* thesans_boot_unselected');
	 Cufon.replace('* > .thesans_boot_selected');
   Cufon.replace('* thesans_boot_selected');
    Cufon.replace('* > .tab_selected');
   Cufon.replace('* tab_selected');			
Cufon.replace('* > .tab_unselected');
   Cufon.replace('* tab_unselected');		

// Slideshow functies

function onAfter(curr, next, opts) {
    var index = opts.currSlide;
    var totaalFoto = opts.slideCount;
    $('#prev2')[index == 0 ? 'hide' : 'show']();
    $('#next2')[index == opts.slideCount - 1 ? 'hide' : 'show']();
	
}

$(function() {
    $('#slideshow').after('<ul id="nav" class="navslider" style="z-index: 400;">').cycle({
        fx:     'fade',
        speed:  'fast',
        timeout: 5000,
        pause: 1,
        pager:  '#nav',
        next:   '#next2',
  	    prev:   '#prev2',
  	    after: onAfter,
        pagerAnchorBuilder: function(idx, slide) {
            //$('ul.navslider li:last').css('margin-right', '0px');
            	var url = $('img',slide).attr('src');
      	 // var url = slide.src;
		  var filename = url.substring(url.lastIndexOf('/')+1);
		//  var src = $('img',slide).attr('src'); 
		//	alert(idx);
	      //filename = escape(filename).replace('+', '%2B').replace('%20', '+').replace('*', '%2A').replace('/', '%2F').replace('@', '%40');		
        return '<li id="smallslider' + idx + '"><a href="#"><img class="hoverimage" src="./includes/imgresize.php?w=75&h=57&f=' + encodeURIComponent(filename) + '" style="border: 3px solid #FFFFFF;" /></a></li>';
        }
    });
});

// Windows Onload functies

$(document).ready(function() {
      		
      		// INIT
      		var classIs = 'leeg';
      		
      		// Verplaatsen straks naar java voor content laden
      		$('#boot_tab_unselected1').click(function(){ 
           		 $('#boot_tab_unselected1').fadeOut(200);
           		  $('#boot_tab_selected2').fadeOut(200);
           		 $('#boot_tab_selected3').fadeOut(200);
           		 $('#boot_tab_selected1').fadeIn(200);
           		  $('#boot_tab_unselected3').fadeIn(200);
           	
           		 $('#boot_tab_unselected2').fadeIn(200);
            });
            
            $('#boot_tab_unselected2').click(function(){ 
           		 $('#boot_tab_unselected2').fadeOut(200);
           		  $('#boot_tab_selected3').fadeOut(200);
           		 $('#boot_tab_selected1').fadeOut(200);
           		 $('#boot_tab_unselected3').fadeIn(200);
           	
           		 $('#boot_tab_unselected1').fadeIn(200);
           		 $('#boot_tab_selected2').fadeIn(200);
            });
            
            $('#boot_tab_unselected3').click(function(){ 
           		 $('#boot_tab_unselected3').fadeOut(200);
           		  $('#boot_tab_selected2').fadeOut(200);
           		 $('#boot_tab_selected1').fadeOut(200);
           		 $('#boot_tab_selected3').fadeIn(200);
           		  $('#boot_tab_unselected2').fadeIn(200);           	
           		 $('#boot_tab_unselected1').fadeIn(200);
            });
      		
         		
      		
            // Go to top - animated
            $('span#gototopper').click(function(){ 
           		 $('html, body').animate({scrollTop:0}, 'slow'); 
           		 return false; 
            });
            
            // gedeelte voor klikken op fotocontroller
            $('#prev2').click(function() {
			//	$('.hoverscroll').stop().animate({"padding-left": "+=79", "opacity": 1}, 500);
			});
			$('#next2').click(function() {
			//	$('.hoverscroll').stop().animate({"padding-left": "-=79", "opacity": 1}, 500);
			//	$.fn.hoverscroll.params = startMoving('left',1);
			});
            
            
          // GEDEELTE VOOR HOVERSCROLL
           

           
			$.fn.hoverscroll.params = $.extend($.fn.hoverscroll.params, {
			vertical : false,
			width: 515,
			height: 75,
			arrows: false,
			debug: false
			});           
         
          $('#nav').hoverscroll();  // maak NAV hoverscroll
            /*$("#nav").hover(
  			function () {
    			alert('in');
  			}, 
  			function () {
   				alert('en uit');
  			}
			);*/
         
         		// EINDE HOVERSCROLL

          
        
	          

	     
	    
	     
	     // animeer boten
	     
	    /* $("div#boten").click(
 		 function () {
	 		if ($(this).css("top") == '101px') {
 		    $("div#boten").stop().animate({ top:"-75px"}, 500);
 		    $("div.sliderGallery").stop().animate({ top:"120px"}, 500);
 		    } else {
 		  //  	 $("div#boten").stop().animate({ top:"101px"}, 500);
 		    //	 $("div.sliderGallery").stop().animate({ top:"0px"}, 500);
 		    }
	     }); */
	     
	     // Hover images in controller voor slideshow
	     $(".hoverimage").hover(
	     	function(){
	     	//	alert('in');
	     	}, function (){
			//alert('en uit');
			}	
	     );
	    
	    // mouseovers linkpage
	    
	  // Hoveractie voor newsitems
	    // Hoveractie voor newsitems
	  $(".news_container_small").hover(
	    function () {	
 		 	$(this).stop().css("background-color", "#D1DCE7");
 		 	$('.newsselect', this).stop().css("color", "#180077");
 		 	Cufon.replace('* > .thesans');
  			 Cufon.replace('* thesans');
  			}, 		 
  			function () {
 		  	$(this).stop().animate({ backgroundColor:"#FFFFFF"}, 500);
 		  	$('.newsselect', this).stop().css("color", "#708cb7");
			Cufon.replace('* > .thesans');
 			  Cufon.replace('* thesans');
 			}
  		);   
	  
  		
  		  $(".news_container_small").click(function () {	
 		 	var newsID = $(this).attr("id");
 		 	var newsStart = $(this).attr("title");
 		 	laadnieuws(newsID, newsStart);
 		 	
  		});
	    
	    
	    	    // Hoveractie voor topmenu
 		$("#topmenu .topmenu_wit").hover(
 		 function () {	
 		 	$(this).css("color", "#D8E2F0");
 		 	Cufon.replace('* > .thesans');
   			Cufon.replace('* thesans');
  			}, 		 function () {
 		  	$(this).css("color", "#ffffff");
			Cufon.replace('* > .thesans');
  			 Cufon.replace('* thesans');
 			}
  		);
	    
	         
	     // Hoveractie voor de boten
 		$("#boten_boot1").hover(
 		 function () {	
 		 	if ($("#boten_boot1").is('.bootmenu_unselected')) { 
				$('#boten_boot1 div.boten_bootbutton').css("background-image", "url('./img/botenbutton_over.jpg')"); 
			}
  			}, 		 function () {
 		  	if ($("#boten_boot1").is('.bootmenu_unselected')) { 
			$('#boten_boot1 div.boten_bootbutton').css("background-image", "url('./img/botenbutton.jpg')"); 
 			}
 			}
  		);

		$("#boten_boot2").hover(
 		 function () {	
 		 	if ($("#boten_boot2").is('.bootmenu_unselected')) { 
			$('#boten_boot2 div.boten_bootbutton').css("background-image", "url('./img/botenbutton_over.jpg')"); 
			}
  			}, 		 function () {
 		  	if ($("#boten_boot2").is('.bootmenu_unselected')) { 
			$('#boten_boot2 div.boten_bootbutton').css("background-image", "url('./img/botenbutton.jpg')"); 
 			}
 			}
  		);
  		
  		$("#boten_boot3").hover(
 		 function () {	
 		  	if ($("#boten_boot3").is('.bootmenu_unselected')) { 
			$('#boten_boot3 div.boten_bootbutton').css("background-image", "url('./img/botenbutton_over.jpg')"); 
  			}
  			}, 		 function () {
 		 //alert('bah');
 		  	if ($("#boten_boot3").is('.bootmenu_unselected')) { 
			$('#boten_boot3 div.boten_bootbutton').css("background-image", "url('./img/botenbutton.jpg')"); 
 			}
 			}
  		);
  		
  		$("#boten_boot4").hover(
 		 function () {	
 		  	if ($("#boten_boot4").is('.bootmenu_unselected')) { 
			$('#boten_boot4 div.boten_bootbutton').css("background-image", "url('./img/botenbutton_over.jpg')"); 
  			}
  			}, 		 function () {
 		  	if ($("#boten_boot4").is('.bootmenu_unselected')) { 
			$('#boten_boot4 div.boten_bootbutton').css("background-image", "url('./img/botenbutton.jpg')"); 
 			}
 			}
  		);
  		
  		$("#boten_boot5").hover(
 		 function () {	
 		  	if ($("#boten_boot5").is('.bootmenu_unselected')) { 
			$('#boten_boot5 div.boten_bootbutton').css("background-image", "url('./img/botenbutton_over.jpg')"); 
			
	
  			}
  			}, 		 function () {
 		  	if ($("#boten_boot5").is('.bootmenu_unselected')) { 
 		  				$('#boten_boot5 div.boten_bootbutton').css("background-image", "url('./img/botenbutton.jpg')"); 
 			}
 			}
  		);
	     
	    // Clickfunctie voor de botenbalk
	    
	    $("#boten_boot1").click(
 		 function () {
 		 //	$("#boten_boot1 div.boten_bootbutton div#bootbutton1").removeClass('thesans_boot_unselected').addClass('thesans');
 		    $("#boten_boot1").removeClass('bootmenu_unselected').addClass('bootmenu_selected');
 		    $("#boten_boot2").removeClass('bootmenu_selected').addClass('bootmenu_unselected');
 		    $('#boten_boot2 div.boten_bootbutton').css("background-image", "url('./img/botenbutton.jpg')"); 
 		    $("#boten_boot3").removeClass('bootmenu_selected').addClass('bootmenu_unselected');
 		    $('#boten_boot3 div.boten_bootbutton').css("background-image", "url('./img/botenbutton.jpg')"); 
 		    $("#boten_boot4").removeClass('bootmenu_selected').addClass('bootmenu_unselected');
 		    $('#boten_boot4 div.boten_bootbutton').css("background-image", "url('./img/botenbutton.jpg')"); 
 		    $("#boten_boot5").removeClass('bootmenu_selected').addClass('bootmenu_unselected');
 		    $('#boten_boot5 div.boten_bootbutton').css("background-image", "url('./img/botenbutton.jpg')"); 
			$("#boten_boot1 div.boten_bootbutton").css("background-image", "url('.')");
			$('#container #main_container #boten #boten_boot1 #bootbutton1').css("color", "#9EB6DA");
			$('#container #main_container #boten #boten_boot2 #bootbutton2').css("color", "#738FB6");
			$('#container #main_container #boten #boten_boot3 #bootbutton3').css("color", "#738FB6");
			$('#container #main_container #boten #boten_boot4 #bootbutton4').css("color", "#738FB6");
			$('#container #main_container #boten #boten_boot5 #bootbutton5').css("color", "#738FB6");	
   			Cufon.replace('* > .thesans_boot_unselected');
   			Cufon.replace('* thesans_boot_unselected');
			
			vulBootLijst('bcboot'); // vul de lijst met boten
			
			// Reload Cufon om de kleuren van de tekst te wijzigen
		//	Cufon.replace('* > .thesans');
 		  //  Cufon.replace('* thesans');
  		  }); 
	     
	    
	     
	     $("#boten_boot2").click(
 		 function () {
 		    $("#boten_boot2").removeClass('bootmenu_unselected').addClass('bootmenu_selected');
 		    $("#boten_boot1").removeClass('bootmenu_selected').addClass('bootmenu_unselected');
 		    $('#boten_boot1 div.boten_bootbutton').css("background-image", "url('./img/botenbutton.jpg')"); 
 		    $("#boten_boot3").removeClass('bootmenu_selected').addClass('bootmenu_unselected');
 		    $('#boten_boot3 div.boten_bootbutton').css("background-image", "url('./img/botenbutton.jpg')"); 
 		    $("#boten_boot4").removeClass('bootmenu_selected').addClass('bootmenu_unselected');
 		    $('#boten_boot4 div.boten_bootbutton').css("background-image", "url('./img/botenbutton.jpg')"); 
 		    $("#boten_boot5").removeClass('bootmenu_selected').addClass('bootmenu_unselected');
 		    $('#boten_boot5 div.boten_bootbutton').css("background-image", "url('./img/botenbutton.jpg')"); 
			$("#boten_boot2 div.boten_bootbutton").css("background-image", "url('.')"); 
			$('#container #main_container #boten #boten_boot1 #bootbutton1').css("color", "#738FB6");
			$('#container #main_container #boten #boten_boot2 #bootbutton2').css("color", "#9EB6DA");
			$('#container #main_container #boten #boten_boot3 #bootbutton3').css("color", "#738FB6");
			$('#container #main_container #boten #boten_boot4 #bootbutton4').css("color", "#738FB6");
			$('#container #main_container #boten #boten_boot5 #bootbutton5').css("color", "#738FB6");	
   			Cufon.replace('* > .thesans_boot_unselected');
   			Cufon.replace('* thesans_boot_unselected');

			vulBootLijst('cboot');
  		  }); 
	     
	     $("#boten_boot3").click(
 		 function () {
 		    $("#boten_boot3").removeClass('bootmenu_unselected').addClass('bootmenu_selected');
 		    $("#boten_boot1").removeClass('bootmenu_selected').addClass('bootmenu_unselected');
 		    $('#boten_boot1 div.boten_bootbutton').css("background-image", "url('./img/botenbutton.jpg')"); 
 		    $("#boten_boot2").removeClass('bootmenu_selected').addClass('bootmenu_unselected');
 		    $('#boten_boot2 div.boten_bootbutton').css("background-image", "url('./img/botenbutton.jpg')"); 
 		    $("#boten_boot4").removeClass('bootmenu_selected').addClass('bootmenu_unselected');
 		    $('#boten_boot4 div.boten_bootbutton').css("background-image", "url('./img/botenbutton.jpg')"); 
 		    $("#boten_boot5").removeClass('bootmenu_selected').addClass('bootmenu_unselected');
 		    $('#boten_boot5 div.boten_bootbutton').css("background-image", "url('./img/botenbutton.jpg')"); 
			$("#boten_boot3 div.boten_bootbutton").css("background-image", "url('.')"); 
			$('#container #main_container #boten #boten_boot1 #bootbutton1').css("color", "#738FB6");
			$('#container #main_container #boten #boten_boot2 #bootbutton2').css("color", "#738FB6");
			$('#container #main_container #boten #boten_boot3 #bootbutton3').css("color", "#9EB6DA");
			$('#container #main_container #boten #boten_boot4 #bootbutton4').css("color", "#738FB6");
			$('#container #main_container #boten #boten_boot5 #bootbutton5').css("color", "#738FB6");	
   			Cufon.replace('* > .thesans_boot_unselected');
   			Cufon.replace('* thesans_boot_unselected');

		
			vulBootLijst('rboot');
  		  }); 
  		  
  		 $("#boten_boot4").click(
 		 function () {
 		    $("#boten_boot4").removeClass('bootmenu_unselected').addClass('bootmenu_selected');
 		    $("#boten_boot1").removeClass('bootmenu_selected').addClass('bootmenu_unselected');
 		    $('#boten_boot1 div.boten_bootbutton').css("background-image", "url('./img/botenbutton.jpg')"); 
 		    $("#boten_boot3").removeClass('bootmenu_selected').addClass('bootmenu_unselected');
 		    $('#boten_boot3 div.boten_bootbutton').css("background-image", "url('./img/botenbutton.jpg')"); 
 		    $("#boten_boot2").removeClass('bootmenu_selected').addClass('bootmenu_unselected');
 		    $('#boten_boot2 div.boten_bootbutton').css("background-image", "url('./img/botenbutton.jpg')"); 
 		    $("#boten_boot5").removeClass('bootmenu_selected').addClass('bootmenu_unselected');
 		    $('#boten_boot5 div.boten_bootbutton').css("background-image", "url('./img/botenbutton.jpg')"); 
			$("#boten_boot4 div.boten_bootbutton").css("background-image", "url('.')"); 
			$('#container #main_container #boten #boten_boot1 #bootbutton1').css("color", "#738FB6");
			$('#container #main_container #boten #boten_boot2 #bootbutton2').css("color", "#738FB6");
			$('#container #main_container #boten #boten_boot3 #bootbutton3').css("color", "#738FB6");
			$('#container #main_container #boten #boten_boot4 #bootbutton4').css("color", "#9EB6DA");
			$('#container #main_container #boten #boten_boot5 #bootbutton5').css("color", "#738FB6");	
   			Cufon.replace('* > .thesans_boot_unselected');
   			Cufon.replace('* thesans_boot_unselected');

			vulBootLijst('srboot');
  		  }); 
  		  
  		  $("#boten_boot5").click(
 		 function () {
 		    $("#boten_boot5").removeClass('bootmenu_unselected').addClass('bootmenu_selected');
 		    $("#boten_boot1").removeClass('bootmenu_selected').addClass('bootmenu_unselected');
 		    $('#boten_boot1 div.boten_bootbutton').css("background-image", "url('./img/botenbutton.jpg')"); 
 		    $("#boten_boot3").removeClass('bootmenu_selected').addClass('bootmenu_unselected');
 		    $('#boten_boot3 div.boten_bootbutton').css("background-image", "url('./img/botenbutton.jpg')"); 
 		    $("#boten_boot4").removeClass('bootmenu_selected').addClass('bootmenu_unselected');
 		    $('#boten_boot4 div.boten_bootbutton').css("background-image", "url('./img/botenbutton.jpg')"); 
 		    $("#boten_boot2").removeClass('bootmenu_selected').addClass('bootmenu_unselected');
 		    $('#boten_boot2 div.boten_bootbutton').css("background-image", "url('./img/botenbutton.jpg')"); 
			$("#boten_boot5 div.boten_bootbutton").css("background-image", "url('.')"); 
			$('#container #main_container #boten #boten_boot1 #bootbutton1').css("color", "#738FB6");
			$('#container #main_container #boten #boten_boot2 #bootbutton2').css("color", "#738FB6");
			$('#container #main_container #boten #boten_boot3 #bootbutton3').css("color", "#738FB6");
			$('#container #main_container #boten #boten_boot4 #bootbutton4').css("color", "#738FB6");
			$('#container #main_container #boten #boten_boot5 #bootbutton5').css("color", "#9EB6DA");	
   			Cufon.replace('* > .thesans_boot_unselected');
   			Cufon.replace('* thesans_boot_unselected');

			vulBootLijst('miscboot');
			
  		  });  
	     });
	     
// Overige functies



// Haal menu met boten weer naar beneden als er op 'designs' wordt geklikt
function takeDownMenu() {
 	if ($("div#boten").css("top") != '101px') {
 		$("div#boten").stop().animate({ top:"101px"}, 500);
 		$("div.sliderGallery").stop().animate({ top:"-100px"}, 500);
 	}
}

// Vul de boten lijst

function vulBootLijst(categorie) {
	 classIs = 'designs';
    $("div.sliderGallery UL").hide();
    $("div.handle").animate({opacity: 0}, 200);
	$("div#boten").stop().animate({ top:"-75px"}, 300);
	$("div.sliderGallery").stop().animate({ top:"-100px"}, 125).animate({ top:"116px"}, 500, function() {
				$('div.sliderGallery').css("background-image", "url(\'./img/ajax-loader.gif\')"); 
				$("div.sliderGallery").load("./includes/vul_categorie_boot.php?cat="+categorie, function() {
				$('div.sliderGallery').css("background-image", "url(.)"); 
				$("div.sliderGallery UL").fadeIn("slow");
				$("div.handle").fadeIn("slow");
				});
					
		});
}

// Uitzondering voor de Jclass

function vulBootLijstJclass(categorie) {
	classIs = 'jclass';
    $("div.sliderGallery UL").hide();
    $("#text_loader").show();
    $("#foto_loader").show();
    $("div.handle").animate({opacity: 0}, 200);
	$("div.sliderGallery").stop().animate({ top:"96px"}, 1, function() {
				$('div.sliderGallery').css("background-image", "url(\'./img/ajax-loader.gif\')"); 
				$("div.sliderGallery").load("./includes/vul_categorie_boot.php?cat="+categorie, function() {
				$('div.sliderGallery').css("background-image", "url(.)"); 
				$("div.sliderGallery UL").fadeIn("slow", function() {
					laadBootContent("?cat=jbasis&boot=1");
				});
				$("div.handle").fadeIn("slow");
				});
					
		});
}

// Uitzondering voor de current projects

function vulBootLijstCurrentprojects() {
 classIs = 'projects';
    $("div.sliderGallery UL").hide();
    $("#text_loader").show();
    $("#foto_loader").show();
    $("div.handle").animate({opacity: 0}, 200);
	$("div.sliderGallery").stop().animate({ top:"96px"}, 1, function() {
				$('div.sliderGallery').css("background-image", "url(\'./img/ajax-loader.gif\')"); 
				$("div.sliderGallery").load("./includes/vul_categorie_boot.php?cat=currentprojects", function() {
				$('div.sliderGallery').css("background-image", "url(.)"); 
				$("div.sliderGallery UL").fadeIn("slow", function() {
					laadBootContent("?cat=projects&boot=1");
				});
				$("div.handle").fadeIn("slow");
				});
					
		});
}

function colorToHex(color) {
   			 if (color.substr(0, 1) === '#') {
        	return color;
   			 }
   			 var digits = /(.*?)rgb\((\d+), (\d+), (\d+)\)/.exec(color);
    
  			  var red = parseInt(digits[2]);
   			 var green = parseInt(digits[3]);
    		var blue = parseInt(digits[4]);
    
  			  var rgb = blue | (green << 8) | (red << 16);
    		return digits[1] + '#' + rgb.toString(16);
			};
     	   
    function scroller(counter, bootcounter, linker) {
   			
   				//$('.sliderGallery').scrollTo( '400px', 800,{axis:'x'} );
				//$(...).scrollTo( $('div li:eq(14)'), 800 );
				//var container = $('div.sliderGallery ~ ul');
           		//var ul = $('ul', container);	
				//ul.trigger( 'goto', [ 3 ] );
				//container.scrollTo('+=100px', 500);
				//alert		
				var container = $('div.sliderGallery');
           		var ul = $('ul', container);
           		var tweeNaLaatste = bootcounter - 2;
           		var eenNaLaatste = bootcounter - 1;
           		var laatste = bootcounter;
           		
           		//alert(ul.width());
           		//alert(bootcounter);
           		//alert(counter * 170);
           		var locatieBoot = counter * 170; // reken uit hoeveer de boot staat in slidergallery
           		var percentageBoot = locatieBoot / ul.width(); // bereken percentage van de bootlocatie   		
           		var maxHandle = 792; // de maximale lengte van de slider waar de handle in stat
				var widthLijst = -1 * (ul.width() - (5 * 170 + 112));
				var locatieHandle = percentageBoot * maxHandle;
			
			if (bootcounter > 5) {
				
           		if (counter == 1) {
           			ul.stop().animate({'left' : 0}, 500);
           			$('.handle').stop().animate({'left' : 10 * 0}, 500, function () {
           			laadBootContent(linker);
           		});   
 
           		 // $('.handle').stop().animate({'left' : locatieHandle}, 500)          
           		} else if (counter == 2) {
           			ul.stop().animate({'left' : 0}, 500);
           		//	$('.handle').stop().animate({'left' : 30}, 500);
           			$('.handle').stop().animate({'left' : locatieHandle}, 500, function () {
           				laadBootContent(linker);
           			});    
           		} else if (counter == 3) {
           			ul.stop().animate({'left' : 0}, 500);
           		//	$('.handle').stop().animate({'left' : 60}, 500);
           			$('.handle').stop().animate({'left' : locatieHandle}, 500, function () {
           			laadBootContent(linker);
           		});   
   
           	/*
	} else if (counter == 13) {
           			ul.stop().animate({'left' : -1436}, 500);
           			$('.handle').stop().animate({'left' :  704}, 500);             
           		
*/
           	    } else if (counter == tweeNaLaatste) {
           	    	ul.stop().animate({'left' : widthLijst}, 500);
           		//	$('.handle').stop().animate({'left' :  734}, 500);
           		$('.handle').stop().animate({'left' : locatieHandle}, 500, function () {
           			laadBootContent(linker);

           		});   
      
           	    } else if (counter == eenNaLaatste) {
           	    	ul.stop().animate({'left' : widthLijst}, 500);
           		//	$('.handle').stop().animate({'left' :  764}, 500); 
           		$('.handle').stop().animate({'left' : locatieHandle}, 500, function () {
           			laadBootContent(linker);

           		});   
     
           	    } else if (counter == laatste) {
           	    	ul.stop().animate({'left' : widthLijst}, 500);
           		//	$('.handle').stop().animate({'left' :  794}, 500);
           		$('.handle').stop().animate({'left' : locatieHandle}, 500, function () {
           			laadBootContent(linker);

           		});   
   
           			  
           	    }
           		else if (bootcounter > 6) {
           		   ul.stop().animate({'left' : -locatieBoot + 566}, 500);
           		  //  ul.stop().animate({'left' : 250 + -155 * counter}, 500);
           		   //ul.css('left', 100 * -1 * counter);
           		 //  $('.handle').stop().animate({'left' : 225 + 20 * counter}, 500);             
           		$('.handle').stop().animate({'left' : locatieHandle}, 500, function () {
           			laadBootContent(linker);
           		});   
           		} 
           		
           	} else {
           		ul.stop().animate({'left' : 0}, 500);
           		laadBootContent(linker);
     
           	}
           	
				//alert(range);
               // alert(counter);
          
     	 
               
               
			}
			
			function laadBootContent(linker) {
			
				$('#slideshow').cycle('stop');
				$("#boot_tab_container").hide().load("./includes/laadtabs.php"+linker, function() {
					Cufon.replace('* > .tab_selected');
 			   		Cufon.replace('* tab_selected');			
					Cufon.replace('* > .tab_unselected');
   					Cufon.replace('* tab_unselected');
					laadBootText($('#boot_tab_unselected1').text(), linker); // laad de boot
				
				$('#boot_tab_unselected1').stop().click(function(){ 
		       		$('#boot_tab_unselected1').stop().fadeOut(200);
		       		$('#boot_tab_selected2').stop().fadeOut(200);
		       		$('#boot_tab_selected3').stop().fadeOut(200);
		       		$('#boot_tab_selected1').stop().fadeIn(200);
		       		$('#boot_tab_unselected3').stop().fadeIn(200);
		       		$('#boot_tab_unselected2').stop().fadeIn(200);
           			laadBootText($('#boot_tab_unselected1').text(), linker);
           		 });
            
            	$('#boot_tab_unselected2').stop().click(function(){ 
           		  	$('#boot_tab_unselected2').stop().fadeOut(200);
           			 $('#boot_tab_selected3').stop().fadeOut(200);
           		 	$('#boot_tab_selected1').stop().fadeOut(200);
           		 	$('#boot_tab_unselected3').stop().fadeIn(200);
           	
           		 	$('#boot_tab_unselected1').stop().fadeIn(200);
           		 	$('#boot_tab_selected2').stop().fadeIn(200);
           		  laadBootText($('#boot_tab_unselected2').text(), linker);
            	});
            
            	$('#boot_tab_unselected3').stop().click(function(){ 
           		 $('#boot_tab_unselected3').stop().fadeOut(200);
           		  $('#boot_tab_selected2').stop().fadeOut(200);
           		 $('#boot_tab_selected1').stop().fadeOut(200);
           		 $('#boot_tab_selected3').stop().fadeIn(200);
           		  $('#boot_tab_unselected2').stop().fadeIn(200);           	
           		 $('#boot_tab_unselected1').stop().fadeIn(200);
           		  laadBootText($('#boot_tab_unselected3').text(), linker);
            	});
			
				
			
			});		
			}
        
			function laadBootText(sectie, linker) {
			// laad tekst bij boten BELANGRIJK!!!!
		
				if( $('#boot_content').is(':hidden') ) {
						$("#fadecontainer").animate({"opacity": 0 }, 1, function () { 
						$("#boot_content_linkpage").hide();
						$("#boot_content").show();
						//$("#boot_content").show().animate({"opacity": 0 }, 0).animate({"opacity": 1 }, 200);
    		 			$("#boot_tab_container").show();
    		 		
    		 			$("#topmenu_links").html("<a href=\"javascript:laadLinksPagina();\" class=\"topmenu_wit\">links</a>");
     
       		 			if (classIs == 'projects') {
    		 				$("#topmenu_currentprojects").html("<a href=\"./currentprojects\" class=\"topmenu_blauw\">current projects</a>");
    		 			} else if (classIs == 'designs') {
    		 				$("#topmenu_designs").html("<a href=\"./\" class=\"topmenu_blauw\">designs</a>");
    		 			} else if (classIs == 'jclass') {
    		 				$("#topmenu_jclass").html("<a href=\"./jclass\" class=\"topmenu_blauw\">j-class</a>");
    		 			}
    		 			
						Cufon.replace('* > .thesans');
  						 Cufon.replace('* thesans');
  						 Cufon.replace('* > .thesans_selected');
   						Cufon.replace('* thesans_selected');
  					  Cufon.replace('* > .thesans_boot_unselected');
  					  });
				} else {			
					$("#boot_tab_container").show();
					$("#topmenu_contact").html("<a href=\"javascript:laadContactPagina();\" class=\"topmenu_wit\">contact</a>");
					$("#topmenu_companyprofile").html("<a href=\"javascript:laadCompanyProfile();\" class=\"topmenu_wit\">company profile</a>");
					$("#topmenu_news").html("<a href=\"javascript:laadNews();\" class=\"topmenu_wit\">news</a>");
					if (classIs == 'projects') {
    		 				$("#topmenu_currentprojects").html("<a href=\"./currentprojects\" class=\"topmenu_blauw\">current projects</a>");
    		 			} else if (classIs == 'designs') {
    		 				$("#topmenu_designs").html("<a href=\"javascript:takeDownMenu();\" class=\"topmenu_blauw\">designs</a>");
    		 			} else if (classIs == 'jclass') {
    		 				$("#topmenu_jclass").html("<a href=\"./jclass\" class=\"topmenu_blauw\">j-class</a>");
    		 			}    		 			
					Cufon.replace('* > .thesans');
  					Cufon.replace('* thesans');
  				    Cufon.replace('* > .thesans_selected');
   				    Cufon.replace('* thesans_selected');
  					Cufon.replace('* > .thesans_boot_unselected');			
				}
			
				$("#boot_content_links").stop().animate({"opacity": 0 }, 300, function () {
			
					$("#text_loader").show();
	     			$("#boot_content_links").load("./includes/laadboottext.php"+linker+"&tab="+sectie, function() {
	     				$("#text_loader").hide();
	     				$("#boot_content_links").animate({"opacity": 1 }, 100, function() {
	     					 if($.browser.msie) { this.style.removeAttribute('filter'); };
	     					 $("#boot_content_rechts").stop().animate({"opacity": 0 }, 300, function () {
			   				  $("#foto_loader").show();
	     					  $("#boot_content_rechts").load("./includes/laadbootfoto.php"+linker+"&tab="+sectie, function() {
	     						$("#foto_loader").hide();
	     				 		$("#boot_content_rechts").animate({"opacity": 1 }, 100);	     					     		
	     					});
	     				     				     			
	     					}); 
	     				});
	     				$("#fadecontainer").animate({"opacity": 1 }, 500, function(){
	     					 if($.browser.msie) { this.style.removeAttribute('filter'); }; 	
	     				});	
	     				   				
	     			});	
	     		});
			}
	
			function backlaadLinksPagina(){
			
			 $("#topmenu_designs").html("<a href=\"./\" class=\"topmenu_wit\">designs</a>");
			 $("#topmenu_companyprofile").html("<a href=\"javascript:laadCompanyProfile();\" class=\"topmenu_wit\">company profile</a>");
			 $("#topmenu_currentprojects").html("<a href=\"./currentprojects\" class=\"topmenu_wit\">current projects</a>");
			 $("#topmenu_jclass").html("<a href=\"./jclass\" class=\"topmenu_wit\">j-class</a>");
			 $("#topmenu_news").html("<a href=\"javascript:laadNews();\" class=\"topmenu_wit\">news</a>");
			 $("#topmenu_contact").html("<a href=\"javascript:laadContactPagina();\" class=\"topmenu_wit\">contact</a>");
			 $("#topmenu_links").html("<a href=\"javascript:laadLinksPagina();\" class=\"topmenu_blauw\">links</a>");
			// $("#boot_tab_container").html("<div id=\"boot_tab_unselected1\" class=\"tab_selected\">links</div><div id=\"boot_tab_selected1\" class=\"tab_unselected\">links</div>");
			// $("#boot_content").animate({"opacity": 0 }, 200, function () {
				//$("#boot_content").hide();
			 	$("#boot_content").animate({"opacity": 0 }, 5).load("./includes/laadlinks.php", function() {
			 		$("#boot_content").css("background-image", "url(./img/boot_achtergrond_links.png)").animate({"opacity": 1 }, 200);
			 		if ($("#boten").length > 0){
    					 $("#boot_content").stop().css({top: "141px"});
					}
	     			$("#boot_content").animate({"opacity": 1 }, 200, function() {
	     			
	     				$("div.botenblok").removeClass('botenblok_selected');
	     				$("div.botenblok").stop().css({color: "#5B7BA8"});
	    				$('div.botenblok').stop().animate({ backgroundColor: "#D1DcE7" }, "slow");	     					
   					Cufon.replace("div.botenblok"); 
  				//});
	    		Cufon.replace('* > .thesans_boot_unselected');
 	       		Cufon.replace('* thesans_boot_unselected');			
	     		});
			});

			 //$("#boot_content").animate({"opacity": 0 }, 200, function() {
			 	
			 	
			 //	});
			 Cufon.replace('* > .thesans');
  			 Cufon.replace('* thesans');
  			 Cufon.replace('* > .thesans_selected');
  			 Cufon.replace('* thesans_selected');
  			 Cufon.replace('* > .thesans_boot_unselected');
			}
			
			function laadLinksPagina(){
			
			 $("#topmenu_designs").html("<a href=\"./\" class=\"topmenu_wit\">designs</a>");
			 $("#topmenu_companyprofile").html("<a href=\"javascript:laadCompanyProfile();\" class=\"topmenu_wit\">company profile</a>");
			 $("#topmenu_currentprojects").html("<a href=\"./currentprojects\" class=\"topmenu_wit\">current projects</a>");
			 $("#topmenu_jclass").html("<a href=\"./jclass\" class=\"topmenu_wit\">j-class</a>");
			 $("#topmenu_news").html("<a href=\"javascript:laadNews();\" class=\"topmenu_wit\">news</a>");
			 $("#topmenu_contact").html("<a href=\"javascript:laadContactPagina();\" class=\"topmenu_wit\">contact</a>");
			 $("#topmenu_links").html("<a href=\"javascript:laadLinksPagina();\" class=\"topmenu_blauw\">links</a>");
			// $("#boot_tab_container").html("<div id=\"boot_tab_unselected1\" class=\"tab_selected\">links</div><div id=\"boot_tab_selected1\" class=\"tab_unselected\">links</div>");
			 $("#fadecontainer").animate({"opacity": 0 }, 200, function () {
				$("#boot_content").hide();
			 	$("#boot_content_linkpage").load("./includes/laadlinks.php", function() {
			 	$("#boot_content_linkpage").show();
			 	if ($("#boten").length > 0){
    				 $("#boot_content_linkpage").stop().css({top: "141px"});
				}
	     			$("#fadecontainer").animate({"opacity": 1 }, 200, function() {
	     				if($.browser.msie) { if($.browser.msie) { this.style.removeAttribute('filter'); }; };

	     				$("div.botenblok").removeClass('botenblok_selected');
	     				$("div.botenblok").stop().css({color: "#5B7BA8"});
	    				$('div.botenblok').stop().animate({ backgroundColor: "#D1DcE7" }, "slow");	     					
   					Cufon.replace("div.botenblok"); 
  				});
	    		Cufon.replace('* > .thesans_boot_unselected');
 	       		Cufon.replace('* thesans_boot_unselected');			
	     		});
			});

			 //$("#boot_content").animate({"opacity": 0 }, 200, function() {
			 	
			 	
			 //	});
			 Cufon.replace('* > .thesans');
  			 Cufon.replace('* thesans');
  			 Cufon.replace('* > .thesans_selected');
  			 Cufon.replace('* thesans_selected');
  			 Cufon.replace('* > .thesans_boot_unselected');
			}
			
			function laadContactPagina(){
			 
			 $("#topmenu_designs").html("<a href=\"./\" class=\"topmenu_wit\">designs</a>");
			 $("#topmenu_companyprofile").html("<a href=\"javascript:laadCompanyProfile();\" class=\"topmenu_wit\">company profile</a>");
			 $("#topmenu_currentprojects").html("<a href=\"./currentprojects\" class=\"topmenu_wit\">current projects</a>");
			 $("#topmenu_jclass").html("<a href=\"./jclass\" class=\"topmenu_wit\">j-class</a>");
			 $("#topmenu_news").html("<a href=\"javascript:laadNews();\" class=\"topmenu_wit\">news</a>");
			 $("#topmenu_contact").html("<a href=\"javascript:laadContactPagina();\" class=\"topmenu_blauw\">contact</a>");
			 $("#topmenu_links").html("<a href=\"javascript:laadLinksPagina();\" class=\"topmenu_wit\">links</a>");
			 
			 
			 if( $('#boot_content').is(':hidden') ) {
			 $("#fadecontainer").animate({"opacity": 0 }, 200, function () {
			 $("#boot_content_linkpage").hide();
			 $("#boot_content").load("./includes/gdnp_contacttext.php", function() {	
			 			$("#boot_content").show();
			      		$("#fadecontainer").animate({"opacity": 1 }, 200, function() {
			      			if($.browser.msie) { if($.browser.msie) { this.style.removeAttribute('filter'); }; };

			      		});
	     				$("div.botenblok").removeClass('botenblok_selected');
	     				$("div.botenblok").stop().css({color: "#5B7BA8"});
	     				$('div.botenblok').stop().animate({ backgroundColor: "#D1DcE7" }, "slow");	     					
   						
   						Cufon.replace("div.botenblok"); 
	     				Cufon.replace('* > .thesans_boot_unselected');
 						Cufon.replace('* thesans_boot_unselected');
	     				

	     			});
			
			});
			} else {
				 $("#fadecontainer").animate({"opacity": 0 }, 100, function() {  
				 $("#boot_content").load("./includes/gdnp_contacttext.php", function() {
			      		$("#fadecontainer").animate({"opacity": 1 }, 200, function() {
			      		if($.browser.msie) { if($.browser.msie) { this.style.removeAttribute('filter'); }; };

			      		});		
	     				$("div.botenblok").removeClass('botenblok_selected');
	     				$("div.botenblok").stop().css({color: "#5B7BA8"});
	     				$('div.botenblok').stop().animate({ backgroundColor: "#D1DcE7" }, "slow");	     					
   						
   						Cufon.replace("div.botenblok"); 
	     				Cufon.replace('* > .thesans_boot_unselected');
 						Cufon.replace('* thesans_boot_unselected');
	     				

	     			});
			});
			
			}
			 //$("#boot_content").animate({"opacity": 0 }, 200, function() {
			 	
			 	
			 //	});
			  Cufon.replace('* > .thesans');
   			  Cufon.replace('* thesans');
   			  Cufon.replace('* > .thesans_selected');
 			  Cufon.replace('* thesans_selected');
   			  Cufon.replace('* > .thesans_boot_unselected');
			}

		function laadCompanyProfile(){
			 $('#slideshow').cycle('stop');
			 $("#topmenu_designs").html("<a href=\"./\" class=\"topmenu_wit\">designs</a>");
			 $("#topmenu_companyprofile").html("<a href=\"javascript:laadCompanyProfile();\" class=\"topmenu_blauw\">company profile</a>");
			 $("#topmenu_currentprojects").html("<a href=\"./currentprojects\" class=\"topmenu_wit\">current projects</a>");
			 $("#topmenu_jclass").html("<a href=\"./jclass\" class=\"topmenu_wit\">j-class</a>");
			 $("#topmenu_news").html("<a href=\"javascript:laadNews();\" class=\"topmenu_wit\">news</a>");
			 $("#topmenu_contact").html("<a href=\"javascript:laadContactPagina();\" class=\"topmenu_wit\">contact</a>");
			 $("#topmenu_links").html("<a href=\"javascript:laadLinksPagina();\" class=\"topmenu_wit\">links</a>");
			 
			 
			 if( $('#boot_content').is(':hidden') ) {
			$("#fadecontainer").animate({"opacity": 0 }, 200, function () {
			// $("#boot_content_linkpage").animate({"opacity": 0 }, 200, function () {
			 $("#boot_content_linkpage").hide();
			 $("#boot_content").load("./includes/gdnp_companyprofiletext.php", function() {	
			      		$("#boot_content").show();
			      		$("#fadecontainer").animate({"opacity": 1 }, 200, function() {
			      			if($.browser.msie) { if($.browser.msie) { this.style.removeAttribute('filter'); }; };

			      		});
	     				$("div.botenblok").removeClass('botenblok_selected');
	     				$("div.botenblok").stop().css({color: "#5B7BA8"});
	     				$('div.botenblok').stop().animate({ backgroundColor: "#D1DcE7" }, "slow");	     					
   						
   						Cufon.replace("div.botenblok"); 
	     				Cufon.replace('* > .thesans_boot_unselected');
 						Cufon.replace('* thesans_boot_unselected');
	     				

	     			});
			
			});
			} else {
				 $("#fadecontainer").animate({"opacity": 0 }, 100, function() {  
				 $("#boot_content").load("./includes/gdnp_companyprofiletext.php", function() {
			      		$("#fadecontainer").animate({"opacity": 1 }, 200, function(){
			      		if($.browser.msie) { if($.browser.msie) { this.style.removeAttribute('filter'); }; };

			      		});		
	     				$("div.botenblok").removeClass('botenblok_selected');
	     				$("div.botenblok").stop().css({color: "#5B7BA8"});
	     				$('div.botenblok').stop().animate({ backgroundColor: "#D1DcE7" }, "slow");	     					
   						
   						Cufon.replace("div.botenblok"); 
	     				Cufon.replace('* > .thesans_boot_unselected');
 						Cufon.replace('* thesans_boot_unselected');
	     				

	     			});
			});
			
			}
			 //$("#boot_content").animate({"opacity": 0 }, 200, function() {
			 	
			 	
			 //	});
			  Cufon.replace('* > .thesans');
   			  Cufon.replace('* thesans');
   			  Cufon.replace('* > .thesans_selected');
 			  Cufon.replace('* thesans_selected');
   			  Cufon.replace('* > .thesans_boot_unselected');
			}

					
			function tester(){
			 	var container = $('div.sliderGallery');
           		var ul = $('.sliderGallery UL');
                ul.animate({'left' : 340 * -1}, 500);
			}
			
		function oldernews(start) {
				$("#boot_content_links").stop().animate({"opacity": 0 }, 100, function () {
					$("#boot_content_links").load("./includes/gdnp_nieuws.php?start="+start, function() {
						$("#boot_content_links").stop().animate({"opacity": 1 }, 300, function() {
						
						if($.browser.msie) { if($.browser.msie) { this.style.removeAttribute('filter'); }; };

						});
					});
				});
				
			}
			
		
		
			function laadnieuws(id, start) {	
			
	     		$("#boot_content_links").stop().animate({"opacity": 0 }, 150, function () {
					$("#text_loader").show();
	     			$("#boot_content_links").load("./includes/laadnewstext.php?newsid="+id+"&nieuwsstart="+start, function() {
	     			$("#text_loader").hide();
	     			$("#boot_content_links").animate({"opacity": 1 }, 100, function () {	     			
	     			if($.browser.msie) { if($.browser.msie) { this.style.removeAttribute('filter'); }; };

	     		$("#boot_content_rechts").stop().animate({"opacity": 0 }, 150, function () {
			    $("#foto_loader").show();
	     			$("#boot_content_rechts").load("./includes/laadnewsslideshow.php?newsid="+id, function() {
	     		//	alert('klaar');
	     			 $("#foto_loader").hide();
	     				$("#boot_content_rechts").animate({"opacity": 1 }, 100);  			
	    			});
	    			
	    			     		
	     			
	     		});
	     			});	 
	     			});
	     		});
	     	}
