
/*****Algemene functies*****/

function in_openNews(event){
	$(".test").css('height','auto');
	$(event+'> parent').css('background-color','#afe');
}

/**** Product_details photo zoom ****/
var minX;
var minY;
var maxX;
var maxY;
var width;
var offset;

function pd_photoZoomActions(){
	$('#product_detail .productFoto').mouseover(function(e) {
		$('.pd_photoZoomHover').remove();
		$('.pd_photoZoomTrans').remove();
		$('.pd_photoZoomPhoto').remove();
		$('.preLoadImage').remove();

		var offset= $('.productFoto').offset();
		
		//Set transperance div on photo for navigation
		$('body').append('<div class="pd_photoZoomTrans"></div>');
		$('.pd_photoZoomTrans').css({top:Math.round(offset.top)+'px',left:Math.round(offset.left)+'px'});
		
		//Set hover div to navigate
		$('body').append('<div class="pd_photoZoomHover"></div>');
		
		//Set new photo
		$('body').append('<div class="pd_photoZoomPhoto"></div>');
		$('.pd_photoZoomPhoto').css({top:Math.round(offset.top)+'px',left:(Math.round(offset.left+15)+$('.productFoto').width())+'px'});
		
		//Set low quality picture
		url = $('#product_detail .productFoto').css('background-image');
			
		if($.browser.msie && ($.browser.version == '7.0' || $.browser.version == '8.0')){//If browser is IE
			
		}else{
			//Load low quality picture
			$('.pd_photoZoomPhoto').css({'background-image': url});
		}
		
		
		//Strip url from low to high quality 
		newUrl = url.replace("/shop/", "/shop_480/").replace("gr.jpg", ".jpg");
		newUrlPreLoad = newUrl.replace('url(','').replace(')','').replace('"','');	
			
		//Preload hidden image
		$('body').append('<img style="display:none" class="preLoadImage" src="'+newUrlPreLoad+'" />');

		//Load high quality image
		$('.preLoadImage').load(function(response, status, xhr) {
			$('.pd_photoZoomPhoto').css({'background-image': newUrl});
		});
		
		//Show message when high quality is not available
		$('.preLoadImage').error(function(){
			$('.pd_photoZoomPhoto').html('<span class="noQuality">Geen hoge kwaliteit afbeelding beschikbaar.</span>');
			if($.browser.msie && ($.browser.version == '7.0' || $.browser.version == '8.0')){//If browser is IE
				newUrl = url.replace("/shop/", "/shop_ie/");
				$('.pd_photoZoomPhoto').css({'background-image': newUrl});
			}
		});

		
		
		//ake product information opacity
		$('.product_decription').css({opacity:'0.3'});
		
		//Set info for hover
		minX = Math.round(offset.left);
		minY = Math.round(offset.top);
		maxX = Math.round(offset.left)+$('.productFoto').width();
		maxY = Math.round(offset.top)+$('.productFoto').height();
		width = $('.pd_photoZoomHover').width()/2;
		offset= $('.productFoto').offset();
		
		//Set right picture and hover positions
		pd_photoZoomMove(e);
		
		$('.pd_photoZoomTrans').mouseout(function() {
			$('.pd_photoZoomTrans').unbind('mousemove');
			$('.pd_photoZoomHover').remove();
			$('.pd_photoZoomTrans').remove();
			$('.pd_photoZoomPhoto').remove();
			$('.preLoadImage').remove();
			$('.product_decription').css({opacity:'1.0'});
		});
		
		$('.pd_photoZoomTrans').mousemove(function(e) {
			pd_photoZoomMove(e);
			//$('#sidebar').html('muisX:'+e.pageX+'muisY:'+e.pageY);
		});

	});	
}

