/*
* EnterFrame - A jquery extension that creates a bindable enterFrame event.
*
* Copyright (c) 2011 Matthew Drake (w) The Foundry Agency
*
* Licensed under the MIT license:
*   http://www.opensource.org/licenses/mit-license.php
*
*
*/
var parseInput = function (val, base) {

    if (!isNaN(val))
        return val;


    if (val.search(/%$/g) != -1) {
        val = Number(val.replace(/[^\-\.0-9]/gi, "")) / 100;
        //
        return val * base;
    }
    return 0;
}

var _framespecial = {
    setup: function (data, namespaces, eventHandle) {
        
        $.enterFrame("start");

    },

    add: function (handleObj) {



        // Save a reference to the bound event handler.
        var callback = handleObj.handler;
        var inst = $.enterFrame("instances");

        handleObj.handler = function (event) {

            if (event.target == event.currentTarget && !$(event.target).hasClass("fn-enter-frame-pause")) {
                
                if ($(event.currentTarget).enterFrame("can_frame")) {
                    $.extend(arguments[0], $(event.currentTarget).enterFrame("data"));
                    return callback.apply(this, arguments);
                }
            }
            return true;
        };
        inst["$" + handleObj.guid] = handleObj;

        $.enterFrame("instances", inst);
    },
    teardown: function (obj) {
        $.enterFrame("stop");
    },
    remove: function (obj) {
        var inst = $.enterFrame("instances");
        delete inst["$" + obj.guid];
        $.enterFrame("instances", inst);
        return;
        var data = $(obj.currentTarget).enterFrame("data");
        if (data && data.remove)
            data.remove.call(obj.currentTarget, data);
    }
};

jQuery.event.special.enterFrame = _framespecial;

$(function () {
    jQuery.event.special.enterFrame = _framespecial;
});

window._framerate = 30;

if (!(window.requestAnimationFrame ||
              window.webkitRequestAnimationFrame ||
              window.mozRequestAnimationFrame ||
              window.oRequestAnimationFrame ||
              window.msRequestAnimationFrame)) {
    window._framerate = 90; 
    window._legacyframe=true;           
};

window.requestAnimFrame = (function () {
    return window.requestAnimationFrame ||
              window.webkitRequestAnimationFrame ||
              window.mozRequestAnimationFrame ||
              window.oRequestAnimationFrame ||
              window.msRequestAnimationFrame ||
              function (/* function */callback, /* DOMElement */element) {
                  console.log("Intervalset");

                  window.setInterval(callback, Math.round(150));
              };
})();

              

if (!window.isNumber)
    window.isNumber = function (n) {
        return !isNaN(parseFloat(n)) && isFinite(n);
    };

    if (!window.$functions)
        window.$functions = function (args) {
            var funcs = [];
            for (var i=0;i<args.length;i++) {
                if ($.isFunction(args[i]))
                    funcs.push(args[i]);
            }
            return funcs;
        };

    if (!window.$numbers)
        window.$numbers = function (args) {
            var nums = [];
            for (var i=0;i<args.length;i++) {
                if (isNumber(args[i]))
                    nums.push(args[i]);
            }
            return nums;
        };
    
    if (!window.$strings)
        window.$strings = function (args) {
                
            var strs = [];
            for (var i = 0; i < args.length; i++) {
                if (typeof (args[i]) == 'string' && !isNumber(args[i]))
                    strs.push(args[i]);
            }
            return strs;
        };


