//========================================================================================//
//
// THIRD PARTY PLUG-INS
//========================================================================================//


/**
* jQuery.timers - Timer abstractions for jQuery
* Written by Blair Mitchelmore (blair DOT mitchelmore AT gmail DOT com)
* Licensed under the WTFPL (http://sam.zoy.org/wtfpl/).
* Date: 2009/10/16
*
* @author Blair Mitchelmore
* @version 1.2
*
**/

jQuery.fn.extend({
    everyTime: function(interval, label, fn, times) {
        return this.each(function() {
            jQuery.timer.add(this, interval, label, fn, times);
        });
    },
    oneTime: function(interval, label, fn) {
        return this.each(function() {
            jQuery.timer.add(this, interval, label, fn, 1);
        });
    },
    stopTime: function(label, fn) {
        return this.each(function() {
            jQuery.timer.remove(this, label, fn);
        });
    }
});

jQuery.extend({
    timer: {
        global: [],
        guid: 1,
        dataKey: "jQuery.timer",
        regex: /^([0-9]+(?:\.[0-9]*)?)\s*(.*s)?$/,
        powers: {
            // Yeah this is major overkill...
            'ms': 1,
            'cs': 10,
            'ds': 100,
            's': 1000,
            'das': 10000,
            'hs': 100000,
            'ks': 1000000
        },
        timeParse: function(value) {
            if (value == undefined || value == null)
                return null;
            var result = this.regex.exec(jQuery.trim(value.toString()));
            if (result[2]) {
                var num = parseFloat(result[1]);
                var mult = this.powers[result[2]] || 1;
                return num * mult;
            } else {
                return value;
            }
        },
        add: function(element, interval, label, fn, times) {
            var counter = 0;

            if (jQuery.isFunction(label)) {
                if (!times)
                    times = fn;
                fn = label;
                label = interval;
            }

            interval = jQuery.timer.timeParse(interval);

            if (typeof interval != 'number' || isNaN(interval) || interval < 0)
                return;

            if (typeof times != 'number' || isNaN(times) || times < 0)
                times = 0;

            times = times || 0;

            var timers = jQuery.data(element, this.dataKey) || jQuery.data(element, this.dataKey, {});

            if (!timers[label])
                timers[label] = {};

            fn.timerID = fn.timerID || this.guid++;

            var handler = function() {
                if ((++counter > times && times !== 0) || fn.call(element, counter) === false)
                    jQuery.timer.remove(element, label, fn);
            };

            handler.timerID = fn.timerID;

            if (!timers[label][fn.timerID])
                timers[label][fn.timerID] = window.setInterval(handler, interval);

            this.global.push(element);

        },
        remove: function(element, label, fn) {
            var timers = jQuery.data(element, this.dataKey), ret;

            if (timers) {

                if (!label) {
                    for (label in timers)
                        this.remove(element, label, fn);
                } else if (timers[label]) {
                    if (fn) {
                        if (fn.timerID) {
                            window.clearInterval(timers[label][fn.timerID]);
                            delete timers[label][fn.timerID];
                        }
                    } else {
                        for (var fn in timers[label]) {
                            window.clearInterval(timers[label][fn]);
                            delete timers[label][fn];
                        }
                    }

                    for (ret in timers[label]) break;
                    if (!ret) {
                        ret = null;
                        delete timers[label];
                    }
                }

                for (ret in timers) break;
                if (!ret)
                    jQuery.removeData(element, this.dataKey);
            }
        }
    }
});

jQuery(window).bind("unload", function() {
    jQuery.each(jQuery.timer.global, function(index, item) {
        jQuery.timer.remove(item);
    });
});

/*
* 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. 
*
*/
/*!
* jCarousel - Riding carousels with jQuery
*   http://sorgalla.com/jcarousel/
*
* Copyright (c) 2006 Jan Sorgalla (http://sorgalla.com)
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
*
* Built on top of the jQuery library
*   http://jquery.com
*
* Inspired by the "Carousel Component" by Bill Scott
*   http://billwscott.com/carousel/
*/

/*global window, jQuery */
(function($) {
    // Default configuration properties.
    var defaults = {
        vertical: false,
        rtl: false,
        start: 1,
        offset: 1,
        size: null,
        scroll: 3,
        visible: null,
        animation: 'normal',
        easing: 'swing',
        auto: 0,
        wrap: null,
        initCallback: null,
        reloadCallback: null,
        itemLoadCallback: null,
        itemFirstInCallback: null,
        itemFirstOutCallback: null,
        itemLastInCallback: null,
        itemLastOutCallback: null,
        itemVisibleInCallback: null,
        itemVisibleOutCallback: null,
        buttonNextHTML: '<div></div>',
        buttonPrevHTML: '<div></div>',
        buttonNextEvent: 'click',
        buttonPrevEvent: 'click',
        buttonNextCallback: null,
        buttonPrevCallback: null,
        itemFallbackDimension: null
    }, windowLoaded = false;

    $(window).bind('load.jcarousel', function() { windowLoaded = true; });

    /**
    * The jCarousel object.
    *
    * @constructor
    * @class jcarousel
    * @param e {HTMLElement} The element to create the carousel for.
    * @param o {Object} A set of key/value pairs to set as configuration properties.
    * @cat Plugins/jCarousel
    */
    $.jcarousel = function(e, o) {
        this.options = $.extend({}, defaults, o || {});

        this.locked = false;
        this.autoStopped = false;

        this.container = null;
        this.clip = null;
        this.list = null;
        this.buttonNext = null;
        this.buttonPrev = null;
        this.buttonNextState = null;
        this.buttonPrevState = null;

        // Only set if not explicitly passed as option
        if (!o || o.rtl === undefined) {
            this.options.rtl = ($(e).attr('dir') || $('html').attr('dir') || '').toLowerCase() == 'rtl';
        }

        this.wh = !this.options.vertical ? 'width' : 'height';
        this.lt = !this.options.vertical ? (this.options.rtl ? 'right' : 'left') : 'top';

        // Extract skin class
        var skin = '', split = e.className.split(' ');

        for (var i = 0; i < split.length; i++) {
            if (split[i].indexOf('jcarousel-skin') != -1) {
                $(e).removeClass(split[i]);
                skin = split[i];
                break;
            }
        }

        if (e.nodeName.toUpperCase() == 'UL' || e.nodeName.toUpperCase() == 'OL') {
            this.list = $(e);
            this.container = this.list.parent();

            if (this.container.hasClass('jcarousel-clip')) {
                if (!this.container.parent().hasClass('jcarousel-container')) {
                    this.container = this.container.wrap('<div></div>');
                }

                this.container = this.container.parent();
            } else if (!this.container.hasClass('jcarousel-container')) {
                this.container = this.list.wrap('<div></div>').parent();
            }
        } else {
            this.container = $(e);
            this.list = this.container.find('ul,ol').eq(0);
        }

        if (skin !== '' && this.container.parent()[0].className.indexOf('jcarousel-skin') == -1) {
            this.container.wrap('<div class=" ' + skin + '"></div>');
        }

        this.clip = this.list.parent();

        if (!this.clip.length || !this.clip.hasClass('jcarousel-clip')) {
            this.clip = this.list.wrap('<div></div>').parent();
        }

        this.buttonNext = $('.jcarousel-next', this.container);

        if (this.buttonNext.size() === 0 && this.options.buttonNextHTML !== null) {
            this.buttonNext = this.clip.after(this.options.buttonNextHTML).next();
        }

        this.buttonNext.addClass(this.className('jcarousel-next'));

        this.buttonPrev = $('.jcarousel-prev', this.container);

        if (this.buttonPrev.size() === 0 && this.options.buttonPrevHTML !== null) {
            this.buttonPrev = this.clip.after(this.options.buttonPrevHTML).next();
        }

        this.buttonPrev.addClass(this.className('jcarousel-prev'));

        this.clip.addClass(this.className('jcarousel-clip')).css({
            overflow: 'hidden',
            position: 'relative'
        });

        this.list.addClass(this.className('jcarousel-list')).css({
            overflow: 'hidden',
            position: 'relative',
            top: 0,
            margin: 0,
            padding: 0
        }).css((this.options.rtl ? 'right' : 'left'), 0);

        this.container.addClass(this.className('jcarousel-container')).css({
            position: 'relative'
        });

        if (!this.options.vertical && this.options.rtl) {
            this.container.addClass('jcarousel-direction-rtl').attr('dir', 'rtl');
        }

        var di = this.options.visible !== null ? Math.ceil(this.clipping() / this.options.visible) : null;
        var li = this.list.children('li');

        var self = this;

        if (li.size() > 0) {
            var wh = 0, j = this.options.offset;
            li.each(function() {
                self.format(this, j++);
                wh += self.dimension(this, di);
            });

            this.list.css(this.wh, (wh + 100) + 'px');

            // Only set if not explicitly passed as option
            if (!o || o.size === undefined) {
                this.options.size = li.size();
            }
        }

        // For whatever reason, .show() does not work in Safari...
        this.container.css('display', 'block');
        this.buttonNext.css('display', 'block');
        this.buttonPrev.css('display', 'block');

        this.funcNext = function() { self.next(); };
        this.funcPrev = function() { self.prev(); };
        this.funcResize = function() { self.reload(); };

        if (this.options.initCallback !== null) {
            this.options.initCallback(this, 'init');
        }

        if (!windowLoaded && $.browser.safari) {
            this.buttons(false, false);
            $(window).bind('load.jcarousel', function() { self.setup(); });
        } else {
            this.setup();
        }
    };

    // Create shortcut for internal use
    var $jc = $.jcarousel;

    $jc.fn = $jc.prototype = {
        jcarousel: '0.2.7'
    };

    $jc.fn.extend = $jc.extend = $.extend;

    $jc.fn.extend({
        /**
        * Setups the carousel.
        *
        * @method setup
        * @return undefined
        */
        setup: function() {
            this.first = null;
            this.last = null;
            this.prevFirst = null;
            this.prevLast = null;
            this.animating = false;
            this.timer = null;
            this.tail = null;
            this.inTail = false;

            if (this.locked) {
                return;
            }

            this.list.css(this.lt, this.pos(this.options.offset) + 'px');
            var p = this.pos(this.options.start, true);
            this.prevFirst = this.prevLast = null;
            this.animate(p, false);

            $(window).unbind('resize.jcarousel', this.funcResize).bind('resize.jcarousel', this.funcResize);
        },

        /**
        * Clears the list and resets the carousel.
        *
        * @method reset
        * @return undefined
        */
        reset: function() {
            this.list.empty();

            this.list.css(this.lt, '0px');
            this.list.css(this.wh, '10px');

            if (this.options.initCallback !== null) {
                this.options.initCallback(this, 'reset');
            }

            this.setup();
        },

        /**
        * Reloads the carousel and adjusts positions.
        *
        * @method reload
        * @return undefined
        */
        reload: function() {
            if (this.tail !== null && this.inTail) {
                this.list.css(this.lt, $jc.intval(this.list.css(this.lt)) + this.tail);
            }

            this.tail = null;
            this.inTail = false;

            if (this.options.reloadCallback !== null) {
                this.options.reloadCallback(this);
            }

            if (this.options.visible !== null) {
                var self = this;
                var di = Math.ceil(this.clipping() / this.options.visible), wh = 0, lt = 0;
                this.list.children('li').each(function(i) {
                    wh += self.dimension(this, di);
                    if (i + 1 < self.first) {
                        lt = wh;
                    }
                });

                this.list.css(this.wh, wh + 'px');
                this.list.css(this.lt, -lt + 'px');
            }

            this.scroll(this.first, false);
        },

        /**
        * Locks the carousel.
        *
        * @method lock
        * @return undefined
        */
        lock: function() {
            this.locked = true;
            this.buttons();
        },

        /**
        * Unlocks the carousel.
        *
        * @method unlock
        * @return undefined
        */
        unlock: function() {
            this.locked = false;
            this.buttons();
        },

        /**
        * Sets the size of the carousel.
        *
        * @method size
        * @return undefined
        * @param s {Number} The size of the carousel.
        */
        size: function(s) {
            if (s !== undefined) {
                this.options.size = s;
                if (!this.locked) {
                    this.buttons();
                }
            }

            return this.options.size;
        },

        /**
        * Checks whether a list element exists for the given index (or index range).
        *
        * @method get
        * @return bool
        * @param i {Number} The index of the (first) element.
        * @param i2 {Number} The index of the last element.
        */
        has: function(i, i2) {
            if (i2 === undefined || !i2) {
                i2 = i;
            }

            if (this.options.size !== null && i2 > this.options.size) {
                i2 = this.options.size;
            }

            for (var j = i; j <= i2; j++) {
                var e = this.get(j);
                if (!e.length || e.hasClass('jcarousel-item-placeholder')) {
                    return false;
                }
            }

            return true;
        },

        /**
        * Returns a jQuery object with list element for the given index.
        *
        * @method get
        * @return jQuery
        * @param i {Number} The index of the element.
        */
        get: function(i) {
            return $('.jcarousel-item-' + i, this.list);
        },

        /**
        * Adds an element for the given index to the list.
        * If the element already exists, it updates the inner html.
        * Returns the created element as jQuery object.
        *
        * @method add
        * @return jQuery
        * @param i {Number} The index of the element.
        * @param s {String} The innerHTML of the element.
        */
        add: function(i, s) {
            var e = this.get(i), old = 0, n = $(s);

            if (e.length === 0) {
                var c, j = $jc.intval(i);
                e = this.create(i);
                while (true) {
                    c = this.get(--j);
                    if (j <= 0 || c.length) {
                        if (j <= 0) {
                            this.list.prepend(e);
                        } else {
                            c.after(e);
                        }
                        break;
                    }
                }
            } else {
                old = this.dimension(e);
            }

            if (n.get(0).nodeName.toUpperCase() == 'LI') {
                e.replaceWith(n);
                e = n;
            } else {
                e.empty().append(s);
            }

            this.format(e.removeClass(this.className('jcarousel-item-placeholder')), i);

            var di = this.options.visible !== null ? Math.ceil(this.clipping() / this.options.visible) : null;
            var wh = this.dimension(e, di) - old;

            if (i > 0 && i < this.first) {
                this.list.css(this.lt, $jc.intval(this.list.css(this.lt)) - wh + 'px');
            }

            this.list.css(this.wh, $jc.intval(this.list.css(this.wh)) + wh + 'px');

            return e;
        },

        /**
        * Removes an element for the given index from the list.
        *
        * @method remove
        * @return undefined
        * @param i {Number} The index of the element.
        */
        remove: function(i) {
            var e = this.get(i);

            // Check if item exists and is not currently visible
            if (!e.length || (i >= this.first && i <= this.last)) {
                return;
            }

            var d = this.dimension(e);

            if (i < this.first) {
                this.list.css(this.lt, $jc.intval(this.list.css(this.lt)) + d + 'px');
            }

            e.remove();

            this.list.css(this.wh, $jc.intval(this.list.css(this.wh)) - d + 'px');
        },

        /**
        * Moves the carousel forwards.
        *
        * @method next
        * @return undefined
        */
        next: function() {
            if (this.tail !== null && !this.inTail) {
                this.scrollTail(false);
            } else {
                this.scroll(((this.options.wrap == 'both' || this.options.wrap == 'last') && this.options.size !== null && this.last == this.options.size) ? 1 : this.first + this.options.scroll);
            }
        },

        /**
        * Moves the carousel backwards.
        *
        * @method prev
        * @return undefined
        */
        prev: function() {
            if (this.tail !== null && this.inTail) {
                this.scrollTail(true);
            } else {
                this.scroll(((this.options.wrap == 'both' || this.options.wrap == 'first') && this.options.size !== null && this.first == 1) ? this.options.size : this.first - this.options.scroll);
            }
        },

        /**
        * Scrolls the tail of the carousel.
        *
        * @method scrollTail
        * @return undefined
        * @param b {Boolean} Whether scroll the tail back or forward.
        */
        scrollTail: function(b) {
            if (this.locked || this.animating || !this.tail) {
                return;
            }

            this.pauseAuto();

            var pos = $jc.intval(this.list.css(this.lt));

            pos = !b ? pos - this.tail : pos + this.tail;
            this.inTail = !b;

            // Save for callbacks
            this.prevFirst = this.first;
            this.prevLast = this.last;

            this.animate(pos);
        },

        /**
        * Scrolls the carousel to a certain position.
        *
        * @method scroll
        * @return undefined
        * @param i {Number} The index of the element to scoll to.
        * @param a {Boolean} Flag indicating whether to perform animation.
        */
        scroll: function(i, a) {
            if (this.locked || this.animating) {
                return;
            }

            this.pauseAuto();
            this.animate(this.pos(i), a);
        },

        /**
        * Prepares the carousel and return the position for a certian index.
        *
        * @method pos
        * @return {Number}
        * @param i {Number} The index of the element to scoll to.
        * @param fv {Boolean} Whether to force last item to be visible.
        */
        pos: function(i, fv) {
            var pos = $jc.intval(this.list.css(this.lt));

            if (this.locked || this.animating) {
                return pos;
            }

            if (this.options.wrap != 'circular') {
                i = i < 1 ? 1 : (this.options.size && i > this.options.size ? this.options.size : i);
            }

            var back = this.first > i;

            // Create placeholders, new list width/height
            // and new list position
            var f = this.options.wrap != 'circular' && this.first <= 1 ? 1 : this.first;
            var c = back ? this.get(f) : this.get(this.last);
            var j = back ? f : f - 1;
            var e = null, l = 0, p = false, d = 0, g;

            while (back ? --j >= i : ++j < i) {
                e = this.get(j);
                p = !e.length;
                if (e.length === 0) {
                    e = this.create(j).addClass(this.className('jcarousel-item-placeholder'));
                    c[back ? 'before' : 'after'](e);

                    if (this.first !== null && this.options.wrap == 'circular' && this.options.size !== null && (j <= 0 || j > this.options.size)) {
                        g = this.get(this.index(j));
                        if (g.length) {
                            e = this.add(j, g.clone(true));
                        }
                    }
                }

                c = e;
                d = this.dimension(e);

                if (p) {
                    l += d;
                }

                if (this.first !== null && (this.options.wrap == 'circular' || (j >= 1 && (this.options.size === null || j <= this.options.size)))) {
                    pos = back ? pos + d : pos - d;
                }
            }

            // Calculate visible items
            var clipping = this.clipping(), cache = [], visible = 0, v = 0;
            c = this.get(i - 1);
            j = i;

            while (++visible) {
                e = this.get(j);
                p = !e.length;
                if (e.length === 0) {
                    e = this.create(j).addClass(this.className('jcarousel-item-placeholder'));
                    // This should only happen on a next scroll
                    if (c.length === 0) {
                        this.list.prepend(e);
                    } else {
                        c[back ? 'before' : 'after'](e);
                    }

                    if (this.first !== null && this.options.wrap == 'circular' && this.options.size !== null && (j <= 0 || j > this.options.size)) {
                        g = this.get(this.index(j));
                        if (g.length) {
                            e = this.add(j, g.clone(true));
                        }
                    }
                }

                c = e;
                d = this.dimension(e);
                if (d === 0) {
                    throw new Error('jCarousel: No width/height set for items. This will cause an infinite loop. Aborting...');
                }

                if (this.options.wrap != 'circular' && this.options.size !== null && j > this.options.size) {
                    cache.push(e);
                } else if (p) {
                    l += d;
                }

                v += d;

                if (v >= clipping) {
                    break;
                }

                j++;
            }

            // Remove out-of-range placeholders
            for (var x = 0; x < cache.length; x++) {
                cache[x].remove();
            }

            // Resize list
            if (l > 0) {
                this.list.css(this.wh, this.dimension(this.list) + l + 'px');

                if (back) {
                    pos -= l;
                    this.list.css(this.lt, $jc.intval(this.list.css(this.lt)) - l + 'px');
                }
            }

            // Calculate first and last item
            var last = i + visible - 1;
            if (this.options.wrap != 'circular' && this.options.size && last > this.options.size) {
                last = this.options.size;
            }

            if (j > last) {
                visible = 0;
                j = last;
                v = 0;
                while (++visible) {
                    e = this.get(j--);
                    if (!e.length) {
                        break;
                    }
                    v += this.dimension(e);
                    if (v >= clipping) {
                        break;
                    }
                }
            }

            var first = last - visible + 1;
            if (this.options.wrap != 'circular' && first < 1) {
                first = 1;
            }

            if (this.inTail && back) {
                pos += this.tail;
                this.inTail = false;
            }

            this.tail = null;
            if (this.options.wrap != 'circular' && last == this.options.size && (last - visible + 1) >= 1) {
                var m = $jc.margin(this.get(last), !this.options.vertical ? 'marginRight' : 'marginBottom');
                if ((v - m) > clipping) {
                    this.tail = v - clipping - m;
                }
            }

            if (fv && i === this.options.size && this.tail) {
                pos -= this.tail;
                this.inTail = true;
            }

            // Adjust position
            while (i-- > first) {
                pos += this.dimension(this.get(i));
            }

            // Save visible item range
            this.prevFirst = this.first;
            this.prevLast = this.last;
            this.first = first;
            this.last = last;

            return pos;
        },

        /**
        * Animates the carousel to a certain position.
        *
        * @method animate
        * @return undefined
        * @param p {Number} Position to scroll to.
        * @param a {Boolean} Flag indicating whether to perform animation.
        */
        animate: function(p, a) {
            if (this.locked || this.animating) {
                return;
            }

            this.animating = true;

            var self = this;
            var scrolled = function() {
                self.animating = false;

                if (p === 0) {
                    self.list.css(self.lt, 0);
                }

                if (!self.autoStopped && (self.options.wrap == 'circular' || self.options.wrap == 'both' || self.options.wrap == 'last' || self.options.size === null || self.last < self.options.size || (self.last == self.options.size && self.tail !== null && !self.inTail))) {
                    self.startAuto();
                }

                self.buttons();
                self.notify('onAfterAnimation');

                // This function removes items which are appended automatically for circulation.
                // This prevents the list from growing infinitely.
                if (self.options.wrap == 'circular' && self.options.size !== null) {
                    for (var i = self.prevFirst; i <= self.prevLast; i++) {
                        if (i !== null && !(i >= self.first && i <= self.last) && (i < 1 || i > self.options.size)) {
                            self.remove(i);
                        }
                    }
                }
            };

            this.notify('onBeforeAnimation');

            // Animate
            if (!this.options.animation || a === false) {
                this.list.css(this.lt, p + 'px');
                scrolled();
            } else {
                var o = !this.options.vertical ? (this.options.rtl ? { 'right': p} : { 'left': p }) : { 'top': p };
                this.list.animate(o, this.options.animation, this.options.easing, scrolled);
            }
        },

        /**
        * Starts autoscrolling.
        *
        * @method auto
        * @return undefined
        * @param s {Number} Seconds to periodically autoscroll the content.
        */
        startAuto: function(s) {
            if (s !== undefined) {
                this.options.auto = s;
            }

            if (this.options.auto === 0) {
                return this.stopAuto();
            }

            if (this.timer !== null) {
                return;
            }

            this.autoStopped = false;

            var self = this;
            this.timer = window.setTimeout(function() { self.next(); }, this.options.auto * 1000);
        },

        /**
        * Stops autoscrolling.
        *
        * @method stopAuto
        * @return undefined
        */
        stopAuto: function() {
            this.pauseAuto();
            this.autoStopped = true;
        },

        /**
        * Pauses autoscrolling.
        *
        * @method pauseAuto
        * @return undefined
        */
        pauseAuto: function() {
            if (this.timer === null) {
                return;
            }

            window.clearTimeout(this.timer);
            this.timer = null;
        },

        /**
        * Sets the states of the prev/next buttons.
        *
        * @method buttons
        * @return undefined
        */
        buttons: function(n, p) {
            if (n == null) {
                n = !this.locked && this.options.size !== 0 && ((this.options.wrap && this.options.wrap != 'first') || this.options.size === null || this.last < this.options.size);
                if (!this.locked && (!this.options.wrap || this.options.wrap == 'first') && this.options.size !== null && this.last >= this.options.size) {
                    n = this.tail !== null && !this.inTail;
                }
            }

            if (p == null) {
                p = !this.locked && this.options.size !== 0 && ((this.options.wrap && this.options.wrap != 'last') || this.first > 1);
                if (!this.locked && (!this.options.wrap || this.options.wrap == 'last') && this.options.size !== null && this.first == 1) {
                    p = this.tail !== null && this.inTail;
                }
            }

            var self = this;

            if (this.buttonNext.size() > 0) {
                this.buttonNext.unbind(this.options.buttonNextEvent + '.jcarousel', this.funcNext);

                if (n) {
                    this.buttonNext.bind(this.options.buttonNextEvent + '.jcarousel', this.funcNext);
                }

                this.buttonNext[n ? 'removeClass' : 'addClass'](this.className('jcarousel-next-disabled')).attr('disabled', n ? false : true);

                if (this.options.buttonNextCallback !== null && this.buttonNext.data('jcarouselstate') != n) {
                    this.buttonNext.each(function() { self.options.buttonNextCallback(self, this, n); }).data('jcarouselstate', n);
                }
            } else {
                if (this.options.buttonNextCallback !== null && this.buttonNextState != n) {
                    this.options.buttonNextCallback(self, null, n);
                }
            }

            if (this.buttonPrev.size() > 0) {
                this.buttonPrev.unbind(this.options.buttonPrevEvent + '.jcarousel', this.funcPrev);

                if (p) {
                    this.buttonPrev.bind(this.options.buttonPrevEvent + '.jcarousel', this.funcPrev);
                }

                this.buttonPrev[p ? 'removeClass' : 'addClass'](this.className('jcarousel-prev-disabled')).attr('disabled', p ? false : true);

                if (this.options.buttonPrevCallback !== null && this.buttonPrev.data('jcarouselstate') != p) {
                    this.buttonPrev.each(function() { self.options.buttonPrevCallback(self, this, p); }).data('jcarouselstate', p);
                }
            } else {
                if (this.options.buttonPrevCallback !== null && this.buttonPrevState != p) {
                    this.options.buttonPrevCallback(self, null, p);
                }
            }

            this.buttonNextState = n;
            this.buttonPrevState = p;
        },

        /**
        * Notify callback of a specified event.
        *
        * @method notify
        * @return undefined
        * @param evt {String} The event name
        */
        notify: function(evt) {
            var state = this.prevFirst === null ? 'init' : (this.prevFirst < this.first ? 'next' : 'prev');

            // Load items
            this.callback('itemLoadCallback', evt, state);

            if (this.prevFirst !== this.first) {
                this.callback('itemFirstInCallback', evt, state, this.first);
                this.callback('itemFirstOutCallback', evt, state, this.prevFirst);
            }

            if (this.prevLast !== this.last) {
                this.callback('itemLastInCallback', evt, state, this.last);
                this.callback('itemLastOutCallback', evt, state, this.prevLast);
            }

            this.callback('itemVisibleInCallback', evt, state, this.first, this.last, this.prevFirst, this.prevLast);
            this.callback('itemVisibleOutCallback', evt, state, this.prevFirst, this.prevLast, this.first, this.last);
        },

        callback: function(cb, evt, state, i1, i2, i3, i4) {
            if (this.options[cb] == null || (typeof this.options[cb] != 'object' && evt != 'onAfterAnimation')) {
                return;
            }

            var callback = typeof this.options[cb] == 'object' ? this.options[cb][evt] : this.options[cb];

            if (!$.isFunction(callback)) {
                return;
            }

            var self = this;

            if (i1 === undefined) {
                callback(self, state, evt);
            } else if (i2 === undefined) {
                this.get(i1).each(function() { callback(self, this, i1, state, evt); });
            } else {
                var call = function(i) {
                    self.get(i).each(function() { callback(self, this, i, state, evt); });
                };
                for (var i = i1; i <= i2; i++) {
                    if (i !== null && !(i >= i3 && i <= i4)) {
                        call(i);
                    }
                }
            }
        },

        create: function(i) {
            return this.format('<li></li>', i);
        },

        format: function(e, i) {
            e = $(e);
            var split = e.get(0).className.split(' ');
            for (var j = 0; j < split.length; j++) {
                if (split[j].indexOf('jcarousel-') != -1) {
                    e.removeClass(split[j]);
                }
            }
            e.addClass(this.className('jcarousel-item')).addClass(this.className('jcarousel-item-' + i)).css({
                'float': (this.options.rtl ? 'right' : 'left'),
                'list-style': 'none'
            }).attr('jcarouselindex', i);
            return e;
        },

        className: function(c) {
            return c + ' ' + c + (!this.options.vertical ? '-horizontal' : '-vertical');
        },

        dimension: function(e, d) {
            var el = e.jquery !== undefined ? e[0] : e;

            var old = !this.options.vertical ?
                (el.offsetWidth || $jc.intval(this.options.itemFallbackDimension)) + $jc.margin(el, 'marginLeft') + $jc.margin(el, 'marginRight') :
                (el.offsetHeight || $jc.intval(this.options.itemFallbackDimension)) + $jc.margin(el, 'marginTop') + $jc.margin(el, 'marginBottom');

            if (d == null || old == d) {
                return old;
            }

            var w = !this.options.vertical ?
                d - $jc.margin(el, 'marginLeft') - $jc.margin(el, 'marginRight') :
                d - $jc.margin(el, 'marginTop') - $jc.margin(el, 'marginBottom');

            $(el).css(this.wh, w + 'px');

            return this.dimension(el);
        },

        clipping: function() {
            return !this.options.vertical ?
                this.clip[0].offsetWidth - $jc.intval(this.clip.css('borderLeftWidth')) - $jc.intval(this.clip.css('borderRightWidth')) :
                this.clip[0].offsetHeight - $jc.intval(this.clip.css('borderTopWidth')) - $jc.intval(this.clip.css('borderBottomWidth'));
        },

        index: function(i, s) {
            if (s == null) {
                s = this.options.size;
            }

            return Math.round((((i - 1) / s) - Math.floor((i - 1) / s)) * s) + 1;
        }
    });

    $jc.extend({
        /**
        * Gets/Sets the global default configuration properties.
        *
        * @method defaults
        * @return {Object}
        * @param d {Object} A set of key/value pairs to set as configuration properties.
        */
        defaults: function(d) {
            return $.extend(defaults, d || {});
        },

        margin: function(e, p) {
            if (!e) {
                return 0;
            }

            var el = e.jquery !== undefined ? e[0] : e;

            if (p == 'marginRight' && $.browser.safari) {
                var old = { 'display': 'block', 'float': 'none', 'width': 'auto' }, oWidth, oWidth2;

                $.swap(el, old, function() { oWidth = el.offsetWidth; });

                old.marginRight = 0;
                $.swap(el, old, function() { oWidth2 = el.offsetWidth; });

                return oWidth2 - oWidth;
            }

            return $jc.intval($.css(el, p));
        },

        intval: function(v) {
            v = parseInt(v, 10);
            return isNaN(v) ? 0 : v;
        }
    });

    /**
    * Creates a carousel for all matched elements.
    *
    * @example $("#mycarousel").jcarousel();
    * @before <ul id="mycarousel" class="jcarousel-skin-name"><li>First item</li><li>Second item</li></ul>
    * @result
    *
    * <div class="jcarousel-skin-name">
    *   <div class="jcarousel-container">
    *     <div class="jcarousel-clip">
    *       <ul class="jcarousel-list">
    *         <li class="jcarousel-item-1">First item</li>
    *         <li class="jcarousel-item-2">Second item</li>
    *       </ul>
    *     </div>
    *     <div disabled="disabled" class="jcarousel-prev jcarousel-prev-disabled"></div>
    *     <div class="jcarousel-next"></div>
    *   </div>
    * </div>
    *
    * @method jcarousel
    * @return jQuery
    * @param o {Hash|String} A set of key/value pairs to set as configuration properties or a method name to call on a formerly created instance.
    */
    $.fn.jcarousel = function(o) {
        if (typeof o == 'string') {
            var instance = $(this).data('jcarousel'), args = Array.prototype.slice.call(arguments, 1);
            return instance[o].apply(instance, args);
        } else {
            return this.each(function() {
                $(this).data('jcarousel', new $jc(this, o));
            });
        }
    };

})(jQuery);