function pd_photoZoomMove(e){
	var	posX = e.pageX-width;
	var posY = e.pageY-width;
	var photoX = (e.pageX-minX-width)*2;
	var photoY = (e.pageY-minY-width)*2;
		//alert(e.pageX);
	
	if(e.pageX<(minX+width)){
		posX = minX;
		photoX = 0;
	}else if(e.pageX>(maxX-width)){
		posX = maxX-($('.pd_photoZoomHover').width());
		photoX = 240;
	}

	if(e.pageY<(minY+width)){
		posY = minY;
		photoY = 0;
		
	}else if(e.pageY>(maxY-width)){
		posY = maxY-($('.pd_photoZoomHover').width());
		photoY = 240;
	}
	
	$('.pd_photoZoomHover').css({top:(posY), left:(posX)});//Center Hover div
	$('.pd_photoZoomPhoto').css({'background-position':(-photoX)+'px '+(-photoY)+'px'});//Center Hover div
	//$('#sidebar').html('muisX:'+e.pageX+'muisY:'+e.pageY+'minX:'+minX+' maxX:'+maxX+'photoX:'+photoX);//Center Hover div
	
}


/*****Side slide function*****/
jQuery.fn.sideSlide = function(options) {
   	var s = jQuery.extend({
     	container: "#container", 
		margin: 10,
		zindex:999
   	}, options);
	
	//Bevat container waarbinnen het object zich mag bewegen
	var container = {
		name:s.container,
		pos:$(s.container).position()
	};
	
	//Bevat het te bewegen object
	var object = {
		name:this,
		pos:this.position()
	};
		
	moveObject();
	$(window).bind('scroll resize', function() {
		moveObject();
	});
	
	function moveObject(){
		var sP 	= $(window).scrollTop();
		var oby = ($(object.name).height()+s.margin);
		var cby = ($(container.name).height()+container.pos.top);
		
		if(sP>=(object.pos.top-s.margin) && $(window).height()>oby){
			//Als object niet meer zichtbaar is vanaf begin, dan zet hem vast
			if(cby > (sP+s.margin+oby)){
				//Als object niet via onderkant uit container behoud positie
				cssTop = s.margin;
			}else{
				//Als object via onderkant uit container berekenen nieuwe positie
				cssTop = (s.margin-(sP+s.margin+oby-cby));
			}
			$(object.name).css({position:'fixed',top:cssTop, 'z-index':s.zindex});
		}else{
			//Als object zichtbaar is vanuit begin positie dit zo laten
			$(object.name).css({position:'static'});
		}
	}
 };

