﻿/*
 
jQuery Tools 1.2.5 / Scrollable Navigator

NO COPYRIGHTS OR LICENSES. DO WHAT YOU LIKE.

http://flowplayer.org/tools/scrollable/navigator.html

Since: September 2009
Date:    Wed Sep 22 06:02:10 2010 +0000 
*/
(function (d) {
    function p(b, g) { var h = d(g); return h.length < 2 ? h : b.parent().find(g) } var m = d.tools.scrollable; m.navigator = { conf: { navi: ".navi", naviItem: null, activeClass: "active", indexed: false, idPrefix: null, history: false} }; d.fn.navigator = function (b) {
        if (typeof b == "string") b = { navi: b }; b = d.extend({}, m.navigator.conf, b); var g; this.each(function () {
            function h(a, c, i) { e.seekTo(c); if (j) { if (location.hash) location.hash = a.attr("href").replace("#", "") } else return i.preventDefault() } function f() {
                return k.find(b.naviItem ||
"> *")
            } function n(a) { var c = d("<" + (b.naviItem || "a") + "/>").click(function (i) { h(d(this), a, i) }).attr("href", "#" + a); a === 0 && c.addClass(l); b.indexed && c.text(a + 1); b.idPrefix && c.attr("id", b.idPrefix + a); return c.appendTo(k) } function o(a, c) { a = f().eq(c.replace("#", "")); a.length || (a = f().filter("[href=" + c + "]")); a.click() } var e = d(this).data("scrollable"), k = b.navi.jquery ? b.navi : p(e.getRoot(), b.navi), q = e.getNaviButtons(), l = b.activeClass, j = b.history && d.fn.history; if (e) g = e; e.getNaviButtons = function () { return q.add(k) };
            f().length ? f().each(function (a) { d(this).click(function (c) { h(d(this), a, c) }) }) : d.each(e.getItems(), function (a) { n(a) }); e.onBeforeSeek(function (a, c) { setTimeout(function () { if (!a.isDefaultPrevented()) { var i = f().eq(c); !a.isDefaultPrevented() && i.length && f().removeClass(l).eq(c).addClass(l) } }, 1) }); e.onAddItem(function (a, c) { c = n(e.getItems().index(c)); j && c.history(o) }); j && f().history(o)
        }); return b.api ? g : this
    } 
})(jQuery);

