jQuery(function($) {
	// MENU
	$('#' + category).addClass('current').children('a').addClass('active');
	$('#' + category + ' .' + color).addClass('current').children('a')
			.addClass('active');

	$(document).ready(function() {
		$("ul.main").superfish({
					pathClass : 'current',
					autoArrows : false
				});
	});

	// SLIDER
	var si = null;

	function scrollLampen(stop, dir, steps, clearfirst) {
		if (stop == false) {
			if (clearfirst) {
				clearInterval(si);
			}
			si = setInterval(function() {
						var l = $('#lampen')[0];
						if (dir == "r") {
							l.scrollLeft = l.scrollLeft + steps;
						} else {
							l.scrollLeft = l.scrollLeft - steps;
						}
						updateButtons();
						l = null;
					}, 35);
		} else {
			clearInterval(si);
		}
	}
	function updateButtons() {
		if ($('#lampen')[0].scrollLeft == 0) {
			$('#prev').children()[0].src = baseUrl
					+ '/images/prev_disabled.gif';
		} else {
			$('#prev').children()[0].src = baseUrl + '/images/prev.gif';
		}

		if ($('#lampen').children()[0].scrollWidth == $('#lampen')[0].scrollLeft
				+ $('#content').width()) {
			$('#next').children()[0].src = baseUrl
					+ '/images/next_disabled.gif';
		} else {
			$('#next').children()[0].src = baseUrl + '/images/next.gif';
		}
		if ($('#lampen').children()[0].scrollWidth < $('#content').width()) {
			$('#next').children()[0].src = baseUrl
					+ '/images/next_disabled.gif';
		}
	}

	if ($('#lampen').length != 0) {
		updateButtons();
	}

	$('#prev').mousedown(function() {
				scrollLampen(false, "l", 12, true);
			});

	$('#prev').mouseup(function() {
				scrollLampen(false, "l", 6, true);
			});

	$('#prev').mouseover(function() {
				scrollLampen(false, "l", 6, false);
			});

	$('#prev').mouseout(function() {
				scrollLampen(true);
			});

	$('#next').mousedown(function() {
				scrollLampen(false, "r", 12, true);
			});

	$('#next').mouseup(function() {
				scrollLampen(false, "r", 6, true);
			});

	$('#next').mouseover(function() {
				scrollLampen(false, "r", 6, false);
			});

	$('#next').mouseout(function() {
				scrollLampen(true);
			});
	
	
	//notify instellingen
	$.growl.settings.displayTimeout = 2500;
	$.growl.settings.noticeTemplate = ''
	  + '<div style="z-index:999999;">'
	  + '<div style="float: right; background-image: url('+baseUrl+'/images/normalTop.png); position: relative; width: 259px; height: 16px; margin: 0pt;font-size:1px;"></div>'
	  + '<div style="float: right; background-image: url('+baseUrl+'/images/normalBackground.png); position: relative; display: block; color: #ffffff; font-family: Arial; font-size: 12px; line-height: 14px; width: 259px; margin: 0pt;">' 
	  + '  <img style="margin: 3px 3px 3px 10px; margin-top: 0px; float: left;" src="%image%" />'
	  + '  <a href="#" style="font-size:15px; color:#FFF; float:right; margin-right:20px; text-decoration:none;" onclick="return false;" rel="close">&#215;</a>'
	  + '  <br /><br /><h3 style="margin: 0 14px 0 90px; padding-bottom: 10px; font-size: 13px;">%title%</h3>'
	  + '  <p style="margin: 0 14px 0 90px; font-size: 12px;">%message%</p>'
	  + '</div>'
	  + '<div style="float: right; background-image: url('+baseUrl+'/images/normalBottom.png); position: relative; width: 259px; height: 16px; margin-bottom: 10px;">'
	  + '</div>'
	  + '</div>';
	$.growl.settings.noticeCss = {
	  position: 'relative'
	};
	
	$.growl.settings.dockTemplate = '<div></div>';
	$.growl.settings.dockCss = {
	    position: 'absolute',
	    top: '165px',
	    right: ($(document).width() / 2) - (260 / 2)+'px',
	    width: '260px'
	  };
});

// SHOPPINGBASKET
function addToShoppingbasket(id, qty, image, name, title, text) {
	var v = $('#' + qty).val();
	$.ajax({
		type : "POST",
		url : baseUrl + "/shoppingbasket/add/",
		data : "idproduct=" + id + "&quantity=" + v,
		success : function(msg) {
			//alert("Data Saved: " + msg);
			$.growl(title, v + " x " + name + " " + text, image);
			updateQuantity();
		}
	});
}
function updateQuantity() {
	$.ajax({
		type : "GET",
		url : baseUrl + "/shoppingbasket/quantity/",
		success : function(msg) {
			document.getElementById("wwquantity").innerHTML = msg;
		}
	});
}