/*****Zoeken trefwoord*****/
function zt_setSumbit(page){
	var trefwoord = $("#zoeken_trefwoord input[type=text]").val();
	
	trefwoord = trefwoord.replace(/'/g,' ');
	trefwoord = trefwoord.replace(/"/g,' ');
	trefwoord = trefwoord.replace(/\//g,' ');
	trefwoord = trefwoord.replace(/ /g,'+');
	
	if(page){var extra = '/'+page+'/'; }else{var extra = '';}
	$('#form_zoeken_trefwoord').get(0).setAttribute('action', extra+'#!/zoeken-op-trefwoord/'+trefwoord+'/');
}

function zt_trefwoordActions(){
	$("#zoeken_trefwoord input[type=text]").autoSuggest("/include_shop/ajax_searchsuggest.php", {
		minChars: 2, 
		matchCase: false,
		resultsHighlight: false,
		keyDelay:400,
		startText: '',
		emptyText: 'Geen resultaten',
		formatList: function(data, elem){
			var my_image = data.image;
			var my_info = data.value;
			var my_cleanurl = data.cleanurl;
			var my_type = data.type;
			if(my_type!=='extra'){
				var new_elem = elem.html("<img src='"+my_image+"'><span id='search_"+my_cleanurl+"'>"+my_info+'</span>');
			}else{
				var new_elem = elem.html("<span id='search_"+my_cleanurl+"'>"+my_info+"</span>");
			}
			return new_elem;
		},
		resultClick: function(data){
			var redirect = $("span", this).attr('id').replace('search_','');
			$('#zoeken_trefwoord .as-selection-item').remove();
			window.location.href = "/"+redirect+"/";
		}
	});
}

function zt_trefwoordHash(){
		var hashTag = window.location.hash; //Hastag ophalen
		var isFilter= hashTag.split('/');   //Hastag opdelen
		var hashTag = '#!/'+isFilter[1]+'/'+isFilter[2]
		if(isFilter[1]=='zoeken-op-trefwoord'){		//Controleren of het om een zoekfilter gaat
			$('#assortiment ul').css({opacity:'0.5'}); //content licht gekleurd tonen, als 'non-actief'
			
			var zoekCriteria = isFilter[2].split('+'); //zoekcriteria opsplitsen op de +
			if(isFilter[2]!==''){
				/*Tonen zoekcriteria*/
				var gezochtOp = ('<h2>Zoeken op trefwoord</h2><p>Er is gezocht op de volgende woorden:</p><span id="filter_gezocht">'); 
				
				$.each(zoekCriteria, function(key, woord) { 
						gezochtOp = gezochtOp+'<a class="actief" title="Klik om zoekcriteria te verwijderen" rel="'+woord+'">'+woord+'</a>';
						
					});
				
				gezochtOp = gezochtOp+'</span>';
				
				
				$('#zoeken_specifiek').html(gezochtOp);
				$('#zoeken_specifiek a').click(function(){
					var newUrl='#!/zoeken-op-trefwoord/';
					var current = $('#zoeken_specifiek a').index($(this));
					var i = 0;
					$.each(zoekCriteria, function(key, woord){
						if(key!==current){
							if(i>0){
								newUrl+='+';
							}
							newUrl += woord;
							i++;
						}	
					});
					window.location.hash = newUrl ;
				});
			}else{
				$('#zoeken_specifiek').html('');
			}
			
				
			/*AJAX Request*/ //id gegevens genereren en weg filteren opties
			$.post("/include_shop/inc_ajax.php", { //Bij succes herlaad het assortiment
				  ajaxStandard:true,
				  'zoekCriteria':zoekCriteria,
				  ajaxPhp: "$_SESSION['productFilter']['hash']='"+hashTag+"';",
				  ajaxPage: "ajax_searchtrefwoord.php"
			},
			function(data){
				if(isFilter[3]==undefined || isFilter[3]==''){
					isFilter[3]=1;
				}
				$.post("/include_shop/inc_ajax.php", { //Bij succes herlaad het assortiment
					 ajaxStandard:true,
					 ajaxPhp: "$_SESSION['productFilter']['pagenr']="+isFilter[3]+";",
					 trefwoord: zoekCriteria,
					 ajaxPage: "pr.php"
				},
				function(data){
					$('#assortiment').html(data); //Werkt alleen wanneer #assortiment element bestaat
					$("#holder").jHeights(); //Hersteld hoogte van website
					$('#assortiment ul').css({opacity:'1.0'}); //content kleur terug geven
				});	
			});
		}
}

/*****Weergave functies*****/


function wg_productAantal(){
	$('#productAantallen a').click(function() {					
		var aantal = $(this).html();	
		$('#assortiment ul').css({opacity:'0.5'});
		$.post("/include_shop/inc_ajax.php", { //Sla weergave aantal op in session
			  ajaxPage: "f_weergave.php", 
			  ajaxFunction: 'weergave_productAantal('+aantal+',true);' 
			}, 
		   	function(data){ 
				$.post("/include_shop/inc_ajax.php", { //Bij succes herlaad het assortiment
					ajaxStandard:true,
					ajaxPhp: '$_SESSION["productFilter"]["pagenr"] = 1;',
					ajaxPage: "pr.php"
				},
				function(data){
					$('#assortiment').html(data); //Werkt alleen wanneer #assortiment element bestaat
					$("#holder").jHeights(); //Hersteld hoogte van website
					$('#assortiment ul').css({opacity:'1.0'});
				});
		   	});
		
		//Weergave betreffende aantal op class='actief' zetten
		$('#productAantallen a').removeClass('actief');									
		$(this).addClass('actief');	
	});
}


/*****Zoeken specifiek functies*****/

//Functies / knoppen / verbonden aan zoekfilter
function zs_filterActions(){
	$('#zoeken_specifiek nav li').click(function() { //Open filter scherm
		if(!$(this).hasClass("actief2")){
			$('#zoeken_specifiek > ul > li').removeClass("actief2");
			$('#zoeken_specifiek nav li').removeClass("actief2");
			$('#'+$(this).attr('name')).addClass("actief2");
			$(this).addClass("actief2");
			
			//Instellen juiste session voor weergave
			var id = $(this).attr('name').replace("filter_", ""); //Haal nummer van filter op
						
			$.post("/include_shop/inc_ajax.php", { 
				   ajaxPage: 		"f_weergave.php", 
				   ajaxFunction: 	'weergave_zoekfilter('+id+',true);' 
			});
		}else{
			$('#zoeken_specifiek > ul > li').removeClass("actief2");
			$('#zoeken_specifiek nav li').removeClass("actief2");
			$.post("/include_shop/inc_ajax.php", { 
			   ajaxPage: 		"f_weergave.php", 
			   ajaxFunction: 	'weergave_zoekfilter(10,true);' //schrijft session naar niet bestaande waarde, hierdoor blijft het scherm uit
			});
		}
		
		
	});
	
	$('#zoeken_specifiek input').change(function(){
		zs_setFilterHash();
	});
		
	$('#zoeken_specifiek li li').click(function(){ //Zorg dat hele LI element clickable wordt voor toggle
		if ($('input',this).attr("checked")) {
      		$('input',this).attr('checked', false);
   		}else{
			$('input',this).attr('checked', true);	
		}
		zs_setFilterHash();
	});
}


//Bouw hashtag op voor zoekcriteria
function zs_setFilterHash(){
	var searchInfo ="#!/zoekfilter/";
		var $i=0;
		$('#filter input:checked').each(function(index) {
				if($i>0){
					searchInfo = searchInfo + '+'
				}
				searchInfo = searchInfo + $(this).val();
				$i++;
		});	
		window.location.hash = searchInfo;
}

/*
	Dubbele woorden gevonden bij filter systeem: 'mix', 'schelp', 'transparant', 'glit-lined', 'zilverlined'
	dit zorgt voor fouten bij het zoeken
*/

function zs_filterHash(){ //wanneer hashtag wijzigd voer onderstaande script uit
	$(window).bind( 'hashchange', function( event ) {
		var hashTag = window.location.hash; //Hastag ophalen
		var isFilter= hashTag.split('/');   //Hastag opdelen
		var hashTag = '#!/'+isFilter[1]+'/'+isFilter[2]
		if(isFilter[1]=='zoekfilter'){		//Controleren of het om een zoekfilter gaat
			$('#assortiment ul').css({opacity:'0.5'}); //content licht gekleurd tonen, als 'non-actief'
			
			var zoekCriteria = isFilter[2].split('+'); //zoekcriteria opsplitsen op de +
			var gezochtOp = '';
			$('#filter li li').removeClass('actief'); //Overal de 'actief' verwijderen zodat hij vervolgens op de juiste plekken weer aangezet wordt
			$('#filter li li input').attr('checked', false); //Overal input verwijderen i.v.m. bug van teveel boxen gevinkt bij refresh


			if(isFilter[2]!==''){//als er zoekinhoud is
				/*WEERGAVE zoekfilter section*/
				$.each(zoekCriteria, function(key, woord) { 
					//Heractiveer checkbox wanneer nodig
					$('#filter_'+woord).attr('checked', true);
					$('#filter_'+woord).parent().addClass('actief');

					//Haal juiste naam op
					var title = $('#filter_'+woord).attr('title');
					//Creeer 'gezocht op string'
					if(key>0){
						gezochtOp = gezochtOp+' ';
					}
					gezochtOp = gezochtOp+'<a class="actief" title="Klik om zoekcriteria te verwijderen" rel="'+woord+'">'+title+' &nbsp;&times;</a>';
					
				});
				$('#filter_gezocht_holder').css({visibility:'visible'});
			}else{
				/*WEERGAVE*/
				$('#filter_gezocht_holder').css({visibility:'hidden'});
				var hashTag = ''; //Hastag ophalen
			}
			
			//Toon zoek criteria
			$('#filter_gezocht').html(gezochtOp);
			
			//Maak 'zoek' items clickable, bij click worden ze verwijderd
			$('#filter_gezocht a').bind('click',function(){
				$('#filter_'+$(this).attr('rel')).attr('checked',false);
				zs_setFilterHash();									 
			});
			
			
			/***1 DEEP AJAX***/ //Sessions opnieuw instellen voordat er een actie ondernomen wordt
			var url = window.location.pathname; //Hastag ophalen
			var urlSections= url.split('/');   //Hastag opdelen
			for(i=1;i<=4;i++){
				if(urlSections[i]==undefined || urlSections[i]==''){
					urlSections[i] = false;
				}
			};
			$.get("/include_shop/inc_ajax.php", { //Bij succes herlaad het assortiment
							 ajaxStandard:true,
							  page:urlSections[1],
							  category:urlSections[2],
							  subcategory:urlSections[3],
							  para1:urlSections[4]
			}, function (data){
				
				
				/***2 DEEP AJAX***/ //id gegevens genereren en weg filteren opties
				
				$.post("/include_shop/inc_ajax.php", { //Bij succes herlaad het assortiment
					 ajaxStandard:true,
					  'zoekCriteria':zoekCriteria,
					  ajaxPhp: "$_SESSION['productFilter']['hash']='"+hashTag+"';",
					  ajaxPage: "ajax_searchfilter.php"
				},
				function(data){
					
					
					/***3 DEEP AJAX***/
					
					$('#filter > li > ul > li').css({opacity:'0.3', cursor:'default'});
					$('#filter > li > ul > li').unbind('click');
					$.each(data, function(key, val) {
						$('#filter_'+val['cleanurl']).parent().css({opacity:'1.0',cursor:'pointer'});
						$('#filter_'+val['cleanurl']).parent().click(function(){ //Zorg dat hele LI element clickable wordt voor toggle
							if ($('#filter_'+val['cleanurl']).attr("checked")) {
								$('#filter_'+val['cleanurl']).attr('checked', false);
							}else{
								$('#filter_'+val['cleanurl']).attr('checked', true);	
							}
							zs_setFilterHash();
						});
					});
					
					if(isFilter[3]==undefined || isFilter[3]==''){
						isFilter[3]=1;
					}
					/*Herladen producten pagina*/
					$.post("/include_shop/inc_ajax.php", { //Bij succes herlaad het assortiment
						 ajaxStandard:true,
						  ajaxPhp: "$_SESSION['productFilter']['pagenr']="+isFilter[3]+";",
						  ajaxPage: "pr.php"
					},
					function(data){
						$('#assortiment').html(data); //Werkt alleen wanneer #assortiment element bestaat
						$("#holder").jHeights(); //Hersteld hoogte van website
						$('#assortiment ul').css({opacity:'1.0'}); //content kleur terug geven
					});	
				});
			});
		}else if(isFilter[1]=='zoeken-op-trefwoord'){ //Als zoeken op trefwoord roep deze functie aan
			zt_trefwoordHash();
		}
    });

    $(window).trigger("hashchange");
}

//Reset zoek criteria filter
function zs_resetFilter(){
	$('#filter input:checked').each(function(index) {
		$(this).attr('checked',false);
	});	
	zs_setFilterHash();
}





/*****Winkelwagen functies*****/

function ww_openPage(page){
	$.post('/include_shop/inc_ajax.php?winkelmand_pag='+page, { //Sla weergave aantal op in session
			  	'ajaxInclude[]':(['general.php']), 
				ajaxPage: "inc_winkelwagen_small.php"
				},   	
				function(data){
					$('#winkelmandje').html(data);
					$("#holder").jHeights();//Hoogte herstellen van website
	});
}

function ww_addProduct(product_id,event){
	var newUrl = $('#'+product_id).serialize();
	$.post("/include_shop/inc_ajax.php?changetype=add&"+newUrl, { //Sla weergave aantal op in session
			  	'ajaxInclude[]':(['general.php']), 
				ajaxPage: "inc_winkelwagen_small.php"
				},   	
				function(data){
					$('#winkelmandje').html(data);
	 				ww_popup(event,newUrl);	//Laat pop up zien
					$("#holder").jHeights();//Hoogte herstellen van website
	});
	
}

function ww_addProductPlus(product_id, event){
	var newUrl = $('#'+product_id).serialize();
	var error = false
	if($('#aantal_1').val() == '' || $('#aantal_1').val() == undefined){
		if($('#aantal_2').val() == '' || $('#aantal_2').val() == undefined){
			if($('#aantal_3').val() == ''  || $('#aantal_3').val() == undefined){
				if($('#aantal_4').val() == ''  || $('#aantal_4').val() == undefined){
					if($('#aantal_5').val() == ''  || $('#aantal_5').val() == undefined){
						alert('U moet minimaal 1 aantal invoeren voordat u het artikel kunt toevoegen aan uw winkelmandje.');
						error= true;
					}
				}
			}
		}
	}
	if(error==false){
			$.post("/include_shop/inc_ajax.php?changetype=add&"+newUrl, { //Sla weergave aantal op in session
			  		'ajaxInclude[]':(['general.php']), 
					ajaxPage: "inc_winkelwagen_small.php"
				},   	
				function(data){
					$('#winkelmandje').html(data);
					ww_popup(event,newUrl);	//Laat pop up zien
					$("#holder").jHeights();//Hoogte herstellen van website
				});
			$('#aantal_1').val('');
			$('#aantal_2').val('');
			$('#aantal_3').val('');
			$('#aantal_4').val('');
			$('#aantal_5').val('');
	}
}

function ww_popup(event, newUrl){
	var positions = $(event).offset();
	
	$.post("/include_shop/inc_ajax.php?"+newUrl, { //Sla weergave aantal op in session
			  	'ajaxInclude[]':(['general.php']), 
				ajaxPage: "../js/winkelwagen/getProductInfo.php"
			},   	
			function(info){
				var info = info.split('#');
				if(info[0]==1){
					$('body').append($('<div>'+info[1]+'</div>')
						.css({ left: positions.left, top: positions.top})
						.addClass("ww_popup")
					);
					var e = $('.ww_popup'); 
				}else{
					$('body').append($('<div>'+info[1]+'</div>')
						.css({ left: positions.left, top: positions.top})
						.addClass("ww_popup_big")
					);		
					var e = $('.ww_popup_big'); 
				}			
				e.queue(function(){ 
					setTimeout(function(){ 
						e.dequeue();
						if($.browser.msie){
							e.remove();
						}
					}, 2000 ); 
				});
				e.fadeOut(500, function() { 
					$(this).remove(); 
				});
			}
		);
}

function ww_checkInput(event,e,type){
	if ( event.keyCode !== 46 && event.keyCode !== 8 && event.keyCode !== 37 && event.keyCode !== 39 && event.keyCode !== 9) {//left, right, tab, del, backspace
		if (event.keyCode < 95){
			if (event.keyCode < 48 || event.keyCode > 57 ) {//if not numbers
				if(event.preventDefault){
					event.preventDefault();
				}else{
					event.returnValue = false; 
				}
			}
		} else {
			if (event.keyCode < 96 || event.keyCode > 105 ) {
				if(event.preventDefault){
					event.preventDefault();
				}else{
					event.returnValue = false; 
				}
			}
		}
	}
  	if(type=='groot' && event.keyCode == 13){
		$('#wwUpdate').trigger('click');
	}else if(event.keyCode == 13){
		$('.button_winkelwagen').trigger('click');
   	}
}

function ww_addAllProduct(){
	$.post("/include_shop/inc_ajax.php?changetype=add_verlanglijst", { //Sla weergave aantal op in session
			  		'ajaxInclude[]':(['general.php']), 
					ajaxPage: "inc_winkelwagen_small.php"
				},   	
				function(data){
					$('#winkelmandje').html(data);
					alert('Uw verlanglijstje is toegevoegd aan uw winkelwagen');
					$("#holder").jHeights();//Hoogte herstellen van website
				});
}


function ww_changeLayout(number,type){
	$('#wwGroot').toggleClass('wwLayout'+number,type);
	$.post("/include_shop/inc_ajax.php?type=add_verlanglijst", { //Sla weergave aantal op in session
			  		'ajaxInclude[]':(['general.php'],['f_weergave.php']),
					"ajaxFunction": "weergave_setLayout("+type+");"
				},   	
				function(data){
				});
	
	if(type==true){
		$("#wwLayout1").css('opacity','0.6');
		$("#wwLayout2").css('opacity','1.0');
	}else{
		$("#wwLayout1").css('opacity','1.0');
		$("#wwLayout2").css('opacity','0.6');
	}
	$("#holder").jHeights();//Hoogte herstellen van website
}

function ww_delProduct(newUrl){
	/*$('#winkelmandje').load('include_shop/inc_winkelwagen_small.php?'+newUrl);*/
	
	$.post("/include_shop/inc_ajax.php?changetype=add&"+newUrl, { //Sla weergave aantal op in session
			  		'ajaxInclude[]':(['general.php']), 
					ajaxPage: "inc_winkelwagen_small.php"
				},   	
				function(data){
					$('#winkelmandje').html(data);
				});
}




/*****Verlanglijstje functies*****/

function vl_addProduct(product_id,redirect,event){
	$.post('/include_shop/inc_ajax.php?changetypeSmall=add&p_id='+product_id+'&redirect='+redirect, { //Sla weergave aantal op in session
			  		ajaxStandard:true, 
					ajaxPage: "inc_verlanglijst_small.php"
				},   	
				function(data){
					$('#verlanglijstje').html(data);
					vl_popup(event);	//Laat pop up zien
					$("#holder").jHeights();//Hoogte herstellen van website
				});
}

function vl_delProduct(product_id){
	$.post('/include_shop/inc_ajax.php?changetypeSmall=delete&p_id='+product_id, { //Sla weergave aantal op in session
			  		ajaxStandard:true, 
					ajaxPage: "inc_verlanglijst_small.php"
				},   	
				function(data){
					$('#verlanglijstje').html(data);
					$("#holder").jHeights();//Hoogte herstellen van website
				});
}

function vl_popup(event){
	var info = 'Toegevoegd aan verlanglijstje';
	var positions = $(event).offset();
	$('body').append($('<div>'+info+'</div>')
		.css({ left: positions.left, top: positions.top})
		.addClass("vl_popup")
	);
	var e = $('.vl_popup'); 
	e.queue(function(){ 
		setTimeout(function(){ 
			e.dequeue();
			if($.browser.msie){
				e.remove();
			}
		}, 2000 ); 
	});
	e.fadeOut(500, function() { 
		$(this).remove(); 
	});
}