(function ($) {


    /*
    * 
    * Define Local EnterFrame
    * 
    */
    var data = function (self, $data) {
        if (!self)
            self = window;
        if ($data)
            return $(self).data("enterFrame", $data);

        var $d = $(self).data("enterFrame");
        if ($d)
            return $d;
        $d = $.extend(true, {}, _localDefaults);
        return data(self, $d);
    };

    var _localDefaults = {
        start: -1,
        stagger: 1,
        stagger_offset: 0,
        namespace: "",
        remove: function () { },
        paused: false
    };



    var methods = {
        base: function (options) {

            
            var funcs = $functions(arguments);
            
            var strs = $strings(arguments);

            var callback = funcs[0] || options.callback;
            var remove = funcs[1] || options.remove || _localDefaults.remove;
            
            var namespace = strs[0] || options.namespace || _localDefaults.namespace;
            
            var args = { callback: callback, remove: remove,namespace:namespace };
            $.extend(true, options,  _localDefaults,args);
            data(this, options);
            
            if(namespace.length)
                namespace="."+namespace;
            
            return $(this).bind("enterFrame", callback);

        },
        remove: function (options) {
            if(!options)
                options={};
            
            var funcs = $functions(arguments);
            
            var strs = $strings(arguments);

            //var callback = funcs[0] || options.callback;
            //var remove = funcs[1] || options.remove || _localDefaults.remove;
            
            var namespace = strs[0] || options.namespace || _localDefaults.namespace;
            
            
            
            
            if(namespace.length)
                namespace="."+namespace;
            $(this).removeData("enterFrame");
            return $(this).unbind("enterFrame"+namespace);

        },
        //sample use: $.enterFrame("interval",stagger,func);
        interval: function ($options) {
            var funcs = $functions(arguments);
            var nums = $numbers(arguments);
            var strs = $strings(arguments);
            
            var namespace = strs[0] || $options.namespace || _localDefaults.namespace;

            var callback = funcs[0] || $options.callback;
            var remove = funcs[1] || $options.remove || _localDefaults.remove;
            var stagger = nums[0] || $options.stagger || _localDefaults.stagger;
            var stagger_offset = nums[1] || $options.stagger_offset || _localDefaults.stagger_offset;
            
            var options = { callback: callback, remove: remove, stagger: stagger, stagger_offset: stagger_offset,namespace:namespace};
            
            $.extend(true, _localDefaults,options);
            data(this, options);
            
            if(namespace.length)
                namespace="."+namespace;

            return $(this).enterFrame(options);
        },

        clear_interval: function (namespace) {
            var d = data(this);
            
            var off_stagger = ((c + d.stagger_offset) % d.stagger);

            d.stagger_offset -= off_stagger;

            data(this, d);

            return this;
        },
        remove_interval: function (namespace) {

            if(namespace.length)
                namespace="."+namespace;
            return $(this).unbind("enterFrame.interval"+namespace);
        },
        pause: function () {

            var d = data(this);
            d.paused = true;
            data(this, d);
            return this;
        },
        toggle: function () {

            var d = data(this);
            d.paused = !d.paused;
            data(this, d);
            return this;
        },
        paused: function () {

            var d = data(this);


            return d.paused;
        },
        data: function ($data) {
            if (!$data) {
                var d = data(this);
                d.count = $(this).enterFrame("count");
                return d;
            }

            return data(this, $data);
        },
        resume: function () {


            var d = data(this);
            d.paused = false;
            data(this, d);
            return this;
        },
        

        can_frame: function () {
            var $data = data(this);
            if ($data.paused)
                return false;

            var c = methods.count.apply(this);
            if(isNaN(c))
                return false;
            
            
            if (((c + $data.stagger_offset) % $data.stagger) == 0)
                return true;
            return false;
        },

        count: function () {
            var $data = data(this);
            if ($data.start == -1)
                $data.start = _values.count;

            return _values.count - $data.start;
        }
    };


    $.fn.extend(
{
    enterFrame: function (method) {
        if (methods[method]) {
            
            return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
        } else if (typeof method === 'object' || !method || $.isFunction(method)) {
            return methods.base.apply(this, arguments);
        } else {
            //console.log('Method ' + method + ' does not exist on enterframe');
            return methods.base.apply(this, arguments);
        }
    }
});


    /*
    * 
    * Define Global EnterFrame
    * 
    */


    /* 
    *Set defaults 
    */
    var _values = {
        paused: false,
        running: false,
        count: 0,
        queued: false,
        loaded: false
    };

    var _instances = {};

    /* 
    *Define Global Methods 
    */
    var globalMethods = {
        //recalibrates framerate and resets interval
        start: function (options) {
            
            
            
            

            if (_values.running)
                return this;
            _values.running = true;
            
            window.requestAnimFrame(globalMethods.frame);

            return this;
        },
        //global
        count: function () {
            return _values.count;
        },
        //global
        instances: function ($instances) {
            if ($instances)
                _instances = $instances;
            return _instances;
        },
        //global
        frame: function (e) {
            if (!_values.paused) {
                _values.count++;
                $("*").trigger("enterFrame");
                $(window).trigger("enterFrame");
            }
            if (_values.running&&!window._legacyframe)
                window.requestAnimFrame(globalMethods.frame);
        },
        //global
        frameRate: function () {
            if(arguments.length>0)
                window._framerate=arguments[0];
            return window._framerate;
        },
        //global
        pause: function () {
            if (arguments.length > 0)
                _values.paused = arguments[0];
            else
                _values.paused = true;

        },
        //global
        unpause: function () {

            _values.paused = false;

        },
        //global
        paused: function () {

            return _values.paused;

        },
        //global
        stop: function (data) {

            _values.running = false;

        },
        //global
        bind: function (data) {

            if (arguments[1])
                $(window).enterFrame(data, arguments[1]);
            else
                $(window).enterFrame(data);
        }
    };


    /* 
    *Extend Global Methods 
    */
    $.extend(
	{
	    enterFrame: function (method) {
	        if (globalMethods[method]) {
	            return globalMethods[method].apply(this, Array.prototype.slice.call(arguments, 1));
	        } else if ($.isFunction(method)) {
	            return globalMethods.bind.apply(this, arguments);
	        } else if (typeof method === 'object' || !method) {
	            return globalMethods.bind.apply(this, arguments);
	        } else {
	            console.log('Method ' + method + ' does not exist on enterframe');
	        }
	    }
	});


})(jQuery);




