/**
 * Copyright (c) 2010 Sylvain Gougouzian (sylvain@gougouzian.fr)
 * MIT (http://www.opensource.org/licenses/mit-license.php) licensed.
 * GNU GPL (http://www.gnu.org/licenses/gpl.html) licensed.
 *
 * jQuery moodular version: 2.3
 *
 * Requires: jQuery 1.3.2+ 	// http://www.jquery.com
 * Compatible : Internet Explorer 6+, Firefox 1.5+, Safari 3+, Opera 9+, Chrome 0.9+
 */
jQuery(function($){
	$.fn.moodular = function(options){
		var el = null;
		var opts = $.extend({}, $.fn.moodular.defaults, options);
		var ctrls = $.extend({}, $.fn.moodular.controls);
		var effects = $.extend({}, $.fn.moodular.effects);
		this.each(function(){
			el = new $moodular(this, opts, ctrls, effects);
			$(window).bind('resize', function () { el._resize(); });
		});
		return opts.api ? el : null;
	};
	$.moodular = function(e, opts, ctrls, effects){
		this.e = $(e);
		if (opts.random) {
			var elems = this.e.children($('> ' + opts.item));
			elems.sort(function() { return (Math.round(Math.random())-0.5); });
			this.e.remove($('> ' + opts.item));
			for(var i=0; i < elems.length; i++)
				this.e.append(elems[i]);
		}
		if (opts.continuous) $(e).html($(e).html() + $(e).html());
		this.aItems = null;
		this.nbItems = 0;
		this.current = 0;
		this.locked = false;
		this.dep = 0;
		this.timerMoving = null;
		this.opts = opts;
		this.controls = ctrls;
		this.effects = effects;
		this.direction = ((opts.direction == 'left') || (opts.direction == 'top') ? 'next' : 'prev');
		this.pos = ((opts.direction == 'left') || (opts.direction == 'right') ? 'left' : 'top');
		this.dir = ((opts.direction == 'right') || (opts.direction == 'bottom') ? -1 : 1);
		this.vertical = (this.pos == 'left' ? false : true);
		this._init();
	};
	var $moodular = $.moodular;
	$moodular.fn = $moodular.prototype = {
		moodular: '2.3'
	};
	$moodular.fn.extend = $moodular.extend = $.extend;
	$moodular.fn.extend({
		_init: function(){
			var self = this;
			this._resize();
			this.e.wrap('<div></div>');
			this.e.parent().css({
				'position' : 'relative',
				'overflow' : 'hidden',
				'width'	: this.e.width(),
				'height' : this.e.height()
			});
			this.e.css({
				'position' : 'absolute'
			});
			s = 0;
			$('> ' + this.opts.item, this.e).each(function() {
				if (this.vertical) {
					s += parseInt($(this).outerHeight(true));
				}
				else {
					s += parseInt($(this).outerWidth(true));
				}
			});
			this.e.css(this.vertical ? 'height' : 'width', s + 'px');
			this.aItems = $('> ' + this.opts.item, this.e);
			this.nbItems = this.aItems.length;
			if (!this.opts.continuous) this.nbItems = this.nbItems * 2;
			var control = this.opts.controls.split(' ');
			var i;
			for (i = 0; i < control.length; i++) {
				if ($.isFunction(this.controls[control[i]]))
					this.controls[control[i]](this);
			}
			var effect = this.opts.effects.split(' ');
			for (i = 0; i < effect.length; i++) {
				if ($.isFunction(this.effects.init[effect[i]]))
					this.effects.init[effect[i]](this);
			}
			if (this.opts.startOn) {
				this.speed = this.opts.speed;
				this.opts.speed = 1;
				this.moveTo(this.opts.startOn);
			}
			if (this.opts.auto) {
				setTimeout(function(){
					self._animate('next');
				}, self.opts.dispTimeout);
			}
		},
		_animate: function(dir){
			dir = (dir == undefined ? this.direction : dir);
			if (!this.locked) {
				this.locked = true;
				clearTimeout(this.timerMoving);
				this.dep = this.dep == 0 ? this.opts.scroll : this.dep;
				if (this.dir == -1) {
					if (dir == "next") {
						dir = "prev";
					}
					else if (dir == "prev") {
						dir = "next";
					}
				}
				if (dir != 'next') {
					this.dep *= -1;
				}
				var cont = true;
				if (!this.opts.continuous) {
					if (dir == 'next') {
						if (this.current >= ((this.nbItems / 2) - 1)) {
							cont = false;
							this.locked = false;
						}
					}
					else {
						if (this.current <= 0) {
							cont = false;
							this.locked = false;
						}
					}
				}
				if (cont) {
					this._beforeMoving();
				}
			}
		},
		_beforeMoving: function(){
			var effect = this.opts.effects.split(' ');
			var i;
			for (i = 0; i < effect.length; i++) {
				if ($.isFunction(this.effects.before[effect[i]]))
					this.effects.before[effect[i]](this, (this.dep < 0 ? -1 : 1));
			}
			if (this.dep < 0 && this.opts.continuous) {
				var size = 0;
				for (i = 0; i < Math.abs(this.dep); i++) {
					var item = $('> ' + this.opts.item + ':last', this.e);
					size += parseInt(item.css(this.vertical ? 'height' : 'width'));
					$('> ' + this.opts.item + ':last', this.e).remove();
					this.e.prepend(item);
				}
				this.e.css(this.pos, -size);
			}
			this._move();
		},
		_move: function(){
			var self = this;
			if ($.isFunction(this.opts.move)) {
				this.opts.move(this, function(){
					self._afterMoving();
				});
			}
			else {
				var size = 0;
				var i;
				if (this.dep > 0) {
					for (i = 0; i < this.dep; i++) {
						if (this.vertical) {
							size += parseInt(this.aItems.eq(this._realpos(this.current) + i).outerHeight(true));
						}
						else {
							size += parseInt(this.aItems.eq(this._realpos(this.current) + i).outerWidth(true));
						}
					}
				}
				else {
					if (!this.opts.continuous && this.current <=0) {}
					else {
						for (i = 0; i < Math.abs(this.dep); i++) {
							if (this.vertical) {
								size += parseInt(this.aItems.eq(this._realpos(this.current) - i).outerHeight(true));
							}
							else {
								size += parseInt(this.aItems.eq(this._realpos(this.current) - i).outerWidth(true));
							}
						}
					}
				}
				if (this.e.css(this.pos) == 'auto') this.e.css(this.pos, 0);
				var dest = parseInt(this.e.css(this.pos)) + (this.dep > 0 ? -1 : 1) * size;
				if (!this.opts.continuous) {
					if (dest > 0) dest = 0;
					if (this.vertical) {
						if ((parseInt(this.e.height()) + dest) < parseInt(this.e.parent().height())) {
							dest = parseInt(this.e.parent().height()) - parseInt(this.e.height());
						}
					}
					else {
						if ((parseInt(this.e.width()) + dest) < parseInt(this.e.parent().width())) {
							dest = parseInt(this.e.parent().width()) - parseInt(this.e.width()) ;
						}
					}
				}
				if (this.vertical) {
					this.e.stop(true, true).animate({
						top: parseInt(dest) + 'px'
					}, this.opts.speed, this.opts.easing, function(){
						self._afterMoving();
					});
				}
				else {
					this.e.stop(true, true).animate({
						left: parseInt(dest) + 'px'
					}, this.opts.speed, this.opts.easing, function(){
						self._afterMoving();
					});
				}
			}
		},
		_afterMoving: function(){
			var i;
			if (this.dep > 0 && this.opts.continuous) {
				for (i = 0; i < this.dep; i++) {
					var item = $('> ' + this.opts.item + ':first', this.e);
					$('> ' + this.opts.item + ':first', this.e).remove();
					this.e.append(item);
				}
				this.e.css(this.pos, 0);
			}
			var self = this;
			this.current = this.current + this.dep;
			if (this.current == -1) {
				if (this.opts.continuous)
					this.current = this.nbItems - 1;
				else
					this.current = 0;
			}
			else {
				if (this.current == this.nbItems) {
					this.current = 0;
				}
				else {
					this.current = this._realpos(this.current);
				}
			}
			this.dep = 0;
			this.locked = false;
			var effect = this.opts.effects.split(' ');
			for (i = 0; i < effect.length; i++) {
				if ($.isFunction(this.effects.after[effect[i]]))
					this.effects.after[effect[i]](this);
			}
			for (i = 0; i < this.opts.callbacks.length; i++) {
				this.opts.callbacks[i](this);
			}
			var control = this.opts.controls.split(' ');
			for (i = 0; i < control.length; i++) {
				if ($.isFunction(this.controls.callback[control[i]]))
					this.controls.callback[control[i]](this);
			}
			if (this.opts.startOn) {
				this.opts.speed = this.speed;
			}
			if (this.opts.auto) {
				this.timerMoving = setTimeout(function(){
					self._animate('next');
				}, this.opts.dispTimeout);
			}
		},
		_realpos: function(i){
			if (i < 0) i = (this.nbItems / 2) - i;
			return (i < (this.nbItems / 2) ? i : (i - (this.nbItems / 2)));
		},
		_resize: function () {
			var s = $('> ' + this.opts.item, this.e).css(this.vertical ? 'height' : 'width');
			$('> ' + this.opts.item, this.e).each(function() {
				if (this.vertical) {
					$(this).height($(this).height());
				}
				else {
					$(this).width($(this).width());
				}
			});
		},
		reanimate: function() {
			if (!this.opts.auto) {
				this.locked = false;
				this.opts.auto = true;
				var self = this;
				this.timerMoving = setTimeout(function(){
					self._animate('next');
				}, this.opts.dispTimeout);
			}
		},
		start: function(){
			if (!this.opts.auto) {
				this.locked = false;
				this.opts.auto = true;
				this._animate('next');
			}
			return false;
		},
		stop: function(){
			clearTimeout(this.timerMoving);
			this.opts.auto = false;
			return false;
		},
		next: function(){
			this._animate('next');
			return false;
		},
		prev: function(){
			this._animate('prev');
			return false;
		},
		getCurrent: function(){
			return this._realpos(this.current);
		},
		moveTo: function(i){
			if (i > (this.nbItems / 2)) {
				i = (this.nbItems / 2) - 1;
			}
			this.dep = parseInt(i) - parseInt(this.current);
			if (this.dep != 0) {
				this._animate('next');
			}
			return false;
		}
	});
	$.fn.moodular.defaults = {
		item: 'li',
		controls: '',
		effects: '',
		easing: '',
		auto: true,
		continuous: true,
		speed: 2000,
		direction: 'left',
		scroll: 1,
		startOn: 0,
		dispTimeout: 1000,
		callbacks: [],
		random: false,
		api: false
	};
	$.fn.moodular.controls = {
		callback: {}
	};
	$.fn.moodular.effects = {
		init: {},
		before: {},
		after: {}
	};
});