/*
**
**	GalleryView - jQuery Content Gallery Plugin
**	Author: 		Jack Anderson
**	Version:		2.1 (March 14, 2010)
**	
**	Please use this development script if you intend to make changes to the
**	plugin code.  For production sites, please use jquery.galleryview-2.1-pack.js.
**	
**  See README.txt for instructions on how to markup your HTML
**
**	See CHANGELOG.txt for a review of changes and LICENSE.txt for the applicable
**	licensing information.
**
*/

//Global variable to check if window is already loaded
//Used for calling GalleryView after page has loaded
var window_loaded = false;

(function($) {
    $.fn.galleryView = function(options) {
        var opts = $.extend($.fn.galleryView.defaults, options);

        var id;
        var iterator = 0; 	// INT - Currently visible panel/frame
        var item_count = 0; 	// INT - Total number of panels/frames
        var slide_method; 	// STRING - indicator to slide entire filmstrip or just the pointer ('strip','pointer')
        var theme_path; 		// STRING - relative path to theme directory
        var paused = false; 	// BOOLEAN - flag to indicate whether automated transitions are active

        // Element dimensions
        var gallery_width;
        var gallery_height;
        var pointer_height;
        var pointer_width;
        var strip_width;
        var strip_height;
        var wrapper_width;
        var f_frame_width;
        var f_frame_height;
        var frame_caption_size = 20;
        var gallery_padding;
        var filmstrip_margin;
        var filmstrip_orientation;


        // Arrays used to scale frames and panels
        var frame_img_scale = {};
        var panel_img_scale = {};
        var img_h = {};
        var img_w = {};

        // Flag indicating whether to scale panel images
        var scale_panel_images = true;

        var panel_nav_displayed = false;

        // Define jQuery objects for reuse
        var j_gallery;
        var j_filmstrip;
        var j_frames;
        var j_frame_img_wrappers;
        var j_panels;
        var j_pointer;


        /*
        **	Plugin Functions
        */

        /*
        **	showItem(int)
        **		Transition from current frame to frame i (1-based index)
        */
        function showItem(i) {
            // Disable next/prev buttons until transition is complete
            // This prevents overlapping of animations
            $('.nav-next-overlay', j_gallery).unbind('click');
            $('.nav-prev-overlay', j_gallery).unbind('click');
            $('.nav-next', j_gallery).unbind('click');
            $('.nav-prev', j_gallery).unbind('click');
            j_frames.unbind('click');

            if (opts.show_filmstrip) {
                // Fade out current frame
                $('.current', j_frames).removeClass('current').find('img').stop().animate({
                    'opacity': opts.frame_opacity
                }, opts.transition_speed);
                // Fade in target frame
                j_frames.eq(i).addClass('current').find('img').stop().animate({
                    'opacity': 1.0
                }, opts.transition_speed);
            }

            //If necessary, fade out all panels while fading in target panel
            if (opts.show_panels && opts.fade_panels) {
                j_panels.fadeOut(opts.transition_speed).eq(i % item_count).fadeIn(opts.transition_speed, function() {
                    //If no filmstrip exists, re-bind click events to navigation buttons
                    if (!opts.show_filmstrip) {
                        $('.nav-prev-overlay', j_gallery).click(showPrevItem);
                        $('.nav-next-overlay', j_gallery).click(showNextItem);
                        $('.nav-prev', j_gallery).click(showPrevItem);
                        $('.nav-next', j_gallery).click(showNextItem);
                    }
                });
            }

            // If gallery has a filmstrip, handle animation of frames
            if (opts.show_filmstrip) {
                // Slide either pointer or filmstrip, depending on transition method
                if (slide_method == 'strip') {
                    // Stop filmstrip if it's currently in motion
                    j_filmstrip.stop();
                    var distance;
                    var diststr;
                    if (filmstrip_orientation == 'horizontal') {
                        // Determine distance between pointer (eventual destination) and target frame
                        distance = getPos(j_frames[i]).left - (getPos(j_pointer[0]).left + (pointer_width / 2) - (f_frame_width / 2));
                        diststr = (distance >= 0 ? '-=' : '+=') + Math.abs(distance) + 'px';

                        // Animate filmstrip and slide target frame under pointer
                        j_filmstrip.animate({
                            'left': diststr
                        }, opts.transition_speed, opts.easing, function() {
                            var old_i = i;
                            // After transition is complete, shift filmstrip so that a sufficient number of frames
                            // remain on either side of the visible filmstrip
                            if (i > item_count) {
                                i = i % item_count;
                                iterator = i;
                                j_filmstrip.css('left', '-' + ((f_frame_width + opts.frame_gap) * i) + 'px');
                            } else if (i <= (item_count - strip_size)) {
                                i = (i % item_count) + item_count;
                                iterator = i;
                                j_filmstrip.css('left', '-' + ((f_frame_width + opts.frame_gap) * i) + 'px');
                            }
                            // If the target frame has changed due to filmstrip shifting,
                            // make sure new target frame has 'current' class and correct size/opacity settings
                            if (old_i != i) {
                                j_frames.eq(old_i).removeClass('current').find('img').css({
                                    'opacity': opts.frame_opacity
                                });
                                j_frames.eq(i).addClass('current').find('img').css({
                                    'opacity': 1.0
                                });
                            }
                            // If panels are not set to fade in/out, simply hide all panels and show the target panel
                            if (!opts.fade_panels) {
                                j_panels.hide().eq(i % item_count).show();
                            }

                            // Once animation is complete, re-bind click events to navigation buttons
                            $('.nav-prev-overlay', j_gallery).click(showPrevItem);
                            $('.nav-next-overlay', j_gallery).click(showNextItem);
                            $('.nav-prev', j_gallery).click(showPrevItem);
                            $('.nav-next', j_gallery).click(showNextItem);
                            enableFrameClicking();
                        });
                    } else { // filmstrip_orientation == 'vertical'
                        //Determine distance between pointer (eventual destination) and target frame
                        distance = getPos(j_frames[i]).top - (getPos(j_pointer[0]).top + (pointer_height) - (f_frame_height / 2));
                        diststr = (distance >= 0 ? '-=' : '+=') + Math.abs(distance) + 'px';

                        // Animate filmstrip and slide target frame under pointer
                        j_filmstrip.animate({
                            'top': diststr
                        }, opts.transition_speed, opts.easing, function() {
                            // After transition is complete, shift filmstrip so that a sufficient number of frames
                            // remain on either side of the visible filmstrip
                            var old_i = i;
                            if (i > item_count) {
                                i = i % item_count;
                                iterator = i;
                                j_filmstrip.css('top', '-' + ((f_frame_height + opts.frame_gap) * i) + 'px');
                            } else if (i <= (item_count - strip_size)) {
                                i = (i % item_count) + item_count;
                                iterator = i;
                                j_filmstrip.css('top', '-' + ((f_frame_height + opts.frame_gap) * i) + 'px');
                            }
                            //If the target frame has changed due to filmstrip shifting,
                            //Make sure new target frame has 'current' class and correct size/opacity settings
                            if (old_i != i) {
                                j_frames.eq(old_i).removeClass('current').find('img').css({
                                    'opacity': opts.frame_opacity
                                });
                                j_frames.eq(i).addClass('current').find('img').css({
                                    'opacity': 1.0
                                });
                            }
                            // If panels are not set to fade in/out, simply hide all panels and show the target panel
                            if (!opts.fade_panels) {
                                j_panels.hide().eq(i % item_count).show();
                            }

                            // Once animation is complete, re-bind click events to navigation buttons
                            $('.nav-prev-overlay', j_gallery).click(showPrevItem);
                            $('.nav-next-overlay', j_gallery).click(showNextItem);
                            $('.nav-prev', j_gallery).click(showPrevItem);
                            $('.nav-next', j_gallery).click(showNextItem);
                            enableFrameClicking();
                        });
                    }
                } else if (slide_method == 'pointer') {
                    // Stop pointer if it's currently in motion
                    j_pointer.stop();
                    // Get screen position of target frame
                    var pos = getPos(j_frames[i]);

                    if (filmstrip_orientation == 'horizontal') {
                        // Slide the pointer over the target frame
                        j_pointer.animate({
                            'left': (pos.left + (f_frame_width / 2) - (pointer_width / 2) + 'px')
                        }, opts.transition_speed, opts.easing, function() {
                            if (!opts.fade_panels) {
                                j_panels.hide().eq(i % item_count).show();
                            }
                            $('.nav-prev-overlay', j_gallery).click(showPrevItem);
                            $('.nav-next-overlay', j_gallery).click(showNextItem);
                            $('.nav-prev', j_gallery).click(showPrevItem);
                            $('.nav-next', j_gallery).click(showNextItem);
                            enableFrameClicking();
                        });
                    } else {
                        // Slide the pointer over the target frame
                        j_pointer.animate({
                            'top': (pos.top + (f_frame_height / 2) - (pointer_height) + 'px')
                        }, opts.transition_speed, opts.easing, function() {
                            if (!opts.fade_panels) {
                                j_panels.hide().eq(i % item_count).show();
                            }
                            $('.nav-prev-overlay', j_gallery).click(showPrevItem);
                            $('.nav-next-overlay', j_gallery).click(showNextItem);
                            $('.nav-prev', j_gallery).click(showPrevItem);
                            $('.nav-next', j_gallery).click(showNextItem);
                            enableFrameClicking();
                        });
                    }
                }

            }
        };

        /*
        **	extraWidth(jQuery element)
        **		Return the combined width of the border and padding to the elements left and right.
        **		If the border is non-numerical, assume zero (not ideal, will fix later)
        **		RETURNS - int
        */
        function extraWidth(el) {
            if (!el) { return 0; }
            if (el.length == 0) { return 0; }
            el = el.eq(0);
            var ew = 0;
            ew += getInt(el.css('paddingLeft'));
            ew += getInt(el.css('paddingRight'));
            ew += getInt(el.css('borderLeftWidth'));
            ew += getInt(el.css('borderRightWidth'));
            return ew;
        };

        /*
        **	extraHeight(jQuery element)
        **		Return the combined height of the border and padding above and below the element
        **		If the border is non-numerical, assume zero (not ideal, will fix later)
        **		RETURN - int
        */
        function extraHeight(el) {
            if (!el) { return 0; }
            if (el.length == 0) { return 0; }
            el = el.eq(0);
            var eh = 0;
            eh += getInt(el.css('paddingTop'));
            eh += getInt(el.css('paddingBottom'));
            eh += getInt(el.css('borderTopWidth'));
            eh += getInt(el.css('borderBottomWidth'));
            return eh;
        };

        /*
        **	showNextItem()
        **		Transition from current frame to next frame
        */
        function showNextItem() {

            // Cancel any transition timers until we have completed this function
            $(document).stopTime("transition");
            if (++iterator == j_frames.length) { iterator = 0; }
            // We've already written the code to transition to an arbitrary panel/frame, so use it
            showItem(iterator);
            // If automated transitions haven't been cancelled by an option or paused on hover, re-enable them
            if (!paused) {
                $(document).everyTime(opts.transition_interval, "transition", function() {
                    showNextItem();
                });
            }
        };

        /*
        **	showPrevItem()
        **		Transition from current frame to previous frame
        */
        function showPrevItem() {
            // Cancel any transition timers until we have completed this function
            $(document).stopTime("transition");
            if (--iterator < 0) { iterator = item_count - 1; }
            // We've already written the code to transition to an arbitrary panel/frame, so use it
            showItem(iterator);
            // If automated transitions haven't been cancelled by an option or paused on hover, re-enable them
            if (!paused) {
                $(document).everyTime(opts.transition_interval, "transition", function() {
                    showNextItem();
                });
            }
        };

        /*
        **	getPos(jQuery element
        **		Calculate position of an element relative to top/left corner of gallery
        **		If the gallery bounding box itself is passed to the function, calculate position of gallery relative to top/left corner of browser window
        ** 		RETURNS - JSON {left: int, top: int}
        */
        function getPos(el) {
            var left = 0, top = 0;
            var el_id = el.id;
            if (el.offsetParent) {
                do {
                    left += el.offsetLeft;
                    top += el.offsetTop;
                } while (el = el.offsetParent);
            }
            //If we want the position of the gallery itself, return it
            if (el_id == id) { return { 'left': left, 'top': top }; }
            //Otherwise, get position of element relative to gallery
            else {
                var gPos = getPos(j_gallery[0]);
                var gLeft = gPos.left;
                var gTop = gPos.top;

                return { 'left': left - gLeft, 'top': top - gTop };
            }
        };

        /*
        **	enableFrameClicking()
        **		Add an onclick event handler to each frame
        **		Exception: if a frame has an anchor tag, do not add an onlick handler
        */
        function enableFrameClicking() {
            j_frames.each(function(i) {
                if ($('a', this).length == 0) {
                    $(this).click(function() {
                        // Prevent transitioning to the current frame (unnecessary)
                        if (iterator != i) {
                            $(document).stopTime("transition");
                            showItem(i);
                            iterator = i;
                            if (!paused) {
                                $(document).everyTime(opts.transition_interval, "transition", function() {
                                    showNextItem();
                                });
                            }
                        }
                    });
                }
            });
        };

        /*
        **	buildPanels()
        **		Construct gallery panels from <div class="panel"> elements
        **		NOTE - These DIVs are generated automatically from the content of the UL passed to the plugin
        */
        function buildPanels() {
            // If panel overlay content exists, add the necessary overlay background DIV
            // The overlay content and background are separate elements so the background's opacity isn't inherited by the content
            j_panels.each(function(i) {
                if ($('.panel-overlay', this).length > 0) {
                    $(this).append('<div class="overlay-background"></div>');
                }
            });
            // If there is no filmstrip in this gallery, add navigation buttons to the panel itself
            if (!opts.show_filmstrip) {
                $('<img />').addClass('nav-next').attr('src', theme_path + opts.nav_theme + '/next.gif').appendTo(j_gallery).css({
                    'position': 'absolute',
                    'zIndex': '1100',
                    'cursor': 'pointer',
                    'top': ((opts.panel_height - 22) / 2) + gallery_padding + 'px',
                    'right': '10px',
                    'display': 'none'
                }).click(showNextItem);
                $('<img />').addClass('nav-prev').attr('src', theme_path + opts.nav_theme + '/prev.gif').appendTo(j_gallery).css({
                    'position': 'absolute',
                    'zIndex': '1100',
                    'cursor': 'pointer',
                    'top': ((opts.panel_height - 22) / 2) + gallery_padding + 'px',
                    'left': '10px',
                    'display': 'none'
                }).click(showPrevItem);

                $('<img />').addClass('nav-next-overlay').attr('src', theme_path + opts.nav_theme + '/panel-nav-next.gif').appendTo(j_gallery).css({
                    'position': 'absolute',
                    'zIndex': '1099',
                    'top': ((opts.panel_height - 22) / 2) + gallery_padding - 10 + 'px',
                    'right': '0',
                    'display': 'none',
                    'cursor': 'pointer',
                    'opacity': 0.75
                }).click(showNextItem);

                $('<img />').addClass('nav-prev-overlay').attr('src', theme_path + opts.nav_theme + '/panel-nav-prev.gif').appendTo(j_gallery).css({
                    'position': 'absolute',
                    'zIndex': '1099',
                    'top': ((opts.panel_height - 22) / 2) + gallery_padding - 10 + 'px',
                    'left': '0',
                    'display': 'none',
                    'cursor': 'pointer',
                    'opacity': 0.75
                }).click(showPrevItem);
            }
            // Set the height and width of each panel, and position it appropriately within the gallery
            j_panels.each(function(i) {
                $(this).css({
                    'width': (opts.panel_width - extraWidth(j_panels)) + 'px',
                    'height': (opts.panel_height - extraHeight(j_panels)) + 'px',
                    'position': 'absolute',
                    'overflow': 'hidden',
                    'display': 'none'
                });
                switch (opts.filmstrip_position) {
                    case 'top': $(this).css({
                        'top': strip_height + Math.max(gallery_padding, filmstrip_margin) + 'px',
                        'left': gallery_padding + 'px'
                    }); break;
                    case 'left': $(this).css({
                        'top': gallery_padding + 'px',
                        'left': strip_width + Math.max(gallery_padding, filmstrip_margin) + 'px'
                    }); break;
                    default: $(this).css({ 'top': gallery_padding + 'px', 'left': gallery_padding + 'px' }); break;
                }
            });
            // Position each panel overlay within panel
            $('.panel-overlay', j_panels).css({
                'position': 'absolute',
                'zIndex': '999',
                'width': (opts.panel_width - extraWidth($('.panel-overlay', j_panels))) + 'px',
                'left': '0'
            });
            $('.overlay-background', j_panels).css({
                'position': 'absolute',
                'zIndex': '998',
                'width': opts.panel_width + 'px',
                'left': '0',
                'opacity': opts.overlay_opacity
            });
            if (opts.overlay_position == 'top') {
                $('.panel-overlay', j_panels).css('top', 0);
                $('.overlay-background', j_panels).css('top', 0);
            } else {
                $('.panel-overlay', j_panels).css('bottom', 0);
                $('.overlay-background', j_panels).css('bottom', 0);
            }

            $('.panel iframe', j_panels).css({
                'width': opts.panel_width + 'px',
                'height': opts.panel_height + 'px',
                'border': '0'
            });

            // If panel images have to be scaled to fit within frame, do so and position them accordingly
            if (scale_panel_images) {
                $('img', j_panels).each(function(i) {
                    $(this).css({
                        'height': panel_img_scale[i % item_count] * img_h[i % item_count],
                        'width': panel_img_scale[i % item_count] * img_w[i % item_count],
                        'position': 'relative',
                        'top': (opts.panel_height - (panel_img_scale[i % item_count] * img_h[i % item_count])) / 2 + 'px',
                        'left': (opts.panel_width - (panel_img_scale[i % item_count] * img_w[i % item_count])) / 2 + 'px'
                    });
                });
            }
        };

        /*
        **	buildFilmstrip()
        **		Construct filmstrip from <ul class="filmstrip"> element
        **		NOTE - 'filmstrip' class is automatically added to UL passed to plugin
        */
        function buildFilmstrip() {
            // Add wrapper to filmstrip to hide extra frames
            j_filmstrip.wrap('<div class="strip_wrapper"></div>');
            if (slide_method == 'strip') {
                j_frames.clone().appendTo(j_filmstrip);
                j_frames.clone().appendTo(j_filmstrip);
                j_frames = $('li', j_filmstrip);
            }
            // If captions are enabled, add caption DIV to each frame and fill with the image titles
            if (opts.show_captions) {
                j_frames.append('<div class="caption"></div>').each(function(i) {
                    $(this).find('.caption').html($(this).find('img').attr('title'));
                    //$(this).find('.caption').html(i);		
                });
            }
            // Position the filmstrip within the gallery
            j_filmstrip.css({
                'listStyle': 'none',
                'margin': '0',
                'padding': '0',
                'width': strip_width + 'px',
                'position': 'absolute',
                'zIndex': '900',
                'top': (filmstrip_orientation == 'vertical' && slide_method == 'strip' ? -((f_frame_height + opts.frame_gap) * iterator) : 0) + 'px',
                'left': (filmstrip_orientation == 'horizontal' && slide_method == 'strip' ? -((f_frame_width + opts.frame_gap) * iterator) : 0) + 'px',
                'height': strip_height + 'px'
            });
            j_frames.css({
                'float': 'left',
                'position': 'relative',
                'height': f_frame_height + (opts.show_captions ? frame_caption_size : 0) + 'px',
                'width': f_frame_width + 'px',
                'zIndex': '901',
                'padding': '0',
                'cursor': 'pointer'
            });
            // Set frame margins based on user options and position of filmstrip within gallery
            switch (opts.filmstrip_position) {
                case 'top': j_frames.css({
                    'marginBottom': filmstrip_margin + 'px',
                    'marginRight': opts.frame_gap + 'px'
                }); break;
                case 'bottom': j_frames.css({
                    'marginTop': filmstrip_margin + 'px',
                    'marginRight': opts.frame_gap + 'px'
                }); break;
                case 'left': j_frames.css({
                    'marginRight': filmstrip_margin + 'px',
                    'marginBottom': opts.frame_gap + 'px'
                }); break;
                case 'right': j_frames.css({
                    'marginLeft': filmstrip_margin + 'px',
                    'marginBottom': opts.frame_gap + 'px'
                }); break;
            }
            // Apply styling to individual image wrappers. These will eventually hide overflow in the case of cropped filmstrip images
            $('.img_wrap', j_frames).each(function(i) {
                $(this).css({
                    'height': Math.min(opts.frame_height, img_h[i % item_count] * frame_img_scale[i % item_count]) + 'px',
                    'width': Math.min(opts.frame_width, img_w[i % item_count] * frame_img_scale[i % item_count]) + 'px',
                    'position': 'relative',
                    'top': (opts.show_captions && opts.filmstrip_position == 'top' ? frame_caption_size : 0) + Math.max(0, (opts.frame_height - (frame_img_scale[i % item_count] * img_h[i % item_count])) / 2) + 'px',
                    'left': Math.max(0, (opts.frame_width - (frame_img_scale[i % item_count] * img_w[i % item_count])) / 2) + 'px',
                    'overflow': 'hidden'
                });
            });
            // Scale each filmstrip image if necessary and position it within the image wrapper
            $('img', j_frames).each(function(i) {
                $(this).css({
                    'opacity': opts.frame_opacity,
                    'height': img_h[i % item_count] * frame_img_scale[i % item_count] + 'px',
                    'width': img_w[i % item_count] * frame_img_scale[i % item_count] + 'px',
                    'position': 'relative',
                    'top': Math.min(0, (opts.frame_height - (frame_img_scale[i % item_count] * img_h[i % item_count])) / 2) + 'px',
                    'left': Math.min(0, (opts.frame_width - (frame_img_scale[i % item_count] * img_w[i % item_count])) / 2) + 'px'

                }).mouseover(function() {
                    $(this).stop().animate({ 'opacity': 1.0 }, 300);
                }).mouseout(function() {
                    //Don't fade out current frame on mouseout
                    if (!$(this).parent().parent().hasClass('current')) { $(this).stop().animate({ 'opacity': opts.frame_opacity }, 300); }
                });
            });
            // Set overflow of filmstrip wrapper to hidden so as to hide frames that don't fit within the gallery
            $('.strip_wrapper', j_gallery).css({
                'position': 'absolute',
                'overflow': 'hidden'
            });
            // Position filmstrip within gallery based on user options
            if (filmstrip_orientation == 'horizontal') {
                $('.strip_wrapper', j_gallery).css({
                    'top': (opts.filmstrip_position == 'top' ? Math.max(gallery_padding, filmstrip_margin) + 'px' : opts.panel_height + gallery_padding + 'px'),
                    'left': ((gallery_width - wrapper_width) / 2) + gallery_padding + 'px',
                    'width': wrapper_width + 'px',
                    'height': strip_height + 'px'
                });
            } else {
                $('.strip_wrapper', j_gallery).css({
                    'left': (opts.filmstrip_position == 'left' ? Math.max(gallery_padding, filmstrip_margin) + 'px' : opts.panel_width + gallery_padding + 'px'),
                    'top': Math.max(gallery_padding, opts.frame_gap) + 'px',
                    'width': strip_width + 'px',
                    'height': wrapper_height + 'px'
                });
            }
            // Style frame captions
            $('.caption', j_gallery).css({
                'position': 'absolute',
                'top': (opts.filmstrip_position == 'bottom' ? f_frame_height : 0) + 'px',
                'left': '0',
                'margin': '0',
                'width': f_frame_width + 'px',
                'padding': '0',
                'height': frame_caption_size + 'px',
                'overflow': 'hidden',
                'lineHeight': frame_caption_size + 'px'
            });
            // Create pointer for current frame
            var pointer = $('<div></div>');
            pointer.addClass('pointer').appendTo(j_gallery).css({
                'position': 'absolute',
                'zIndex': '1000',
                'width': '0px',
                'fontSize': '0px',
                'lineHeight': '0%',
                'borderTopWidth': pointer_height + 'px',
                'borderRightWidth': (pointer_width / 2) + 'px',
                'borderBottomWidth': pointer_height + 'px',
                'borderLeftWidth': (pointer_width / 2) + 'px',
                'borderStyle': 'solid'
            });

            // For IE6, use predefined color string in place of transparent (IE6 bug fix, see stylesheet)
            var transColor = $.browser.msie && $.browser.version.substr(0, 1) == '6' ? 'pink' : 'transparent';

            // If there are no panels, make pointer transparent (nothing to point to)
            // This is not the optimal solution, but we need the pointer to exist as a reference for transition animations
            if (!opts.show_panels) { pointer.css('borderColor', transColor); }

            switch (opts.filmstrip_position) {
                case 'top': pointer.css({
                    'bottom': (opts.panel_height - (pointer_height * 2) + gallery_padding + filmstrip_margin) + 'px',
                    'left': ((gallery_width - wrapper_width) / 2) + (slide_method == 'strip' ? 0 : ((f_frame_width + opts.frame_gap) * iterator)) + ((f_frame_width / 2) - (pointer_width / 2)) + gallery_padding + 'px',
                    'borderBottomColor': transColor,
                    'borderRightColor': transColor,
                    'borderLeftColor': transColor
                }); break;
                case 'bottom': pointer.css({
                    'top': (opts.panel_height - (pointer_height * 2) + gallery_padding + filmstrip_margin) + 'px',
                    'left': ((gallery_width - wrapper_width) / 2) + (slide_method == 'strip' ? 0 : ((f_frame_width + opts.frame_gap) * iterator)) + ((f_frame_width / 2) - (pointer_width / 2)) + gallery_padding + 'px',
                    'borderTopColor': transColor,
                    'borderRightColor': transColor,
                    'borderLeftColor': transColor
                }); break;
                case 'left': pointer.css({
                    'right': (opts.panel_width - pointer_width + gallery_padding + filmstrip_margin) + 'px',
                    'top': (f_frame_height / 2) - (pointer_height) + (slide_method == 'strip' ? 0 : ((f_frame_height + opts.frame_gap) * iterator)) + gallery_padding + 'px',
                    'borderBottomColor': transColor,
                    'borderRightColor': transColor,
                    'borderTopColor': transColor
                }); break;
                case 'right': pointer.css({
                    'left': (opts.panel_width - pointer_width + gallery_padding + filmstrip_margin) + 'px',
                    'top': (f_frame_height / 2) - (pointer_height) + (slide_method == 'strip' ? 0 : ((f_frame_height + opts.frame_gap) * iterator)) + gallery_padding + 'px',
                    'borderBottomColor': transColor,
                    'borderLeftColor': transColor,
                    'borderTopColor': transColor
                }); break;
            }

            j_pointer = $('.pointer', j_gallery);

            // Add navigation buttons
            var navNext = $('<img />');
            navNext.addClass('nav-next').attr('src', theme_path + opts.nav_theme + '/next.gif').appendTo(j_gallery).css({
                //navNext.addClass('nav-next').attr('src="/_assets/next.gif"').appendTo(j_gallery).css({
                'position': 'absolute',
                'cursor': 'pointer'
            }).click(showNextItem);
            var navPrev = $('<img />');
            navPrev.addClass('nav-prev').attr('src', theme_path + opts.nav_theme + '/prev.gif').appendTo(j_gallery).css({
                //navPrev.addClass('nav-prev').attr('src="/_assets/prev.gif"').appendTo(j_gallery).css({
                'position': 'absolute',
                'cursor': 'pointer'
            }).click(showPrevItem);
            if (filmstrip_orientation == 'horizontal') {
                navNext.css({
                    'top': (opts.filmstrip_position == 'top' ? Math.max(gallery_padding, filmstrip_margin) : opts.panel_height + filmstrip_margin + gallery_padding) + ((f_frame_height - 22) / 2) + 'px',
                    'right': ((gallery_width + (gallery_padding * 2)) / 2) - (wrapper_width / 2) - opts.frame_gap - 22 + 'px'
                });
                navPrev.css({
                    'top': (opts.filmstrip_position == 'top' ? Math.max(gallery_padding, filmstrip_margin) : opts.panel_height + filmstrip_margin + gallery_padding) + ((f_frame_height - 22) / 2) + 'px',
                    'left': ((gallery_width + (gallery_padding * 2)) / 2) - (wrapper_width / 2) - opts.frame_gap - 22 + 'px'
                });
            } else {
                navNext.css({
                    'left': (opts.filmstrip_position == 'left' ? Math.max(gallery_padding, filmstrip_margin) : opts.panel_width + filmstrip_margin + gallery_padding) + ((f_frame_width - 22) / 2) + 13 + 'px',
                    'top': wrapper_height + (Math.max(gallery_padding, opts.frame_gap) * 2) + 'px'
                });
                navPrev.css({
                    'left': (opts.filmstrip_position == 'left' ? Math.max(gallery_padding, filmstrip_margin) : opts.panel_width + filmstrip_margin + gallery_padding) + ((f_frame_width - 22) / 2) - 13 + 'px',
                    'top': wrapper_height + (Math.max(gallery_padding, opts.frame_gap) * 2) + 'px'
                });
            }
        };

        /*
        **	mouseIsOverGallery(int,int)
        **		Check to see if mouse coordinates lie within borders of gallery
        **		This is a more reliable method than using the mouseover event
        **		RETURN - boolean
        */
        function mouseIsOverGallery(x, y) {
            var pos = getPos(j_gallery[0]);
            var top = pos.top;
            var left = pos.left;
            return x > left && x < left + gallery_width + (filmstrip_orientation == 'horizontal' ? (gallery_padding * 2) : gallery_padding + Math.max(gallery_padding, filmstrip_margin)) && y > top && y < top + gallery_height + (filmstrip_orientation == 'vertical' ? (gallery_padding * 2) : gallery_padding + Math.max(gallery_padding, filmstrip_margin));
        };

        /*
        **	getInt(string)
        **		Parse a string to obtain the integer value contained
        **		If the string contains no number, return zero
        **		RETURN - int
        */
        function getInt(i) {
            i = parseInt(i, 10);
            if (isNaN(i)) { i = 0; }
            return i;
        };

        /*
        **	buildGallery()
        **		Construct HTML and CSS for the gallery, based on user options
        */
        function buildGallery() {
            var gallery_images = opts.show_filmstrip ? $('img', j_frames) : $('img', j_panels);
            // For each image in the gallery, add its original dimensions and scaled dimensions to the appropriate arrays for later reference
            gallery_images.each(function(i) {
                img_h[i] = this.height;
                img_w[i] = this.width;
                if (opts.frame_scale == 'nocrop') {
                    frame_img_scale[i] = Math.min(opts.frame_height / img_h[i], opts.frame_width / img_w[i]);
                } else {
                    frame_img_scale[i] = Math.max(opts.frame_height / img_h[i], opts.frame_width / img_w[i]);
                }

                if (opts.panel_scale == 'nocrop') {
                    panel_img_scale[i] = Math.min(opts.panel_height / img_h[i], opts.panel_width / img_w[i]);
                } else {
                    panel_img_scale[i] = Math.max(opts.panel_height / img_h[i], opts.panel_width / img_w[i]);
                }
            });

            // Size gallery based on position of filmstrip
            j_gallery.css({
                'position': 'relative',
                'width': gallery_width + (filmstrip_orientation == 'horizontal' ? (gallery_padding * 2) : gallery_padding + Math.max(gallery_padding, filmstrip_margin)) + 'px',
                'height': gallery_height + (filmstrip_orientation == 'vertical' ? (gallery_padding * 2) : gallery_padding + Math.max(gallery_padding, filmstrip_margin)) + 'px'
            });

            // Build filmstrip if necessary
            if (opts.show_filmstrip) {
                buildFilmstrip();
                enableFrameClicking();
            }
            // Build panels if necessary
            if (opts.show_panels) {
                buildPanels();
            }

            // If user opts to pause on hover, or no filmstrip exists, add some mouseover functionality
            if (opts.pause_on_hover || (opts.show_panels && !opts.show_filmstrip)) {
                $(document).mousemove(function(e) {
                    if (mouseIsOverGallery(e.pageX, e.pageY)) {
                        // If the user opts to pause on hover, kill automated transitions
                        if (opts.pause_on_hover) {
                            if (!paused) {
                                // Pause slideshow in 500ms
                                $(document).oneTime(500, "animation_pause", function() {
                                    $(document).stopTime("transition");
                                    paused = true;
                                });
                            }
                        }
                        // Display panel navigation on mouseover
                        if (opts.show_panels && !opts.show_filmstrip && !panel_nav_displayed) {
                            $('.nav-next-overlay').fadeIn('fast');
                            $('.nav-prev-overlay').fadeIn('fast');
                            $('.nav-next', j_gallery).fadeIn('fast');
                            $('.nav-prev', j_gallery).fadeIn('fast');
                            panel_nav_displayed = true;
                        }
                    } else {
                        // If the mouse leaves the gallery, stop the pause timer and restart automated transitions
                        if (opts.pause_on_hover) {
                            $(document).stopTime("animation_pause");
                            if (paused) {
                                $(document).everyTime(opts.transition_interval, "transition", function() {
                                    showNextItem();
                                });
                                paused = false;
                            }
                        }
                        // Hide panel navigation
                        if (opts.show_panels && !opts.show_filmstrip && panel_nav_displayed) {
                            $('.nav-next-overlay').fadeOut('fast');
                            $('.nav-prev-overlay').fadeOut('fast');
                            $('.nav-next', j_gallery).fadeOut('fast');
                            $('.nav-prev', j_gallery).fadeOut('fast');
                            panel_nav_displayed = false;
                        }
                    }
                });
            }

            // Hide loading box and display gallery
            j_filmstrip.css('visibility', 'visible');
            j_gallery.css('visibility', 'visible');
            $('.loader', j_gallery).fadeOut('1000', function() {
                // Show the 'first' panel (set by opts.start_frame)
                showItem(iterator);
                // If we have more than one item, begin automated transitions
                if (item_count > 1) {
                    $(document).everyTime(opts.transition_interval, "transition", function() {
                        showNextItem();
                    });
                }
            });
            if (opts.onComplete) {
                opts.onComplete();
            }
        };

        /*
        **	MAIN PLUGIN CODE
        */
        return this.each(function() {
            //Hide the unstyled UL until we've created the gallery
            $(this).css('visibility', 'hidden');

            // Wrap UL in DIV and transfer ID to container DIV
            $(this).wrap("<div></div>");
            j_gallery = $(this).parent();
            j_gallery.css('visibility', 'hidden').attr('id', $(this).attr('id')).addClass('gallery');

            // Assign filmstrip class to UL
            $(this).removeAttr('id').addClass('filmstrip');

            // If the transition or pause timers exist for any reason, stop them now.
            $(document).stopTime("transition");
            $(document).stopTime("animation_pause");

            // Save the id of the UL passed to the plugin
            id = j_gallery.attr('id');

            // If the UL does not contain any <div class="panel-content"> elements, we will scale the UL images to fill the panels
            scale_panel_images = $('.panel-content', j_gallery).length == 0;

            // Define dimensions of pointer <div>
            pointer_height = opts.pointer_size;
            pointer_width = opts.pointer_size * 2;

            // Determine filmstrip orientation (vertical or horizontal)
            // Do not show captions on vertical filmstrips (override user set option)
            filmstrip_orientation = (opts.filmstrip_position == 'top' || opts.filmstrip_position == 'bottom' ? 'horizontal' : 'vertical');
            if (filmstrip_orientation == 'vertical') { opts.show_captions = false; }

            // Determine path between current page and plugin images
            // Scan script tags and look for path to GalleryView plugin
            $('script').each(function(i) {
                var s = $(this);
                if (s.attr('src') && s.attr('src').match(/jquery\.galleryview/)) {
                    loader_path = s.attr('src').split('jquery.galleryview')[0];
                    theme_path = s.attr('src').split('jquery.galleryview')[0] + 'themes/';
                }
            });
            theme_path = '/_scripts/themes/';
            // Assign elements to variables to minimize calls to jQuery
            j_filmstrip = $('.filmstrip', j_gallery);
            j_frames = $('li', j_filmstrip);
            j_frames.addClass('frame');

            // If the user wants panels, generate them using the filmstrip images
            if (opts.show_panels) {
                for (i = j_frames.length - 1; i >= 0; i--) {
                    if (j_frames.eq(i).find('.panel-content').length > 0) {
                        j_frames.eq(i).find('.panel-content').remove().prependTo(j_gallery).addClass('panel');
                    } else {
                        p = $('<div>');
                        p.addClass('panel');
                        im = $('<img />');
                        im.attr('src', j_frames.eq(i).find('img').eq(0).attr('src')).appendTo(p);
                        p.prependTo(j_gallery);
                        j_frames.eq(i).find('.panel-overlay').remove().appendTo(p);
                    }
                }
            } else {
                $('.panel-overlay', j_frames).remove();
                $('.panel-content', j_frames).remove();
            }

            // If the user doesn't want a filmstrip, delete it
            if (!opts.show_filmstrip) { j_filmstrip.remove(); }
            else {
                // Wrap the frame images (and links, if applicable) in container divs
                // These divs will handle cropping and zooming of the images
                j_frames.each(function(i) {
                    if ($(this).find('a').length > 0) {
                        $(this).find('a').wrap('<div class="img_wrap"></div>');
                    } else {
                        $(this).find('img').wrap('<div class="img_wrap"></div>');
                    }
                });
                j_frame_img_wrappers = $('.img_wrap', j_frames);
            }

            j_panels = $('.panel', j_gallery);

            if (!opts.show_panels) {
                opts.panel_height = 0;
                opts.panel_width = 0;
            }


            // Determine final frame dimensions, accounting for user-added padding and border
            f_frame_width = opts.frame_width + extraWidth(j_frame_img_wrappers);
            f_frame_height = opts.frame_height + extraHeight(j_frame_img_wrappers);

            // Number of frames in filmstrip
            item_count = opts.show_panels ? j_panels.length : j_frames.length;

            // Number of frames that can display within the gallery block
            // 64 = width of block for navigation button * 2 + 20
            if (filmstrip_orientation == 'horizontal') {
                strip_size = opts.show_panels ? Math.floor((opts.panel_width - ((opts.frame_gap + 22) * 2)) / (f_frame_width + opts.frame_gap)) : Math.min(item_count, opts.filmstrip_size);
            } else {
                strip_size = opts.show_panels ? Math.floor((opts.panel_height - (opts.frame_gap + 22)) / (f_frame_height + opts.frame_gap)) : Math.min(item_count, opts.filmstrip_size);
            }

            // Determine animation method for filmstrip
            // If more items than strip size, slide filmstrip
            // Otherwise, slide pointer
            if (strip_size >= item_count) {
                slide_method = 'pointer';
                strip_size = item_count;
            }
            else { slide_method = 'strip'; }

            iterator = (strip_size < item_count ? item_count : 0) + opts.start_frame - 1;

            // Determine dimensions of various gallery elements
            filmstrip_margin = (opts.show_panels ? getInt(j_filmstrip.css('marginTop')) : 0);
            j_filmstrip.css('margin', '0px');

            if (filmstrip_orientation == 'horizontal') {
                // Width of gallery block
                gallery_width = opts.show_panels ? opts.panel_width : (strip_size * (f_frame_width + opts.frame_gap)) + 44 + opts.frame_gap;

                // Height of gallery block = screen + filmstrip + captions (optional)
                gallery_height = (opts.show_panels ? opts.panel_height : 0) + (opts.show_filmstrip ? f_frame_height + filmstrip_margin + (opts.show_captions ? frame_caption_size : 0) : 0);
            } else {
                // Width of gallery block
                gallery_height = opts.show_panels ? opts.panel_height : (strip_size * (f_frame_height + opts.frame_gap)) + 22;

                // Height of gallery block = screen + filmstrip + captions (optional)
                gallery_width = (opts.show_panels ? opts.panel_width : 0) + (opts.show_filmstrip ? f_frame_width + filmstrip_margin : 0);
            }

            // Width of filmstrip
            if (filmstrip_orientation == 'horizontal') {
                if (slide_method == 'pointer') { strip_width = (f_frame_width * item_count) + (opts.frame_gap * (item_count)); }
                else { strip_width = (f_frame_width * item_count * 3) + (opts.frame_gap * (item_count * 3)); }
            } else {
                strip_width = (f_frame_width + filmstrip_margin);
            }
            if (filmstrip_orientation == 'horizontal') {
                strip_height = (f_frame_height + filmstrip_margin + (opts.show_captions ? frame_caption_size : 0));
            } else {
                if (slide_method == 'pointer') { strip_height = (f_frame_height * item_count + opts.frame_gap * (item_count)); }
                else { strip_height = (f_frame_height * item_count * 3) + (opts.frame_gap * (item_count * 3)); }
            }

            // Width of filmstrip wrapper (to hide overflow)
            wrapper_width = ((strip_size * f_frame_width) + ((strip_size - 1) * opts.frame_gap));
            wrapper_height = ((strip_size * f_frame_height) + ((strip_size - 1) * opts.frame_gap));


            gallery_padding = getInt(j_gallery.css('paddingTop'));
            j_gallery.css('padding', '0px');

            // Place loading box over gallery until page loads
            galleryPos = getPos(j_gallery[0]);
            $('<div>').addClass('loader').css({
                'position': 'absolute',
                'zIndex': '32666',
                'opacity': 1,
                'top': '0px',
                'left': '0px',
                'width': gallery_width + (filmstrip_orientation == 'horizontal' ? (gallery_padding * 2) : gallery_padding + Math.max(gallery_padding, filmstrip_margin)) + 'px',
                'height': gallery_height + (filmstrip_orientation == 'vertical' ? (gallery_padding * 2) : gallery_padding + Math.max(gallery_padding, filmstrip_margin)) + 'px'
            }).appendTo(j_gallery);

            // Don't call the buildGallery function until the window is loaded
            // NOTE - lazy way of waiting until all images are loaded, may find a better solution for future versions
            //			if(!window_loaded) {
            //				$(window).load(function(){
            //					window_loaded = true;
            //					buildGallery();
            //				});
            //			} else {
            buildGallery();
            //			}

        });
    };

    /*
    **	GalleryView options and default values
    */
    $.fn.galleryView.defaults = {

        show_panels: true, 				//BOOLEAN - flag to show or hide panel portion of gallery
        show_filmstrip: true, 			//BOOLEAN - flag to show or hide filmstrip portion of gallery

        panel_width: 600, 				//INT - width of gallery panel (in pixels)
        panel_height: 400, 				//INT - height of gallery panel (in pixels)
        frame_width: 60, 				//INT - width of filmstrip frames (in pixels)
        frame_height: 40, 				//INT - width of filmstrip frames (in pixels)

        start_frame: 1, 					//INT - index of panel/frame to show first when gallery loads
        filmstrip_size: 3,
        transition_speed: 800, 			//INT - duration of panel/frame transition (in milliseconds)
        transition_interval: 4000, 		//INT - delay between panel/frame transitions (in milliseconds)

        overlay_opacity: 0.7, 			//FLOAT - transparency for panel overlay (1.0 = opaque, 0.0 = transparent)
        frame_opacity: 0.3, 				//FLOAT - transparency of non-active frames (1.0 = opaque, 0.0 = transparent)

        pointer_size: 8, 				//INT - Height of frame pointer (in pixels)

        nav_theme: 'dark', 				//STRING - name of navigation theme to use (folder must exist within 'themes' directory)
        easing: 'swing', 				//STRING - easing method to use for animations (jQuery provides 'swing' or 'linear', more available with jQuery UI or Easing plugin)

        filmstrip_position: 'bottom', 	//STRING - position of filmstrip within gallery (bottom, top, left, right)
        overlay_position: 'bottom', 		//STRING - position of panel overlay (bottom, top, left, right)

        panel_scale: 'nocrop', 			//STRING - cropping option for panel images (crop = scale image and fit to aspect ratio determined by panel_width and panel_height, nocrop = scale image and preserve original aspect ratio)
        frame_scale: 'crop', 			//STRING - cropping option for filmstrip images (same as above)

        frame_gap: 5, 					//INT - spacing between frames within filmstrip (in pixels)

        show_captions: false, 			//BOOLEAN - flag to show or hide frame captions
        fade_panels: true, 				//BOOLEAN - flag to fade panels during transitions or swap instantly
        pause_on_hover: false, 			//BOOLEAN - flag to pause slideshow when user hovers over the gallery
        onComplete: null
    };
})(jQuery);


