
	$(document).ready(function()
		{
			// Cookie stuff ----------------------------------------------------------------------------------------------
			function setCookie(c_name,value,expiredays)
				{
					var exdate = new Date();
					exdate.setDate(exdate.getDate() + expiredays);
					document.cookie = c_name + "=" + escape(value) + ((expiredays == null) ? "" : ";expires=" + exdate.toUTCString());
				}

			function getCookie(c_name)
				{
					if(document.cookie.length > 0)
				  		{
				  			c_start = document.cookie.indexOf(c_name + "=");

							if(c_start != -1)
							    {
								    c_start = c_start + c_name.length + 1;
								    c_end = document.cookie.indexOf(";", c_start);

									if(c_end == -1)
										c_end = document.cookie.length;

									return unescape(document.cookie.substring(c_start,c_end));
							    }
				  		}

					return "";
				}


			// Sujet panel definition ----------------------------------------------------------------------------------------------

			// Hide pagernav at start
			$("#goPrev").fadeOut(0);
			$("#goNext").fadeOut(0);

			// Show pagernav when someone hovers the sujets
			$("#sujetBox").hover(
				function()
					{
						$("#goPrev").fadeIn(500);
						$("#goNext").fadeIn(500);
					},
				function()
					{
						$("#goPrev").fadeOut(500);
						$("#goNext").fadeOut(500);
					});


			var slidePosition = getCookie("trinklSlide");

			if(slidePosition == "")
				slidePosition = 0;

			$("#sujetWrapper").cycle(
				{
					fx: 'fade',				// choose your transition type, ex: fade, scrollUp, shuffle, etc...
					timeout: 6000,
					speed: 2000,			// speed of the transition (any valid fx speed value)
					easing: null,
					next:	'#goNext',
    				prev:   '#goPrev',
    				pause: 1,
					startingSlide: slidePosition,
				    after: function(curr,next,opts)
						{

							slidePosition = opts.currSlide;
//							alert(slidePosition);
							setCookie("trinklSlide", slidePosition, 2);		// Set a cookie for 7 days
						}
				});


			$('#galleryWrapperBox').cycle(
				{
				    fx:     'scrollUp',
				    speed:  800,
				    timeout: 0,
				    sync: 1,
				    easeIn: 'easeOutQuad',
				    easeOut: 'easeInQuad',
				    next:   '#galleryPagerBox .galNext',		//	Next button
//				    prev:   '#galleryPagerBox .galPrev'		//	Previous button
				});


			// Gallery settings ----------------------------------------------------------------------------------------------
			$(".picholder").fadeTo(0, 0.75);

			$(".picholder").hover(
				function()
					{
						$(this).stop().fadeTo(600, 1);
					},
				function()
					{
						$(this).stop().fadeTo(400, 0.75);
					});





		});
