jQuery.cookie = function (name, value, options) {
    if (typeof value !== 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires === 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires === 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }
        // CAUTION: Needed to parenthesize options.path and options.domain
        // in the following expressions, otherwise they evaluate to undefined
        // in the packed version for some reason...
        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie !== '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) === (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};
/* tinyscrollbar 
(function ($) {
	$.fn.tinyscrollbar = function (op) {
		var options = $.extend({ 
			axis: 'y', // vertical or horizontal scrollbar? ( x || y ).
			wheel: 40,  //how many pixels must the mouswheel scroll at a time.
			scroll: true, //enable or disable the mousewheel scrollbar
			size: 'auto', //set the size of the scrollbar to auto or a fixed number.
			sizethumb: 'auto' //set the size of the thumb to auto or a fixed number.
		}, op);
		var oWrapper = $(this);
		var oViewport = { obj: $('.viewport', this) };
		var oContent = { obj: $('.overview', this) };		
		var oScrollbar = { obj: $('.scrollbar', this) };
		var oTrack = { obj: $('.track', oScrollbar.obj) };
		var oThumb = { obj: $('.thumb', oScrollbar.obj) };
		var sAxis = options.axis === 'x', sDirection = sAxis ? 'left' : 'top', sSize = sAxis ? 'Width' : 'Height';
		var iScroll, iPosition = { start:  0, now: 0 }, iMouse = {};
		
		if (this.length > 1) { 
			this.each(function () {
				$(this).tinyscrollbar(options);
			}); 
			return this;
		}   
		this.initialize = function () {
			this.update();
			setEvents();
			return this;
		};
		this.update = function (num) {
			iScroll = 0;
			oViewport[options.axis] = oViewport.obj[0]['offset' + sSize];
			oContent[options.axis] = oContent.obj[0]['scroll' + sSize];
			oContent.ratio = oViewport[options.axis] / oContent[options.axis];
			oScrollbar.obj.toggleClass('disable', oContent.ratio >= 1);
			oTrack[options.axis] = options.size === 'auto' ? oViewport[options.axis] : options.size;
			oThumb[options.axis] = Math.min(oTrack[options.axis], Math.max(0, (options.sizethumb === 'auto' ? (oTrack[options.axis] * oContent.ratio) : options.sizethumb)));
			oScrollbar.ratio = options.sizethumb === 'auto' ? (oContent[options.axis] / oTrack[options.axis]) : (oContent[options.axis] - oViewport[options.axis]) / (oTrack[options.axis] - oThumb[options.axis]);
			setSize();
		};
		this.scrollTo = function (num) {
			iScroll = num < (oContent[options.axis] - oViewport[options.axis]) ? num : oContent[options.axis] - oViewport[options.axis];
			iScroll = iScroll < 0 ? 0 : iScroll; 
			oThumb.obj.css(sDirection, iScroll / oScrollbar.ratio);
			oContent.obj.css(sDirection, -iScroll);
		};
		function setSize() {
			oContent.obj.removeAttr('style'); 
			oThumb.obj.removeAttr('style');
			iMouse.start = oThumb.obj.offset()[sDirection];
			var sCssSize = sSize.toLowerCase(); 
			oScrollbar.obj.css(sCssSize, oTrack[options.axis]);
			oTrack.obj.css(sCssSize, oTrack[options.axis]);
			oThumb.obj.css(sCssSize, oThumb[options.axis]);
		}
		function setEvents() {
			oThumb.obj.bind('mousedown', start);
			oTrack.obj.bind('mouseup', drag);
			if (options.scroll && this.addEventListener) {
				oWrapper[0].addEventListener('DOMMouseScroll', wheel, false);
				oWrapper[0].addEventListener('mousewheel', wheel, false);
			} else if (options.scroll) {
				oWrapper[0].onmousewheel = wheel;
			}
		}
		function start(oEvent) {
			iMouse.start = sAxis ? oEvent.pageX : oEvent.pageY;
			iPosition.start = parseInt(oThumb.obj.css(sDirection), 10) || 0;
			$(document).bind('mousemove', drag);
			$(document).bind('mouseup', end);
			oThumb.obj.bind('mouseup', end);
			return false;
		}	
		function wheel(oEvent) {
			if (!(oContent.ratio >= 1)) {
				oEvent = $.event.fix(oEvent || window.event);
				var iDelta = oEvent.wheelDelta ? oEvent.wheelDelta / 120 : -oEvent.detail / 3;
				iScroll -= iDelta * options.wheel;
				iScroll = Math.min((oContent[options.axis] - oViewport[options.axis]), Math.max(0, iScroll));
				oThumb.obj.css(sDirection, iScroll / oScrollbar.ratio);
				oContent.obj.css(sDirection, -iScroll);
				oEvent.preventDefault();
			}
		}
		function end(oEvent) {
			$(document).unbind('mousemove', drag);
			$(document).unbind('mouseup', end);
			oThumb.obj.unbind('mouseup', end);
			return false;
		}
		function drag(oEvent) {
			if (!(oContent.ratio >= 1)) {
				iPosition.now = Math.min((oTrack[options.axis] - oThumb[options.axis]), Math.max(0, (iPosition.start + ((sAxis ? oEvent.pageX : oEvent.pageY) - iMouse.start))));
				iScroll = iPosition.now * oScrollbar.ratio;
				oContent.obj.css(sDirection, -iScroll);
				oThumb.obj.css(sDirection, iPosition.now);
			}
			//return false;
		}
		return this.initialize();
	};
})(jQuery);
*/
(function($){
	$.tiny = $.tiny || { };
	
	$.tiny.scrollbar = {
		options: {	
			axis: 'y', // vertical or horizontal scrollbar? ( x || y ).
			wheel: 40,  //how many pixels must the mouswheel scroll at a time.
			scroll: true, //enable or disable the mousewheel;
			size: 'auto', //set the size of the scrollbar to auto or a fixed number.
			sizethumb: 'auto' //set the size of the thumb to auto or a fixed number.
		}
	};	
	
	$.fn.tinyscrollbar = function(options) { 
		var options = $.extend({}, $.tiny.scrollbar.options, options); 		
		this.each(function(){ $(this).data('tsb', new Scrollbar($(this), options)); });
		return this;
	};
	$.fn.tinyscrollbar_update = function(sScroll) { return $(this).data('tsb').update(sScroll); };
	$.fn.update = function(sScroll) { return $(this).data('tsb').update(sScroll); };
	$.fn.scrollTo = function(num) { return $(this).data('tsb').scrollTo(num); };
	
	function Scrollbar(root, options){
		var oSelf = this;
		var oWrapper = root;
		var oViewport = { obj: $('.viewport', root) };
		var oContent = { obj: $('.overview', root) };
		var oScrollbar = { obj: $('.scrollbar', root) };
		var oTrack = { obj: $('.track', oScrollbar.obj) };
		var oThumb = { obj: $('.thumb', oScrollbar.obj) };
		var sAxis = options.axis == 'x', sDirection = sAxis ? 'left' : 'top', sSize = sAxis ? 'Width' : 'Height';
		var iScroll, iPosition = { start: 0, now: 0 }, iMouse = {};

		function initialize() {	
			oSelf.update();
			setEvents();
			return oSelf;
		}
		this.update = function(sScroll){
			oViewport[options.axis] = oViewport.obj[0]['offset'+ sSize];
			oContent[options.axis] = oContent.obj[0]['scroll'+ sSize];
			oContent.ratio = oViewport[options.axis] / oContent[options.axis];
			oScrollbar.obj.toggleClass('disable', oContent.ratio >= 1);
			oTrack[options.axis] = options.size == 'auto' ? oViewport[options.axis] : options.size;
			oThumb[options.axis] = Math.min(oTrack[options.axis], Math.max(0, ( options.sizethumb == 'auto' ? (oTrack[options.axis] * oContent.ratio) : options.sizethumb )));
			oScrollbar.ratio = options.sizethumb == 'auto' ? (oContent[options.axis] / oTrack[options.axis]) : (oContent[options.axis] - oViewport[options.axis]) / (oTrack[options.axis] - oThumb[options.axis]);
			iScroll = (sScroll == 'relative' && oContent.ratio <= 1) ? Math.min((oContent[options.axis] - oViewport[options.axis]), Math.max(0, iScroll)) : 0;
			iScroll = (sScroll == 'bottom' && oContent.ratio <= 1) ? (oContent[options.axis] - oViewport[options.axis]) : isNaN(parseInt(sScroll)) ? iScroll : parseInt(sScroll);
			setSize();
		};
		this.scrollTo = function (num) {
			iScroll = num < (oContent[options.axis] - oViewport[options.axis]) ? num : oContent[options.axis] - oViewport[options.axis];
			iScroll = iScroll < 0 ? 0 : iScroll; 
			oThumb.obj.css(sDirection, iScroll / oScrollbar.ratio);
			oContent.obj.css(sDirection, -iScroll);
		};
		function setSize(){
			oThumb.obj.css(sDirection, iScroll / oScrollbar.ratio);
			oContent.obj.css(sDirection, -iScroll);
			iMouse['start'] = oThumb.obj.offset()[sDirection];
			var sCssSize = sSize.toLowerCase(); 
			oScrollbar.obj.css(sCssSize, oTrack[options.axis]);
			oTrack.obj.css(sCssSize, oTrack[options.axis]);
			oThumb.obj.css(sCssSize, oThumb[options.axis]);		
		};		
		function setEvents(){
			oThumb.obj.bind('mousedown', start);
			oThumb.obj[0].ontouchstart = function(oEvent){
				oEvent.preventDefault();
				oThumb.obj.unbind('mousedown');
				start(oEvent.touches[0]);
				return false;
			};	
			oTrack.obj.bind('mouseup', drag);
			if(options.scroll && this.addEventListener){
				oWrapper[0].addEventListener('DOMMouseScroll', wheel, false);
				oWrapper[0].addEventListener('mousewheel', wheel, false );
			}
			else if(options.scroll){oWrapper[0].onmousewheel = wheel;}
		};
		function start(oEvent){
			iMouse.start = sAxis ? oEvent.pageX : oEvent.pageY;
			var oThumbDir = parseInt(oThumb.obj.css(sDirection));
			iPosition.start = oThumbDir == 'auto' ? 0 : oThumbDir;
			$(document).bind('mousemove', drag);
			document.ontouchmove = function(oEvent){
				$(document).unbind('mousemove');
				drag(oEvent.touches[0]);
			};
			$(document).bind('mouseup', end);
			oThumb.obj.bind('mouseup', end);
			oThumb.obj[0].ontouchend = document.ontouchend = function(oEvent){
				$(document).unbind('mouseup');
				oThumb.obj.unbind('mouseup');
				end(oEvent.touches[0]);
			};
			return false;
		};		
		function wheel(oEvent){
			if(!(oContent.ratio >= 1)){
				oEvent = $.event.fix(oEvent || window.event);
				var iDelta = oEvent.wheelDelta ? oEvent.wheelDelta/120 : -oEvent.detail/3;
				iScroll -= iDelta * options.wheel;
				iScroll = Math.min((oContent[options.axis] - oViewport[options.axis]), Math.max(0, iScroll));
				oThumb.obj.css(sDirection, iScroll / oScrollbar.ratio);
				oContent.obj.css(sDirection, -iScroll);
				oEvent.preventDefault();
			};
		};
		function end(oEvent){
			$(document).unbind('mousemove', drag);
			$(document).unbind('mouseup', end);
			oThumb.obj.unbind('mouseup', end);
			document.ontouchmove = oThumb.obj[0].ontouchend = document.ontouchend = null;
			return false;
		};
		function drag(oEvent){
			if(!(oContent.ratio >= 1)){
				iPosition.now = Math.min((oTrack[options.axis] - oThumb[options.axis]), Math.max(0, (iPosition.start + ((sAxis ? oEvent.pageX : oEvent.pageY) - iMouse.start))));
				iScroll = iPosition.now * oScrollbar.ratio;
				oContent.obj.css(sDirection, -iScroll);
				oThumb.obj.css(sDirection, iPosition.now);
			}
			return false;
		};
		
		return initialize();
	};
})(jQuery);


var Uly = {
	siteRoot: undefined,
	currentId: undefined,
	createCookie: function (name, value, days) {
		var expires;
		if (days) {
			var date = new Date();
			date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
			expires = "; expires=" + date.toGMTString();
		} else {
			expires = "";
		}
		document.cookie = name + "=" + value + expires + "; path=/";
	},
	readCookie: function (name) {
		var nameEQ = name + "=";
		var ca = document.cookie.split(';');
		for (var i = 0, len = ca.length;i < len; i++) {
			var c = ca[i];
			while (c.charAt(0) === ' ') {
				c = c.substring(1, c.length);
			}
			if (c.indexOf(nameEQ) === 0) {
				return c.substring(nameEQ.length, c.length);
			}
		}
		return null;
	},
	eraseCookie: function (name) {
		Uly.createCookie(name, "", -1);
	}
};
/* $(function () {
	$('div.harmonicaPart .title').click(function () {
		$(this).next().slideToggle("slow");
		return false;
	}).next().hide();
}); */


var svg = (function () {
	var options = {
		container: "raphael",
		shape: "website",
		width: 650,
		height: 825,
		defaultAttributes: {
			fill: '#fff',
			stroke: 'none'
		}
	},
	shapes = {
		collection: 'M0 1L140 0L140 390L164 390C176.2 390 186 399.8 186 412C186 424.1 176.2 434 164 434L140 434L140 825L0 824z',
		collectionButton: 'M200 390L224 390C236.2 390 246 399.8 246 412C246 424.1 236.2 434 224 434L200 434z',
		competition: "M35 825L35 400L615 400L615 825z",
		disclaimer: "M650 780L100 780C72 780 50 758 50 730L50 280C50 252 72 230 100 230L650 230z",
		ingredienten: "M650 575L130 575C102 575 80 553 80 525L80 305C80 277 102 255 130 255L650 255z",
		magazines: "M524.8 629.9c-0.1 7.7 -6.4 13.8 -14.1 13.8l-385.6 -3c-7.7 -0.1 -14 -6.3 -13.9 -14l4.2 -540.2c0.1 -7.7 6.4 -13.9 14.1 -13.8l385.6 3c7.7 0.1 14 6.3 13.9 14L524.8 629.9z",
		magBubbles: ["M106.9 684L152 640.5L194 640.8z", "M197.2 640.5L231.2 640.8L166 681z", "M348 685.1L273.1 641.6L315.1 642z", "M448.4 685.7L373.5 642L415.4 642z", "M540.7 686.3L465.8 642.7L507.8 643.1z" ],
		page: 'M0 0L650 0L650 825L0 835z',
		product: "M650 575L130 575C102 575 80 553 80 525L80 305C80 277 102 255 130 255L650 255z",
		qanda: "M0 250L540 250C568 250 590 272 590 300L590 670C590 698 568 720 540 720L0 720z",
		resellers: "M650 875L50 875L50 200C50 172 72 150 100 150L650 150",
		solution1: "M0 250L540 250C568 250 590 272 590 300L590 670C590 698 568 720 540 720L0 720z",
		solution2: "M0 825L0 150L650 150L650 825z",
		solution3: "M0 825L0 150L590 150C618 150 640 172 640 200L640 825z",
		solution: "M0 225L580 225C591 225 600 234 600 245L600 805C600 816 591 825 580 825L0 825z",
		tips: 'M650 225L650 825L45 825C34 825 25 816 25 805L25 245C25 234 34 225 45 225z',
		training: "M0 250L540 250C568 250 590 272 590 300L590 670C590 698 568 720 540 720L0 720z",
		website: "M650 780L100 780C72 780 50 758 50 730L50 280C50 252 72 230 100 230L650 230z"
	},
	r, b, c, canvas, context;
    function canvasDraw( path )
    {
        var pAr = path.split( /[a-zA-Z]/ )
        ,   len = pAr.length
        ,   i   = 0
        ,   cur
        ;

        context.beginPath();
        while( i < len )
        {
            cur = pAr[ i ].split( /\s/ )
            switch ( cur.length )
            {
                case 2:
                   context.lineTo( cur[ 0 ], cur[ 1 ] )
                    break;
                case 6:
                    context.bezierCurveTo( cur[ 0 ], cur[ 1 ], cur[ 2 ],cur[ 3 ], cur[ 4 ], cur[ 5 ] )
                    break;
                default:
            }
            i += 1;
        }
        context.fillStyle = "#ffffff";
        context.fill();
    }
	return {
		initialised: false
    ,   canvasInitialised: false
	,   init: function () {
			if ( document.getElementById(options.container) ) {

                if ( Modernizr.svg || $.browser.msie )
                {
                    r = new Raphael(document.getElementById(options.container), options.width, options.height);
                    svg.initialised = true;
                }
                else if ( !$.browser.msie && Modernizr.canvas )
                {
                    canvas = document.createElement( "canvas" );
                    canvas.setAttribute( "width", options.width + "px" );
                    canvas.setAttribute( "height", options.height + "px" );
                    document.getElementById( options.container ).appendChild( canvas );
                    context = canvas.getContext( "2d" );
                    if ( context )
                        svg.canvasInitialised = true
                }
			}
		},
		draw: function (s) {
			if (!svg.initialised || !svg.canvasInitialised ) {
				svg.init();
			}
			if (shapes[s]) {
                if ( svg.canvasInitialised )
                    canvasDraw( shapes[s] );
                else
    				r.path(shapes[s]).attr(options.defaultAttributes);
			}
		},
		drawBubble: function (xVal) {
			if (!svg.initialised || !svg.canvasInitialised ) {
				svg.init();
			}
			var x = xVal || 0;
            if ( svg.canvasInitialised )
            {
                canvasDraw( shapes[s] )
			}
            else if (b)
            {
				b.animate({path: shapes.magBubbles[x]}, 500);
			} else {
				b = r.path(shapes.magBubbles[x]).attr(options.defaultAttributes);
			}
		},
		showBubble: function () {
			if (b) {
				b.show();
			}
		},
		hideBubble: function () {
			if (b) {
				b.hide();
			}
		},
		drawOverlay: function (cont, h) {
			if (document.getElementById(cont) && ( Modernizr.svg || $.browser.msie ) ) {
                c = new Raphael(document.getElementById(cont), 190, h);
                var center = Math.floor(h / 2);
                var path = ['M0 0L120 0L120 ', center - 22, 'L144 ', center - 22, 'C156.2 ', center - 22, ' 166 ', center - 12.1, ' 166 ', center, 'C166 ', center + 12.1, ' 156.2 ', center + 22, ' 144 ', center + 22, 'L120 ', center + 22, 'L120 ', h, 'L0 ', h, 'z'].join('');
                c.path(path).attr({
                    fill: '0-#777:0-#dedcdc:15',
                    'fill-opacity': 0.6,
                    stroke: 'none'
                });
			}
		}
	};
})();


/**
 * @author Samele Artuso <samuele.a@gmail.com>
 */
(function ($) {
	$.fn.unselectable = function () {
		return this.each(function () {
			$(this)
				.css('-moz-user-select', 'none')		// FF
				.css('-khtml-user-select', 'none')		// Safari, Google Chrome
				.css('user-select', 'none');			// CSS 3
			
			if ($.browser.msie) {						// IE
				$(this).each(function () {
					this.ondrag = function () {
						return false;
					};
				});
				$(this).each(function () {
					this.onselectstart = function () {
						return (false);
					};
				});
			} else if ($.browser.opera) {
				$(this).attr('unselectable', 'on');
			}
		});
	};
})(jQuery);



