(function($){
	var EYE = window.EYE = function() {
		var _registered = {
			init: []
		};
		return {
			init: function() {
				$.each(_registered.init, function(nr, fn){
					fn.call();
				});
			},
			extend: function(prop) {
				for (var i in prop) {
					if (prop[i] != undefined) {
						this[i] = prop[i];
					}
				}
			},
			register: function(fn, type) {
				if (!_registered[type]) {
					_registered[type] = [];
				}
				_registered[type].push(fn);
			}
		};
	}();
	$(EYE.init);
})(jQuery);
(function($) {
EYE.extend({
	getPosition : function(e, forceIt)
	{
		var x = 0;
		var y = 0;
		var es = e.style;
		var restoreStyles = false;
		if (forceIt && jQuery.curCSS(e,'display') == 'none') {
			var oldVisibility = es.visibility;
			var oldPosition = es.position;
			restoreStyles = true;
			es.visibility = 'hidden';
			es.display = 'block';
			es.position = 'absolute';
		}
		var el = e;
		if (el.getBoundingClientRect) { // IE
			var box = el.getBoundingClientRect();
			x = box.left + Math.max(document.documentElement.scrollLeft, document.body.scrollLeft) - 2;
			y = box.top + Math.max(document.documentElement.scrollTop, document.body.scrollTop) - 2;
		} else {
			x = el.offsetLeft;
			y = el.offsetTop;
			el = el.offsetParent;
			if (e != el) {
				while (el) {
					x += el.offsetLeft;
					y += el.offsetTop;
					el = el.offsetParent;
				}
			}
			if (jQuery.browser.safari && jQuery.curCSS(e, 'position') == 'absolute' ) {
				x -= document.body.offsetLeft;
				y -= document.body.offsetTop;
			}
			el = e.parentNode;
			while (el && el.tagName.toUpperCase() != 'BODY' && el.tagName.toUpperCase() != 'HTML')
			{
				if (jQuery.curCSS(el, 'display') != 'inline') {
					x -= el.scrollLeft;
					y -= el.scrollTop;
				}
				el = el.parentNode;
			}
		}
		if (restoreStyles == true) {
			es.display = 'none';
			es.position = oldPosition;
			es.visibility = oldVisibility;
		}
		return {x:x, y:y};
	},
	getSize : function(e)
	{
		var w = parseInt(jQuery.curCSS(e,'width'), 10);
		var h = parseInt(jQuery.curCSS(e,'height'), 10);
		var wb = 0;
		var hb = 0;
		if (jQuery.curCSS(e, 'display') != 'none') {
			wb = e.offsetWidth;
			hb = e.offsetHeight;
		} else {
			var es = e.style;
			var oldVisibility = es.visibility;
			var oldPosition = es.position;
			es.visibility = 'hidden';
			es.display = 'block';
			es.position = 'absolute';
			wb = e.offsetWidth;
			hb = e.offsetHeight;
			es.display = 'none';
			es.position = oldPosition;
			es.visibility = oldVisibility;
		}
		return {w:w, h:h, wb:wb, hb:hb};
	},
	getClient : function(e)
	{
		var h, w;
		if (e) {
			w = e.clientWidth;
			h = e.clientHeight;
		} else {
			var de = document.documentElement;
			w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
			h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight;
		}
		return {w:w,h:h};
	},
	getScroll : function (e)
	{
		var t=0, l=0, w=0, h=0, iw=0, ih=0;
		if (e && e.nodeName.toLowerCase() != 'body') {
			t = e.scrollTop;
			l = e.scrollLeft;
			w = e.scrollWidth;
			h = e.scrollHeight;
		} else  {
			if (document.documentElement) {
				t = document.documentElement.scrollTop;
				l = document.documentElement.scrollLeft;
				w = document.documentElement.scrollWidth;
				h = document.documentElement.scrollHeight;
			} else if (document.body) {
				t = document.body.scrollTop;
				l = document.body.scrollLeft;
				w = document.body.scrollWidth;
				h = document.body.scrollHeight;
			}
			if (typeof pageYOffset != 'undefined') {
				t = pageYOffset;
				l = pageXOffset;
			}
			iw = self.innerWidth||document.documentElement.clientWidth||document.body.clientWidth||0;
			ih = self.innerHeight||document.documentElement.clientHeight||document.body.clientHeight||0;
		}
		return { t: t, l: l, w: w, h: h, iw: iw, ih: ih };
	},
	getMargins : function(e, toInteger)
	{
		var t = jQuery.curCSS(e,'marginTop') || '';
		var r = jQuery.curCSS(e,'marginRight') || '';
		var b = jQuery.curCSS(e,'marginBottom') || '';
		var l = jQuery.curCSS(e,'marginLeft') || '';
		if (toInteger)
			return {
				t: parseInt(t, 10)||0,
				r: parseInt(r, 10)||0,
				b: parseInt(b, 10)||0,
				l: parseInt(l, 10)
			};
		else
			return {t: t, r: r,	b: b, l: l};
	},
	getPadding : function(e, toInteger)
	{
		var t = jQuery.curCSS(e,'paddingTop') || '';
		var r = jQuery.curCSS(e,'paddingRight') || '';
		var b = jQuery.curCSS(e,'paddingBottom') || '';
		var l = jQuery.curCSS(e,'paddingLeft') || '';
		if (toInteger)
			return {
				t: parseInt(t, 10)||0,
				r: parseInt(r, 10)||0,
				b: parseInt(b, 10)||0,
				l: parseInt(l, 10)
			};
		else
			return {t: t, r: r,	b: b, l: l};
	},
	getBorder : function(e, toInteger)
	{
		var t = jQuery.curCSS(e,'borderTopWidth') || '';
		var r = jQuery.curCSS(e,'borderRightWidth') || '';
		var b = jQuery.curCSS(e,'borderBottomWidth') || '';
		var l = jQuery.curCSS(e,'borderLeftWidth') || '';
		if (toInteger)
			return {
				t: parseInt(t, 10)||0,
				r: parseInt(r, 10)||0,
				b: parseInt(b, 10)||0,
				l: parseInt(l, 10)||0
			};
		else
			return {t: t, r: r,	b: b, l: l};
	},
	traverseDOM : function(nodeEl, func)
	{
		func(nodeEl);
		nodeEl = nodeEl.firstChild;
		while(nodeEl){
			EYE.traverseDOM(nodeEl, func);
			nodeEl = nodeEl.nextSibling;
		}
	},
	getInnerWidth :  function(el, scroll) {
		var offsetW = el.offsetWidth;
		return scroll ? Math.max(el.scrollWidth,offsetW) - offsetW + el.clientWidth:el.clientWidth;
	},
	getInnerHeight : function(el, scroll) {
		var offsetH = el.offsetHeight;
		return scroll ? Math.max(el.scrollHeight,offsetH) - offsetH + el.clientHeight:el.clientHeight;
	},
	getExtraWidth : function(el) {
		if($.boxModel)
			return (parseInt($.curCSS(el, 'paddingLeft'))||0)
				+ (parseInt($.curCSS(el, 'paddingRight'))||0)
				+ (parseInt($.curCSS(el, 'borderLeftWidth'))||0)
				+ (parseInt($.curCSS(el, 'borderRightWidth'))||0);
		return 0;
	},
	getExtraHeight : function(el) {
		if($.boxModel)
			return (parseInt($.curCSS(el, 'paddingTop'))||0)
				+ (parseInt($.curCSS(el, 'paddingBottom'))||0)
				+ (parseInt($.curCSS(el, 'borderTopWidth'))||0)
				+ (parseInt($.curCSS(el, 'borderBottomWidth'))||0);
		return 0;
	},
	isChildOf: function(parentEl, el, container) {
		if (parentEl == el) {
			return true;
		}
		if (!el || !el.nodeType || el.nodeType != 1) {
			return false;
		}
		if (parentEl.contains && !$.browser.safari) {
			return parentEl.contains(el);
		}
		if ( parentEl.compareDocumentPosition ) {
			return !!(parentEl.compareDocumentPosition(el) & 16);
		}
		var prEl = el.parentNode;
		while(prEl && prEl != container) {
			if (prEl == parentEl)
				return true;
			prEl = prEl.parentNode;
		}
		return false;
	},
	centerEl : function(el, axis)
	{
		var clientScroll = EYE.getScroll();
		var size = EYE.getSize(el);
		if (!axis || axis == 'vertically')
			$(el).css(
				{
					top: clientScroll.t + ((Math.min(clientScroll.h,clientScroll.ih) - size.hb)/2) + 'px'
				}
			);
		if (!axis || axis == 'horizontally')
			$(el).css(
				{
					left: clientScroll.l + ((Math.min(clientScroll.w,clientScroll.iw) - size.wb)/2) + 'px'
				}
			);
	}
});
if (!$.easing.easeout) {
	$.easing.easeout = function(p, n, firstNum, delta, duration) {
		return -delta * ((n=n/duration-1)*n*n*n - 1) + firstNum;
	};
}

})(jQuery);
(function($){
	EYE.extend({

		spacegallery: {

			//default options (many options are controled via CSS)
			defaults: {
				border: 6, // border arround the image
				perspective: 700, // perpective height
				minScale: 0.2, // minimum scale for the image in the back
				/////mod
				duration: 500, // aimation duration
				/////
				loadingClass: null, // CSS class applied to the element while looading images
				before: function(){return false},
				after: function(){return false}
			},

			animated: false,

			//position images
			positionImages: function(el) {
				var left = 0;
				EYE.spacegallery.animated = false;
				$(el)
					.find('a')
						.removeClass(el.spacegalleryCfg.loadingClass)
						.end()
					.find('img')
						.removeAttr('height')
						.each(function(nr){
							var newWidth = this.spacegallery.origWidth - (this.spacegallery.origWidth - this.spacegallery.origWidth * el.spacegalleryCfg.minScale) * el.spacegalleryCfg.asins[nr];
							var newHeight = this.spacegallery.origHeight - (this.spacegallery.origHeight - this.spacegallery.origHeight * el.spacegalleryCfg.minScale) * el.spacegalleryCfg.asins[nr];
							$(this)
								.css({
									left: (el.spacegalleryCfg.lefts[nr] ) + 'px',
									marginTop: - parseInt((newHeight + el.spacegalleryCfg.border)/2, 10) + 'px',
									opacity: 1 - el.spacegalleryCfg.asins[nr]
								})
								.attr('width', parseInt(newWidth));
							this.spacegallery.next = el.spacegalleryCfg.asins[nr+1];
							this.spacegallery.nextLeft = el.spacegalleryCfg.lefts[nr+1] - el.spacegalleryCfg.lefts[nr];
							this.spacegallery.origLeft = el.spacegalleryCfg.lefts[nr];
							this.spacegallery.nextTop = el.spacegalleryCfg.tops[nr-1] - el.spacegalleryCfg.tops[nr] ;
							this.spacegallery.origTop = el.spacegalleryCfg.tops[nr];
							this.spacegallery.opacity = 1 - el.spacegalleryCfg.asins[nr];
							this.spacegallery.increment = el.spacegalleryCfg.asins[nr] - this.spacegallery.next;
							this.spacegallery.current = el.spacegalleryCfg.asins[nr];
							this.spacegallery.width = newWidth;
							this.spacegallery.height = newHeight;
						})
			},

			//animate to next image
			next: function(e) {
				if (EYE.spacegallery.animated === false) {
					EYE.spacegallery.animated = true;
					var el = this.parentNode;
					el.spacegalleryCfg.before.apply(el);
					$(el)
						.css('spacegallery', 0)
						.animate({
							spacegallery: 100
						},{
							easing: 'easeOut',
							duration: el.spacegalleryCfg.duration,
							complete: function() {
								$(el).find('img:last').prependTo(el);
								EYE.spacegallery.positionImages(el);
								el.spacegalleryCfg.after.apply(el);
							},
							step: function(now) {
								$('img', this).each(function(nr){
									var newWidth,newHeight, left, top, next;
									if ((nr + 1) == el.spacegalleryCfg.images) {
										left = this.spacegallery.origLeft + this.spacegallery.nextLeft * 4 * now /100;
										top = this.spacegallery.origTop + this.spacegallery.nextTop * 4 * now /100;
										newWidth = this.spacegallery.width * left / this.spacegallery.origLeft;
										newHeight = this.spacegallery.height * top / this.spacegallery.origTop;

										$(this).css({
											left: left + 'px',
											opacity: 0.5 - now/100,
											marginTop: parseInt((newHeight + el.spacegalleryCfg.border)/2, 10) -240 + 'px'
										}).attr('width', newWidth);
									} else {
										next = this.spacegallery.current - this.spacegallery.increment * now /100;
										newWidth = this.spacegallery.origWidth - (this.spacegallery.origWidth - this.spacegallery.origWidth * el.spacegalleryCfg.minScale) * next;
										newHeight = this.spacegallery.origHeight - (this.spacegallery.origHeight - this.spacegallery.origHeight * el.spacegalleryCfg.minScale) * next;
										$(this).css({
											left: this.spacegallery.origLeft + this.spacegallery.nextLeft * now /100 + 'px',
											opacity: 1 - next,
											marginTop: - parseInt((newHeight + el.spacegalleryCfg.border)/2, 10) + 'px'
										}).attr('width', newWidth);
									}
								});
							}
						});
				}

				this.blur();
				return false;
			},

			//constructor
			init: function(opt) {
				opt = $.extend({}, EYE.spacegallery.defaults, opt||{});
				return this.each(function(){
					var el = this;
					if ($(el).is('.spacegallery')) {
						$('<a href="#"></a>')
							.appendTo(this)
							.addClass(opt.loadingClass)
							.bind('click', EYE.spacegallery.next);

						el.spacegalleryCfg = opt;
						el.spacegalleryCfg.images = el.getElementsByTagName('img').length;
						el.spacegalleryCfg.loaded = 0;
						el.spacegalleryCfg.asin = Math.asin(1);
						el.spacegalleryCfg.asins = {};
						el.spacegalleryCfg.tops = {};
						el.spacegalleryCfg.lefts = {};
						el.spacegalleryCfg.increment = parseInt(el.spacegalleryCfg.perspective/el.spacegalleryCfg.images, 10);
						var left = 0;
						//window.setTimeout(EYE.spacegallery.next, 5000);
						$('img', el)
							.each(function(nr){
								var imgEl = new Image();
								var elImg = this;
								el.spacegalleryCfg.asins[nr] = 1 - Math.asin((nr+1)/el.spacegalleryCfg.images)/el.spacegalleryCfg.asin;
								left += el.spacegalleryCfg.increment - el.spacegalleryCfg.increment * el.spacegalleryCfg.asins[nr];
								el.spacegalleryCfg.tops[nr] = el.spacegalleryCfg.lefts[nr] = left;
								elImg.spacegallery = {};
								imgEl.src = this.src;
								if (imgEl.complete) {
									el.spacegalleryCfg.loaded ++;
									elImg.spacegallery.origWidth = imgEl.width;
									elImg.spacegallery.origHeight = imgEl.height
								} else {
									imgEl.onload = function() {
										el.spacegalleryCfg.loaded ++;
										elImg.spacegallery.origWidth = imgEl.width;
										elImg.spacegallery.origHeight = imgEl.height;
										if (el.spacegalleryCfg.loaded == el.spacegalleryCfg.images) {

											EYE.spacegallery.positionImages(el);
										}
									};
								}
							});
						el.spacegalleryCfg.asins[el.spacegalleryCfg.images] = el.spacegalleryCfg.asins[el.spacegalleryCfg.images - 1] * 1.3;
						el.spacegalleryCfg.lefts[el.spacegalleryCfg.images] = el.spacegalleryCfg.lefts[el.spacegalleryCfg.images - 1] * 1.3;
						el.spacegalleryCfg.tops[el.spacegalleryCfg.images] = el.spacegalleryCfg.tops[el.spacegalleryCfg.images - 1] * 1.3;
						if (el.spacegalleryCfg.loaded == el.spacegalleryCfg.images) {
							EYE.spacegallery.positionImages(el);
						}
					}
				});
			}
		}
	});

	$.fn.extend({

		/**
		 * Create a space gallery
		 * @name spacegallery
		 * @description create a space gallery
		 * @option	int			border			Images' border. Default: 6
		 * @option	int			perspective		Perpective height. Default: 140
		 * @option	float		minScale		Minimum scale for the image in the back. Default: 0.2
		 * @option	int			duration		Animation duration. Default: 800
		 * @option	string		loadingClass	CSS class applied to the element while looading images. Default: null
		 * @option	function	before			Callback function triggered before going to the next image
		 * @option	function	after			Callback function triggered after going to the next image
		 */
		spacegallery: EYE.spacegallery.init
	});
	$.extend($.easing,{
		easeOut:function (x, t, b, c, d) {
			return -c *(t/=d)*(t-2) + b;
		}
	});
})(jQuery);
    (function($){
	var initLayout = function() {
		$('#myGallery').spacegallery({loadingClass: 'loading'});
	};
	EYE.register(initLayout, 'init');
})(jQuery);
$(function(){
jQuery.easing.def = 'easeOutElastic';
	$('.menu-hover')
	.mouseover(function(){
		$(this).stop().animate(
			{backgroundPosition:"(-930px -192px)"},
			{duration:800,easing:"easeOutElastic"});
		$($(this).children('a')).stop().
		animate({paddingTop: '55px'},{duration:800,easing:"easeOutElastic"})
		//.animate({paddingTop: '35px'},{duration:100,easing:"linear"});
	})
	.mouseout(function(){
		$('#logo').html();
		$(this).stop().animate(
			{backgroundPosition:"(-930px -310px)"},
			{duration:200});
		$($(this).children('a')).stop().
		animate({paddingTop: '35px'},{duration:1000,easing:"easeOutElastic"})
	});
	$('.menu-select').hover(function(){ $(this).addClass("menu-select-hover"); },function(){ $(this).removeClass("menu-select-hover"); });
	Reference = $("#frame-carousel li:first-child");
	NbElement = $("#frame-carousel li").length;
	$("#frame-carousel ul").css("width", (Reference.width() * NbElement) );

	var Cpt = 0;
	var animated = false;
	$('#popular #prev-carousel img').css('opacity',0.4);
	$("#next-carousel")
	.click(function() {
		if( !animated && Cpt < (NbElement-1) ){
			Cpt++;
			op = new Array(1,0.8);
			carousel(Cpt, op);
		}
		return false;

	})
	.mouseover(function(){if( Cpt < (NbElement-1) )$('#popular #next-carousel img').css('opacity',1);})
	.mouseout(function(){if( Cpt < (NbElement-1) )$('#popular #next-carousel img').css('opacity',0.8);});

	$("#prev-carousel")
	.click(function() {
		if( !animated && Cpt > 0 ){
			Cpt--;
			op = new Array(0.8,1);
			carousel(Cpt, op);
		}
		return false;

	})
	.mouseover(function(){if( Cpt > 0 )$('#popular #prev-carousel img').css('opacity',1);})
	.mouseout(function(){if( Cpt > 0 )$('#popular #prev-carousel img').css('opacity',0.8);});

	$('#select-carousel a').mouseover(function(){
		if( !animated ){
			Cpt=$('#select-carousel a').index(this);
			op = new Array(0.8,0.8);
			carousel(Cpt, op);
		}
		return false;
	});
	$('#header li.menu-select a').css('textShadow', '0px 0px 5px #f3a3c3');
	$('#header li.menu-hover a').css('textShadow', '0px 0px 5px #ffffff');
	$('#banner2 h2').css('textShadow', '0px 2px 2px #ffffff');
	$('#search h2').css('textShadow', '0px 2px 2px #fff');
	//$('img[src=img/klick.png]').css('opacity',0);
	if($.browser.msie)$('#clic img').attr('src','img/klick.gif');
	$("#myGallery").mousemove( function(e) {
		$('#clic').css('left',(e.pageX+0 ) + "px").css('top',(e.pageY-45 ) + "px");
	}).hover(function(){
			$('#clic img').stop().animate({height:'42px',width:77,marginTop:0},{queue:false,easing: 'easeOutElastic'});
		},
		function(){
			$('#clic img').stop().animate({height:0,width:0,marginTop:'42px'},{queue:false,easing: 'easeInElastic'});
		});
});
function carousel(compt, op){
	animated = true;
	$('#select-carousel a').removeAttr('class');
	$($('#select-carousel a')[compt]).addClass('select-carousel');
	$("#frame-carousel ul").stop().animate(
		{ marginLeft : - (Reference.width() * compt) + 'px' },
		{ complete: function(){
			animated = false;
			$('#popular #next-carousel img').css('opacity',( compt == NbElement-1 )?0.4:op[0]);
			$('#popular #prev-carousel img').css('opacity',( compt == 0 )?0.4:op[1]);
			},
		easing: 'easeOut' }
	);
}