document.documentElement.className += 'js_active';
jQuery.noConflict();
jQuery(document).ready(function () {

    jQuery('#SearchInput').bind('keypress', function (e) {
        var code = (e.keyCode ? e.keyCode : e.which);
        if (code == 13) { //Enter keycode
            if (jQuery('#SearchInput').val() != '') {
                jQuery('.search').trigger('click');
            }
        }
    });

    var email_regex = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;

    jQuery('#NewsletterInput').bind('keypress', function (e) {
        var code = (e.keyCode ? e.keyCode : e.which);
        if (code == 13) { //Enter keycode
            if (jQuery('#NewsletterInput').val() != '' && email_regex.test(jQuery('#NewsletterInput').val())) {
                jQuery('#newsletter').trigger('click');
            }
        }
    });



    // cufon
    //Cufon.replace('.landingPage .details .txt');

    // placeholder
    jQuery('input[type=text]').placeholder();

    // mainNav hover
    jQuery('.mainBtn').hover(function () {
        jQuery(this).find('.left').css('background-position', '0 -90px');
        jQuery(this).find('.mid').css('background-position', '0 -120px');
        jQuery(this).find('.right').css('background-position', '0 -150px');
    },
        function () {
            jQuery(this).find('.left').css('background-position', '0 0');
            jQuery(this).find('.mid').css('background-position', '0 -30px');
            jQuery(this).find('.right').css('background-position', '0 -60px');
        })

    jQuery('.mainNav .mainBtn').bind('mouseenter mouseleave', function (e) {
        var _this = jQuery(this),
            _sub = _this.find('.submenu');

        if (e.type == 'mouseenter') {
            _sub.removeClass('visuallyhidden');
        } else {
            _sub.addClass('visuallyhidden');
        }
    });

    jQuery('.equal-height-content').each(function () {
        var _max = 0,
            _cols = jQuery(this).find('.equal-height-col');

        _cols.each(function () {
            var _height = jQuery(this).height();

            _max = _height > _max ? _height : _max;
        });

        _cols.height(_max);
    });


    // carousel
    jQuery(".carousel").jCarouselLite({
        btnNext: ".btnNext",
        btnPrev: ".btnPrev",
        visible: 5,
        easing: "easeInOutBack",
        speed: 700
    });

    jQuery("#referenceSlider").jCarouselLite({
        visible: 5,
        easing: "easeOutCirc",
        auto: 2000,
        speed: 2000,
        hoverPause: true
    });

    jQuery("#referenceSlider ul li a").hover(function () {
        jQuery(this).find('img').eq(1).css({ 'display': 'block' });
        jQuery(this).find('img').eq(1).animate({ opacity: 1 }, 500);
    },
		function () {
		    jQuery(this).find('img').eq(1).animate({ opacity: 0 }, 500, function () {
		        jQuery(this).find('img').eq(1).css({ 'display': 'none' });
		    });
		}

		)

    // carousel hover
    jQuery(".carousel").delegate("li", "mouseenter", function () {
        jQuery(this).find('a').append('<img class="magnifyingGlass" src="assets/images/subNavHover.png" alt="info" />');
        jQuery(this).addClass('over');
    });

    jQuery(".carousel").delegate("li", "mouseleave", function () {
        if (jQuery(this).hasClass('over')) {
            jQuery(this).find('img').eq(1).remove();
            jQuery(this).removeClass('over');
        }
    });

    // twitter
    jQuery("#twitter").getTwitter({
        userName: "nexumbogazici",
        numTweets: 7,
        loaderText: "Loading tweets...",
        slideIn: true,
        slideDuration: 750,
        showHeading: false,
        showProfileLink: false,
        showTimestamp: true
    });

    //activates the broadscope slider
    if (jQuery.fn.avia_fade_slider)
        jQuery(".slideshow_container").avia_fade_slider();

    // pagination last item margin-right:0
    jQuery('.pagination .pages li:last').css('margin-right', '0');

    // preventDefault selected pagination link
    jQuery('nav.pagination ul li.selected a').click(function () {
        return false;
    })

    // deleting margin to subNavMenu 2th item
    jQuery('nav.newsSubMenu ul li:nth-child(2n)').css('margin-right', '0');

    // deleting padding-right to threeColumned 3th item
    jQuery('.threeColumned li:nth-child(3n)').css('padding-right', '0');


    // Landing Background
    /*
    jQuery('.lendingLeft').hover(function() {
    jQuery('.landingTable').css('background-image', 'url(../images/landing-bogazici.jpg)');
    console.log('background bogazici');
    },
    function() {
    jQuery('.landingTable').css('background-image', 'url(../images/landing-default.jpg)');
    console.log('background default');
    })

    jQuery('.lendingRight').hover(function() {
    jQuery('.landingTable').css('background-image', 'url(../images/landing-creative.jpg)');
    console.log('background creative');
    },
    function() {
    jQuery('.landingTable').css('background-image', 'url(../images/landing-default.jpg)');
    console.log('background default');
    })
    */


    jQuery('.bogaziciPart').mouseenter(function () {
        jQuery('.bogaziciBg').stop().animate({ opacity: 1 }, 300);
    })

    jQuery('.bogaziciPart').mouseleave(function () {
        jQuery('.bogaziciBg').stop().animate({ opacity: 0 }, 300);
    })

    jQuery('.creativePart').mouseenter(function () {
        jQuery('.creativeBg').stop().animate({ opacity: 1 }, 300);
    })

    jQuery('.creativePart').mouseleave(function () {
        jQuery('.creativeBg').stop().animate({ opacity: 0 }, 300);
    })





});