// ColorBox v1.3.15 - a full featured, light-weight, customizable lightbox based on jQuery 1.3+
// Copyright (c) 2010 Jack Moore - jack@colorpowered.com
// Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
(function(b, ib) { var t = "none", M = "LoadedContent", c = false, v = "resize.", o = "y", q = "auto", e = true, L = "nofollow", m = "x"; function f(a, c) { a = a ? ' id="' + i + a + '"' : ""; c = c ? ' style="' + c + '"' : ""; return b("<div" + a + c + "/>") } function p(a, b) { b = b === m ? n.width() : n.height(); return typeof a === "string" ? Math.round(/%/.test(a) ? b / 100 * parseInt(a, 10) : parseInt(a, 10)) : a } function U(b) { return a.photo || /\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?$/i.test(b) } function cb(a) { for (var c in a) if (b.isFunction(a[c]) && c.substring(0, 2) !== "on") a[c] = a[c].call(l); a.rel = a.rel || l.rel || L; a.href = a.href || b(l).attr("href"); a.title = a.title || l.title; return a } function w(c, a) { a && a.call(l); b.event.trigger(c) } function jb() { var b, e = i + "Slideshow_", c = "click." + i, f, k; if (a.slideshow && h[1]) { f = function() { F.text(a.slideshowStop).unbind(c).bind(V, function() { if (g < h.length - 1 || a.loop) b = setTimeout(d.next, a.slideshowSpeed) }).bind(W, function() { clearTimeout(b) }).one(c + " " + N, k); j.removeClass(e + "off").addClass(e + "on"); b = setTimeout(d.next, a.slideshowSpeed) }; k = function() { clearTimeout(b); F.text(a.slideshowStart).unbind([V, W, N, c].join(" ")).one(c, f); j.removeClass(e + "on").addClass(e + "off") }; a.slideshowAuto ? f() : k() } } function db(c) { if (!O) { l = c; a = cb(b.extend({}, b.data(l, r))); h = b(l); g = 0; if (a.rel !== L) { h = b("." + G).filter(function() { return (b.data(this, r).rel || this.rel) === a.rel }); g = h.index(l); if (g === -1) { h = h.add(l); g = h.length - 1 } } if (!u) { u = D = e; j.show(); if (a.returnFocus) try { l.blur(); b(l).one(eb, function() { try { this.focus() } catch (a) { } }) } catch (f) { } x.css({ opacity: +a.opacity, cursor: a.overlayClose ? "pointer" : q }).show(); a.w = p(a.initialWidth, m); a.h = p(a.initialHeight, o); d.position(0); X && n.bind(v + P + " scroll." + P, function() { x.css({ width: n.width(), height: n.height(), top: n.scrollTop(), left: n.scrollLeft() }) }).trigger("scroll." + P); w(fb, a.onOpen); Y.add(H).add(I).add(F).add(Z).hide(); ab.html(a.close).show() } d.load(e) } } var gb = { transition: "elastic", speed: 300, width: c, initialWidth: "600", innerWidth: c, maxWidth: c, height: c, initialHeight: "450", innerHeight: c, maxHeight: c, scalePhotos: e, scrolling: e, inline: c, html: c, iframe: c, photo: c, href: c, title: c, rel: c, opacity: .9, preloading: e, current: "image {current} of {total}", previous: "previous", next: "next", close: "close", open: c, returnFocus: e, loop: e, slideshow: c, slideshowAuto: e, slideshowSpeed: 2500, slideshowStart: "start slideshow", slideshowStop: "stop slideshow", onOpen: c, onLoad: c, onComplete: c, onCleanup: c, onClosed: c, overlayClose: e, escKey: e, arrowKey: e }, r = "colorbox", i = "cbox", fb = i + "_open", W = i + "_load", V = i + "_complete", N = i + "_cleanup", eb = i + "_closed", Q = i + "_purge", hb = i + "_loaded", E = b.browser.msie && !b.support.opacity, X = E && b.browser.version < 7, P = i + "_IE6", x, j, A, s, bb, T, R, S, h, n, k, J, K, Z, Y, F, I, H, ab, B, C, y, z, l, g, a, u, D, O = c, d, G = i + "Element"; d = b.fn[r] = b[r] = function(c, f) { var a = this, d; if (!a[0] && a.selector) return a; c = c || {}; if (f) c.onComplete = f; if (!a[0] || a.selector === undefined) { a = b("<a/>"); c.open = e } a.each(function() { b.data(this, r, b.extend({}, b.data(this, r) || gb, c)); b(this).addClass(G) }); d = c.open; if (b.isFunction(d)) d = d.call(a); d && db(a[0]); return a }; d.init = function() { var l = "hover", m = "clear:left"; n = b(ib); j = f().attr({ id: r, "class": E ? i + "IE" : "" }); x = f("Overlay", X ? "position:absolute" : "").hide(); A = f("Wrapper"); s = f("Content").append(k = f(M, "width:0; height:0; overflow:hidden"), K = f("LoadingOverlay").add(f("LoadingGraphic")), Z = f("Title"), Y = f("Current"), I = f("Next"), H = f("Previous"), F = f("Slideshow").bind(fb, jb), ab = f("Close")); A.append(f().append(f("TopLeft"), bb = f("TopCenter"), f("TopRight")), f(c, m).append(T = f("MiddleLeft"), s, R = f("MiddleRight")), f(c, m).append(f("BottomLeft"), S = f("BottomCenter"), f("BottomRight"))).children().children().css({ "float": "left" }); J = f(c, "position:absolute; width:9999px; visibility:hidden; display:none"); b("body").prepend(x, j.append(A, J)); s.children().hover(function() { b(this).addClass(l) }, function() { b(this).removeClass(l) }).addClass(l); B = bb.height() + S.height() + s.outerHeight(e) - s.height(); C = T.width() + R.width() + s.outerWidth(e) - s.width(); y = k.outerHeight(e); z = k.outerWidth(e); j.css({ "padding-bottom": B, "padding-right": C }).hide(); I.click(d.next); H.click(d.prev); ab.click(d.close); s.children().removeClass(l); b("." + G).live("click", function(a) { if (!(a.button !== 0 && typeof a.button !== "undefined" || a.ctrlKey || a.shiftKey || a.altKey)) { a.preventDefault(); db(this) } }); x.click(function() { a.overlayClose && d.close() }); b(document).bind("keydown", function(b) { if (u && a.escKey && b.keyCode === 27) { b.preventDefault(); d.close() } if (u && a.arrowKey && !D && h[1]) if (b.keyCode === 37 && (g || a.loop)) { b.preventDefault(); H.click() } else if (b.keyCode === 39 && (g < h.length - 1 || a.loop)) { b.preventDefault(); I.click() } }) }; d.remove = function() { j.add(x).remove(); b("." + G).die("click").removeData(r).removeClass(G) }; d.position = function(f, d) { function b(a) { bb[0].style.width = S[0].style.width = s[0].style.width = a.style.width; K[0].style.height = K[1].style.height = s[0].style.height = T[0].style.height = R[0].style.height = a.style.height } var e, h = Math.max(document.documentElement.clientHeight - a.h - y - B, 0) / 2 + n.scrollTop(), g = Math.max(n.width() - a.w - z - C, 0) / 2 + n.scrollLeft(); e = j.width() === a.w + z && j.height() === a.h + y ? 0 : f; A[0].style.width = A[0].style.height = "9999px"; j.dequeue().animate({ width: a.w + z, height: a.h + y, top: h, left: g }, { duration: e, complete: function() { b(this); D = c; A[0].style.width = a.w + z + C + "px"; A[0].style.height = a.h + y + B + "px"; d && d() }, step: function() { b(this) } }) }; d.resize = function(b) { if (u) { b = b || {}; if (b.width) a.w = p(b.width, m) - z - C; if (b.innerWidth) a.w = p(b.innerWidth, m); k.css({ width: a.w }); if (b.height) a.h = p(b.height, o) - y - B; if (b.innerHeight) a.h = p(b.innerHeight, o); if (!b.innerHeight && !b.height) { b = k.wrapInner("<div style='overflow:auto'></div>").children(); a.h = b.height(); b.replaceWith(b.children()) } k.css({ height: a.h }); d.position(a.transition === t ? 0 : a.speed) } }; d.prep = function(m) { var c = "hidden"; function l(s) { var p, f, m, c, l = h.length, q = a.loop; d.position(s, function() { function s() { E && j[0].style.removeAttribute("filter") } if (u) { E && o && k.fadeIn(100); k.show(); w(hb); Z.show().html(a.title); if (l > 1) { typeof a.current === "string" && Y.html(a.current.replace(/\{current\}/, g + 1).replace(/\{total\}/, l)).show(); I[q || g < l - 1 ? "show" : "hide"]().html(a.next); H[q || g ? "show" : "hide"]().html(a.previous); p = g ? h[g - 1] : h[l - 1]; m = g < l - 1 ? h[g + 1] : h[0]; a.slideshow && F.show(); if (a.preloading) { c = b.data(m, r).href || m.href; f = b.data(p, r).href || p.href; c = b.isFunction(c) ? c.call(m) : c; f = b.isFunction(f) ? f.call(p) : f; if (U(c)) b("<img/>")[0].src = c; if (U(f)) b("<img/>")[0].src = f } } K.hide(); a.transition === "fade" ? j.fadeTo(e, 1, function() { s() }) : s(); n.bind(v + i, function() { d.position(0) }); w(V, a.onComplete) } }) } if (u) { var o, e = a.transition === t ? 0 : a.speed; n.unbind(v + i); k.remove(); k = f(M).html(m); k.hide().appendTo(J.show()).css({ width: function() { a.w = a.w || k.width(); a.w = a.mw && a.mw < a.w ? a.mw : a.w; return a.w } (), overflow: a.scrolling ? q : c }).css({ height: function() { a.h = a.h || k.height(); a.h = a.mh && a.mh < a.h ? a.mh : a.h; return a.h } () }).prependTo(s); J.hide(); b("#" + i + "Photo").css({ cssFloat: t, marginLeft: q, marginRight: q }); X && b("select").not(j.find("select")).filter(function() { return this.style.visibility !== c }).css({ visibility: c }).one(N, function() { this.style.visibility = "inherit" }); a.transition === "fade" ? j.fadeTo(e, 0, function() { l(0) }) : l(e) } }; d.load = function(u) { var n, c, s, q = d.prep; D = e; l = h[g]; u || (a = cb(b.extend({}, b.data(l, r)))); w(Q); w(W, a.onLoad); a.h = a.height ? p(a.height, o) - y - B : a.innerHeight && p(a.innerHeight, o); a.w = a.width ? p(a.width, m) - z - C : a.innerWidth && p(a.innerWidth, m); a.mw = a.w; a.mh = a.h; if (a.maxWidth) { a.mw = p(a.maxWidth, m) - z - C; a.mw = a.w && a.w < a.mw ? a.w : a.mw } if (a.maxHeight) { a.mh = p(a.maxHeight, o) - y - B; a.mh = a.h && a.h < a.mh ? a.h : a.mh } n = a.href; K.show(); if (a.inline) { f().hide().insertBefore(b(n)[0]).one(Q, function() { b(this).replaceWith(k.children()) }); q(b(n)) } else if (a.iframe) { j.one(hb, function() { var c = b("<iframe frameborder='0' style='width:100%; height:100%; border:0; display:block'/>")[0]; c.name = i + +new Date; c.src = a.href; if (!a.scrolling) c.scrolling = "no"; if (E) c.allowtransparency = "true"; b(c).appendTo(k).one(Q, function() { c.src = "//about:blank" }) }); q(" ") } else if (a.html) q(a.html); else if (U(n)) { c = new Image; c.onload = function() { var e; c.onload = null; c.id = i + "Photo"; b(c).css({ border: t, display: "block", cssFloat: "left" }); if (a.scalePhotos) { s = function() { c.height -= c.height * e; c.width -= c.width * e }; if (a.mw && c.width > a.mw) { e = (c.width - a.mw) / c.width; s() } if (a.mh && c.height > a.mh) { e = (c.height - a.mh) / c.height; s() } } if (a.h) c.style.marginTop = Math.max(a.h - c.height, 0) / 2 + "px"; h[1] && (g < h.length - 1 || a.loop) && b(c).css({ cursor: "pointer" }).click(d.next); if (E) c.style.msInterpolationMode = "bicubic"; setTimeout(function() { q(c) }, 1) }; setTimeout(function() { c.src = n }, 1) } else n && J.load(n, function(d, c, a) { q(c === "error" ? "Request unsuccessful: " + a.statusText : b(this).children()) }) }; d.next = function() { if (!D) { g = g < h.length - 1 ? g + 1 : 0; d.load() } }; d.prev = function() { if (!D) { g = g ? g - 1 : h.length - 1; d.load() } }; d.close = function() { if (u && !O) { O = e; u = c; w(N, a.onCleanup); n.unbind("." + i + " ." + P); x.fadeTo("fast", 0); j.stop().fadeTo("fast", 0, function() { w(Q); k.remove(); j.add(x).css({ opacity: 1, cursor: q }).hide(); setTimeout(function() { O = c; w(eb, a.onClosed) }, 1) }) } }; d.element = function() { return b(l) }; d.settings = gb; b(d.init) })(jQuery, this);