/*
* Tween - A jquery extension that creates a tween enterFrame event.
*
* Copyright (c) 2011 Matthew Drake (w) The Foundry Agency
*
* Licensed under the MIT license:
*   http://www.opensource.org/licenses/mit-license.php
*
*
*/

(function ($) {


    /*
    * 
    * Define Local Tween
    * 
    */
    var defaults = {
        callback: function () { },
        oncomplete: function () { },
        _timestart: 0,
        length: 100,
        start: 0,
        end: 1,
        namespace:"",
        _completed: 0,
        ease: false
    };

    var methods = {

        //sample use $.tween(len,ease,onframe,onexit);
        //sample use $.tween(len,onframe);
        //sample use $.tween(len,start,end,onframe);
        //sample use $.tween(len,end,onframe);
        base: function (options) {
            
            var funcs = $functions(arguments);
            var nums = $numbers(arguments);
            var strs = $strings(arguments);

            var args={};
            
            args.callback = funcs[0]||options.callback||defaults.callback;
            args.oncomplete = funcs[1]||options.oncomplete||defaults.oncomplete;
            
            args.length = Math.round(nums[0]||options.length||defaults.length);
            args.start = (nums.length>2?nums[1]:options.start)||defaults.start;
            args.end = nums.pop()||options.end||defaults.end;
            
            args.ease = strs[0]||options.ease||defaults.ease;

            options = $.extend({}, defaults, options, args);
            

            if (options.ease) {
                if (!isNaN(options.ease) || options.ease === true) {
                    options.ease = "inOutQuad";
                }
            }


            if (options.css && !options.start && $(this).css(options.css))
                options.start = Number($(this).css(options.css).replace(/[^0-9\.\-]/g, ""));

            options._timestart = $.enterFrame('count');


            $(this).tween('remove');

            $(this).data("foundryTween", options);
            
            $(this).toggleClass("in-tween", true);
            
            $(this).bind("enterFrame.tween", function (e) {

                
                var tweenData = $(this).data("foundryTween");

                var span = e.count - tweenData._timestart;

                var length = tweenData.length;

                if (span > length) {
                    $(this).tween('remove');
                    tweenData.completed = 1;
                    tweenData.oncomplete.call(this, e, tweenData);
                    return true;
                }

                tweenData.completed = span / length;
                var dist = tweenData.end - tweenData.start;
                tweenData.pos = tweenData.completed * dist + tweenData.start;


                if (tweenData.ease) {

                    /*
                    * 
                    * Ease 
                    */
                    var ease = tweenData.ease.charAt(0).toUpperCase() + tweenData.ease.slice(1);

                    tweenData.tcompleted = $.easing["ease" + ease](null, tweenData.completed, 0, 1, 1);
                    //console.log(tweenData.completed+":"+(1/length)+":"+
                    //	tweenData.tcompleted);
                }else{
                    tweenData.tpos = tweenData.pos* dist + tweenData.start;
                    tweenData.tcompleted = tweenData.completed;
                }

                if (tweenData.tcompleted) {
                    tweenData.tpos = tweenData.tcompleted * dist + tweenData.start;
                } else {
                    tweenData.tpos = tweenData.pos;
                    tweenData.tcompleted = tweenData.completed;
                }

                tweenData.callback.call(this, e, tweenData);
                $(this).data("foundryTween",tweenData);
            });

            return this;
        },
        remove: function () {
            //@TODO - figure this out
            //$(this).toggleClass("in-tween", false);
            //$(this).unbind("enterFrame.tween");
            //$(this).removeData("foundryTween");
        },

        restart: function () {
            var d = $(this).data("foundryTween");
            d._timestart = $.enterFrame('count');
            $(this).data("foundryTween", d);
        },

        
        moveto: function (pos) {
            var d = $(this).data("foundryTween");
            d._timestart = $.enterFrame('count')+pos;
            $(this).data("foundryTween", d);
        }
    };


    $.fn.extend(
{
    tween: function (method) {
        if (methods[method]) {
            return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
        } else if (typeof method === 'object' || !method || $.isFunction(method)) {
            return methods.base.apply(this, arguments);
        } else {
            return methods.base.apply(this, arguments);
        }
    }
});



    /* 
    *Extend Global Methods 
    */
    $.extend(
	{
	    tween: function (method) {
	        return $("body").tween(method);
	    }
	});


})(jQuery);




