$(document).ready(function () {

	/*var firstitem = $('.innerwrap .contentfifth').first();
	var firstitemhtml = $(firstitem).html();
	$(firstitem).remove();
	
	
	$('#content .contentfifth').last().removeClass('contentlast');
	
	$('#content .contentfifth').last().after('<div class="contentitem contentfifth contentlast">' + firstitemhtml + '</div>');*/
	
	//$('#content .contentfifth').last().addClass('contentlast');
	
	var setfontsize = $.cookie("fontsize");
	
	if (setfontsize == 's') { $('body').css({ 'fontSize' : '13px' }); }
	if (setfontsize == 'm') { $('body').css({ 'fontSize' : '15px' }); }
	if (setfontsize == 'l') { $('body').css({ 'fontSize' : '18px' }); }
	
	
	$('#slidercontent').cycle({
		fx: 'scrollLeft',
	    timeout: 6000,
	    pager:  '#sliderindicator',
	    pause:   1
	});
	
	
	function resetItemHeight(){
		var maxitemheight = 0;
		$('.contentfifth').each(function (){
			var curheight = $(this).height();
			if(curheight > maxitemheight){ maxitemheight = curheight; }
		});
		$('.contentfifth').css({ 'height' : maxitemheight + 'px' });
	}
	
	resetItemHeight();
	
	$('#textsize a#size_s').click(function(){ $('body').css({ 'fontSize' : '13px' }); $.cookie('fontsize', 's'); resetItemHeight(); });
	
	$('#textsize a#size_m').click(function(){ $('body').css({ 'fontSize' : '15px' }); $.cookie('fontsize', 'm'); resetItemHeight(); });
	
	$('#textsize a#size_l').click(function(){ $('body').css({ 'fontSize' : '18px' }); $.cookie('fontsize', 'l'); resetItemHeight(); });
	
	$('.contentfifth').find('a').each(function(){
		if($(this).attr('href') == 'http://www.foodconnect.nl/uw-maaltijd/gezonde-voeding'){
			
			$(this).attr('href', '#');
			if($(this).html() == 'Lees verder »'){ $(this).remove(); }
			//$(this).remove();
		}
		
	});
	$('#submenu').find('a').each(function(){
		if($(this).attr('href') == 'http://www.foodconnect.nl/uw-maaltijd/gezonde-voeding'){
			$(this).attr('href', 'http://winkel.foodconnect.nl');
		}
	});
	
	shopchoiceContent = '<a href="http://178.22.57.38/FoodConnect/login.aspx?lnkMenu=Koelvers&Groep=comp" title="Koelvers zelf samenstellen"><img src="/wp-content/themes/foodconnect/images/content/snelkeuze01.jpg" alt="" /></a><a href="http://178.22.57.38/FoodConnect/login.aspx?lnkMenu=Koelvers&Groep=menu" title="Koelvers menukeuze"><img src="/wp-content/themes/foodconnect/images/content/snelkeuze02.jpg" alt="" /></a><a href="http://178.22.57.38/FoodConnect/Vriesvers/frmVriesvers.aspx" title="Vriesvers menukeuze"><img src="/wp-content/themes/foodconnect/images/content/snelkeuze03.jpg" alt="" /></a>';
		
	$('#shopchoice').fancybox({
		'autoDimensions' : false,
		'width' : 622,
		'height' : 260,
		'content' : shopchoiceContent,
		'overlayColor' : '#000',
		'titleShow' : false
	});
	
	
});