/*
 * jQuery Expander plugin
 * Version 0.4  (12/09/2008)
 * @requires jQuery v1.1.1+
 *
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 */
 
(function(d){d.fn.expander=function(s){function n(b){b.hide().prev("span.read-more").show()}function o(b,a){if(b.collapseTimer)p=setTimeout(function(){n(a);b.onCollapse(a.parent(),false)},b.collapseTimer)}var q=d.extend({},d.fn.expander.defaults,s),p;return this.each(function(){var b=d(this),a=d.meta?d.extend({},q,b.data()):q,k,g,c;c=b.html();var e=c.slice(0,a.slicePoint).replace(/\w+$/,"");if(g=e.match(/<\w[^>]*>/g))e=c.slice(0,a.slicePoint+g.join("").length).replace(/\w+$/,"");if(e.lastIndexOf("<")>
e.lastIndexOf(">"))e=e.slice(0,e.lastIndexOf("<"));var h=c.slice(e.length);if(!d("span.details",this).length){if(h.replace(/\s+$/,"").split(" ").length<a.widow)return;if(h.indexOf("</")>-1){c=h.match(/<(\/)?[^>]*>/g);for(var i=0;i<c.length;i++)if(c[i].indexOf("</")>-1){for(var l,f=false,m=0;m<i;m++){l=c[m].slice(0,c[m].indexOf(" ")).replace(/(\w)$/,"$1>");if(l==c[i].replace(/\//,""))f=true}if(!f){e+=c[i];l=false;for(f=g.length-1;f>=0;f--)if(g[f].slice(0,g[f].indexOf(" ")).replace(/(\w)$/,"$1>")==
c[i].replace(/\//,"")&&l==false){k=k?g[f]+k:g[f];l=true}}}h=k&&k+h||h}b.html([e,'<span class="read-more">',a.expandPrefix,'<a href="#">',a.expandText,'</a></span><span class="details">',h,"</span>"].join(""))}var j=d("span.details",this),r=d("span.read-more",this);j.hide();r.find("a").click(function(){r.hide();if(a.expandEffect==="show"&&!a.expandSpeed){a.beforeExpand(b);j.show();a.afterExpand(b);o(a,j)}else{a.beforeExpand(b);j[a.expandEffect](a.expandSpeed,function(){j.css({zoom:""});a.afterExpand(b);
o(a,j)})}return false});if(a.userCollapse){b.find("span.details").append('<span class="re-collapse">'+a.userCollapsePrefix+'<a href="#">'+a.userCollapseText+"</a></span>");b.find("span.re-collapse a").click(function(){clearTimeout(p);var t=d(this).parents("span.details");n(t);a.onCollapse(b,true);return false})}})};d.fn.expander.defaults={slicePoint:100,widow:4,expandText:"read more",expandPrefix:"&hellip; ",collapseTimer:0,expandEffect:"fadeIn",expandSpeed:"",userCollapse:true,userCollapseText:"[collapse expanded text]",
userCollapsePrefix:" ",beforeExpand:function(){},afterExpand:function(){},onCollapse:function(){}}})(jQuery);
 
/*!
* Tiny Carousel 1.8
* http://www.baijs.nl/tinycarousel
*
* Copyright 2010, Maarten Baijs
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://www.opensource.org/licenses/mit-license.php
* http://www.opensource.org/licenses/gpl-2.0.php
*
* Date: 10 / 11 / 2010
* Depends on library: jQuery
*/
(function($) {
    $.fn.tinycarousel = function(options) {
        var defaults = {
            start: 1, // where should the carousel start?
            display: 1, // how many blocks do you want to move at 1 time?
            axis: 'x', // vertical or horizontal scroller? ( x || y ).
            controls: true, // show left and right navigation buttons.
            pager: false, // is there a page number navigation present?
            interval: false, // move to another block on intervals.
            intervaltime: 3000, // interval time in milliseconds.
            rewind: false, // If interval is true and rewind is true it will play in reverse if the last slide is reached.
            animation: true, // false is instant, true is animate.
            duration: 1000, // how fast must the animation move in ms?
            callback: null // function that executes after every move
        };
        var options = $.extend(defaults, options);

        var oSlider = $(this);
        var oViewport = $('.viewport:first', oSlider);
        var oContent = $('.overview:first', oSlider);
        var oPages = oContent.find('li');
        var oBtnNext = $('.next:first', oSlider);
        var oBtnPrev = $('.prev:first', oSlider);
        var oPager = $('.pager:first', oSlider);
        var iViewPortSide = oViewport.innerWidth() / options.display;
        var iPageSize, iSteps, iCurrent, oTimer, bPause, bForward = true, bAxis = options.axis == 'x';

        return this.each(function() {
            initialize();
        });
        function initialize() {
            //added a fix for colorbox. $.outerWidth(true) doesn't work inside of it.
            var correctWidth = $('.overview li', oSlider).outerWidth(true);

            iPageSize = bAxis ? correctWidth : $(oPages[0]).outerHeight();

            var iLeftover = Math.ceil(((bAxis ? oViewport.outerWidth() : oViewport.outerHeight()) / (iPageSize * options.display)) - 1);

            iSteps = Math.max(1, Math.ceil(oPages.length / options.display) - iLeftover);
            iCurrent = Math.min(iSteps, Math.max(1, options.start)) - 2;
            oContent.css(bAxis ? 'width' : 'height', (iPageSize * oPages.length));
            move(1);
            setEvents();
        }
        function setEvents() {
            if (options.controls && oBtnPrev.length > 0 && oBtnNext.length > 0) {
                oBtnPrev.click(function() { move(-1); return false; });
                oBtnNext.click(function() { move(1); return false; });
            }
            if (options.interval) {
                oSlider.hover(function() { clearTimeout(oTimer); bPause = true }, function() { bPause = false; setTimer(); });
            }
            if (options.pager && oPager.length > 0) {
                $('a', oPager).click(setPager);
            }


        }
        function setButtons() {
            if (options.controls) {
                oBtnPrev.toggleClass('disable', !(iCurrent > 0));
                oBtnNext.toggleClass('disable', !(iCurrent + 1 < iSteps));
            }
            if (options.pager) {
                var oNumbers = $('.pagenum', oPager);
                oNumbers.removeClass('active');
                $(oNumbers[iCurrent]).addClass('active');
            }
        }
        function setPager(oEvent) {
            if ($(this).hasClass('pagenum')) {
                iCurrent = parseInt(this.rel) - 1;
                move(1);
            }
            return false;
        }
        function setTimer() {
            if (options.interval && !bPause) {
                clearTimeout(oTimer);
                oTimer = setTimeout(function() {
                    iCurrent = !options.rewind && (iCurrent + 1 == iSteps) ? -1 : iCurrent;
                    bForward = iCurrent + 1 == iSteps ? false : iCurrent == 0 ? true : bForward;
                    move((options.rewind ? (bForward ? 1 : -1) : 1));
                }, options.intervaltime);
            }
        }

        function move(iDirection) {

            if (iCurrent + iDirection > -1 && iCurrent + iDirection <= iSteps) {
                iCurrent += iDirection;
                var oPosition = {};

                oPosition[bAxis ? 'left' : 'top'] = -(iCurrent * (iPageSize * options.display));
                oContent.animate(oPosition, {
                    queue: false,
                    duration: options.animation ? options.duration : 0,
                    complete: function() {
                        if (typeof options.callback == 'function')
                            options.callback.call(this, oPages[iCurrent], iCurrent);
                    }
                });
                setButtons();
                setTimer();
            }
        }
    };
})(jQuery);


/****************************************************************
*                                                              *
*  JQuery Curvy Corners by Mike Jolley                         *
*  http://blue-anvil.com                                       *
*  http://code.google.com/p/jquerycurvycorners/                *
*  ==========================================================  *
*                                                              *
*  Version 2.1.1 (Based on CC 2.1 beta)                          *
*                                                              *
*  Original by: Terry Riegel, Cameron Cooke and Tim Hutchison  *
*  Website: http://www.curvycorners.net                        *
*                                                              *
*  This library is free software; you can redistribute         *
*  it and/or modify it under the terms of the GNU              *
*  Lesser General Public License as published by the           *
*  Free Software Foundation; either version 2.1 of the         *
*  License, or (at your option) any later version.             *
*                                                              *
*  This library is distributed in the hope that it will        *
*  be useful, but WITHOUT ANY WARRANTY; without even the       *
*  implied warranty of MERCHANTABILITY or FITNESS FOR A        *
*  PARTICULAR PURPOSE. See the GNU Lesser General Public       *
*  License for more details.                                   *
*                                                              *
*  You should have received a copy of the GNU Lesser           *
*  General Public License along with this library;             *
*  Inc., 59 Temple Place, Suite 330, Boston,                   *
*  MA 02111-1307 USA                                           *
*                                                              *
****************************************************************/
/*
eval(function(p, a, c, k, e, r) { e = function(c) { return (c < a ? '' : e(parseInt(c / a))) + ((c = c % a) > 35 ? String.fromCharCode(c + 29) : c.toString(36)) }; if (!''.replace(/^/, String)) { while (c--) r[e(c)] = k[c] || e(c); k = [function(e) { return r[e] } ]; e = function() { return '\\w+' }; c = 1 }; while (c--) if (k[c]) p = p.replace(new RegExp('\\b' + e(c) + '\\b', 'g'), k[c]); return p } ('(17($){17 1w(a){10.3p=a;10.1I=10.1W=10.1H=10.1X=0;10.3Y=10.3r=10.3y=10.3B="";10.2y=2C};1w.1N.2s=17(a,b,c,d){11(!a){10.1I=10.1W=10.1H=10.1X=1i(c);10.3Y=10.3r=10.3y=10.3B=d}1l{3E=a.1y(0)+b.1y(0);10[3E+\'R\']=1i(c);10[3E+\'u\']=d}};1w.1N.1j=17(a){11(/^(t|b)(l|r)(R|u)$/.2S(a))18 10[a];11(/^(t|b)(l|r)2R$/.2S(a)){12 b=a.1y(0)+a.1y(1);18 10[b+\'R\']+10[b+\'u\']}11(/^(t|b)2R?$/.2S(a)){12 c=a.1y(0);c+=10[c+\'2Z\']>10[c+\'34\']?\'l\':\'r\';12 d=10[c+\'R\'];11(a.1U===3&&a.1y(2)===\'u\')d+=10[c=\'u\'];18 d}20 1p 1P(\'67\\\'t 6d 5G \'+a);};1w.1N.41=17(a){11(a!==\'t\'&&a!==\'b\')20 1p 1P("55 54 3m \'t\' 4Y \'b\'");18 1a.69(10[a+\'2Z\']-10[a+\'34\'])};1w.1N.3U=17(a){10.3Y=10.3r=10.3y=10.3B=\'14\';11(\'1R\'1F a)10.1I=a.1R.1b;11(\'1V\'1F a)10.1W=a.1V.1b;11(\'1t\'1F a)10.1H=a.1t.1b;11(\'2f\'1F a)10.1X=a.2f.1b;11(\'2y\'1F a)10.2y=a.2y};1w.1N.4X=17(a){12 b=[\'1R\',\'1V\',\'1t\',\'2f\'];12 c=0;12 i,2u;1D(i 1F b)11(!2U(i)){2u=10[b[i]+\'u\'];11(2u!==\'\'&&2u!==\'14\'){c=1p 1w;1r}}11(!c)c=10;1l{12 d,31,e=6F.5n(a,\'1h\');1D(i 1F b)11(!2U(i)){d=b[i];2u=10[d+\'u\'];31=10[d+\'R\'];11(2u!==\'14\'){12 e=a.1d.1h;a.1d.1h=31+2u;31=a.1d.66;a.1d.1h=e}c[d+\'R\']=31;c[d+\'u\']=\'14\'}a.1d.1h=e}18 c};1w.1N.4W=17(a){11(a!==\'t\'&&a!==\'b\')20 1p 1P("55 54 3m \'t\' 4Y \'b\'");18 10[a+\'2Z\']+10[a+\'34\']};1w.1N.4V=17(a){12 b=0;11(10[a+\'2Z\'])++b;11(10[a+\'34\'])++b;18 b};1w.1N.4U=17(){12 a=[];11(10.1I)a.2L(\'1R\');11(10.1W)a.2L(\'1V\');11(10.1H)a.2L(\'1t\');11(10.1X)a.2L(\'2f\');18 a};11(2T 2X===\'2w\')2X=1p 3c;$.3b.3a=17(2F){12 3I=1L;12 3P,3T,33;2o{3P=(1f.2H.1d.6B!==2w)}2k(36){}2o{3T=(1f.2H.1d.5F!==2w)}2k(36){}2o{33=(1f.2H.1d.4T!==2w)}2k(36){}11(3P||3T||33)3I=2C;11(2F 4S 1w){1n=2F}1l{12 2F=1Y.68({1R:{1b:8},1V:{1b:8},1t:{1b:8},2f:{1b:8},2y:2C},2F);12 1n=1p 1w(10);1n.3U(2F)}17 1c(){10.1x=37[1];10.4R=37[0];12 G=$(10.1x);12 H;10.5S=1p 3c();10.2g=10.2m=10.2x=H=2p;12 I=G.6a();11(G.3d(\'6e\'))20 1p 1P("6f 6k 6z 4P 4N "+10.1x.5e+" 5h.","1P");11(G.13(\'3z\')===\'4M\'){G.13(\'3z\',\'4M-5O\')}11(!I){10.2W=17(){};18}11(37[0]4S 1w){10.19=37[0].4X(10.1x)}1l{10.19=1p 1w(\'\');10.19.3U(10.4R)}12 J=G.13("4L")?G.13("4L"):0;12 K=G.13("4K")?G.13("4K"):0;12 L=G.13("4J")?G.13("4J"):0;12 M=G.13("4E")?G.13("4E"):0;12 N=G.13("6v");12 O=G.13("6A");12 P=G.13("6E");12 Q=G.13("6I");12 R=G.13("5c");12 S=G.13("5f");12 T=G.13("5k");12 U=G.13("5q");12 V=G.13("2D");12 W=G.13("1s");12 X=G.13("1T");12 Y,1e;Y=G.13("4B")?G.13("4B"):0;1e=G.13("4x")?G.13("4x"):0;12 Z=G.13("1O");12 3m=G.13("4v");12 4u=G.13("6u");12 4s=G.13("35");12 4r=G.13("3n");12 6C=G.13("1g");12 2b=1Y.2N.4q>7&&$.2N.4p?G.13("2d"):2p;12 1Z=10.19.1j(\'4o\');12 1t=10.19.1j(\'5p\');12 1C=17(a){11(2T a===\'5t\')18 a;11(2T a!==\'5u\')20 1p 1P(\'5z 5D 5E \'+2T a);12 b=/^[-\\d.]([a-z]+)$/.2O(a);11(b&&b[1]!=\'14\')20 1p 1P(\'5H 5N \'+b[1]);11(2U(a=1i(a)))a=0;18 a};12 4l=17(a){18 a<=0?"0":a+"14"};2o{10.1k=1C(J);10.1Q=1C(K);10.1o=1C(L);10.32=1C(M);10.2n=1c.2i(V);10.4k=1C(3m);10.6c=1C(4u);10.3C=1C(4s);10.3D=1C(4r);10.2c=I;10.2Q=G.6r();10.3G=1c.2i(N);10.3H=1c.2i(O);10.4j=1c.2i(P);10.4h=1c.2i(Q);10.3K=10.1k+"14"+" "+R+" "+10.3G;10.3L=10.1Q+"14"+" "+S+" "+10.3H;10.3q=10.1o+"14"+" "+T+" "+10.4j;10.3o=10.32+"14"+" "+U+" "+10.4h;10.1s=(W!="4g"&&W!="5b")?W:"";10.1T=X}2k(e){}12 28=10.2Q;12 24=I;11($.2N.4f){Y=1C(Y);1e=1C(1e);11(Y){12 t=24+10.1o+10.32;11(Y>t)Y=t;Y=(t/Y*25)+\'%\'}11(1e){12 t=28+10.1k+10.1Q;11(1e>t)1e=t;1e=(t/1e*25)+\'%\'}}10.2Y=1f.26("2q");11(2b)10.2Y.1d.2d=2b;3g(10.1x.4e)10.2Y.1v(10.1x.3Z(10.1x.4e));11(Z!="2a")G.13("1O","4d");10.1x.1d.4c=\'0\';10.1x.1d.1g=10.1x.1d.1s=\'4g\';10.1x.1d.2D=\'2z\';10.1x.1d.1z=(24+10.1o+10.32)+\'14\';10.1x.1d.1E=(28+10.1k+10.1Q)+\'14\';12 2l=1f.26("2q");$(2l).13({1z:24+\'14\',\'4c\':"0",1O:"2a",1E:4l(28+10.1k+10.1Q-1Z-1t),1q:1Z+"14",1h:"0",\'2D\':V,\'1s\':10.1s,\'1T\':10.1T,\'5T\':\'5U\'});11(2b)$(2l).13(\'2d\',\'2d\');11(10.1o)$(2l).13(\'3v\',10.3q);11(10.1k&&!1Z)$(2l).13(\'4b\',10.3K);11(10.32)$(2l).13(\'3x\',10.3o);11(10.1Q&&!1t)$(2l).13(\'4a\',10.3L);10.2x=10.1x.1v(2l);I=$(10.2x).13("1z");11(I===""||I==="43"||I.39("%")!==-1)20 1P(\'6b 1z 3d \'+I);10.2c=(I!=""&&I!="43"&&I.39("%")==-1)?1i(I):$(10.2x).1z();10.2W=17(){10.1u=10.1e=0;11(10.1S){12 e=17(a,b,c){11(a===0)18 0;12 d;11(a===\'1M\'||a===\'1G\')18 c-b;11(a===\'6g\')18(c-b)/2;11(a.39(\'%\')>0)18(c-b)/(25/1i(a));18 1C(a)};10.1u=e(Y,10.1S.1z,24);10.1e=e(1e,10.1S.1E,28)}1l 11(10.1s){10.1u=1C(Y);10.1e=1C(1e)}11(1Z){f=1f.26("2q");$(f).13({1z:10.2c+"14",\'3k\':"2t",2G:"2I",1O:"2a",\'35\':10.1k+"14",\'3n\':10.1k+"14",1E:1Z+"14",1q:-1Z+"14",1h:-10.1o+"14"});10.2g=10.2x.1v(f)}11(1t){12 f=1f.26("2q");$(f).13({1z:10.2c+"14",\'3k\':"2t",2G:"2I",1O:"2a",\'35\':10.1Q+"14",\'3n\':10.1Q+"14",1E:1t+"14",1G:-1t+"14",1h:-10.1o+"14"});10.2m=10.2x.1v(f)}12 g=10.19.4U();1D(12 i 1F g)11(!2U(i)){12 h=g[i];12 j=10.19[h+\'R\'];12 l,29,21,2V;11(h=="1V"||h=="1R"){l=10.1k;29=10.3G;2V=10.1k}1l{l=10.1Q;29=10.3H;2V=10.1Q}21=j-2V;12 m=1f.26("2q");$(m).13({1O:"2a","48-3S":"2t",2G:"2I"}).1E(10.19.1j(h+\'2R\')).1z(10.19.1j(h+\'2R\'));12 n,1A,3h;12 o=2b?1i(/5o\\(46.(\\d+)\\)/.2O(2b)[1]):25;1D(n=0;n<j;++n){12 p=(n+1>=21)?-1:1a.44(1a.2h(1a.1J(21,2)-1a.1J(n+1,2)))-1;11(21!=j){12 q=(n>=21)?-1:1a.49(1a.2h(1a.1J(21,2)-1a.1J(n,2)));12 r=(n+1>=j)?-1:1a.44(1a.2h(1a.1J(j,2)-1a.1J((n+1),2)))-1}12 s=(n>=j)?-1:1a.49(1a.2h(1a.1J(j,2)-1a.1J(n,2)));11(p>-1)10.2e(n,0,10.2n,o,(p+1),m,2C,j);11(21!=j){11(10.19.2y){1D(1A=p+1;1A<q;++1A){11(10.1s!=""){12 u=1c.3i(n,1A,21)*25;10.2e(n,1A,29,o,1,m,u>=30,j)}1l 11(10.2n!==\'2z\'){12 v=1c.45(10.2n,29,1c.3i(n,1A,21));10.2e(n,1A,v,o,1,m,1L,j)}1l 10.2e(n,1A,29,o>>1,1,m,1L,j)}11(r>=q){11(q==-1)q=0;10.2e(n,q,29,o,(r-q+1),m,1L,0)}3h=29;1A=r}1l{11(r>p){10.2e(n,(p+1),29,o,(r-p),m,1L,0)}}}1l{3h=10.2n;1A=p}11(10.19.2y&&10.2n!==\'2z\'){3g(++1A<s){10.2e(n,1A,3h,(1c.3i(n,1A,j)*o),1,m,2V<=0,j)}}}1D(12 t=0,k=m.47.1U;t<k;++t){12 w=m.47[t];12 x=1i($(w).13(\'1q\'));12 y=1i($(w).13(\'1h\'));12 A=1i($(w).13(\'1E\'));11(h=="1R"||h=="1t"){$(w).13(\'1h\',(j-y-1)+"14")}11(h=="1V"||h=="1R"){$(w).13(\'1q\',(j-A-x)+"14")}$(w).13(\'1T\',10.1T);11(10.1s)2E(h){1m"1V":$(w).13(\'1K\',(10.1u-10.1o+j-24-y)+"14 "+(10.1e+A+x+10.1k-j)+"14");1r;1m"1R":$(w).13(\'1K\',(10.1u-j+y+1+10.1o)+"14 "+(10.1e-j+A+x+10.1k)+"14");1r;1m"1t":$(w).13(\'1K\',(10.1u-j+y+1+10.1o)+"14 "+(10.1e-28-10.1k+(!1Y.2B.2A?x:-x)+j)+"14");1r;1m"2f":11(!1Y.2B.2A){$(w).13(\'1K\',(10.1u-10.1o-24+j-y)+"14 "+(10.1e-28-10.1k+x+j)+"14")}1l{$(w).13(\'1K\',(10.1u-10.1o-24+j-y)+"14 "+(10.1e-28-10.1k+j-x)+"14")}}}2E(h){1m"1R":$(m).13(\'1q\',m.1d.1h="0");10.2g.1v(m);1r;1m"1V":$(m).13(\'1q\',m.1d.1M="0");10.2g.1v(m);1r;1m"1t":$(m).13(\'1G\',m.1d.1h="0");10.2m.1v(m);1r;1m"2f":$(m).13(\'1G\',m.1d.1M="0");10.2m.1v(m)}}12 B={t:10.19.41(\'t\'),b:10.19.41(\'b\')};1D(z 1F B){11(2T z===\'17\')4i;11(!10.19.1j(z+\'R\'))4i;11(B[z]){12 C=(10.19[z+"2Z"]<10.19[z+"34"])?z+"l":z+"r";12 D=1f.26("2q");$(D).13({\'1E\':B[z]+"14",\'1z\':10.19.1j(C+\'2R\'),\'1O\':"2a",\'3k\':"2t",\'2G\':"2I",\'2D\':10.2n,\'1s\':10.1s,\'1T\':10.1T});11(2b)$(D).13(\'2d\',\'2d\');2E(C){1m"1R":$(D).13({\'1G\':\'\',\'1h\':\'0\',\'3v\':10.3q,\'1K\':10.1u+"14 "+(10.1k+10.1e-10.19.1I)+"14"});10.2g.1v(D);1r;1m"1V":$(D).13({\'1G\':\'\',\'1M\':\'0\',\'3x\':10.3o,\'1K\':(10.1u-10.2c+10.19.1W)+"14 "+(10.1k+10.1e-10.19.1W)+"14"});10.2g.1v(D);1r;1m"1t":$(D).13({\'1q\':\'\',\'1h\':\'0\',\'3v\':10.3q,\'1K\':10.1u+"14 "+(10.1e-10.1k-10.2Q+B[z]+10.19.1H)+"14"});10.2m.1v(D);1r;1m"2f":$(D).13({\'1q\':\'\',\'1M\':\'0\',\'3x\':10.3o,\'1K\':(10.1o+10.1u-10.2c+10.19.1X)+"14 "+(10.1e-10.1k-10.2Q+B[z]+10.19.1X)+"14"});10.2m.1v(D)}}12 E=1f.26("2q");11(2b)$(E).13(\'2d\',\'2d\');$(E).13({\'1O\':"4d",\'3k\':"2t",\'2G\':"2I",\'1z\':10.4m(z),\'2D\':10.2n,\'1s\':10.1s,\'1T\':10.1T});2E(z){1m"t":11(10.2g){11(!1Y.2B.2A){$(E).13(\'1E\',25+1Z+"14")}1l{$(E).13(\'1E\',25+1Z-10.1k+"14")}$(E).13(\'4n\',10.19.1I?(10.19.1I-10.1o)+"14":"0");$(E).13(\'4b\',10.3K);11(10.1s){12 F=10.19.1I?(10.1o+10.1u-10.19.1I)+"14 ":10.1u+"14 ";$(E).13(\'1K\',F+10.1e+"14");$(10.2x).13(\'1K\',10.1u+"14 "+(10.1e-1Z+10.1o)+"14")}10.2g.1v(E)}1r;1m"b":11(10.2m){11(!1Y.2B.2A){$(E).13(\'1E\',1t+"14")}1l{$(E).13(\'1E\',1t-10.1Q+"14")}$(E).13(\'4n\',10.19.1H?(10.19.1H-10.1o)+"14":"0");$(E).13(\'4a\',10.3L);11(10.1s){12 F=10.19.1H?(10.1u+10.1o-10.19.1H)+"14 ":10.1u+"14 ";$(E).13(\'1K\',F+(10.1e-28-10.1k+1t)+"14")}10.2m.1v(E)}}}z=24;11(1Y.2B.2A)z-=10.3C+10.3D;$(10.2Y).13({\'1O\':\'2a\',\'1h\':10.1o+"14",\'4v\':10.4k+"14",\'1q\':10.1k+"14",\'35\':10.3C+"14",\'3n\':10.3D+"14",\'1z\':z+"14",\'3X\':G.13(\'3X\')}).3W(\'3Q\');G.13(\'3X\',\'1h\').3W(\'3O\');10.1x.1v(10.2Y);11(H)$(H).13(\'3z\',6D)};11(10.1s){Y=10.3N(Y);1e=10.3N(1e);11(10.1S){10.1S.4t=10;10.2v=10.2W;10.2W=17(){11(10.1S.6N)10.2v();1l 10.1S.56=1p 57(\'$(10.4t).2v();\')}}}};1c.1N.3N=17(c){11(c===\'1q\'||c===\'1h\'||1i(c)===0)18 0;11(!(/^[-\\d.]+14$/.2S(c))&&!10.1S){10.1S=1p 58;12 d=17(a){12 b=/59\\("?([^\'"]+)"?\\)/.2O(a);18(b?b[1]:a)};10.1S.5a=d(10.1s)}18 c};1c.1N.2e=17(a,b,c,d,e,f,g,h){12 i=1f.26("2q");$(i).13({"1E":e+"14","1z":"2t","1O":"2a","48-3S":"2t","2G":"2I","1q":b+"14","1h":a+"14","3j-4w":c});12 j=10.19.1j(\'4o\');11(g&&10.1s!=""){$(i).13({"3j-1O":"-"+(10.2c-(h-a)+10.1k)+"14 -"+((10.2Q+j+b)-10.1k)+"14","3j-5d":10.1s})}11(d!=25)$(i).13({46:(d/25)});f.1v(i)};1c.1N.4m=17(a){12 b,3F;b=!1Y.2B.2A?0:10.19.4V(a)*10.1o;11((3F=10.2c-10.19.4W(a)+b)<0)20 1P("65 5g 1x 1z");18 3F+\'14\'};1c.4y=17(a){12 d=1f.26(\'5i\');d.1d.2D=a;1f.2H.1v(d);11(5j.4z){12 b=1f.5l.4z(d,2p).5m(\'3j-4w\');d.4A.3Z(d);11(b.2j(0,3)==="3s")b=1c.2P(b);18 b}1l{12 c=1f.2H.5r();c.5s(d);c.4C(\'4D\',1L,a);12 e=c.5v(\'4D\');12 f="3s("+(e&5w)+", "+((e&5x)>>8)+", "+((e&5y)>>16)+")";d.4A.3Z(d);c=2p;18 1c.2P(f)}};1c.45=17(a,b,c){11(a===\'2z\'||b===\'2z\')20 1P(\'5A 5B 5C 2z\');11(a.1y(0)!==\'#\'){a=1c.2i(a)}11(b.1y(0)!==\'#\'){b=1c.2i(b)}12 d=1i(a.2j(1,2),16);12 e=1i(a.2j(3,2),16);12 f=1i(a.2j(5,2),16);12 g=1i(b.2j(1,2),16);12 h=1i(b.2j(3,2),16);12 i=1i(b.2j(5,2),16);11(c>1||c<0)c=1;12 j=1a.40((d*c)+(g*(1-c)));11(j>2K)j=2K;11(j<0)j=0;12 k=1a.40((e*c)+(h*(1-c)));11(k>2K)k=2K;11(k<0)k=0;12 l=1a.40((f*c)+(i*(1-c)));11(l>2K)l=2K;11(l<0)l=0;18"#"+1c.2r(j)+1c.2r(k)+1c.2r(l)};1c.2r=17(a){12 b=[\'0\',\'1\',\'2\',\'3\',\'4\',\'5\',\'6\',\'7\',\'8\',\'9\',\'A\',\'B\',\'C\',\'D\',\'E\',\'F\'];18 b[a>>>4]+\'\'+b[a&15]};1c.3i=17(x,y,r){12 a;12 b=r*r;12 c=1p 3c(2);12 d=1p 3c(2);12 e=0;12 f="";12 g=1a.2h(b-1a.1J(x,2));11(g>=y&&g<(y+1)){f="5I";c[e]=0;d[e]=g-y;++e}g=1a.2h(b-1a.1J(y+1,2));11(g>=x&&g<(x+1)){f+="5J";c[e]=g-x;d[e]=1;++e}g=1a.2h(b-1a.1J(x+1,2));11(g>=y&&g<(y+1)){f+="5K";c[e]=1;d[e]=g-y;++e}g=1a.2h(b-1a.1J(y,2));11(g>=x&&g<(x+1)){f+="5L";c[e]=g-x;d[e]=0}2E(f){1m"5M":a=1a.3f(d[0],d[1])+((1a.4F(d[0],d[1])-1a.3f(d[0],d[1]))/2);1r;1m"5P":a=1-(((1-c[0])*(1-d[1]))/2);1r;1m"5Q":a=1a.3f(c[0],c[1])+((1a.4F(c[0],c[1])-1a.3f(c[0],c[1]))/2);1r;1m"5R":a=d[0]*c[1]/2;1r;4G:a=1}18 a};1c.2P=17(a){2o{12 b=1c.4H(a);12 c=1i(b[0]);12 d=1i(b[1]);12 f=1i(b[2]);12 g="#"+1c.2r(c)+1c.2r(d)+1c.2r(f)}2k(e){4I("5V 5W 5X 5Y 5Z 60 61 62 4N 63 1F 17 2P")}18 g};1c.4H=17(a){12 b=a.64(4,a.39(")"));18 b.3R(", ")};1c.2i=17(a){11(a!=""&&a!="2z"){11(a.2j(0,3)==="3s"){a=1c.2P(a)}1l 11(a.1y(0)!==\'#\'){a=4y(a)}1l 11(a.1U===4){a="#"+a.1y(1)+a.1y(1)+a.1y(2)+a.1y(2)+a.1y(3)+a.1y(3)}}18 a};18 10.2J(17(){11(!$(10).3d(\'.3O\')){11(3I){11(1n.1j(\'1I\')){$(10).13({\'1g-1q-1h-1b\':1n.1j(\'1I\')+\'14\',\'-1B-1g-1b-3J\':1n.1j(\'1I\')+\'14\',\'-3e-1g-1q-1h-1b\':1n.1j(\'1I\')+\'14\'})}11(1n.1j(\'1W\')){$(10).13({\'1g-1q-1M-1b\':1n.1j(\'1W\')+\'14\',\'-1B-1g-1b-3A\':1n.1j(\'1W\')+\'14\',\'-3e-1g-1q-1M-1b\':1n.1j(\'1W\')+\'14\'})}11(1n.1j(\'1H\')){$(10).13({\'1g-1G-1h-1b\':1n.1j(\'1H\')+\'14\',\'-1B-1g-1b-3w\':1n.1j(\'1H\')+\'14\',\'-3e-1g-1G-1h-1b\':1n.1j(\'1H\')+\'14\'})}11(1n.1j(\'1X\')){$(10).13({\'1g-1G-1M-1b\':1n.1j(\'1X\')+\'14\',\'-1B-1g-1b-3u\':1n.1j(\'1X\')+\'14\',\'-3e-1g-1G-1M-1b\':1n.1j(\'1X\')+\'14\'})}}1l{11(!$(10).3d(\'.4O\')){$(10).3W(\'4O\');38=$(10).4Q(\'1d\');11(38==\'2w\'){38=\'\'}2X.2L({3t:10,19:1n,1d:38,6h:$(10).6i(2C)})}12 a=1p 1c(1n,10);a.2W()}}})};$.3b.6j=17(){18 10.2J(17(i,e){27=e;$.2J(2X,17(a,b){11(b.3t==27&&$(\'.3Q\',27).3S()>0){$(27).6l($(27).6m(\'.3Q:6n\').6o());1d=b.1d==\'2w\'?b.1d:\'\';$(27).6p(\'3O\').4Q(\'1d\',1d);18 1L}})})};$.3b.6q=17(){18 10.2J(17(i,e){27=e;$.2J(2X,17(a,b){11(b.3t==27){$(27).3a(b.19);18 1L}})})};$.3b.2v=17(){18 10.2J(17(i,e){3V=e;11(\'2v\'1F 3V)3V.2v();1l 20 1P(\'6s 2v 17\')})};$(17(){11($.2N.4p){2o{1f.4C("6t",1L,2C)}2k(e){};17 2M(a){11(!1i(a))18\'14\';12 b=/^[\\d.]+(\\w+)$/.2O(a);18 b[1]};12 t,i,j;17 3M(a){12 b=a.1d;11(1Y.2N.4q>6.0){12 c=b[\'-1B-1g-1b\']||0;12 d=b[\'-1B-1g-1b-3A\']||0;12 e=b[\'-1B-1g-1b-3J\']||0;12 f=b[\'-1B-1g-1b-3u\']||0;12 g=b[\'-1B-1g-1b-3w\']||0}1l{12 c=b[\'1B-1g-1b\']||0;12 d=b[\'1B-1g-1b-3A\']||0;12 e=b[\'1B-1g-1b-3J\']||0;12 f=b[\'1B-1g-1b-3u\']||0;12 g=b[\'1B-1g-1b-3w\']||0}11(c){12 t=c.3R(\'/\');t=t[0].3R(/\\s+/);11(t[t.1U-1]===\'\')t.6w();2E(t.1U){1m 3:e=t[0];d=g=t[1];f=t[2];c=1L;1r;1m 2:e=f=t[0];d=g=t[1];c=1L;1m 1:1r;1m 4:e=t[0];d=t[1];f=t[2];g=t[3];c=1L;1r;4G:4I(\'6x 4P 6y: \'+c)}}11(c||e||d||f||g){12 h=1p 1w(a.3p);11(c)h.2s(2p,2p,1i(c),2M(c));1l{11(d)h.2s(\'t\',\'r\',1i(d),2M(d));11(e)h.2s(\'t\',\'l\',1i(e),2M(e));11(g)h.2s(\'b\',\'l\',1i(g),2M(g));11(f)h.2s(\'b\',\'r\',1i(f),2M(f))}$(a.3p).3a(h)}}1D(t=0;t<1f.22.1U;++t){2o{11(1f.22[t].3l){1D(i=0;i<1f.22[t].3l.1U;++i){1D(j=0;j<1f.22[t].3l[i].23.1U;++j){3M(1f.22[t].3l[i].23[j])}}}1D(i=0;i<1f.22[t].23.1U;++i)3M(1f.22[t].23[i])}2k(e){}}}1l 11($.2N.4f){2o{33=(1f.2H.1d.4T!==2w)}2k(36){}11(!33){17 4Z(a){18/1g-((1q|1G)-(1h|1M)-)?1b/.2S(1f.22.50(a).51.52)};23=[];1D(t=0;t<1f.22.1U;++t){11(4Z(t)){12 k=1f.22.50(6G).51.52;k=k.6H(/\\/\\*(\\n|\\r|.)*?\\*\\//g,\'\');12 l=1p 53("^\\\\s*([\\\\w.#][-\\\\w.#, ]+)[\\\\n\\\\s]*\\\\{([^}]+1g-((1q|1G)-(1h|1M)-)?1b[^}]*)\\\\}","6J");12 m;3g((m=l.2O(k))!==2p){12 n=1p 53("(..)1g-((1q|1G)-(1h|1M)-)?1b:\\\\s*([\\\\d.]+)(1F|6K|14|6L|6M)","g");12 o,42=1p 1w(m[1]);3g((o=n.2O(m[2]))!==2p){11(o[1]!=="z-")42.2s(o[3],o[4],o[5],o[6]);23.2L(42)}}}}1D(i 1F 23)11(!2U(i))$(23[i].3p).3a(23[i])}}})})(1Y);', 62, 422, '||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||this|if|var|css|px|||function|return|spec|Math|radius|curvyObject|style|backgroundPosY|document|border|left|parseInt|get|borderWidth|else|case|bd|borderWidthL|new|top|break|backgroundImage|bl|backgroundPosX|appendChild|curvyCnrSpec|box|charAt|width|inty|moz|bm|for|height|in|bottom|blR|tlR|pow|backgroundPosition|false|right|prototype|position|Error|borderWidthB|tl|backgroundObject|backgroundRepeat|length|tr|trR|brR|jQuery|bk|throw|borderRadius|styleSheets|rules|bp|100|createElement|thisdiv|bo|bcolor|absolute|bj|boxWidth|filter|drawPixel|br|topContainer|sqrt|format_colour|substr|catch|bq|bottomContainer|boxColour|try|null|div|IntToHex|setcorner|1px|propu|dispatch|undefined|shell|antiAlias|transparent|boxModel|support|true|backgroundColor|switch|bc|overflow|body|hidden|each|255|push|units|browser|exec|rgb2Hex|boxHeight|Ru|test|typeof|isNaN|borderWidthTB|applyCorners|redrawList|contentContainer|lR||propR|borderWidthR|checkStandard|rR|paddingLeft|err|arguments|thestyles|indexOf|corner|fn|Array|is|webkit|min|while|outsideColour|pixelFraction|background|fontSize|imports|be|paddingRight|borderStringR|selectorText|borderStringL|tru|rgb|node|bottomright|borderLeft|bottomleft|borderRight|blu|display|topright|bru|leftPadding|rightPadding|propname|f_width|borderColour|borderColourB|ba|topleft|borderString|borderStringB|procIEStyles|backgroundCheck|hasCorners|bb|autoPadDiv|split|size|checkMozilla|setfrom|obj|addClass|textAlign|tlu|removeChild|round|radiusdiff|cornerspec|auto|floor|BlendColour|opacity|childNodes|font|ceil|borderBottom|borderTop|padding|relative|firstChild|opera|none|borderColourR|continue|borderColourL|topPadding|bn|fillerWidth|marginLeft|tR|msie|version|bh|bg|holdingElement|bf|paddingTop|color|backgroundPositionY|getComputedColour|getComputedStyle|parentNode|backgroundPositionX|execCommand|ForeColor|borderRightWidth|max|default|rgb2Array|alert|borderLeftWidth|borderBottomWidth|borderTopWidth|inline|to|drawn|corners|attr|settings|instanceof|BorderRadius|cornerNames|radiusCount|radiusSum|cloneOn|or|opera_contains_border_radius|item|ownerNode|text|RegExp|must|Param|onload|Function|Image|url|src|initial|borderTopStyle|image|tagName|borderBottomStyle|exceeds|elements|DIV|window|borderLeftStyle|defaultView|getPropertyValue|get_style|alpha|bR|borderRightStyle|createTextRange|moveToElementText|number|string|queryCommandValue|0xFF|0xFF00|0xFF0000|unexpected|Cannot|blend|with|styleToNPx|type|MozBorderRadius|property|Unexpected|Left|Top|Right|Bottom|LeftRight|unit|block|TopRight|TopBottom|LeftBottom|masterCorners|direction|ltr|There|was|an|error|converting|the|RGB|value|Hexadecimal|substring|Radius|pixelLeft|Don|extend|abs|innerWidth|Shell|bottomPadding|recognize|table|You|center|copy|clone|removeCorners|cannot|html|children|first|contents|removeClass|redrawCorners|innerHeight|No|BackgroundImageCache|paddingBottom|borderTopColor|pop|Illegal|specification|apply|borderBottomColor|WebkitBorderRadius|bi|boxDispSave|borderLeftColor|curvyBrowser|sheetnumber|replace|borderRightColor|mg|em|ex|pt|complete'.split('|'), 0, {}))

*/
/*
 * jQuery Tools 1.2.5 - The missing UI library for the Web
 * 
 * [tabs, tooltip, scrollable, overlay, toolbox.expose]
 * 
 * NO COPYRIGHTS OR LICENSES. DO WHAT YOU LIKE.
 * 
 * http://flowplayer.org/tools/
 * 
 * File generated: Wed Feb 09 06:50:45 GMT 2011
 */
(function(c){function p(d,b,a){var e=this,l=d.add(this),h=d.find(a.tabs),i=b.jquery?b:d.children(b),j;h.length||(h=d.children());i.length||(i=d.parent().find(b));i.length||(i=c(b));c.extend(this,{click:function(f,g){var k=h.eq(f);if(typeof f=="string"&&f.replace("#","")){k=h.filter("[href*="+f.replace("#","")+"]");f=Math.max(h.index(k),0)}if(a.rotate){var n=h.length-1;if(f<0)return e.click(n,g);if(f>n)return e.click(0,g)}if(!k.length){if(j>=0)return e;f=a.initialIndex;k=h.eq(f)}if(f===j)return e;
g=g||c.Event();g.type="onBeforeClick";l.trigger(g,[f]);if(!g.isDefaultPrevented()){o[a.effect].call(e,f,function(){g.type="onClick";l.trigger(g,[f])});j=f;h.removeClass(a.current);k.addClass(a.current);return e}},getConf:function(){return a},getTabs:function(){return h},getPanes:function(){return i},getCurrentPane:function(){return i.eq(j)},getCurrentTab:function(){return h.eq(j)},getIndex:function(){return j},next:function(){return e.click(j+1)},prev:function(){return e.click(j-1)},destroy:function(){h.unbind(a.event).removeClass(a.current);
i.find("a[href^=#]").unbind("click.T");return e}});c.each("onBeforeClick,onClick".split(","),function(f,g){c.isFunction(a[g])&&c(e).bind(g,a[g]);e[g]=function(k){k&&c(e).bind(g,k);return e}});if(a.history&&c.fn.history){c.tools.history.init(h);a.event="history"}h.each(function(f){c(this).bind(a.event,function(g){e.click(f,g);return g.preventDefault()})});i.find("a[href^=#]").bind("click.T",function(f){e.click(c(this).attr("href"),f)});if(location.hash&&a.tabs=="a"&&d.find("[href="+location.hash+"]").length)e.click(location.hash);
else if(a.initialIndex===0||a.initialIndex>0)e.click(a.initialIndex)}c.tools=c.tools||{version:"1.2.5"};c.tools.tabs={conf:{tabs:"a",current:"current",onBeforeClick:null,onClick:null,effect:"default",initialIndex:0,event:"click",rotate:false,history:false},addEffect:function(d,b){o[d]=b}};var o={"default":function(d,b){this.getPanes().hide().eq(d).show();b.call()},fade:function(d,b){var a=this.getConf(),e=a.fadeOutSpeed,l=this.getPanes();e?l.fadeOut(e):l.hide();l.eq(d).fadeIn(a.fadeInSpeed,b)},slide:function(d,
b){this.getPanes().slideUp(200);this.getPanes().eq(d).slideDown(400,b)},ajax:function(d,b){this.getPanes().eq(0).load(this.getTabs().eq(d).attr("href"),b)}},m;c.tools.tabs.addEffect("horizontal",function(d,b){m||(m=this.getPanes().eq(0).width());this.getCurrentPane().animate({width:0},function(){c(this).hide()});this.getPanes().eq(d).animate({width:m},function(){c(this).show();b.call()})});c.fn.tabs=function(d,b){var a=this.data("tabs");if(a){a.destroy();this.removeData("tabs")}if(c.isFunction(b))b=
{onBeforeClick:b};b=c.extend({},c.tools.tabs.conf,b);this.each(function(){a=new p(c(this),d,b);c(this).data("tabs",a)});return b.api?a:this}})(jQuery);
(function(f){function p(a,b,c){var h=c.relative?a.position().top:a.offset().top,d=c.relative?a.position().left:a.offset().left,i=c.position[0];h-=b.outerHeight()-c.offset[0];d+=a.outerWidth()+c.offset[1];if(/iPad/i.test(navigator.userAgent))h-=f(window).scrollTop();var j=b.outerHeight()+a.outerHeight();if(i=="center")h+=j/2;if(i=="bottom")h+=j;i=c.position[1];a=b.outerWidth()+a.outerWidth();if(i=="center")d-=a/2;if(i=="left")d-=a;return{top:h,left:d}}function u(a,b){var c=this,h=a.add(c),d,i=0,j=
0,m=a.attr("title"),q=a.attr("data-tooltip"),r=o[b.effect],l,s=a.is(":input"),v=s&&a.is(":checkbox, :radio, select, :button, :submit"),t=a.attr("type"),k=b.events[t]||b.events[s?v?"widget":"input":"def"];if(!r)throw'Nonexistent effect "'+b.effect+'"';k=k.split(/,\s*/);if(k.length!=2)throw"Tooltip: bad events configuration for "+t;a.bind(k[0],function(e){clearTimeout(i);if(b.predelay)j=setTimeout(function(){c.show(e)},b.predelay);else c.show(e)}).bind(k[1],function(e){clearTimeout(j);if(b.delay)i=
setTimeout(function(){c.hide(e)},b.delay);else c.hide(e)});if(m&&b.cancelDefault){a.removeAttr("title");a.data("title",m)}f.extend(c,{show:function(e){if(!d){if(q)d=f(q);else if(b.tip)d=f(b.tip).eq(0);else if(m)d=f(b.layout).addClass(b.tipClass).appendTo(document.body).hide().append(m);else{d=a.next();d.length||(d=a.parent().next())}if(!d.length)throw"Cannot find tooltip for "+a;}if(c.isShown())return c;d.stop(true,true);var g=p(a,d,b);b.tip&&d.html(a.data("title"));e=e||f.Event();e.type="onBeforeShow";
h.trigger(e,[g]);if(e.isDefaultPrevented())return c;g=p(a,d,b);d.css({position:"absolute",top:g.top,left:g.left});l=true;r[0].call(c,function(){e.type="onShow";l="full";h.trigger(e)});g=b.events.tooltip.split(/,\s*/);if(!d.data("__set")){d.bind(g[0],function(){clearTimeout(i);clearTimeout(j)});g[1]&&!a.is("input:not(:checkbox, :radio), textarea")&&d.bind(g[1],function(n){n.relatedTarget!=a[0]&&a.trigger(k[1].split(" ")[0])});d.data("__set",true)}return c},hide:function(e){if(!d||!c.isShown())return c;
e=e||f.Event();e.type="onBeforeHide";h.trigger(e);if(!e.isDefaultPrevented()){l=false;o[b.effect][1].call(c,function(){e.type="onHide";h.trigger(e)});return c}},isShown:function(e){return e?l=="full":l},getConf:function(){return b},getTip:function(){return d},getTrigger:function(){return a}});f.each("onHide,onBeforeShow,onShow,onBeforeHide".split(","),function(e,g){f.isFunction(b[g])&&f(c).bind(g,b[g]);c[g]=function(n){n&&f(c).bind(g,n);return c}})}f.tools=f.tools||{version:"1.2.5"};f.tools.tooltip=
{conf:{effect:"toggle",fadeOutSpeed:"fast",predelay:0,delay:30,opacity:1,tip:0,position:["top","center"],offset:[0,0],relative:false,cancelDefault:true,events:{def:"mouseenter,mouseleave",input:"focus,blur",widget:"focus mouseenter,blur mouseleave",tooltip:"mouseenter,mouseleave"},layout:"<div/>",tipClass:"tooltip"},addEffect:function(a,b,c){o[a]=[b,c]}};var o={toggle:[function(a){var b=this.getConf(),c=this.getTip();b=b.opacity;b<1&&c.css({opacity:b});c.show();a.call()},function(a){this.getTip().hide();
a.call()}],fade:[function(a){var b=this.getConf();this.getTip().fadeTo(b.fadeInSpeed,b.opacity,a)},function(a){this.getTip().fadeOut(this.getConf().fadeOutSpeed,a)}]};f.fn.tooltip=function(a){var b=this.data("tooltip");if(b)return b;a=f.extend(true,{},f.tools.tooltip.conf,a);if(typeof a.position=="string")a.position=a.position.split(/,?\s/);this.each(function(){b=new u(f(this),a);f(this).data("tooltip",b)});return a.api?b:this}})(jQuery);
(function(e){function p(f,c){var b=e(c);return b.length<2?b:f.parent().find(c)}function u(f,c){var b=this,n=f.add(b),g=f.children(),l=0,j=c.vertical;k||(k=b);if(g.length>1)g=e(c.items,f);e.extend(b,{getConf:function(){return c},getIndex:function(){return l},getSize:function(){return b.getItems().size()},getNaviButtons:function(){return o.add(q)},getRoot:function(){return f},getItemWrap:function(){return g},getItems:function(){return g.children(c.item).not("."+c.clonedClass)},move:function(a,d){return b.seekTo(l+
a,d)},next:function(a){return b.move(1,a)},prev:function(a){return b.move(-1,a)},begin:function(a){return b.seekTo(0,a)},end:function(a){return b.seekTo(b.getSize()-1,a)},focus:function(){return k=b},addItem:function(a){a=e(a);if(c.circular){g.children("."+c.clonedClass+":last").before(a);g.children("."+c.clonedClass+":first").replaceWith(a.clone().addClass(c.clonedClass))}else g.append(a);n.trigger("onAddItem",[a]);return b},seekTo:function(a,d,h){a.jquery||(a*=1);if(c.circular&&a===0&&l==-1&&d!==
0)return b;if(!c.circular&&a<0||a>b.getSize()||a<-1)return b;var i=a;if(a.jquery)a=b.getItems().index(a);else i=b.getItems().eq(a);var r=e.Event("onBeforeSeek");if(!h){n.trigger(r,[a,d]);if(r.isDefaultPrevented()||!i.length)return b}i=j?{top:-i.position().top}:{left:-i.position().left};l=a;k=b;if(d===undefined)d=c.speed;g.animate(i,d,c.easing,h||function(){n.trigger("onSeek",[a])});return b}});e.each(["onBeforeSeek","onSeek","onAddItem"],function(a,d){e.isFunction(c[d])&&e(b).bind(d,c[d]);b[d]=function(h){h&&
e(b).bind(d,h);return b}});if(c.circular){var s=b.getItems().slice(-1).clone().prependTo(g),t=b.getItems().eq(1).clone().appendTo(g);s.add(t).addClass(c.clonedClass);b.onBeforeSeek(function(a,d,h){if(!a.isDefaultPrevented())if(d==-1){b.seekTo(s,h,function(){b.end(0)});return a.preventDefault()}else d==b.getSize()&&b.seekTo(t,h,function(){b.begin(0)})});b.seekTo(0,0,function(){})}var o=p(f,c.prev).click(function(){b.prev()}),q=p(f,c.next).click(function(){b.next()});if(!c.circular&&b.getSize()>1){b.onBeforeSeek(function(a,
d){setTimeout(function(){if(!a.isDefaultPrevented()){o.toggleClass(c.disabledClass,d<=0);q.toggleClass(c.disabledClass,d>=b.getSize()-1)}},1)});c.initialIndex||o.addClass(c.disabledClass)}c.mousewheel&&e.fn.mousewheel&&f.mousewheel(function(a,d){if(c.mousewheel){b.move(d<0?1:-1,c.wheelSpeed||50);return false}});if(c.touch){var m={};g[0].ontouchstart=function(a){a=a.touches[0];m.x=a.clientX;m.y=a.clientY};g[0].ontouchmove=function(a){if(a.touches.length==1&&!g.is(":animated")){var d=a.touches[0],h=
m.x-d.clientX;d=m.y-d.clientY;b[j&&d>0||!j&&h>0?"next":"prev"]();a.preventDefault()}}}c.keyboard&&e(document).bind("keydown.scrollable",function(a){if(!(!c.keyboard||a.altKey||a.ctrlKey||e(a.target).is(":input")))if(!(c.keyboard!="static"&&k!=b)){var d=a.keyCode;if(j&&(d==38||d==40)){b.move(d==38?-1:1);return a.preventDefault()}if(!j&&(d==37||d==39)){b.move(d==37?-1:1);return a.preventDefault()}}});c.initialIndex&&b.seekTo(c.initialIndex,0,function(){})}e.tools=e.tools||{version:"1.2.5"};e.tools.scrollable=
{conf:{activeClass:"active",circular:false,clonedClass:"cloned",disabledClass:"disabled",easing:"swing",initialIndex:0,item:null,items:".items",keyboard:true,mousewheel:false,next:".next",prev:".prev",speed:400,vertical:false,touch:true,wheelSpeed:0}};var k;e.fn.scrollable=function(f){var c=this.data("scrollable");if(c)return c;f=e.extend({},e.tools.scrollable.conf,f);this.each(function(){c=new u(e(this),f);e(this).data("scrollable",c)});return f.api?c:this}})(jQuery);
(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);
(function(b){function k(){if(b.browser.msie){var a=b(document).height(),d=b(window).height();return[window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,a-d<20?d:a]}return[b(document).width(),b(document).height()]}function h(a){if(a)return a.call(b.mask)}b.tools=b.tools||{version:"1.2.5"};var l;l=b.tools.expose={conf:{maskId:"exposeMask",loadSpeed:"slow",closeSpeed:"fast",closeOnClick:true,closeOnEsc:true,zIndex:9998,opacity:0.8,startOpacity:0,color:"#fff",onLoad:null,
onClose:null}};var c,i,e,g,j;b.mask={load:function(a,d){if(e)return this;if(typeof a=="string")a={color:a};a=a||g;g=a=b.extend(b.extend({},l.conf),a);c=b("#"+a.maskId);if(!c.length){c=b("<div/>").attr("id",a.maskId);b("body").append(c)}var m=k();c.css({position:"absolute",top:0,left:0,width:m[0],height:m[1],display:"none",opacity:a.startOpacity,zIndex:a.zIndex});a.color&&c.css("backgroundColor",a.color);if(h(a.onBeforeLoad)===false)return this;a.closeOnEsc&&b(document).bind("keydown.mask",function(f){f.keyCode==
27&&b.mask.close(f)});a.closeOnClick&&c.bind("click.mask",function(f){b.mask.close(f)});b(window).bind("resize.mask",function(){b.mask.fit()});if(d&&d.length){j=d.eq(0).css("zIndex");b.each(d,function(){var f=b(this);/relative|absolute|fixed/i.test(f.css("position"))||f.css("position","relative")});i=d.css({zIndex:Math.max(a.zIndex+1,j=="auto"?0:j)})}c.css({display:"block"}).fadeTo(a.loadSpeed,a.opacity,function(){b.mask.fit();h(a.onLoad);e="full"});e=true;return this},close:function(){if(e){if(h(g.onBeforeClose)===
false)return this;c.fadeOut(g.closeSpeed,function(){h(g.onClose);i&&i.css({zIndex:j});e=false});b(document).unbind("keydown.mask");c.unbind("click.mask");b(window).unbind("resize.mask")}return this},fit:function(){if(e){var a=k();c.css({width:a[0],height:a[1]})}},getMask:function(){return c},isLoaded:function(a){return a?e=="full":e},getConf:function(){return g},getExposed:function(){return i}};b.fn.mask=function(a){b.mask.load(a);return this};b.fn.expose=function(a){b.mask.load(a,this);return this}})(jQuery);

