/*
 * jQuery Tools 1.2.5 - The missing UI library for the Web
 * 
 * [jquery, toolbox.flashembed, toolbox.history, toolbox.expose, toolbox.mousewheel, tabs, tabs.slideshow, tooltip, tooltip.slide, tooltip.dynamic, scrollable, scrollable.autoscroll, scrollable.navigator, overlay, overlay.apple, dateinput, rangeinput, validator]
 * 
 * NO COPYRIGHTS OR LICENSES. DO WHAT YOU LIKE.
 * 
 * http://flowplayer.org/tools/
 * 
 * jQuery JavaScript Library v1.4.2
 * http://jquery.com/
 *
 * Copyright 2010, John Resig
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://docs.jquery.com/License
 *
 * Includes Sizzle.js
 * http://sizzlejs.com/
 * Copyright 2010, The Dojo Foundation
 * Released under the MIT, BSD, and GPL Licenses.
 * 
 * -----
 * 
 

 * jquery.event.wheel.js - rev 1 
 * Copyright (c) 2008, Three Dub Media (http://threedubmedia.com)
 * Liscensed under the MIT License (MIT-LICENSE.txt)
 * http://www.opensource.org/licenses/mit-license.php
 * Created: 2008-07-01 | Updated: 2008-07-14
 * 
 * -----
 * 
 * File generated: Wed Sep 22 06:12:53 GMT 2010
 */

(function (a) {
    function t(d, b) {
        var c = this,
            j = d.add(c),
            o = a(window),
            k, f, m, g = a.tools.expose && (b.mask || b.expose),
            n = Math.random().toString().slice(10);
        if (g) {
            if (typeof g == "string") g = {
                color: g
            };
            g.closeOnClick = g.closeOnEsc = false
        }
        var p = b.target || d.attr("rel");
        f = p ? a(p) : d;
        if (!f.length) throw "Could not find Overlay: " + p;
        d && d.index(f) == -1 && d.click(function (e) {
            c.load(e);
            return e.preventDefault()
        });
        a.extend(c, {
            load: function (e) {
                if (c.isOpened()) return c;
                var h = q[b.effect];
                if (!h) throw 'Overlay: cannot find effect : "' + b.effect + '"';
                b.oneInstance && a.each(s, function () {
                    this.close(e)
                });
                e = e || a.Event();
                e.type = "onBeforeLoad";
                j.trigger(e);
                if (e.isDefaultPrevented()) return c;
                m = true;
                g && a(f).expose(g);
                var i = b.top,
                    r = b.left,
                    u = f.outerWidth({
                        margin: true
                    }),
                    v = f.outerHeight({
                        margin: true
                    });
                if (typeof i == "string") i = i == "center" ? Math.max((o.height() - v) / 2, 0) : parseInt(i, 10) / 100 * o.height();
                if (r == "center") r = Math.max((o.width() - u) / 2, 0);
                h[0].call(c, {
                    top: i,
                    left: r
                }, function () {
                    if (m) {
                        e.type = "onLoad";
                        j.trigger(e)
                    }
                });
                g && b.closeOnClick && a.mask.getMask().one("click", c.close);
                b.closeOnClick && a(document).bind("click." + n, function (l) {
                    a(l.target).parents(f).length || c.close(l)
                });
                b.closeOnEsc && a(document).bind("keydown." + n, function (l) {
                    l.keyCode == 27 && c.close(l)
                });
                return c
            },
            close: function (e) {
                if (!c.isOpened()) return c;
                e = e || a.Event();
                e.type = "onBeforeClose";
                j.trigger(e);
                if (!e.isDefaultPrevented()) {
                    m = false;
                    q[b.effect][1].call(c, function () {
                        e.type = "onClose";
                        j.trigger(e)
                    });
                    a(document).unbind("click." + n).unbind("keydown." + n);
                    g && a.mask.close();
                    return c
                }
            },
            getOverlay: function () {
                return f
            },
            getTrigger: function () {
                return d
            },
            getClosers: function () {
                return k
            },
            isOpened: function () {
                return m
            },
            getConf: function () {
                return b
            }
        });
        a.each("onBeforeLoad,onStart,onLoad,onBeforeClose,onClose".split(","), function (e, h) {
            a.isFunction(b[h]) && a(c).bind(h, b[h]);
            c[h] = function (i) {
                i && a(c).bind(h, i);
                return c
            }
        });
        k = f.find(b.close || ".close");
        if (!k.length && !b.close) {
            k = a('<a class="close"></a>');
            f.prepend(k)
        }
        k.click(function (e) {
            c.close(e)
        });
        b.load && c.load()
    }
    a.tools = a.tools || {
        version: "1.2.5"
    };
    a.tools.overlay = {
        addEffect: function (d, b, c) {
            q[d] = [b, c]
        },
        conf: {
            close: null,
            closeOnClick: true,
            closeOnEsc: true,
            closeSpeed: "fast",
            effect: "default",
            fixed: !a.browser.msie || a.browser.version > 6,
            left: "center",
            load: false,
            mask: null,
            oneInstance: true,
            speed: "normal",
            target: null,
            top: "10%"
        }
    };
    var s = [],
        q = {};
    a.tools.overlay.addEffect("default", function (d, b) {
        var c = this.getConf(),
            j = a(window);
        if (!c.fixed) {
            d.top += j.scrollTop();
            d.left += j.scrollLeft()
        }
        d.position = c.fixed ? "fixed" : "absolute";
        this.getOverlay().css(d).fadeIn(c.speed, b)
    }, function (d) {
        this.getOverlay().fadeOut(this.getConf().closeSpeed, d)
    });
    a.fn.overlay = function (d) {
        var b = this.data("overlay");
        if (b) return b;
        if (a.isFunction(d)) d = {
            onBeforeLoad: d
        };
        d = a.extend(true, {}, a.tools.overlay.conf, d);
        this.each(function () {
            b = new t(a(this), d);
            s.push(b);
            a(this).data("overlay", b)
        });
        return d.api ? b : this
    }
})(jQuery);

