/*
 * jquery.tools 1.0.1 - The missing UI library
 * 
 * [tools.tabs-1.0.0]
 * 
 * Copyright (c) 2009 Tero Piirainen
 * http://flowplayer.org/tools/
 *
 * Dual licensed under MIT and GPL 2+ licenses
 * http://www.opensource.org/licenses
 * 
 * -----
 * 
 * Build: Mon Jun 08 10:59:15 GMT+00:00 2009
 */
(function(c) {
    c.tools = c.tools || {
        version: {}
    };
    c.tools.version.tabs = "1.0.0";
    c.tools.addTabEffect = function(d, e) {
        b[d] = e
    };
    var b = {
        "default": function(d) {
            this.getPanes().hide().eq(d).show()
        },
        fade: function(d) {
            this.getPanes().hide().eq(d).fadeIn()
        },
        slide: function(d) {
            this.getCurrentPane().slideUp("fast");
            this.getPanes().eq(d).slideDown()
        },
        horizontal: function(d) {
            if (!c._hW) {
                c._hW = this.getPanes().eq(0).width()
            }
            this.getCurrentPane().animate({
                width: 0
            },
            function() {
                c(this).hide()
            });
            this.getPanes().eq(d).animate({
                width: c._hW
            },
            function() {
                c(this).show()
            })
        }
    };
    function a(e, f, g) {
        var d = this;
        var h;
        function i(j, k) {
            c(d).bind(j,
            function(m, l) {
                if (k && k.call(this, l.index) === false && l) {
                    l.proceed = false
                }
            });
            return d
        }
        c.each(g,
        function(j, k) {
            if (c.isFunction(k)) {
                i(j, k)
            }
        });
        c.extend(this, {
            click: function(k) {
                if (k === h) {
                    return d
                }
                var m = d.getCurrentPane();
                var l = e.eq(k);
                if (typeof k == "string") {
                    l = e.filter("[href=" + k + "]");
                    k = e.index(l)
                }
                if (!l.length) {
                    if (h >= 0) {
                        return d
                    }
                    k = g.initialIndex;
                    l = e.eq(k)
                }
                var j = {
                    index: k,
                    proceed: true
                };
                c(d).triggerHandler("onBeforeClick", j);
                if (!j.proceed) {
                    return d
                }
                l.addClass(g.current);
                b[g.effect].call(d, k);
                c(d).triggerHandler("onClick", j);
                e.removeClass(g.current);
                l.addClass(g.current);
                h = k;
                return d
            },
            getTabs: function() {
                return e
            },
            getPanes: function() {
                return f
            },
            getCurrentPane: function() {
                return f.eq(h)
            },
            getCurrentTab: function() {
                return e.eq(h)
            },
            getIndex: function() {
                return h
            },
            next: function() {
                return d.click(h + 1)
            },
            prev: function() {
                return d.click(h - 1)
            },
            onBeforeClick: function(j) {
                return i("onBeforeClick", j)
            },
            onClick: function(j) {
                return i("onClick", j)
            }
        });
        e.each(function(j) {
            c(this).bind(g.event,
            function(k) {
                d.click(j);
                if (!g.history) {
                    return k.preventDefault()
                }
            })
        });
        if (g.history) {
            e.history(function(j, k) {
                d.click(k || 0)
            })
        }
        if (location.hash) {
            d.click(location.hash)
        } else {
            d.click(g.initialIndex)
        }
        /*f.find("a[href^=#]").click(function() {
            d.click(c(this).attr("href"))
        })*/
    }
    c.fn.tabs = function(g, d) {
        var e = this.eq(typeof conf == "number" ? conf: 0).data("tabs");
        if (e) {
            return e
        }
        var f = {
            tabs: "a",
            current: "current",
            onBeforeClick: null,
            onClick: null,
            effect: "default",
            history: false,
            initialIndex: 0,
            event: "click",
            api: false
        };
        if (c.isFunction(d)) {
            d = {
                onBeforeClick: d
            }
        }
        c.extend(f, d);
        this.each(function() {
            var h = c(this).find(f.tabs);
            if (!h.length) {
                h = c(this).children()
            }
            var i = g.jquery ? g: c(g);
            e = new a(h, i, f);
            c(this).data("tabs", e)
        });
        return f.api ? e: this
    }
})(jQuery); (function(b) {
    var c, a;
    b.prototype.history = function(e) {
        var d = this;
        if (b.browser.msie) {
            if (!a) {
                a = b("<iframe />").hide().get(0);
                b("body").append(a);
                setInterval(function() {
                    var f = a.contentWindow.document;
                    var g = f.location.hash;
                    if (c !== g) {
                        b.event.trigger("hash", g);
                        c = g
                    }
                },
                100)
            }
            d.bind("click.hash",
            function(g) {
                var f = a.contentWindow.document;
                f.open().close();
                f.location.hash = b(this).attr("href")
            });
            d.eq(0).triggerHandler("click.hash")
        } else {
            setInterval(function() {
                var f = location.hash;
                if (d.filter("[href*=" + f + "]").length && f !== c) {
                    c = f;
                    b.event.trigger("hash", f)
                }
            },
            100)
        }
        b(window).bind("hash", e);
        return this
    }
})(jQuery);