// -------------------------------------------------------------------------------------------
// image preloader
// -------------------------------------------------------------------------------------------


(function($)
{
	$.fn.aviaImagePreloader = function(variables, callback)
	{
		var defaults =
		{
			fadeInSpeed: 800,
			maxLoops: 10
		};

		var options = $.extend(defaults, variables);

		return this.each(function()
		{
			var container 	= $(this),
				images		= $('img', this).css({opacity:1, visibility:'visible', display:'block'}),
				parent = images.parent().addClass('preloading'),
				imageCount = images.length,
				interval = '',
				allImages = images ;


			var methods =
			{
				checkImage: function()
				{
					images.each(function(i)
					{
						if(this.complete == true) images = images.not(this);
					});

					if(images.length && options.maxLoops >= 0)
					{
						options.maxLoops--;
						setTimeout(methods.checkImage, 500);
					}
					else
					{
						methods.showImages();
					}
				},

				showImages: function()
				{
					allImages.each(function(i)
					{
						var currentImage = $(this);
						currentImage.animate({opacity:1}, options.fadeInSpeed, function()
						{
							currentImage.parents().removeClass('preloading');
							if(allImages.length == i+1)
							{
								methods.callback(i);
							}
						});
					});
				},

				callback: function()
				{
					if (variables instanceof Function) { callback = variables; }
					if (callback  instanceof Function) { callback.call(this);  }
				}
			};

			if(!images.length) { methods.callback(); return }
			methods.checkImage();

		});
	};
})(jQuery);


// -------------------------------------------------------------------------------------------
// Main Slideshow
// -------------------------------------------------------------------------------------------

