

$(function(initial) {
	
	//We have turned on Javascript
	$('body').addClass('js');	    
	
		 		    	
	//workaround for IE6 multi classes button bug
	if( jQuery.browser.msie && (jQuery.browser.version <= 6) ){					
		 //nothing to see here people: movin' on
	}
		
	if(!$('.photoLarge img').length > 0 ){
    	$(".photoLarge").hide();   	
    } 
    
    
   
    /* Make sitemap equal height */
    
   var sitemapHeight = ($("#position5").height() -20) ;
    $("#sitemap .sitemapColumn").height(sitemapHeight);
    
    
    	    
    //promoTab
      $("#promoTab").tabs();

	var title ="";

    //medewerker
     $(".employee h3").each(function (i) {
          
       title = $(this).text(); 
      	
      	if (title == 0){
      	$(this).parents("div:first").hide();
      	}
      
  
        
      });

    
    
    //search function
	 $('#search input, #searchProduct input').focus(function(){
         var defaultText = $(this).val();
         $(this).val('');

         $("#search input, #searchProduct input").blur( function () {
         var userInput = $(this).val();

                 if (userInput == ''){
                        $(this).val(defaultText);
                 }
         });



});

		
    
    
    //tell a friend popup
   	$('a.tellafriend').nyroModal({bgColor: '#000000', resizeable: true, autoSizable: true,   minHeight: 700 }); 
      
        
    GoogleMapsLoader();
	
	
});	





		
$(function(accoridon) { 		
	
	
	$('div.accordion:eq(0)> div').hide(); 
	$("div.accordion:eq(0)> h3").click(function()
		{
			$(this).addClass("arrow_down");
  			$(this).next("div").slideToggle(300).siblings("div").slideUp(300);
  			$(this).siblings().removeClass("arrow_down");
		});


	/*
	$('div.accordion:eq(0)> div').hide();  
	$('div.accordion:eq(0)> h3').click(function() {
	   

	    $(this).toggleClass("arrow_down");
	  
		$(this).next().slideToggle('fast');
	 });*/
		
});		


$(function(accoridon) { 

		
	$('div.accordion2:eq(0)> div').hide(); 
	$("div.accordion2:eq(0)> h3").click(function()
		{
  			$(this).addClass("arrow_down");
  			$(this).next("div").slideToggle(300).siblings("div").slideUp(300);
  			$(this).siblings().removeClass("arrow_down");
		});
	 
	
		
});		


/*
	
 $(function(viewSelector) {  
      
       $('select#viewSelector').change(function () {
       
        	var QueryString = document.location.search;
			var QueryMatch = new RegExp("collectionType=(text|image)", "gi");
		
			QueryString = QueryString.substr(1, QueryString.length);
			QueryString = QueryString.replace(QueryMatch, '');
				
			var DocLocation = String(document.location);
			DocLocation = DocLocation.split('?');
			DocLocation = DocLocation[0];
		
			
			var DocumentURL = DocLocation + '?collectionType=' + $('#viewSelector').val();
			
			if (QueryString != '') {
				DocumentURL += '&' + QueryString;
			}
		
		document.location = DocumentURL;    	

	})
	
});	


*/

/*

 $(function(crossSelling) {  
      

  if ( $(".promobarLR").length > 0 ) {
		$("#position4 .productCollection:gt(3)").hide();
	}

  if ( $(".promobarL").length > 0  || $(".promobarR").length > 0) {
		$("#position4 .productCollection:gt(4)").hide();
	}
	
  if ( $(".promobarNO").length > 0 ) {
		$("#position4 .productCollection:gt(5)").hide();
	}  
	
});	


*/


 $(function(paginationList) {  	
	var SelPagination = document.getElementsByName('paginationList');
	
	for (var i = 0; i < SelPagination.length; i++) {
		
		if (typeof attachEvent != 'undefined') {
			//ie only	
			SelPagination[i].onchange = function() {
				document.location = this.value;
			}
		} else {
			SelPagination[i].addEventListener('change', function() {
				document.location = String(this.value);
			}, true);
		}		
		
	}
	
});	




	
/*

 $(function(contact) { 
	//DYNAMIC CONTENT FOR PRODUCTLAYOUT				
	//hide all message_body the first one
	
	$(".dynamicContent_list .dynamicContent_body").hide();
	
			
	$(".dynamicContent_head").append('<div class="read_more">Lees meer</div>');			
	
	//toggle message_body
	
	$(".dynamicContent_head").click(function(){						
		if ($(this).find(".read_more").is(":hidden")) {					   
			$(this).find(".read_more").show();			
				$(this).next(".dynamicContent_body").slideToggle(700,function(){					
					$.scrollTo('.dynamicContent_head', {offset: {top: 0}, duration: 700})					
				});			
		
		} else {		
			
				$(this).next(".dynamicContent_body").slideToggle(700,function(){					
					$.scrollTo('.dynamicContent_head', {offset: {top: 0}, duration: 700})
				});
			
			$(this).find(".read_more").hide();
		
		}	
					
	});		  

	//CONTACT FORM	
	//scroll to and open contactContainer
   $(".openContact_form").click(function(){
		$("#contactContainer").show();
		$.scrollTo("#contactContainer", {offset: {top: 0}, duration: 600});				
		$(this).hide();
		return false;
	});

});
		
	*/	
		
 $(function(collections) {  
	//SCROLLCOLLECTION
	//makes the whole div clickable 
	$(".productScrollCollection").click(function() {
		window.location = $(this).find("h2:first a:first").attr("href");  				  				
	});
	
	
	//COLLECTION
	//makes the whole div clickable
	$(".productCollection").click(function() {
		window.location = $(this).find("h2:first a:first").attr("href");
			
	});
});	



