


$(function(){
		
			QueryLoader.init();
			
			$(".LeesMinder").css('display', 'none');
			
			for (var idcounter = 1; idcounter <= 10; idcounter++) {
				$("#VerticalScrollPane" + idcounter).jScrollPane({showArrows:true, scrollbarWidth: 3, scrollbarMargin: 25, wheelSpeed: 10});
			}
			/*
			$.fn.supersized1.options = {  
				startwidth: 1600,  
				startheight: 1200,
				vertical_center: 1,
				performance : 3,
				slides : [
					{image : 'img/bgrd/BgrdSlide1.jpg'}
				]
			};
	        $('#supersized1').supersized1();
			
			
			$.fn.supersized2.options = {  
				startwidth: 1600,  
				startheight: 1200,
				vertical_center: 1,
				performance : 3,
				slides : [
					{image : 'img/bgrd/BgrdSlide2.png'}
				]
			};
	        $('#supersized2').supersized2();
			
			
			$.fn.supersized2b.options = {  
				startwidth: 1600,  
				startheight: 1200,
				vertical_center: 1,
				performance : 3,
				slides : [
					{image : 'img/bgrd/BgrdSlide2b.png'}
				]
			};
	        $('#supersized2b').supersized2b();
			
			
			$.fn.supersized3.options = {  
				startwidth: 1600,  
				startheight: 1200,
				vertical_center: 1,
				performance : 3,
				slides : [
					{image : 'img/bgrd/BgrdSlide3.png'}
				]
			};
	        $('#supersized3').supersized3();
			
			
			$.fn.supersized4.options = {  
				startwidth: 1600,  
				startheight: 1200,
				vertical_center: 1,
				performance : 3,
				slides : [
					{image : 'img/bgrd/BgrdSlide4.jpg'}
				]
			};
	        $('#supersized4').supersized4();
			
			
			$.fn.supersized5.options = {  
				startwidth: 1600,  
				startheight: 1200,
				vertical_center: 1,
				performance : 3,
				slides : [
					{image : 'img/bgrd/BgrdSlide5.jpg'}
				]
			};
	        $('#supersized5').supersized5();
			
			
			$.fn.supersized6.options = {  
				startwidth: 1600,  
				startheight: 1200,
				vertical_center: 1,
				performance : 3,
				slides : [
					{image : 'img/bgrd/BgrdSlide6.jpg'}
				]
			};
	        $('#supersized6').supersized6();
			
			
			$.fn.supersized7.options = {  
				startwidth: 1600,  
				startheight: 1200,
				vertical_center: 1,
				performance : 3,
				slides : [
					{image : 'img/bgrd/BgrdSlide7.jpg'}
				]
			};
	        $('#supersized7').supersized7();
			
			*/
});


////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////// ALS DE PAGINA (DOM) IS GELADEN //////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////


$(document).ready(function(){Initialize();});



////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////// DETAIL OVERLAY IN DE ACCORDEON TONEN ////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////