/**
 * Copyright (c) 2010 Sylvain Gougouzian (sylvain@gougouzian.fr)
 * MIT (http://www.opensource.org/licenses/mit-license.php) licensed.
 * GNU GPL (http://www.gnu.org/licenses/gpl.html) licensed.
 *
 * jQuery moodular controls by Sylvain Gougouzian http://sylvain.gougouzian.fr
 *
 * Requires: jQuery 1.3.2+ 	// http://www.jquery.com
 * 			jQuery moodular plugin
 *	 		jQuery Mouse Wheel Plugin v3.0.2 // Copyright (c) 2009 [Brandon Aaron] (http://brandonaaron.net)
 *			jQuery UI 1.7.2
 *
 * Compatible : Internet Explorer 6+, Firefox 1.5+, Safari 3+, Opera 9+, Chrome 0.9+
 */
jQuery(function($){
	$.extend($.fn.moodular.controls, {
		keys: function(moodular){
			$(document).keydown(function(event){
				if ((event.keyCode == 39) || (event.keyCode == 40)) {
					moodular._animate('next');
				}
				if ((event.keyCode == 37) || (event.keyCode == 38)) {
					moodular._animate('prev');
				}
			});
			return false;
		},
		click: function(moodular){
			for (var i = 0; i < moodular.nbItems; i++) {
				$('> ' + moodular.opts.item, moodular.e).css('cursor', 'pointer').attr('rel', moodular._realpos(i)).click(function(){
					moodular.locked = false;
					moodular.moveTo($(this).attr('rel'));
					return false;
				});
			}
		},
		stopOver: function (moodular) {
			moodular.e.parent().bind("mouseenter", function(){
				moodular.stop();
			}).bind("mouseleave", function () {
				if (!moodular.locked) { 
					moodular.reanimate();
				} else { 
					moodular.locked = false;
				}
			});
		},
		index: function(moodular){
			moodular.e.parent().parent().append('<ul class="moodular_itemList"></ul>');
			var h = "";
			for (var i = 0; i < (moodular.nbItems / 2); i++) {
				h += '<li class="moodular_itemList_li" rel="' + i + '">' + (i + 1) + '</li>';
			}
			$('.moodular_itemList', moodular.e.parent().parent()).html(h);
			$('li.moodular_itemList_li', moodular.e.parent().parent()).css('cursor', 'pointer').click(function(){
				if(!moodular.locked) {
					moodular.moveTo($(this).attr('rel'));
				} else { 
					moodular.locked = false;
				}
				return false;
			});
			$('.moodular_itemList_li:first').addClass('active');
		},
		tabs: function(moodular){
			if (moodular.opts.tabs) {
				$('a', moodular.opts.tabs).bind('click', function () {
					moodular.moveTo($('> ' + moodular.opts.item, moodular.e).index($($(this).attr('href'))));
				});
				if (window.location.hash.length) {
					moodular.moveTo($('> ' + moodular.opts.item, moodular.e).index($(window.location.hash)));
				}
			}
		},
		wheel: function(moodular){
			moodular.e.parent().parent().bind("mousewheel", function(event, delta){
				
				var dir = delta > 0 ? 'Up' : 'Down';
				if (dir == 'Up') {
					moodular.next();
				}
				else {
					moodular.prev();
				}
				return false;
			});
		},
		mouseover: function(moodular){
			moodular.opts.callbacks[moodular.opts.callbacks.length] = function(moodular){
				if (moodular.isMouseOver) {
					moodular._animate(mouseDirection(moodular));
				}
			};
			moodular.e.parent().parent().bind("mousemove", function(evt){
				moodular.mouseX = evt.pageX;
				moodular.mouseY = evt.pageY;
			});
			moodular.e.parent().parent().bind("mouseenter", function(evt){
				moodular.isMouseOver = true;
				moodular.mouseX = evt.pageX;
				moodular.mouseY = evt.pageY;
				moodular._animate(mouseDirection(moodular));
				return false;
			});
			moodular.e.parent().parent().bind("mouseleave", function(){
				moodular.isMouseOver = false;
				return false;
			});
		},
		touch: function(moodular){
			moodular.touchBPosX = null;
			moodular.touchBPosY = null;
			moodular.touchEPosX = null;
			moodular.touchEPosY = null;
			moodular.e.parent().bind('touchstart', function (event) {
				var e = event.originalEvent;
				moodular.touchBPosX = e.targetTouches[0].pageX;
				moodular.touchBPosY = e.targetTouches[0].pageY;
			}).bind('touchmove', function (event) {
				event.preventDefault();
				var e = event.originalEvent;
				moodular.touchEPosX = e.targetTouches[0].pageX;
				moodular.touchEPosY = e.targetTouches[0].pageY;
			}).bind('touchend', function(e) {
				if (moodular.vertical) {
					if (moodular.opts.direction == 'top') {
						if (moodular.touchEPosY < moodular.touchBPosY)
							moodular.next();
						else
							moodular.prev();
					}
					else {
						if (moodular.touchEPosY > moodular.touchBPosY)
							moodular.next();
						else
							moodular.prev();
					}
				}
				else {
					if (moodular.opts.direction == 'left') {
						if (moodular.touchEPosX < moodular.touchBPosX)
							moodular.next();
						else
							moodular.prev();
					}
					else {
						if (moodular.touchEPosX > moodular.touchBPosX)
							moodular.next();
						else
							moodular.prev();
					}
				}
				moodular.touchBPosX = null;
				moodular.touchBPosY = null;
				moodular.touchEPosX = null;
				moodular.touchEPosY = null;
				return false;
			});
		},
		slider: function (moodular) {
			moodular.e.parent().parent().append('<div id="' + moodular.id + '_slider"></div>');
			$("#" + moodular.id + "_slider", moodular.e.parent().parent()).slider({
				range: "max",
				min: 0,
				max: ((moodular.nbItems) / 2) - 1,
				value: 0,
				stop: function(event, ui) {
					moodular.moveTo(ui.value);
				}
			});
		}
	});

	$.extend($.fn.moodular.controls.callback, {
		index: function (moodular) {
			$('.moodular_itemList li.active').removeClass('active');
			$('.moodular_itemList li').eq(moodular._realpos(moodular.current)).addClass('active');
		},
		slider: function (moodular) {
			$("#" + moodular.id + "_slider", moodular.e.parent().parent()).slider('value', moodular.current);
		}
	});

	function mouseDirection(moodular){
		var offset = moodular.e.parent().parent().offset();
		if (moodular.vertical) {
			if ((moodular.mouseY >= parseInt(offset.top)) && (moodular.mouseY <= parseInt((parseInt(offset.top) + parseInt(moodular.e.parent().parent().height())) / 2))) {
				return 'prev';
			}
			else {
				return 'next';
			}
		}	
		else {
			if ((moodular.mouseX >= parseInt(offset.left)) && (moodular.mouseX <= parseInt((parseInt(offset.left) + parseInt(moodular.e.parent().parent().width())) / 2))) {
				return 'prev';
			}
			else {
				return 'next';
			}
		}
	}
});