/* ###	SHOPPINGCARD ANIMATION ######################################################################## */
/*

$(function(shoppingCart) { 
	//$("#alterAfleveradres").animate({"opacity": "0"}, "fast");
	

 	$("#delivery_Address-yes").click(function(){
		$("#alterAfleveradres").hide("slow");
		$("#clientH3").text("Uw gegevens");

    });

    $("#delivery_Address-no").click(function(){
		$("#alterAfleveradres").show("slow");
		$("#clientH3").text("Uw factuuradres");
    });
	
	
	
});	

*/

	$.fn.deserialize = function(d,config) {
		var data= d;
		me  = this;
	
		if (d === undefined) {
			return me;
		}
	
		config = $.extend({ isPHPnaming	: false,
							overwrite	: true},config);
		
		// check if data is an array, and convert to hash, converting multiple entries of 
		// same name to an array
		if (d.constructor == Array)	{
		alert(999);
			data={};
			for(var i=0; i<d.length; i++) {
				if (typeof data[d[i].name] != 'undefined') {
					if (data[d[i].name].constructor!= Array) {
						data[d[i].name]=[data[d[i].name],d[i].value];
					} else {
						data[d[i].name].push(d[i].value);
					}
				} else {
					data[d[i].name]=d[i].value;
				}
			}
		}
	
		// now data is a hash. insert each parameter into the form
		$('input,select,textarea',me)
		.each(function() {
				  var p=this.name;
				  var v = [];
				  
				  // handle wierd PHP names if required
				  if (config.isPHPnaming) {
					  p=p.replace(/\[\]$/,'');
				  }
				  if(p && data[p] != undefined) {
					  v = data[p].constructor == Array ? data[p] : [data[p]];
				  }
				  // Additional parameter overwrite
				  if (config.overwrite === true || data[p]) {
					  switch(this.type || this.tagName.toLowerCase()) {
					  case "radio":
					  case "checkbox":
						  this.checked=false;
						  for(var i=0;i<v.length;i++) {
							  this.checked|=(this.value!='' && v[i]==this.value);
						  }
						  break;
					  case "select-multiple" || "select":
						  for( i=0;i<this.options.length;i++) {
							  this.options[i].selected=false;
							  for(var j=0;j<v.length;j++) {
								  this.options[i].selected|=(this.options[i].value!='' && this.options[i].value==v[j]);
							  }
						  }
						  break;
					  case "button":
					  case "submit":
						  this.value=v.length>0?v.join(','):this.value;
							  break;
					  default:
						  this.value=v.join(',');
					  }
				  }
			  });
		return me;
	};
	
	
	function deSerializeData(serializeArray) {
		
		data = Array();
		for(var i=0; i<serializeArray.length; i++) {
			
			alert(serializeArray[i].value + '---' + serializeArray[i].value);
			/*
			if (typeof data[serializeArray[i].name] != 'undefined') {
				if (data[serializeArray[i].name].constructor!= Array) {
					data[serializeArray[i].name]=[data[serializeArray[i].name],serializeArray[i].value];
				} else {
					data[serializeArray[i].name].push(serializeArray[i].value);
				}
			} else {
				data[serializeArray[i].name]=serializeArray[i].value;
			}*/
		}
	
		return data;
	
	}

	
	

	