function Initialize()
{
		
		
		//MOUSEOVER voor ALLE icoontjes//
		$(".LeesMeer img").mouseover(function() {
				$(this).attr('src', function() {return this.src.replace('.png','Over.png')});
		});
		$(".LeesMeer img").mouseout(function() {
				$(this).attr('src', function() {return this.src.replace('Over.png','.png')});
		});
		$(".LeesMinder img").mouseover(function() {
				$(this).attr('src', function() {return this.src.replace('.png','Over.png')});
		});
		$(".LeesMinder img").mouseout(function() {
				$(this).attr('src', function() {return this.src.replace('Over.png','.png')});
		});
		$(".prev img").mouseover(function() {
				$(this).attr('src', function() {return this.src.replace('.png','Over.png')});
		});
		$(".prev img").mouseout(function() {
				$(this).attr('src', function() {return this.src.replace('Over.png','.png')});
		});
		$(".next img").mouseover(function() {
				$(this).attr('src', function() {return this.src.replace('.png','Over.png')});
		});
		$(".next img").mouseout(function() {
				$(this).attr('src', function() {return this.src.replace('Over.png','.png')});
		});
		/*
		$(".icon2").mouseover(function() {
				$(this).children("a").children("img").attr('src', function() {return this.src.replace('Gray.png','Color.png')});
				$(this).children("a").children("span").toggle();
		});
		$(".icon2").mouseout(function() {
				$(this).children("a").children("img").attr('src', function() {return this.src.replace('Color.png','Gray.png')});
				$(this).children("a").children("span").toggle();
		});
		
		*/
		var DescriptionVarOriginal = new Array;
		var PageVar = new String();
		var limitVar;
		
		//aantal karakters van benaming product beperken en "..." achteraan plaatsen (afrekenen winkelwagen klein)//
		$(".description").each(function(index) {
			limitVar = $(this).html();
			DescriptionVarOriginal[index+1] = limitVar;
			if (limitVar.length > 500){
				limitVar = limitVar.substring(0,500);
				limitVar = limitVar+"...";
			};
			$(this).html(limitVar);
		});
		
	   
	   //LEES MEER BUTTON
	   $('.LeesMeer').click(function(event){
									 
			PageVar = $(this).parent().parent().parent().attr('id');
			PageVar = PageVar.charAt(PageVar.length-1);
	   		$(this).prev().children('div:first-child').html(DescriptionVarOriginal[PageVar]);
			
			//Geef class een id name van het scrollpane
			$(this).prev().children('div:first-child').attr('id', 'VerticalScrollPane');
			//Verander class naar die van het scrollpane
			$(this).prev().children('div:first-child').toggleClass('scroll-pane');
			$(this).prev().children('div:first-child').removeClass('description');
			
			$(this).toggle();
			$(this).next().toggle();
			$(this).next().next('.FacebookLike').toggle();
			$(this).next().next().next('.links').toggle();
			$(this).next().next().next().next('.eyecatcher').toggle();
			
			//SCROLLPANE TEXT//
			$(this).prev().children('div:first-child').jScrollPane({showArrows:true, scrollbarWidth: 3, scrollbarMargin: 25, wheelSpeed: 10});
			
		});
	   
	   $('.LeesMinder').click(function(event){
	   		//Geef class een id name van het scrollpane
			$(this).prev().prev().children('div:first-child').attr('id', ' ');
			//Verander class naar die van het scrollpane
			$(this).prev().prev().children('div:first-child').removeClass('jScrollPaneContainer jScrollPaneScrollable scroll-pane');
			$(this).prev().prev().children('div:first-child').attr('style',' ');
			
			$(this).prev().prev().children('div:first-child').toggleClass('description');
			
	
			PageVar = $(this).parent().parent().parent().attr('id');
			PageVar = PageVar.charAt(PageVar.length-1);
			limitVar = DescriptionVarOriginal[PageVar];
			if (limitVar.length > 500){
				limitVar = limitVar.substring(0,500);
				limitVar = limitVar+"...";
			};
			$(this).prev().prev().children('div:first-child').html(limitVar);
			//$('.description').html(limitVar1);	
			
			$(this).toggle();
			$(this).prev().toggle();
			$(this).next('.FacebookLike').toggle();
			$(this).next().next('.links').toggle();
			$(this).next().next().next('.eyecatcher').toggle();
		});
		
		
		
		
	   /*
	 
	   	$("#LogoBanner").delay(1000).animate({
  			"top": "-160px"
			}, 
			2000, function(){
				 $("#supersized1").animate({opacity: 1}, 2000);
			}
		);
*/
		//$("#container").animate({opacity: 0.30}, 2000);
	
		
		
		
		
		
		/*if (((BrowserDetect.browser=='Safari')||(BrowserDetect.browser=='Mozilla')||(BrowserDetect.browser=='Chrome')||(BrowserDetect.browser=='Firefox'))&&(BrowserDetect.OS!='iPhone/iPod')) {*/
			
		//if (((BrowserDetect.browser=='Safari')||(BrowserDetect.browser=='Chrome'))&&(BrowserDetect.OS!='iPhone/iPod')) {
		if ((BrowserDetect.browser=='Safari')&&(BrowserDetect.OS!='iPhone/iPod')) {
			
			//var menu3scollposition = $("#menu3").scrollTop();
			//$('#menu3').css( {backgroundPosition: "center center"} );
			
			//var page1position = $('#page1').position();
			//var page2position = $('#page2').position();
			//var page3position = $('#page3').position();
			//var page4position = $('#page4').position();
			//var page5position = $('#page5').position();
			//var page6position = $('#page6').position();
			//var page7position = $('#page7').position();
			var scollposition;
			
			
			/*
			var WindowHeight = $(window).height();
			$("#supersized2 img").css('top', WindowHeight/1.6 + 'px');

			$(window).bind("resize", resizeWindow);
			function resizeWindow( e ) {
				var newWindowHeight = $(window).height();
				$("#supersized2 img").css('top', newWindowHeight/1.6 + 'px');
			}
			*/
			function Scrollen()
			{
				var browserheight = $(window).height();
				if ($.browser.mozilla) {scollposition = $('body').scrollTop();}
				if ($.browser.webkit) {scollposition = $(window).scrollTop();}
				//Hoe hoger de *(x.x) Hoe lager de afbeelding komt te staan ... dus negatief is hoger
				//Dit zorgt voor de versnelling
				//Hoe lager de browserheight/x.x  hoe lager de afbeelding komt te staan
				$("#supersized1 img").css('margin-top', Math.round((scollposition)*(0.4)) + 'px');
				$("#supersized2 img").css('margin-top', Math.round((scollposition)*(0.8) + (browserheight/-1.3)) + 'px');
				//$("#supersized2b img").css('margin-top', Math.round((scollposition)*(0)  ) + 'px');
				$("#supersized3 img").css('margin-top', Math.round((scollposition)*(0.4) + (browserheight/-1.3)) + 'px');
				$("#supersized4 img").css('margin-top', Math.round((scollposition)*(0.2) + (browserheight/-1.7)) + 'px');
				$("#supersized5 img").css('margin-top', Math.round((scollposition)*(0.8) + (browserheight/-0.316)) + 'px');
			}
			
			if ($.browser.mozilla) {$('body').scroll(function () {var timer = setInterval(Scrollen,200);});}
			if ($.browser.webkit) {$(window).scroll(function () { Scrollen(); });}
		}
		
		
		
		//$('#supersized1 img, #supersized2 img, #supersized2b img, #supersized3 img, #supersized4 img, #supersized5 img, #supersized6 img, #supersized7 img').addClass('ImproveImageQuality');
		
		
		
		var ScrollenToVar
		function ScrollenTo(a) {
			//get the full url - like mysitecom/index.htm#home
			var full_url = a;
			//split the url by # and get the anchor target name - home in mysitecom/index.htm#home
			var parts = full_url.split("#");
			var trgt = parts[1];
			//get the top offset of the target anchor
			var target_offset = $("#"+trgt).offset();
			var target_top = target_offset.top;
			return target_top;
		}
		
		function Timer(){
			var t = setTimeout(HigherImageQuality,2000);
		}
		
		function HigherImageQuality() {
			$('.ReduceImageQuality').addClass('ImproveImageQuality');
			$('.ReduceImageQuality').removeClass('ReduceImageQuality');
			
		}
		
		function LowerImageQuality() {
			$('.ImproveImageQuality').addClass('ReduceImageQuality');
			$('.ImproveImageQuality').removeClass('ImproveImageQuality');
		}
		
		
		
		$(".scroll").click(function(event){
			LowerImageQuality();
			event.preventDefault();
			ScrollenToVar = ScrollenTo(this.href);
			$('body').animate({scrollTop:ScrollenToVar}, 2000);
			Timer();
		});
		

		
	
		
		/*
		
		
		/////////PRELOAD BEPAALDE IMAGES: gewoon aanvullen met de images die je wilt laden///////
		///////////////////////////////////////
		///////////////////////////////////////
		///////////////////////////////////////
		
		
		if (document.images) {
				img1 = new Image();
				img2 = new Image();
				img3 = new Image();
				img4 = new Image();
				img1.src = "./img/MainMenuHover.jpg";
				img2.src = "./img/MenuAccordionActiveMenu.jpg";
				img3.src = "./img/MenuAccordionHeaderHover.jpg";
				img4.src = "./img/icons/IconBgrdHover.png";
		}
		
		
		 ///////////////////////////////////////
		 ///////////////////////////////////////
		 ///////////////////////////////////////
		 ///////////////////////////////////////
		 
      */
	
		//////////VERTICAL PICTURE SCROLL/////////
		/////////////////////////////////////
		/////////////////////////////////////
		/////////////////////////////////////
		
		
		// make a <div> per 6 pictures
		// groepjes van 6 maken en dan een div errond wrappen
		for (var id = 1; id < 10; id++) {
			var wrap_container = "#collectie" + id +" .scrollable .items";
			$(wrap_container).each(function(){
					var allElements = $(this).children('.item');
					WRAP_BY = 6;		
					if (allElements.length<=6){
						allElements.wrapAll('<div/>');
						$(this).parent().prev('#actions').children().addClass('disabled');
					}
					else{
						for (var i = 0; i < allElements.length; i += WRAP_BY) {
							allElements.slice(i, i + WRAP_BY).wrapAll('<div/>');
						}
					}
			});
			
		}

		
		//VERTICAL PICTURES SCROLL
		$(".scrollable").scrollable({ vertical: true, mousewheel: false });
	



		// Buttons die de juiste collectie foto's openen
		// Dus de juiste Vertical pictures scroll tonen en de rest verbergen.
		for (var idclick = 1; idclick < 10; idclick++) {
			var collectie_btn = "#klikhiervoor" + idclick;
			$(collectie_btn).click(function(event){	
				for (var idclick2 = 1; idclick2 < 10; idclick2++) {
					var collectie_btn_all_but_target = "#collectie" + idclick2;
					$(collectie_btn_all_but_target).css('display', 'none');
				}
				//var collectie_btn_target = "#collectie" + idclick;
				//$(collectie_btn_target).css('display', 'block');
				var collectie_btn_target = $(this).attr('id');
				collectie_btn_target = collectie_btn_target.charAt(collectie_btn_target.length-1);
				collectie_btn_target = "#collectie" + collectie_btn_target;
				$(collectie_btn_target).css('display', 'block');
				return false;
			});
		}
		
		
		
		$("#formfield_2ce07b50-d135-49a7-967c-322232456875").click(function(){
			OpenTextAreaWindow('2ce07b50-d135-49a7-967c-322232456875','Boodschap');
			return false;
		});
			
			
			
			
		
		/*
		//REMEMBER MENU doormiddel van url//
			$("#menu ul li a").each(function(el) {
				var th = String($(this).attr("href"));
				var wh = String($(window).attr("location"));
				if(wh.toLowerCase().indexOf(th.toLowerCase())>-1){
					//als je class gebruikt ipv id
					$(".menuActive").removeClass("menuActive");
					$(this).addClass("menuActive");
					return false;
				}
							
			});
		*/
		
};





