$(document).ready(function() {
    $('#sfeerimg').cycle({
		fx: 'fade',
		speed:    2000, 
    	timeout:  2000 
	});

	$('.stnd').blur(function() {
		if($(this).val()==''){
			$(this).val($(this).attr('alt'));
		}
	});
	$('.stnd').focus(function() {
		if($(this).val()==$(this).attr('alt')){
			$(this).val('');
		}
	});
	$('.stnd').each(function(){
		if($(this).val()==''){
			$(this).val($(this).attr('alt'));
		}
	});

	$("#keyword").keypress(function (e) {
		if (e.which == 13) {
		   window.location=url+'shop/0/'+$('#keyword').val();
		}
	});
	
	if($(".popup")){
	  $(".popup").fancybox({
			'overlayShow':	true,
			'overlayOpacity':0.5,
			'zoomSpeedIn':	300, 
			'zoomSpeedOut':	0
	  });
	}

});

function logout(){
	$.post('../controller/logout.php', function(){
		window.location='checkout';
	});
}

function show_bankkeuze(val){
	if(val==1){
		$('#ideal').show();
	} else {
		$('#ideal').hide();
	}
}

function friendly_url_encode(tekst){
	tekst = tekst.toLowerCase();
	tekst = tekst.replace(/%/g, '');
	tekst = tekst.replace(/ &amp; /g, '-en-');
	tekst = tekst.replace(/&amp;/g, '-en-');
	tekst = tekst.replace(/ & /g, '-en-');
	tekst = tekst.replace(/&/g, '-en-');
	tekst = tekst.replace(/ \/ /g, '\\');
	tekst = tekst.replace(/\//g, '\\');
	tekst = tekst.replace(/ /g, '-');
	return(tekst);
}

function submitZoek(f)
{
	f.action = f.action + friendly_url_encode($('#keyword').val());
}