/*
 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
 *
 * Uses the built in easing capabilities added In jQuery 1.1
 * to offer multiple easing options
 *
 * TERMS OF USE - jQuery Easing
 * 
 * Open source under the BSD License. 
 * 
 * Copyright © 2008 George McGinley Smith
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without modification, 
 * are permitted provided that the following conditions are met:
 * 
 * Redistributions of source code must retain the above copyright notice, this list of 
 * conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright notice, this list 
 * of conditions and the following disclaimer in the documentation and/or other materials 
 * provided with the distribution.
 * 
 * Neither the name of the author nor the names of contributors may be used to endorse 
 * or promote products derived from this software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
 * OF THE POSSIBILITY OF SUCH DAMAGE. 
 *
*/

// t: current time, b: begInnIng value, c: change In value, d: duration
jQuery.easing['jswing'] = jQuery.easing['swing'];

jQuery.extend( jQuery.easing,
{
	def: 'easeOutQuad',
	swing: function (x, t, b, c, d) {
		//alert(jQuery.easing.default);
		return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
	},
	easeInQuad: function (x, t, b, c, d) {
		return c*(t/=d)*t + b;
	},
	easeOutQuad: function (x, t, b, c, d) {
		return -c *(t/=d)*(t-2) + b;
	},
	easeInOutQuad: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t + b;
		return -c/2 * ((--t)*(t-2) - 1) + b;
	},
	easeInCubic: function (x, t, b, c, d) {
		return c*(t/=d)*t*t + b;
	},
	easeOutCubic: function (x, t, b, c, d) {
		return c*((t=t/d-1)*t*t + 1) + b;
	},
	easeInOutCubic: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t + b;
		return c/2*((t-=2)*t*t + 2) + b;
	},
	easeInQuart: function (x, t, b, c, d) {
		return c*(t/=d)*t*t*t + b;
	},
	easeOutQuart: function (x, t, b, c, d) {
		return -c * ((t=t/d-1)*t*t*t - 1) + b;
	},
	easeInOutQuart: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
		return -c/2 * ((t-=2)*t*t*t - 2) + b;
	},
	easeInQuint: function (x, t, b, c, d) {
		return c*(t/=d)*t*t*t*t + b;
	},
	easeOutQuint: function (x, t, b, c, d) {
		return c*((t=t/d-1)*t*t*t*t + 1) + b;
	},
	easeInOutQuint: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
		return c/2*((t-=2)*t*t*t*t + 2) + b;
	},
	easeInSine: function (x, t, b, c, d) {
		return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
	},
	easeOutSine: function (x, t, b, c, d) {
		return c * Math.sin(t/d * (Math.PI/2)) + b;
	},
	easeInOutSine: function (x, t, b, c, d) {
		return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
	},
	easeInExpo: function (x, t, b, c, d) {
		return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
	},
	easeOutExpo: function (x, t, b, c, d) {
		return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
	},
	easeInOutExpo: function (x, t, b, c, d) {
		if (t==0) return b;
		if (t==d) return b+c;
		if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
		return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
	},
	easeInCirc: function (x, t, b, c, d) {
		return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
	},
	easeOutCirc: function (x, t, b, c, d) {
		return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
	},
	easeInOutCirc: function (x, t, b, c, d) {
		if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
		return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
	},
	easeInElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
	},
	easeOutElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
	},
	easeInOutElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
		return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
	},
	easeInBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158;
		return c*(t/=d)*t*((s+1)*t - s) + b;
	},
	easeOutBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158;
		return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
	},
	easeInOutBack: function (x, t, b, c, d, s) {
		if (s == undefined) s = 1.70158; 
		if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
		return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
	},
	easeInBounce: function (x, t, b, c, d) {
		return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
	},
	easeOutBounce: function (x, t, b, c, d) {
		if ((t/=d) < (1/2.75)) {
			return c*(7.5625*t*t) + b;
		} else if (t < (2/2.75)) {
			return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
		} else if (t < (2.5/2.75)) {
			return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
		} else {
			return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
		}
	},
	easeInOutBounce: function (x, t, b, c, d) {
		if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
		return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
	}
});

/*
 *
 * TERMS OF USE - EASING EQUATIONS
 * 
 * Open source under the BSD License. 
 * 
 * Copyright © 2001 Robert Penner
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without modification, 
 * are permitted provided that the following conditions are met:
 * 
 * Redistributions of source code must retain the above copyright notice, this list of 
 * conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright notice, this list 
 * of conditions and the following disclaimer in the documentation and/or other materials 
 * provided with the distribution.
 * 
 * Neither the name of the author nor the names of contributors may be used to endorse 
 * or promote products derived from this software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
 * OF THE POSSIBILITY OF SUCH DAMAGE. 
 *
 */