(function($)
{
	$.fn.avia_fade_slider = function(variables)
	{
		var defaults =
		{
			slides:'.featured',										//which elements should serve as slide
			transitionDuration: 800,								//how fast should images crossfade
			transitionEasing: 'easeOutQuint',						//easing for the container movement if images got different sizes
			firstFadeInOfElements: 800,								// after preloading how fast should elements be displayed
			appendControlls: true,									//attach controlls via javascript (set to false if JS should not add them)
			appendAutoSlideshowControlls: 'autoslidecontrolls',		//attach play pause fwd and back bitton for the dia show (set to false if you dont want to add them -autoslidecontrolls)
			controllContainerClass:'slidecontrolls',				//container class for slidecontrolls. <a> tags within this container serve as slide controll
			appendCaption: 'feature_excerpt',						//caption div class name. change to false if you dont want to display caption
			convertAttributes: false								// should the image title and alt tag be converted into caption and headlines?
		},

		options = $.extend(defaults, variables);

		return this.each(function()
		{
			var container = $(this),
				slideshow_container = $('.slideshow', this),
				slides = $(options.slides, container).css({position:'relative'}),
				currentSlide = slides.filter(':eq(0)'),
				slideCount = slides.length,
				interval = "",
				i = 0,
				animating = false,
				captions = $(),
				controlls = $(),
				slideControlls = $(),
				nextSlide = $(),
				transition_direction = 'higher',
				no_png_fade = false;

			if($.browser.msie && $.browser.version < 9) no_png_fade = true;
      
      var _color = currentSlide.attr('rel');
	  
	  if(currentSlide.next()) {
		  var _nextColor = currentSlide.next().attr('rel');
	  } else {
		  var _nextColor = jQuery('.slideshow li').eq(0).attr('rel');
	  }
	  
      
	  
		  //currentSlide.parents('.mainSlider').css('background', _color);
		  jQuery('.sliderBg').append("<div class='bg'></div><div class='bg'></div>");
		  jQuery('.sliderBg .bg').eq(1).css('background', _color);
		  jQuery('.sliderBg .bg').eq(0).css('background', _nextColor);
	  

			//helper contains functions that need to be done over and over again
			var helper =
			{
				autoRotation: function()
				{
					if(options.autorotation && slideCount > 1)
					{
						interval = setInterval(function()
						{
							helper.setSlideNumber();
						},
						options.autorotationInterval);
					}
				},

				toggleAutoRotation: function(deactivate)
				{
					var button = $('.ctrl_play, .ctrl_pause', slideControlls);
					if (button.is('.ctrl_play') || deactivate == 'deactivate')
					{
						clearInterval(interval);
						button.removeClass('ctrl_play');
					}
					else
					{
						options.autorotation = true;
						helper.setSlideNumber();
						helper.autoRotation();
						button.addClass('ctrl_play');
					}
					return false;
				},

				newChangePossible: function()
				{
					animating = false;
				},

				setSlideNumber: function(event)
				{
					//stop in case of hidden portfolio items
					if(container.is(':hidden')) return false;

					var stop = false;
					if(event) helper.toggleAutoRotation('deactivate');
					
					if(currentSlide.next('li').hasClass('transition_slide')) {
						_color = currentSlide.attr('rel');
						_nextColor = currentSlide.next('li').attr('rel');
					} else {
						_color = currentSlide.attr('rel');
						_nextColor = jQuery('.slideshow li').eq(0).attr('rel');
					}
					

					if(!animating) //prevents transition if slides are already changing
					{
            
						var restore = i;

						if(event)
						{
							if(event.data.show == 'next') {i++; transition_direction = 'higher';}
							if(event.data.show == 'prev') { 
							
								i--; transition_direction = 'lower'; 
								if(currentSlide.prev('li').hasClass('transition_slide')) {
									_color = currentSlide.attr('rel');
									_nextColor = currentSlide.prev('li').attr('rel');
								} else {
									_color = currentSlide.attr('rel');
									_nextColor = jQuery('.slideshow li:last').attr('rel');
								}
											
							}
							
							if(typeof(event.data.show) == 'number')
							{
								//check if next slide is the same as current slide
								if(i != event.data.show)
								{
									transition_direction = 'lower';
									if(event.data.show > i)
									{
										transition_direction = 'higher';
									}

									i = event.data.show;
								}
								else
								{
									stop = true;
								}
							}
						}
						else
						{
							i++;
						}

						if(i+1 > slideCount) { i = 0; } else
						if(i < 0) {i = slideCount-1};

						//check if next Slide is animating, if so stop and reset i
						if(slides.filter(':eq('+(i)+')').is(':animated')) { stop = true; i = restore;}
            
						var _slide = slides.filter(':eq('+(i)+')');
						//_slide.parents('.mainSlider').css('background', _slide.attr('rel'));
						
						
						//_nextColor = currentSlide.next();
			
						jQuery('.sliderBg .bg').eq(1).css('background', _color);
						jQuery('.sliderBg .bg').eq(0).css('background', _nextColor);
			
						jQuery('.sliderBg .bg:last').animate({opacity: 0}, 500, function() {jQuery('.sliderBg .bg:first').appendTo('.sliderBg');})
						jQuery('.sliderBg .bg:first').css('opacity', 1);

			


			//jQuery('.sliderBg').animate({opacity: 0}, 1000, function() {jQuery('.sliderBg').css({'background': _slide.attr('rel')});});
			//jQuery('.sliderBg').animate({opacity: 1}, 1000);

						if(!stop) // prevents transition if the next slide and the current slide are the same
						{
							animating = true;
							animatingTimeout = setTimeout(helper.newChangePossible, (options.transitionDuration + 100)/(slideCount-1));

							helper.change();
						}
					}
					return false;
				},

				change: function()
				{
					//set controll status
					var activeControll = controlls.find('a:eq('+(i)+')'),
						newHeight = currentSlide.height();


					$('.activeItem', controlls).removeClass('activeItem');
					activeControll.addClass('activeItem');


					//prepare container
					slideshow_container.height(newHeight);
					nextSlide = slides.filter(':eq('+(i)+')');


					if(container.is('.transition_slide'))
					{
						helper.slide(nextSlide);
					}
					else
					{
						helper.fade(nextSlide);
					}

				},

				slide: function()
				{
					var viewport = $(window).width() * 2,
						extraEls = $('.extra_movement', currentSlide),
						modifier = 1;

						if(transition_direction == 'higher')
						{
							modifier = -1;
							extraEls = $(extraEls.get().reverse());
						}

					currentSlide.css({display:"block", position:'absolute', zIndex:3});
					nextSlide.css({display:"block", zIndex:2, position:'absolute', top:'0px', left:viewport * modifier});


					extraEls.each(function(i)
					{
						var el = $(this),
							this_css_left = el.css("left");
						if(this_css_left == 'auto')	this_css_left = "0";

						var	pos_left = parseInt(this_css_left.replace(/px/g, "")),
							adjust_left = pos_left + (((i+1) * 35) * modifier );

							el.animate({left:adjust_left}, 450 ,"linear").animate({left:pos_left},300);
					});



					currentSlide.animate({left: -viewport * modifier}, 800, "easeInQuint", function()
					{
						nextSlide.animate({left: 0 }, 800, 'easeOutBackMod');
						currentSlide = nextSlide;
						helper.adjust_size(currentSlide);
					});


				},

				fade: function(nextSlide)
				{
					//check for video content
					var videoContentCurrent = currentSlide.find('object, embed, iframe, video, .avia_video'),
						videoContentNext = nextSlide.find('object, embed, iframe, video, .avia_video'),
						video_slide_helper = $("<li class='video_slide_helper'></li>").css({opacity:0});

					if(videoContentCurrent.length || videoContentNext.length)
					{

						video_slide_helper.appendTo(slideshow_container).animate({opacity:1}, function()
						{
							currentSlide.css('display','none');
							nextSlide.css({display:"block", zIndex:2, position:'absolute', top:'0px'});
							currentSlide = nextSlide;


							helper.adjust_size(currentSlide, function()
							{
								video_slide_helper.fadeOut(options.transitionDuration, function()
								{
									video_slide_helper.remove();
								});
							});
						});
					}
					else
					{
						//prepare slides
						currentSlide.css({display:"block", position:'absolute', zIndex:3});
						nextSlide.css({display:"block", zIndex:2, position:'absolute', top:'0px'});

						currentSlide.fadeOut( options.transitionDuration );
						currentSlide = nextSlide;
						helper.adjust_size(currentSlide);
					}
				},


				adjust_size: function(element, callback)
				{
					var newHeight = element.height();


					slideshow_container.animate({height:newHeight}, options.transitionDuration, function()
					{
						if(container.is('.transition_slide'))
						{
							slides.css('position','absolute');
						}
						else
						{
							element.css('position','relative');
							slideshow_container.css('height', 'auto');
						}
						if (callback  instanceof Function) { callback.call(this);  }
					});
				}

			};


			//methods holds one time executions
			var methods =
			{
				preload : function(container)
				{
					if($.fn.aviaImagePreloader)
					{
						container.aviaImagePreloader({fadeInSpeed: options.firstFadeInOfElements}, methods.init);
					}
					else
					{
						methods.init();
					}
				},

				init: function()
				{
					//adjust the height of the first slide
					helper.adjust_size(slides.filter(':eq(0)'));

					//get settings for autorotation
					methods.set_autorotation();

					//append slidecontrolls
					methods.appendControlls();

					//check and add slideshow Captions
					methods.appendCaption();

					//show appended elemens
					methods.showAppended();

					//init autorotation
					helper.autoRotation();
				},

				set_autorotation: function()
				{
					if(container.is('.autoslide_true'))
					{
						options.autorotation = true;

						var myRegexp = /autoslidedelay__(\d+)/g;
						var match = myRegexp.exec(container[0].className);

						if(match != null && parseInt(match[1]) > 0)
						{
							options.autorotationInterval = parseInt(match[1]) * 1000;
						}
					}
					else
					{
						options.autorotation = false;
					}
				},

				appendControlls: function()
				{
					//if controlls should be added by javascript and we got more than 1 slide
					if(slideCount > 1)
					{

						var firstClass = 'class="activeItem"';

						controlls = $('<div></div>').appendTo(container)
													.addClass(options.controllContainerClass)
													.css({visibility:'hidden', opacity:0});

						slides.each(function(i){ $('<a '+firstClass+' href="#"></a>').appendTo(controlls); firstClass = ""; });
					}

					if(!options.appendControlls)
					{
						controlls.css({display:'none'});
					}

					//if we got controlls (either added by js above, or already available within the html source code add the click behaviour:
					if(options.controllContainerClass)
					{
						var links = $('.'+options.controllContainerClass, container).find('a');
						links.each(function(i)
						{
							$(this).bind('click', {show: i}, helper.setSlideNumber);
						});
					}

					//slideshow controll buttons
					if(options.appendAutoSlideshowControlls && options.appendControlls && slideCount > 1)
					{
						slideControlls = $('<div></div>').appendTo(container)
														 .addClass(options.appendAutoSlideshowControlls)
														 .css({visibility:'hidden', opacity:0});
						var	status = 'ctrl_pause';

						if(options.autorotation) status += ' ctrl_play';

						slideControlls.html('<a class="ctrl_fwd" href=""></a><a class="'+status+'" href=""></a><a class="ctrl_back" href=""></a>');

						$('.ctrl_back', slideControlls).bind('click', {show: 'prev'}, helper.setSlideNumber);
						$('.ctrl_fwd', slideControlls).bind('click', {show: 'next'}, helper.setSlideNumber);
						$('.ctrl_pause, .ctrl_play', slideControlls).bind('click', helper.toggleAutoRotation);
					}

					if(!container.is('.transition_slide'))
					{
						slideControlls.css('visibility','visible')
						container.hover(
						function()
						{
							slideControlls.stop().animate({opacity:1});
						},

						function()
						{
							slideControlls.stop().animate({opacity:0});
						});
					}

				},

				appendCaption: function()
				{
					if(options.appendCaption && jQuery.fn.aviaConvertAttribute2HTML)
					{
						if(options.convertAttributes) // if we want to use the image data convert it, otherwise check if there is already a caption available and hide it
						{
							slides.aviaConvertAttribute2HTML({newContainerClass: options.appendCaption});
						}
						captions = $('.'+options.appendCaption).css({visibility:'hidden', opacity:0});
					}
				},

				showAppended: function()
				{
					var opa = 0.8;
					//if($.browser.msie && $.browser.version < 9) opa = 0.8;

					$('.'+options.appendCaption+', .'+options.controllContainerClass).css('visibility','visible').animate({opacity:opa}, options.firstFadeInOfElements );

					if(container.is('.transition_slide'))
					{
						$('.'+ options.appendAutoSlideshowControlls ).css('visibility','visible').animate({opacity:opa}, options.firstFadeInOfElements );
					}

				}


			}; // end methods


			methods.preload(container);


		});

	}

})(jQuery);


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;
	},
	easeOutBackMod: function (x, t, b, c, d, s) {
		if (s == undefined) s = 0.6;
		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;
	}
});