/*
* Wait - A jquery extension that creates a wait enterFrame event.
*
* Copyright (c) 2011 Matthew Drake (w) The Foundry Agency
*
* Licensed under the MIT license:
*   http://www.opensource.org/licenses/mit-license.php
*
*
*/

(function ($) {


    /*
    * 
    * Define Local Wait
    * 
    */
    var defaults = {
        oncancel: function () { },
        oncomplete: function () { },
        _timestart: 0,
        len: 90

    };

    var data = function (self, $data) {
        if (!self)
            self = window;
        if ($data){
            $(self).data("foundryWait", $data);
            return $data;
        }

        var $d = $(self).data("foundryWait");
        if ($d)
            return $d;
        $d = $.extend(true, {}, defaults);
        return data(self, $d);
    };

    var methods = {
        //use $.wait(callback);
        //use $.wait(callback,clear);
        //use $.wait(len,callback);
        base: function (options) {
            
            
            var funcs = $functions(arguments);
            var nums = $numbers(arguments);
            

            var args={};

            args.oncomplete = funcs[0]||options.oncomplete||defaults.oncomplete;
            args.oncancel = funcs[1]||options.oncancel||defaults.oncancel;
                        
            
            args.len = nums[0]||options.len||defaults.len;

            


            $(this).wait('remove');
            options._timestart = $.enterFrame('count');
            options = $.extend({}, defaults, options, args);
            data(this, options);


            $(this).toggleClass("in-wait", true);


            $(this).bind("enterFrame.wait", function (e) {



                var waitData = data(this);
                
                var span = e.count - waitData._timestart;
                
                var length = waitData.len;

                if (span > length) {
                    $(this).wait('remove', true);

                    waitData.oncomplete.call(this, e);
                    return true;
                }



            });

            return this;
        },
        remove: function (skipcancel) {
            if (!skipcancel) {
                var $data = data(this);
                
                if ($data) {
                    $data.oncancel.call(this);
                }
            }

            $(this).toggleClass("in-wait", false);
            $(this).unbind("enterFrame.wait");
            $(this).removeData("foundryWait");
        },

        restart: function () {
            var d = $(this).data("foundryWait");
            d._timestart = $.enterFrame('count');
            $(this).data("foundryWait", d);
        },
        cancel: function () {
            $(this).wait('remove');

        }


        
    };


    $.fn.extend(
{
    wait: function (method) {
        if (methods[method]) {
            return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
        } else if (typeof method === 'object' || !method || $.isFunction(method)) {
            return methods.base.apply(this, arguments);
        } else {
            return methods.base.apply(this, arguments);
        }
    }
});



    /* 
    *Extend Global Methods 
    */
    $.extend(
	{
	    wait: function (method) {
	        return $("body").wait.apply($("body").get(0),arguments);
	    }
	});


})(jQuery);



/*
* 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. 
*
*/
