;(function (d) {
    var k = d.scrollTo = function (a, i, e) {
        d(window).scrollTo(a, i, e)
    };
    k.defaults = {
        axis: 'xy',
        duration: parseFloat(d.fn.jquery) >= 1.3 ? 0 : 1
    };
    k.window = function (a) {
        return d(window)._scrollable()
    };
    d.fn._scrollable = function () {
        return this.map(function () {
            var a = this,
                i = !a.nodeName || d.inArray(a.nodeName.toLowerCase(), ['iframe', '#document', 'html', 'body']) != -1;
            if (!i) return a;
            var e = (a.contentWindow || a).document || a.ownerDocument || a;
            return d.browser.safari || e.compatMode == 'BackCompat' ? e.body : e.documentElement
        })
    };
    d.fn.scrollTo = function (n, j, b) {
        if (typeof j == 'object') {
            b = j;
            j = 0
        }
        if (typeof b == 'function') b = {
            onAfter: b
        };
        if (n == 'max') n = 9e9;
        b = d.extend({}, k.defaults, b);
        j = j || b.speed || b.duration;
        b.queue = b.queue && b.axis.length > 1;
        if (b.queue) j /= 2;
        b.offset = p(b.offset);
        b.over = p(b.over);
        return this._scrollable().each(function () {
            var q = this,
                r = d(q),
                f = n,
                s, g = {},
                u = r.is('html,body');
            switch (typeof f) {
            case 'number':
            case 'string':
                if (/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(f)) {
                    f = p(f);
                    break
                }
                f = d(f, this);
            case 'object':
                if (f.is || f.style) s = (f = d(f)).offset()
            }
            d.each(b.axis.split(''), function (a, i) {
                var e = i == 'x' ? 'Left' : 'Top',
                    h = e.toLowerCase(),
                    c = 'scroll' + e,
                    l = q[c],
                    m = k.max(q, i);
                if (s) {
                    g[c] = s[h] + (u ? 0 : l - r.offset()[h]);
                    if (b.margin) {
                        g[c] -= parseInt(f.css('margin' + e)) || 0;
                        g[c] -= parseInt(f.css('border' + e + 'Width')) || 0
                    }
                    g[c] += b.offset[h] || 0;
                    if (b.over[h]) g[c] += f[i == 'x' ? 'width' : 'height']() * b.over[h]
                } else {
                    var o = f[h];
                    g[c] = o.slice && o.slice(-1) == '%' ? parseFloat(o) / 100 * m : o
                }
                if (/^\d+$/.test(g[c])) g[c] = g[c] <= 0 ? 0 : Math.min(g[c], m);
                if (!a && b.queue) {
                    if (l != g[c]) t(b.onAfterFirst);
                    delete g[c]
                }
            });
            t(b.onAfter);

            function t(a) {
                r.animate(g, j, b.easing, a &&
                function () {
                    a.call(this, n, b)
                })
            }
        }).end()
    };
    k.max = function (a, i) {
        var e = i == 'x' ? 'Width' : 'Height',
            h = 'scroll' + e;
        if (!d(a).is('html,body')) return a[h] - d(a)[e.toLowerCase()]();
        var c = 'client' + e,
            l = a.ownerDocument.documentElement,
            m = a.ownerDocument.body;
        return Math.max(l[h], m[h]) - Math.min(l[c], m[c])
    };

    function p(a) {
        return typeof a == 'object' ? a : {
            top: a,
            left: a
        }
    }
})(jQuery);
(function ($) {
    $.fn.ajaxSubmit = function (options) {
        if (typeof options == 'function') options = {
            success: options
        };
        options = $.extend({
            url: this.attr('action') || window.location.toString(),
            type: this.attr('method') || 'GET'
        }, options || {});
        var veto = {};
        this.trigger('form-pre-serialize', [this, options, veto]);
        if (veto.veto) return this;
        var a = this.formToArray(options.semantic);
        if (options.data) {
            options.extraData = options.data;
            for (var n in options.data)
            a.push({
                name: n,
                value: options.data[n]
            });
        }
        if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) return this;
        this.trigger('form-submit-validate', [a, this, options, veto]);
        if (veto.veto) return this;
        var q = $.param(a);
        if (options.type.toUpperCase() == 'GET') {
            options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q;
            options.data = null;
        } else options.data = q;
        var $form = this,
            callbacks = [];
        if (options.resetForm) callbacks.push(function () {
            $form.resetForm();
        });
        if (options.clearForm) callbacks.push(function () {
            $form.clearForm();
        });
        if (!options.dataType && options.target) {
            var oldSuccess = options.success ||
            function () {};
            callbacks.push(function (data) {
                $(options.target).html(data).each(oldSuccess, arguments);
            });
        } else if (options.success) callbacks.push(options.success);
        options.success = function (data, status) {
            for (var i = 0, max = callbacks.length; i < max; i++)
            callbacks[i](data, status, $form);
        };
        var files = $('input:file', this).fieldValue();
        var found = false;
        for (var j = 0; j < files.length; j++)
        if (files[j]) found = true;
        if (options.iframe || found) {
            if ($.browser.safari && options.closeKeepAlive) $.get(options.closeKeepAlive, fileUpload);
            else fileUpload();
        } else $.ajax(options);
        this.trigger('form-submit-notify', [this, options]);
        return this;

        function fileUpload() {
            var form = $form[0];
            var opts = $.extend({}, $.ajaxSettings, options);
            var id = 'jqFormIO' + (new Date().getTime());
            var $io = $('<iframe id="' + id + '" name="' + id + '" />');
            var io = $io[0];
            var op8 = $.browser.opera && window.opera.version() < 9;
            if ($.browser.msie || op8) io.src = 'javascript:false;document.write("");';
            $io.css({
                position: 'absolute',
                top: '-1000px',
                left: '-1000px'
            });
            var xhr = {
                responseText: null,
                responseXML: null,
                status: 0,
                statusText: 'n/a',
                getAllResponseHeaders: function () {},
                getResponseHeader: function () {},
                setRequestHeader: function () {}
            };
            var g = opts.global;
            if (g && !$.active++) $.event.trigger("ajaxStart");
            if (g) $.event.trigger("ajaxSend", [xhr, opts]);
            var cbInvoked = 0;
            var timedOut = 0;
            setTimeout(function () {
                var t = $form.attr('target'),
                    a = $form.attr('action');
                $form.attr({
                    target: id,
                    encoding: 'multipart/form-data',
                    enctype: 'multipart/form-data',
                    method: 'POST',
                    action: opts.url
                });
                if (opts.timeout) setTimeout(function () {
                    timedOut = true;
                    cb();
                }, opts.timeout);
                var extraInputs = [];
                try {
                    if (options.extraData) for (var n in options.extraData)
                    extraInputs.push($('<input type="hidden" name="' + n + '" value="' + options.extraData[n] + '" />').appendTo(form)[0]);
                    $io.appendTo('body');
                    io.attachEvent ? io.attachEvent('onload', cb) : io.addEventListener('load', cb, false);
                    form.submit();
                } finally {
                    $form.attr('action', a);
                    t ? $form.attr('target', t) : $form.removeAttr('target');
                    $(extraInputs).remove();
                }
            }, 10);

            function cb() {
                if (cbInvoked++) return;
                io.detachEvent ? io.detachEvent('onload', cb) : io.removeEventListener('load', cb, false);
                var ok = true;
                try {
                    if (timedOut) throw 'timeout';
                    var data, doc;
                    doc = io.contentWindow ? io.contentWindow.document : io.contentDocument ? io.contentDocument : io.document;
                    xhr.responseText = doc.body ? doc.body.innerHTML : null;
                    xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;
                    xhr.getResponseHeader = function (header) {
                        var headers = {
                            'content-type': opts.dataType
                        };
                        return headers[header];
                    };
                    if (opts.dataType == 'json' || opts.dataType == 'script') {
                        var ta = doc.getElementsByTagName('textarea')[0];
                        xhr.responseText = ta ? ta.value : xhr.responseText;
                    } else if (opts.dataType == 'xml' && !xhr.responseXML && xhr.responseText != null) {
                        xhr.responseXML = toXml(xhr.responseText);
                    }
                    data = $.httpData(xhr, opts.dataType);
                } catch (e) {
                    ok = false;
                    $.handleError(opts, xhr, 'error', e);
                }
                if (ok) {
                    opts.success(data, 'success');
                    if (g) $.event.trigger("ajaxSuccess", [xhr, opts]);
                }
                if (g) $.event.trigger("ajaxComplete", [xhr, opts]);
                if (g && !--$.active) $.event.trigger("ajaxStop");
                if (opts.complete) opts.complete(xhr, ok ? 'success' : 'error');
                setTimeout(function () {
                    $io.remove();
                    xhr.responseXML = null;
                }, 100);
            };

            function toXml(s, doc) {
                if (window.ActiveXObject) {
                    doc = new ActiveXObject('Microsoft.XMLDOM');
                    doc.async = 'false';
                    doc.loadXML(s);
                } else doc = (new DOMParser()).parseFromString(s, 'text/xml');
                return (doc && doc.documentElement && doc.documentElement.tagName != 'parsererror') ? doc : null;
            };
        };
    };
    $.fn.ajaxForm = function (options) {
        return this.ajaxFormUnbind().bind('submit.form-plugin', function () {
            $(this).ajaxSubmit(options);
            return false;
        }).each(function () {
            $(":submit,input:image", this).bind('click.form-plugin', function (e) {
                var $form = this.form;
                $form.clk = this;
                if (this.type == 'image') {
                    if (e.offsetX != undefined) {
                        $form.clk_x = e.offsetX;
                        $form.clk_y = e.offsetY;
                    } else if (typeof $.fn.offset == 'function') {
                        var offset = $(this).offset();
                        $form.clk_x = e.pageX - offset.left;
                        $form.clk_y = e.pageY - offset.top;
                    } else {
                        $form.clk_x = e.pageX - this.offsetLeft;
                        $form.clk_y = e.pageY - this.offsetTop;
                    }
                }
                setTimeout(function () {
                    $form.clk = $form.clk_x = $form.clk_y = null;
                }, 10);
            });
        });
    };
    $.fn.ajaxFormUnbind = function () {
        this.unbind('submit.form-plugin');
        return this.each(function () {
            $(":submit,input:image", this).unbind('click.form-plugin');
        });
    };
    $.fn.formToArray = function (semantic) {
        var a = [];
        if (this.length == 0) return a;
        var form = this[0];
        var els = semantic ? form.getElementsByTagName('*') : form.elements;
        if (!els) return a;
        for (var i = 0, max = els.length; i < max; i++) {
            var el = els[i];
            var n = el.name;
            if (!n) continue;
            if (semantic && form.clk && el.type == "image") {
                if (!el.disabled && form.clk == el) a.push({
                    name: n + '.x',
                    value: form.clk_x
                }, {
                    name: n + '.y',
                    value: form.clk_y
                });
                continue;
            }
            var v = $.fieldValue(el, true);
            if (v && v.constructor == Array) {
                for (var j = 0, jmax = v.length; j < jmax; j++)
                a.push({
                    name: n,
                    value: v[j]
                });
            } else if (v !== null && typeof v != 'undefined') a.push({
                name: n,
                value: v
            });
        }
        if (!semantic && form.clk) {
            var inputs = form.getElementsByTagName("input");
            for (var i = 0, max = inputs.length; i < max; i++) {
                var input = inputs[i];
                var n = input.name;
                if (n && !input.disabled && input.type == "image" && form.clk == input) a.push({
                    name: n + '.x',
                    value: form.clk_x
                }, {
                    name: n + '.y',
                    value: form.clk_y
                });
            }
        }
        return a;
    };
    $.fn.formSerialize = function (semantic) {
        return $.param(this.formToArray(semantic));
    };
    $.fn.fieldSerialize = function (successful) {
        var a = [];
        this.each(function () {
            var n = this.name;
            if (!n) return;
            var v = $.fieldValue(this, successful);
            if (v && v.constructor == Array) {
                for (var i = 0, max = v.length; i < max; i++)
                a.push({
                    name: n,
                    value: v[i]
                });
            } else if (v !== null && typeof v != 'undefined') a.push({
                name: this.name,
                value: v
            });
        });
        return $.param(a);
    };
    $.fn.fieldValue = function (successful) {
        for (var val = [], i = 0, max = this.length; i < max; i++) {
            var el = this[i];
            var v = $.fieldValue(el, successful);
            if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length)) continue;
            v.constructor == Array ? $.merge(val, v) : val.push(v);
        }
        return val;
    };
    $.fieldValue = function (el, successful) {
        var n = el.name,
            t = el.type,
            tag = el.tagName.toLowerCase();
        if (typeof successful == 'undefined') successful = true;
        if (successful && (!n || el.disabled || t == 'reset' || t == 'button' || (t == 'checkbox' || t == 'radio') && !el.checked || (t == 'submit' || t == 'image') && el.form && el.form.clk != el || tag == 'select' && el.selectedIndex == -1)) return null;
        if (tag == 'select') {
            var index = el.selectedIndex;
            if (index < 0) return null;
            var a = [],
                ops = el.options;
            var one = (t == 'select-one');
            var max = (one ? index + 1 : ops.length);
            for (var i = (one ? index : 0); i < max; i++) {
                var op = ops[i];
                if (op.selected) {
                    var v = $.browser.msie && !(op.attributes['value'].specified) ? op.text : op.value;
                    if (one) return v;
                    a.push(v);
                }
            }
            return a;
        }
        return el.value;
    };
    $.fn.clearForm = function () {
        return this.each(function () {
            $('input,select,textarea', this).clearFields();
        });
    };
    $.fn.clearFields = $.fn.clearInputs = function () {
        return this.each(function () {
            var t = this.type,
                tag = this.tagName.toLowerCase();
            if (t == 'text' || t == 'password' || tag == 'textarea') this.value = '';
            else if (t == 'checkbox' || t == 'radio') this.checked = false;
            else if (tag == 'select') this.selectedIndex = -1;
        });
    };
    $.fn.resetForm = function () {
        return this.each(function () {
            if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType)) this.reset();
        });
    };
    $.fn.enable = function (b) {
        if (b == undefined) b = true;
        return this.each(function () {
            this.disabled = !b
        });
    };
    $.fn.select = function (select) {
        if (select == undefined) select = true;
        return this.each(function () {
            var t = this.type;
            if (t == 'checkbox' || t == 'radio') this.checked = select;
            else if (this.tagName.toLowerCase() == 'option') {
                var $sel = $(this).parent('select');
                if (select && $sel[0] && $sel[0].type == 'select-one') {
                    $sel.find('option').select(false);
                }
                this.selected = select;
            }
        });
    };
})(jQuery);
(function ($) {
    var ver = "2.74";
    if ($.support == undefined) {
        $.support = {
            opacity: !($.browser.msie)
        };
    }
    function debug(s) {
        if ($.fn.cycle.debug) {
            log(s);
        }
    }
    function log() {
        if (window.console && window.console.log) {
            window.console.log("[cycle] " + Array.prototype.join.call(arguments, " "));
        }
    }
    $.fn.cycle = function (options, arg2) {
        var o = {
            s: this.selector,
            c: this.context
        };
        if (this.length === 0 && options != "stop") {
            if (!$.isReady && o.s) {
                log("DOM not ready, queuing slideshow");
                $(function () {
                    $(o.s, o.c).cycle(options, arg2);
                });
                return this;
            }
            log("terminating; zero elements found by selector" + ($.isReady ? "" : " (DOM not ready)"));
            return this;
        }
        return this.each(function () {
            var opts = handleArguments(this, options, arg2);
            if (opts === false) {
                return;
            }
            if (this.cycleTimeout) {
                clearTimeout(this.cycleTimeout);
            }
            this.cycleTimeout = this.cyclePause = 0;
            var $cont = $(this);
            var $slides = opts.slideExpr ? $(opts.slideExpr, this) : $cont.children();
            var els = $slides.get();
            if (els.length < 2) {
                log("terminating; too few slides: " + els.length);
                return;
            }
            var opts2 = buildOptions($cont, $slides, els, opts, o);
            if (opts2 === false) {
                return;
            }
            var startTime = opts2.continuous ? 10 : getTimeout(opts2.currSlide, opts2.nextSlide, opts2, !opts2.rev);
            if (startTime) {
                startTime += (opts2.delay || 0);
                if (startTime < 10) {
                    startTime = 10;
                }
                debug("first timeout: " + startTime);
                this.cycleTimeout = setTimeout(function () {
                    go(els, opts2, 0, !opts2.rev);
                }, startTime);
            }
        });
    };

    function handleArguments(cont, options, arg2) {
        if (cont.cycleStop == undefined) {
            cont.cycleStop = 0;
        }
        if (options === undefined || options === null) {
            options = {};
        }
        if (options.constructor == String) {
            switch (options) {
            case "stop":
                cont.cycleStop++;
                if (cont.cycleTimeout) {
                    clearTimeout(cont.cycleTimeout);
                }
                cont.cycleTimeout = 0;
                $(cont).removeData("cycle.opts");
                return false;
            case "toggle":
                cont.cyclePause = (cont.cyclePause === 1) ? 0 : 1;
                return false;
            case "pause":
                cont.cyclePause = 1;
                return false;
            case "resume":
                cont.cyclePause = 0;
                if (arg2 === true) {
                    options = $(cont).data("cycle.opts");
                    if (!options) {
                        log("options not found, can not resume");
                        return false;
                    }
                    if (cont.cycleTimeout) {
                        clearTimeout(cont.cycleTimeout);
                        cont.cycleTimeout = 0;
                    }
                    go(options.elements, options, 1, 1);
                }
                return false;
            case "prev":
            case "next":
                var opts = $(cont).data("cycle.opts");
                if (!opts) {
                    log('options not found, "prev/next" ignored');
                    return false;
                }
                $.fn.cycle[options](opts);
                return false;
            default:
                options = {
                    fx: options
                };
            }
            return options;
        } else {
            if (options.constructor == Number) {
                var num = options;
                options = $(cont).data("cycle.opts");
                if (!options) {
                    log("options not found, can not advance slide");
                    return false;
                }
                if (num < 0 || num >= options.elements.length) {
                    log("invalid slide index: " + num);
                    return false;
                }
                options.nextSlide = num;
                if (cont.cycleTimeout) {
                    clearTimeout(cont.cycleTimeout);
                    cont.cycleTimeout = 0;
                }
                if (typeof arg2 == "string") {
                    options.oneTimeFx = arg2;
                }
                go(options.elements, options, 1, num >= options.currSlide);
                return false;
            }
        }
        return options;
    }
    function removeFilter(el, opts) {
        if (!$.support.opacity && opts.cleartype && el.style.filter) {
            try {
                el.style.removeAttribute("filter");
            } catch (smother) {}
        }
    }
    function buildOptions($cont, $slides, els, options, o) {
        var opts = $.extend({}, $.fn.cycle.defaults, options || {}, $.metadata ? $cont.metadata() : $.meta ? $cont.data() : {});
        if (opts.autostop) {
            opts.countdown = opts.autostopCount || els.length;
        }
        var cont = $cont[0];
        $cont.data("cycle.opts", opts);
        opts.$cont = $cont;
        opts.stopCount = cont.cycleStop;
        opts.elements = els;
        opts.before = opts.before ? [opts.before] : [];
        opts.after = opts.after ? [opts.after] : [];
        opts.after.unshift(function () {
            opts.busy = 0;
        });
        if (!$.support.opacity && opts.cleartype) {
            opts.after.push(function () {
                removeFilter(this, opts);
            });
        }
        if (opts.continuous) {
            opts.after.push(function () {
                go(els, opts, 0, !opts.rev);
            });
        }
        saveOriginalOpts(opts);
        if (!$.support.opacity && opts.cleartype && !opts.cleartypeNoBg) {
            clearTypeFix($slides);
        }
        if ($cont.css("position") == "static") {
            $cont.css("position", "relative");
        }
        if (opts.width) {
            $cont.width(opts.width);
        }
        if (opts.height && opts.height != "auto") {
            $cont.height(opts.height);
        }
        if (opts.startingSlide) {
            opts.startingSlide = parseInt(opts.startingSlide);
        }
        if (opts.random) {
            opts.randomMap = [];
            for (var i = 0; i < els.length; i++) {
                opts.randomMap.push(i);
            }
            opts.randomMap.sort(function (a, b) {
                return Math.random() - 0.5;
            });
            opts.randomIndex = 0;
            opts.startingSlide = opts.randomMap[0];
        } else {
            if (opts.startingSlide >= els.length) {
                opts.startingSlide = 0;
            }
        }
        opts.currSlide = opts.startingSlide = opts.startingSlide || 0;
        var first = opts.startingSlide;
        $slides.css({
            position: "absolute",
            top: 0,
            left: 0
        }).hide().each(function (i) {
            var z = first ? i >= first ? els.length - (i - first) : first - i : els.length - i;
            $(this).css("z-index", z);
        });
        $(els[first]).css("opacity", 1).show();
        removeFilter(els[first], opts);
        if (opts.fit && opts.width) {
            $slides.width(opts.width);
        }
        if (opts.fit && opts.height && opts.height != "auto") {
            $slides.height(opts.height);
        }
        var reshape = opts.containerResize && !$cont.innerHeight();
        if (reshape) {
            var maxw = 0,
                maxh = 0;
            for (var j = 0; j < els.length; j++) {
                var $e = $(els[j]),
                    e = $e[0],
                    w = $e.outerWidth(),
                    h = $e.outerHeight();
                if (!w) {
                    w = e.offsetWidth;
                }
                if (!h) {
                    h = e.offsetHeight;
                }
                maxw = w > maxw ? w : maxw;
                maxh = h > maxh ? h : maxh;
            }
            if (maxw > 0 && maxh > 0) {
                $cont.css({
                    width: maxw + "px",
                    height: maxh + "px"
                });
            }
        }
        if (opts.pause) {
            $cont.hover(function () {
                this.cyclePause++;
            }, function () {
                this.cyclePause--;
            });
        }
        if (supportMultiTransitions(opts) === false) {
            return false;
        }
        var requeue = false;
        options.requeueAttempts = options.requeueAttempts || 0;
        $slides.each(function () {
            var $el = $(this);
            this.cycleH = (opts.fit && opts.height) ? opts.height : $el.height();
            this.cycleW = (opts.fit && opts.width) ? opts.width : $el.width();
            if ($el.is("img")) {
                var loadingIE = ($.browser.msie && this.cycleW == 28 && this.cycleH == 30 && !this.complete);
                var loadingFF = ($.browser.mozilla && this.cycleW == 34 && this.cycleH == 19 && !this.complete);
                var loadingOp = ($.browser.opera && ((this.cycleW == 42 && this.cycleH == 19) || (this.cycleW == 37 && this.cycleH == 17)) && !this.complete);
                var loadingOther = (this.cycleH == 0 && this.cycleW == 0 && !this.complete);
                if (loadingIE || loadingFF || loadingOp || loadingOther) {
                    if (o.s && opts.requeueOnImageNotLoaded && ++options.requeueAttempts < 100) {
                        log(options.requeueAttempts, " - img slide not loaded, requeuing slideshow: ", this.src, this.cycleW, this.cycleH);
                        setTimeout(function () {
                            $(o.s, o.c).cycle(options);
                        }, opts.requeueTimeout);
                        requeue = true;
                        return false;
                    } else {
                        log("could not determine size of image: " + this.src, this.cycleW, this.cycleH);
                    }
                }
            }
            return true;
        });
        if (requeue) {
            return false;
        }
        opts.cssBefore = opts.cssBefore || {};
        opts.animIn = opts.animIn || {};
        opts.animOut = opts.animOut || {};
        $slides.not(":eq(" + first + ")").css(opts.cssBefore);
        if (opts.cssFirst) {
            $($slides[first]).css(opts.cssFirst);
        }
        if (opts.timeout) {
            opts.timeout = parseInt(opts.timeout);
            if (opts.speed.constructor == String) {
                opts.speed = $.fx.speeds[opts.speed] || parseInt(opts.speed);
            }
            if (!opts.sync) {
                opts.speed = opts.speed / 2;
            }
            while ((opts.timeout - opts.speed) < 250) {
                opts.timeout += opts.speed;
            }
        }
        if (opts.easing) {
            opts.easeIn = opts.easeOut = opts.easing;
        }
        if (!opts.speedIn) {
            opts.speedIn = opts.speed;
        }
        if (!opts.speedOut) {
            opts.speedOut = opts.speed;
        }
        opts.slideCount = els.length;
        opts.currSlide = opts.lastSlide = first;
        if (opts.random) {
            opts.nextSlide = opts.currSlide;
            if (++opts.randomIndex == els.length) {
                opts.randomIndex = 0;
            }
            opts.nextSlide = opts.randomMap[opts.randomIndex];
        } else {
            opts.nextSlide = opts.startingSlide >= (els.length - 1) ? 0 : opts.startingSlide + 1;
        }
        if (!opts.multiFx) {
            var init = $.fn.cycle.transitions[opts.fx];
            if ($.isFunction(init)) {
                init($cont, $slides, opts);
            } else {
                if (opts.fx != "custom" && !opts.multiFx) {
                    log("unknown transition: " + opts.fx, "; slideshow terminating");
                    return false;
                }
            }
        }
        var e0 = $slides[first];
        if (opts.before.length) {
            opts.before[0].apply(e0, [e0, e0, opts, true]);
        }
        if (opts.after.length > 1) {
            opts.after[1].apply(e0, [e0, e0, opts, true]);
        }
        if (opts.next) {
            $(opts.next).bind(opts.prevNextEvent, function () {
                return advance(opts, opts.rev ? -1 : 1);
            });
        }
        if (opts.prev) {
            $(opts.prev).bind(opts.prevNextEvent, function () {
                return advance(opts, opts.rev ? 1 : -1);
            });
        }
        if (opts.pager) {
            buildPager(els, opts);
        }
        exposeAddSlide(opts, els);
        return opts;
    }
    function saveOriginalOpts(opts) {
        opts.original = {
            before: [],
            after: []
        };
        opts.original.cssBefore = $.extend({}, opts.cssBefore);
        opts.original.cssAfter = $.extend({}, opts.cssAfter);
        opts.original.animIn = $.extend({}, opts.animIn);
        opts.original.animOut = $.extend({}, opts.animOut);
        $.each(opts.before, function () {
            opts.original.before.push(this);
        });
        $.each(opts.after, function () {
            opts.original.after.push(this);
        });
    }
    function supportMultiTransitions(opts) {
        var i, tx, txs = $.fn.cycle.transitions;
        if (opts.fx.indexOf(",") > 0) {
            opts.multiFx = true;
            opts.fxs = opts.fx.replace(/\s*/g, "").split(",");
            for (i = 0; i < opts.fxs.length; i++) {
                var fx = opts.fxs[i];
                tx = txs[fx];
                if (!tx || !txs.hasOwnProperty(fx) || !$.isFunction(tx)) {
                    log("discarding unknown transition: ", fx);
                    opts.fxs.splice(i, 1);
                    i--;
                }
            }
            if (!opts.fxs.length) {
                log("No valid transitions named; slideshow terminating.");
                return false;
            }
        } else {
            if (opts.fx == "all") {
                opts.multiFx = true;
                opts.fxs = [];
                for (p in txs) {
                    tx = txs[p];
                    if (txs.hasOwnProperty(p) && $.isFunction(tx)) {
                        opts.fxs.push(p);
                    }
                }
            }
        }
        if (opts.multiFx && opts.randomizeEffects) {
            var r1 = Math.floor(Math.random() * 20) + 30;
            for (i = 0; i < r1; i++) {
                var r2 = Math.floor(Math.random() * opts.fxs.length);
                opts.fxs.push(opts.fxs.splice(r2, 1)[0]);
            }
            debug("randomized fx sequence: ", opts.fxs);
        }
        return true;
    }
    function exposeAddSlide(opts, els) {
        opts.addSlide = function (newSlide, prepend) {
            var $s = $(newSlide),
                s = $s[0];
            if (!opts.autostopCount) {
                opts.countdown++;
            }
            els[prepend ? "unshift" : "push"](s);
            if (opts.els) {
                opts.els[prepend ? "unshift" : "push"](s);
            }
            opts.slideCount = els.length;
            $s.css("position", "absolute");
            $s[prepend ? "prependTo" : "appendTo"](opts.$cont);
            if (prepend) {
                opts.currSlide++;
                opts.nextSlide++;
            }
            if (!$.support.opacity && opts.cleartype && !opts.cleartypeNoBg) {
                clearTypeFix($s);
            }
            if (opts.fit && opts.width) {
                $s.width(opts.width);
            }
            if (opts.fit && opts.height && opts.height != "auto") {
                $slides.height(opts.height);
            }
            s.cycleH = (opts.fit && opts.height) ? opts.height : $s.height();
            s.cycleW = (opts.fit && opts.width) ? opts.width : $s.width();
            $s.css(opts.cssBefore);
            if (opts.pager) {
                $.fn.cycle.createPagerAnchor(els.length - 1, s, $(opts.pager), els, opts);
            }
            if ($.isFunction(opts.onAddSlide)) {
                opts.onAddSlide($s);
            } else {
                $s.hide();
            }
        };
    }
    $.fn.cycle.resetState = function (opts, fx) {
        fx = fx || opts.fx;
        opts.before = [];
        opts.after = [];
        opts.cssBefore = $.extend({}, opts.original.cssBefore);
        opts.cssAfter = $.extend({}, opts.original.cssAfter);
        opts.animIn = $.extend({}, opts.original.animIn);
        opts.animOut = $.extend({}, opts.original.animOut);
        opts.fxFn = null;
        $.each(opts.original.before, function () {
            opts.before.push(this);
        });
        $.each(opts.original.after, function () {
            opts.after.push(this);
        });
        var init = $.fn.cycle.transitions[fx];
        if ($.isFunction(init)) {
            init(opts.$cont, $(opts.elements), opts);
        }
    };

    function go(els, opts, manual, fwd) {
        if (manual && opts.busy && opts.manualTrump) {
            $(els).stop(true, true);
            opts.busy = false;
        }
        if (opts.busy) {
            return;
        }
        var p = opts.$cont[0],
            curr = els[opts.currSlide],
            next = els[opts.nextSlide];
        if (p.cycleStop != opts.stopCount || p.cycleTimeout === 0 && !manual) {
            return;
        }
        if (!manual && !p.cyclePause && ((opts.autostop && (--opts.countdown <= 0)) || (opts.nowrap && !opts.random && opts.nextSlide < opts.currSlide))) {
            if (opts.end) {
                opts.end(opts);
            }
            return;
        }
        if (manual || !p.cyclePause) {
            var fx = opts.fx;
            curr.cycleH = curr.cycleH || $(curr).height();
            curr.cycleW = curr.cycleW || $(curr).width();
            next.cycleH = next.cycleH || $(next).height();
            next.cycleW = next.cycleW || $(next).width();
            if (opts.multiFx) {
                if (opts.lastFx == undefined || ++opts.lastFx >= opts.fxs.length) {
                    opts.lastFx = 0;
                }
                fx = opts.fxs[opts.lastFx];
                opts.currFx = fx;
            }
            if (opts.oneTimeFx) {
                fx = opts.oneTimeFx;
                opts.oneTimeFx = null;
            }
            $.fn.cycle.resetState(opts, fx);
            if (opts.before.length) {
                $.each(opts.before, function (i, o) {
                    if (p.cycleStop != opts.stopCount) {
                        return;
                    }
                    o.apply(next, [curr, next, opts, fwd]);
                });
            }
            var after = function () {
                $.each(opts.after, function (i, o) {
                    if (p.cycleStop != opts.stopCount) {
                        return;
                    }
                    o.apply(next, [curr, next, opts, fwd]);
                });
            };
            if (opts.nextSlide != opts.currSlide) {
                opts.busy = 1;
                if (opts.fxFn) {
                    opts.fxFn(curr, next, opts, after, fwd);
                } else {
                    if ($.isFunction($.fn.cycle[opts.fx])) {
                        $.fn.cycle[opts.fx](curr, next, opts, after);
                    } else {
                        $.fn.cycle.custom(curr, next, opts, after, manual && opts.fastOnEvent);
                    }
                }
            }
            opts.lastSlide = opts.currSlide;
            if (opts.random) {
                opts.currSlide = opts.nextSlide;
                if (++opts.randomIndex == els.length) {
                    opts.randomIndex = 0;
                }
                opts.nextSlide = opts.randomMap[opts.randomIndex];
            } else {
                var roll = (opts.nextSlide + 1) == els.length;
                opts.nextSlide = roll ? 0 : opts.nextSlide + 1;
                opts.currSlide = roll ? els.length - 1 : opts.nextSlide - 1;
            }
            if (opts.pager) {
                $.fn.cycle.updateActivePagerLink(opts.pager, opts.currSlide);
            }
        }
        var ms = 0;
        if (opts.timeout && !opts.continuous) {
            ms = getTimeout(curr, next, opts, fwd);
        } else {
            if (opts.continuous && p.cyclePause) {
                ms = 10;
            }
        }
        if (ms > 0) {
            p.cycleTimeout = setTimeout(function () {
                go(els, opts, 0, !opts.rev);
            }, ms);
        }
    }
    $.fn.cycle.updateActivePagerLink = function (pager, currSlide) {
        $(pager).each(function () {
            $(this).find("a").removeClass("activeSlide").filter("a:eq(" + currSlide + ")").addClass("activeSlide");
        });
    };

    function getTimeout(curr, next, opts, fwd) {
        if (opts.timeoutFn) {
            var t = opts.timeoutFn(curr, next, opts, fwd);
            while ((t - opts.speed) < 250) {
                t += opts.speed;
            }
            debug("calculated timeout: " + t + "; speed: " + opts.speed);
            if (t !== false) {
                return t;
            }
        }
        return opts.timeout;
    }
    $.fn.cycle.next = function (opts) {
        advance(opts, opts.rev ? -1 : 1);
    };
    $.fn.cycle.prev = function (opts) {
        advance(opts, opts.rev ? 1 : -1);
    };

    function advance(opts, val) {
        var els = opts.elements;
        var p = opts.$cont[0],
            timeout = p.cycleTimeout;
        if (timeout) {
            clearTimeout(timeout);
            p.cycleTimeout = 0;
        }
        if (opts.random && val < 0) {
            opts.randomIndex--;
            if (--opts.randomIndex == -2) {
                opts.randomIndex = els.length - 2;
            } else {
                if (opts.randomIndex == -1) {
                    opts.randomIndex = els.length - 1;
                }
            }
            opts.nextSlide = opts.randomMap[opts.randomIndex];
        } else {
            if (opts.random) {
                if (++opts.randomIndex == els.length) {
                    opts.randomIndex = 0;
                }
                opts.nextSlide = opts.randomMap[opts.randomIndex];
            } else {
                opts.nextSlide = opts.currSlide + val;
                if (opts.nextSlide < 0) {
                    if (opts.nowrap) {
                        return false;
                    }
                    opts.nextSlide = els.length - 1;
                } else {
                    if (opts.nextSlide >= els.length) {
                        if (opts.nowrap) {
                            return false;
                        }
                        opts.nextSlide = 0;
                    }
                }
            }
        }
        if ($.isFunction(opts.prevNextClick)) {
            opts.prevNextClick(val > 0, opts.nextSlide, els[opts.nextSlide]);
        }
        go(els, opts, 1, val >= 0);
        return false;
    }
    function buildPager(els, opts) {
        var $p = $(opts.pager);
        $.each(els, function (i, o) {
            $.fn.cycle.createPagerAnchor(i, o, $p, els, opts);
        });
        $.fn.cycle.updateActivePagerLink(opts.pager, opts.startingSlide);
    }
    $.fn.cycle.createPagerAnchor = function (i, el, $p, els, opts) {
        var a;
        if ($.isFunction(opts.pagerAnchorBuilder)) {
            a = opts.pagerAnchorBuilder(i, el);
        } else {
            a = '<a href="#">' + (i + 1) + "</a>";
        }
        if (!a) {
            return;
        }
        var $a = $(a);
        if ($a.parents("body").length === 0) {
            var arr = [];
            if ($p.length > 1) {
                $p.each(function () {
                    var $clone = $a.clone(true);
                    $(this).append($clone);
                    arr.push($clone[0]);
                });
                $a = $(arr);
            } else {
                $a.appendTo($p);
            }
        }
        $a.bind(opts.pagerEvent, function (e) {
            e.preventDefault();
            opts.nextSlide = i;
            var p = opts.$cont[0],
                timeout = p.cycleTimeout;
            if (timeout) {
                clearTimeout(timeout);
                p.cycleTimeout = 0;
            }
            if ($.isFunction(opts.pagerClick)) {
                opts.pagerClick(opts.nextSlide, els[opts.nextSlide]);
            }
            go(els, opts, 1, opts.currSlide < i);
            return false;
        });
        if (opts.pagerEvent != "click") {
            $a.click(function () {
                return false;
            });
        }
        if (opts.pauseOnPagerHover) {
            $a.hover(function () {
                opts.$cont[0].cyclePause++;
            }, function () {
                opts.$cont[0].cyclePause--;
            });
        }
    };
    $.fn.cycle.hopsFromLast = function (opts, fwd) {
        var hops, l = opts.lastSlide,
            c = opts.currSlide;
        if (fwd) {
            hops = c > l ? c - l : opts.slideCount - l;
        } else {
            hops = c < l ? l - c : l + opts.slideCount - c;
        }
        return hops;
    };

    function clearTypeFix($slides) {
        function hex(s) {
            s = parseInt(s).toString(16);
            return s.length < 2 ? "0" + s : s;
        }
        function getBg(e) {
            for (; e && e.nodeName.toLowerCase() != "html"; e = e.parentNode) {
                var v = $.css(e, "background-color");
                if (v.indexOf("rgb") >= 0) {
                    var rgb = v.match(/\d+/g);
                    return "#" + hex(rgb[0]) + hex(rgb[1]) + hex(rgb[2]);
                }
                if (v && v != "transparent") {
                    return v;
                }
            }
            return "#ffffff";
        }
        $slides.each(function () {
            $(this).css("background-color", getBg(this));
        });
    }
    $.fn.cycle.commonReset = function (curr, next, opts, w, h, rev) {
        $(opts.elements).not(curr).hide();
        opts.cssBefore.opacity = 1;
        opts.cssBefore.display = "block";
        if (w !== false && next.cycleW > 0) {
            opts.cssBefore.width = next.cycleW;
        }
        if (h !== false && next.cycleH > 0) {
            opts.cssBefore.height = next.cycleH;
        }
        opts.cssAfter = opts.cssAfter || {};
        opts.cssAfter.display = "none";
        $(curr).css("zIndex", opts.slideCount + (rev === true ? 1 : 0));
        $(next).css("zIndex", opts.slideCount + (rev === true ? 0 : 1));
    };
    $.fn.cycle.custom = function (curr, next, opts, cb, speedOverride) {
        var $l = $(curr),
            $n = $(next);
        var speedIn = opts.speedIn,
            speedOut = opts.speedOut,
            easeIn = opts.easeIn,
            easeOut = opts.easeOut;
        $n.css(opts.cssBefore);
        if (speedOverride) {
            if (typeof speedOverride == "number") {
                speedIn = speedOut = speedOverride;
            } else {
                speedIn = speedOut = 1;
            }
            easeIn = easeOut = null;
        }
        var fn = function () {
            $n.animate(opts.animIn, speedIn, easeIn, cb);
        };
        $l.animate(opts.animOut, speedOut, easeOut, function () {
            if (opts.cssAfter) {
                $l.css(opts.cssAfter);
            }
            if (!opts.sync) {
                fn();
            }
        });
        if (opts.sync) {
            fn();
        }
    };
    $.fn.cycle.transitions = {
        fade: function ($cont, $slides, opts) {
            $slides.not(":eq(" + opts.currSlide + ")").css("opacity", 0);
            opts.before.push(function (curr, next, opts) {
                $.fn.cycle.commonReset(curr, next, opts);
                opts.cssBefore.opacity = 0;
            });
            opts.animIn = {
                opacity: 1
            };
            opts.animOut = {
                opacity: 0
            };
            opts.cssBefore = {
                top: 0,
                left: 0
            };
        }
    };
    $.fn.cycle.ver = function () {
        return ver;
    };
    $.fn.cycle.defaults = {
        fx: "fade",
        timeout: 4000,
        timeoutFn: null,
        continuous: 0,
        speed: 1000,
        speedIn: null,
        speedOut: null,
        next: null,
        prev: null,
        prevNextClick: null,
        prevNextEvent: "click",
        pager: null,
        pagerClick: null,
        pagerEvent: "click",
        pagerAnchorBuilder: null,
        before: null,
        after: null,
        end: null,
        easing: null,
        easeIn: null,
        easeOut: null,
        shuffle: null,
        animIn: null,
        animOut: null,
        cssBefore: null,
        cssAfter: null,
        fxFn: null,
        height: "auto",
        startingSlide: 0,
        sync: 1,
        random: 0,
        fit: 0,
        containerResize: 1,
        pause: 0,
        pauseOnPagerHover: 0,
        autostop: 0,
        autostopCount: 0,
        delay: 0,
        slideExpr: null,
        cleartype: !$.support.opacity,
        cleartypeNoBg: false,
        nowrap: 0,
        fastOnEvent: 0,
        randomizeEffects: 1,
        rev: 0,
        manualTrump: true,
        requeueOnImageNotLoaded: true,
        requeueTimeout: 250
    };
})(jQuery);
(function ($) {
    $.fn.cycle.transitions.none = function ($cont, $slides, opts) {
        opts.fxFn = function (curr, next, opts, after) {
            $(next).show();
            $(curr).hide();
            after();
        };
    };
    $.fn.cycle.transitions.scrollUp = function ($cont, $slides, opts) {
        $cont.css("overflow", "hidden");
        opts.before.push($.fn.cycle.commonReset);
        var h = $cont.height();
        opts.cssBefore = {
            top: h,
            left: 0
        };
        opts.cssFirst = {
            top: 0
        };
        opts.animIn = {
            top: 0
        };
        opts.animOut = {
            top: -h
        };
    };
    $.fn.cycle.transitions.scrollDown = function ($cont, $slides, opts) {
        $cont.css("overflow", "hidden");
        opts.before.push($.fn.cycle.commonReset);
        var h = $cont.height();
        opts.cssFirst = {
            top: 0
        };
        opts.cssBefore = {
            top: -h,
            left: 0
        };
        opts.animIn = {
            top: 0
        };
        opts.animOut = {
            top: h
        };
    };
    $.fn.cycle.transitions.scrollLeft = function ($cont, $slides, opts) {
        $cont.css("overflow", "hidden");
        opts.before.push($.fn.cycle.commonReset);
        var w = $cont.width();
        opts.cssFirst = {
            left: 0
        };
        opts.cssBefore = {
            left: w,
            top: 0
        };
        opts.animIn = {
            left: 0
        };
        opts.animOut = {
            left: 0 - w
        };
    };
    $.fn.cycle.transitions.scrollRight = function ($cont, $slides, opts) {
        $cont.css("overflow", "hidden");
        opts.before.push($.fn.cycle.commonReset);
        var w = $cont.width();
        opts.cssFirst = {
            left: 0
        };
        opts.cssBefore = {
            left: -w,
            top: 0
        };
        opts.animIn = {
            left: 0
        };
        opts.animOut = {
            left: w
        };
    };
    $.fn.cycle.transitions.scrollHorz = function ($cont, $slides, opts) {
        $cont.css("overflow", "hidden").width();
        opts.before.push(function (curr, next, opts, fwd) {
            $.fn.cycle.commonReset(curr, next, opts);
            opts.cssBefore.left = fwd ? (next.cycleW - 1) : (1 - next.cycleW);
            opts.animOut.left = fwd ? -curr.cycleW : curr.cycleW;
        });
        opts.cssFirst = {
            left: 0
        };
        opts.cssBefore = {
            top: 0
        };
        opts.animIn = {
            left: 0
        };
        opts.animOut = {
            top: 0
        };
    };
    $.fn.cycle.transitions.scrollVert = function ($cont, $slides, opts) {
        $cont.css("overflow", "hidden");
        opts.before.push(function (curr, next, opts, fwd) {
            $.fn.cycle.commonReset(curr, next, opts);
            opts.cssBefore.top = fwd ? (1 - next.cycleH) : (next.cycleH - 1);
            opts.animOut.top = fwd ? curr.cycleH : -curr.cycleH;
        });
        opts.cssFirst = {
            top: 0
        };
        opts.cssBefore = {
            left: 0
        };
        opts.animIn = {
            top: 0
        };
        opts.animOut = {
            left: 0
        };
    };
    $.fn.cycle.transitions.slideX = function ($cont, $slides, opts) {
        opts.before.push(function (curr, next, opts) {
            $(opts.elements).not(curr).hide();
            $.fn.cycle.commonReset(curr, next, opts, false, true);
            opts.animIn.width = next.cycleW;
        });
        opts.cssBefore = {
            left: 0,
            top: 0,
            width: 0
        };
        opts.animIn = {
            width: "show"
        };
        opts.animOut = {
            width: 0
        };
    };
    $.fn.cycle.transitions.slideY = function ($cont, $slides, opts) {
        opts.before.push(function (curr, next, opts) {
            $(opts.elements).not(curr).hide();
            $.fn.cycle.commonReset(curr, next, opts, true, false);
            opts.animIn.height = next.cycleH;
        });
        opts.cssBefore = {
            left: 0,
            top: 0,
            height: 0
        };
        opts.animIn = {
            height: "show"
        };
        opts.animOut = {
            height: 0
        };
    };
    $.fn.cycle.transitions.shuffle = function ($cont, $slides, opts) {
        var i, w = $cont.css("overflow", "visible").width();
        $slides.css({
            left: 0,
            top: 0
        });
        opts.before.push(function (curr, next, opts) {
            $.fn.cycle.commonReset(curr, next, opts, true, true, true);
        });
        if (!opts.speedAdjusted) {
            opts.speed = opts.speed / 2;
            opts.speedAdjusted = true;
        }
        opts.random = 0;
        opts.shuffle = opts.shuffle || {
            left: -w,
            top: 15
        };
        opts.els = [];
        for (i = 0; i < $slides.length; i++) {
            opts.els.push($slides[i]);
        }
        for (i = 0; i < opts.currSlide; i++) {
            opts.els.push(opts.els.shift());
        }
        opts.fxFn = function (curr, next, opts, cb, fwd) {
            var $el = fwd ? $(curr) : $(next);
            $(next).css(opts.cssBefore);
            var count = opts.slideCount;
            $el.animate(opts.shuffle, opts.speedIn, opts.easeIn, function () {
                var hops = $.fn.cycle.hopsFromLast(opts, fwd);
                for (var k = 0; k < hops; k++) {
                    fwd ? opts.els.push(opts.els.shift()) : opts.els.unshift(opts.els.pop());
                }
                if (fwd) {
                    for (var i = 0, len = opts.els.length; i < len; i++) {
                        $(opts.els[i]).css("z-index", len - i + count);
                    }
                } else {
                    var z = $(curr).css("z-index");
                    $el.css("z-index", parseInt(z) + 1 + count);
                }
                $el.animate({
                    left: 0,
                    top: 0
                }, opts.speedOut, opts.easeOut, function () {
                    $(fwd ? this : curr).hide();
                    if (cb) {
                        cb();
                    }
                });
            });
        };
        opts.cssBefore = {
            display: "block",
            opacity: 1,
            top: 0,
            left: 0
        };
    };
    $.fn.cycle.transitions.turnUp = function ($cont, $slides, opts) {
        opts.before.push(function (curr, next, opts) {
            $.fn.cycle.commonReset(curr, next, opts, true, false);
            opts.cssBefore.top = next.cycleH;
            opts.animIn.height = next.cycleH;
        });
        opts.cssFirst = {
            top: 0
        };
        opts.cssBefore = {
            left: 0,
            height: 0
        };
        opts.animIn = {
            top: 0
        };
        opts.animOut = {
            height: 0
        };
    };
    $.fn.cycle.transitions.turnDown = function ($cont, $slides, opts) {
        opts.before.push(function (curr, next, opts) {
            $.fn.cycle.commonReset(curr, next, opts, true, false);
            opts.animIn.height = next.cycleH;
            opts.animOut.top = curr.cycleH;
        });
        opts.cssFirst = {
            top: 0
        };
        opts.cssBefore = {
            left: 0,
            top: 0,
            height: 0
        };
        opts.animOut = {
            height: 0
        };
    };
    $.fn.cycle.transitions.turnLeft = function ($cont, $slides, opts) {
        opts.before.push(function (curr, next, opts) {
            $.fn.cycle.commonReset(curr, next, opts, false, true);
            opts.cssBefore.left = next.cycleW;
            opts.animIn.width = next.cycleW;
        });
        opts.cssBefore = {
            top: 0,
            width: 0
        };
        opts.animIn = {
            left: 0
        };
        opts.animOut = {
            width: 0
        };
    };
    $.fn.cycle.transitions.turnRight = function ($cont, $slides, opts) {
        opts.before.push(function (curr, next, opts) {
            $.fn.cycle.commonReset(curr, next, opts, false, true);
            opts.animIn.width = next.cycleW;
            opts.animOut.left = curr.cycleW;
        });
        opts.cssBefore = {
            top: 0,
            left: 0,
            width: 0
        };
        opts.animIn = {
            left: 0
        };
        opts.animOut = {
            width: 0
        };
    };
    $.fn.cycle.transitions.zoom = function ($cont, $slides, opts) {
        opts.before.push(function (curr, next, opts) {
            $.fn.cycle.commonReset(curr, next, opts, false, false, true);
            opts.cssBefore.top = next.cycleH / 2;
            opts.cssBefore.left = next.cycleW / 2;
            opts.animIn = {
                top: 0,
                left: 0,
                width: next.cycleW,
                height: next.cycleH
            };
            opts.animOut = {
                width: 0,
                height: 0,
                top: curr.cycleH / 2,
                left: curr.cycleW / 2
            };
        });
        opts.cssFirst = {
            top: 0,
            left: 0
        };
        opts.cssBefore = {
            width: 0,
            height: 0
        };
    };
    $.fn.cycle.transitions.fadeZoom = function ($cont, $slides, opts) {
        opts.before.push(function (curr, next, opts) {
            $.fn.cycle.commonReset(curr, next, opts, false, false);
            opts.cssBefore.left = next.cycleW / 2;
            opts.cssBefore.top = next.cycleH / 2;
            opts.animIn = {
                top: 0,
                left: 0,
                width: next.cycleW,
                height: next.cycleH
            };
        });
        opts.cssBefore = {
            width: 0,
            height: 0
        };
        opts.animOut = {
            opacity: 0
        };
    };
    $.fn.cycle.transitions.blindX = function ($cont, $slides, opts) {
        var w = $cont.css("overflow", "hidden").width();
        opts.before.push(function (curr, next, opts) {
            $.fn.cycle.commonReset(curr, next, opts);
            opts.animIn.width = next.cycleW;
            opts.animOut.left = curr.cycleW;
        });
        opts.cssBefore = {
            left: w,
            top: 0
        };
        opts.animIn = {
            left: 0
        };
        opts.animOut = {
            left: w
        };
    };
    $.fn.cycle.transitions.blindY = function ($cont, $slides, opts) {
        var h = $cont.css("overflow", "hidden").height();
        opts.before.push(function (curr, next, opts) {
            $.fn.cycle.commonReset(curr, next, opts);
            opts.animIn.height = next.cycleH;
            opts.animOut.top = curr.cycleH;
        });
        opts.cssBefore = {
            top: h,
            left: 0
        };
        opts.animIn = {
            top: 0
        };
        opts.animOut = {
            top: h
        };
    };
    $.fn.cycle.transitions.blindZ = function ($cont, $slides, opts) {
        var h = $cont.css("overflow", "hidden").height();
        var w = $cont.width();
        opts.before.push(function (curr, next, opts) {
            $.fn.cycle.commonReset(curr, next, opts);
            opts.animIn.height = next.cycleH;
            opts.animOut.top = curr.cycleH;
        });
        opts.cssBefore = {
            top: h,
            left: w
        };
        opts.animIn = {
            top: 0,
            left: 0
        };
        opts.animOut = {
            top: h,
            left: w
        };
    };
    $.fn.cycle.transitions.growX = function ($cont, $slides, opts) {
        opts.before.push(function (curr, next, opts) {
            $.fn.cycle.commonReset(curr, next, opts, false, true);
            opts.cssBefore.left = this.cycleW / 2;
            opts.animIn = {
                left: 0,
                width: this.cycleW
            };
            opts.animOut = {
                left: 0
            };
        });
        opts.cssBefore = {
            width: 0,
            top: 0
        };
    };
    $.fn.cycle.transitions.growY = function ($cont, $slides, opts) {
        opts.before.push(function (curr, next, opts) {
            $.fn.cycle.commonReset(curr, next, opts, true, false);
            opts.cssBefore.top = this.cycleH / 2;
            opts.animIn = {
                top: 0,
                height: this.cycleH
            };
            opts.animOut = {
                top: 0
            };
        });
        opts.cssBefore = {
            height: 0,
            left: 0
        };
    };
    $.fn.cycle.transitions.curtainX = function ($cont, $slides, opts) {
        opts.before.push(function (curr, next, opts) {
            $.fn.cycle.commonReset(curr, next, opts, false, true, true);
            opts.cssBefore.left = next.cycleW / 2;
            opts.animIn = {
                left: 0,
                width: this.cycleW
            };
            opts.animOut = {
                left: curr.cycleW / 2,
                width: 0
            };
        });
        opts.cssBefore = {
            top: 0,
            width: 0
        };
    };
    $.fn.cycle.transitions.curtainY = function ($cont, $slides, opts) {
        opts.before.push(function (curr, next, opts) {
            $.fn.cycle.commonReset(curr, next, opts, true, false, true);
            opts.cssBefore.top = next.cycleH / 2;
            opts.animIn = {
                top: 0,
                height: next.cycleH
            };
            opts.animOut = {
                top: curr.cycleH / 2,
                height: 0
            };
        });
        opts.cssBefore = {
            left: 0,
            height: 0
        };
    };
    $.fn.cycle.transitions.cover = function ($cont, $slides, opts) {
        var d = opts.direction || "left";
        var w = $cont.css("overflow", "hidden").width();
        var h = $cont.height();
        opts.before.push(function (curr, next, opts) {
            $.fn.cycle.commonReset(curr, next, opts);
            if (d == "right") {
                opts.cssBefore.left = -w;
            } else {
                if (d == "up") {
                    opts.cssBefore.top = h;
                } else {
                    if (d == "down") {
                        opts.cssBefore.top = -h;
                    } else {
                        opts.cssBefore.left = w;
                    }
                }
            }
        });
        opts.animIn = {
            left: 0,
            top: 0
        };
        opts.animOut = {
            opacity: 1
        };
        opts.cssBefore = {
            top: 0,
            left: 0
        };
    };
    $.fn.cycle.transitions.uncover = function ($cont, $slides, opts) {
        var d = opts.direction || "left";
        var w = $cont.css("overflow", "hidden").width();
        var h = $cont.height();
        opts.before.push(function (curr, next, opts) {
            $.fn.cycle.commonReset(curr, next, opts, true, true, true);
            if (d == "right") {
                opts.animOut.left = w;
            } else {
                if (d == "up") {
                    opts.animOut.top = -h;
                } else {
                    if (d == "down") {
                        opts.animOut.top = h;
                    } else {
                        opts.animOut.left = -w;
                    }
                }
            }
        });
        opts.animIn = {
            left: 0,
            top: 0
        };
        opts.animOut = {
            opacity: 1
        };
        opts.cssBefore = {
            top: 0,
            left: 0
        };
    };
    $.fn.cycle.transitions.toss = function ($cont, $slides, opts) {
        var w = $cont.css("overflow", "visible").width();
        var h = $cont.height();
        opts.before.push(function (curr, next, opts) {
            $.fn.cycle.commonReset(curr, next, opts, true, true, true);
            if (!opts.animOut.left && !opts.animOut.top) {
                opts.animOut = {
                    left: w * 2,
                    top: -h / 2,
                    opacity: 0
                };
            } else {
                opts.animOut.opacity = 0;
            }
        });
        opts.cssBefore = {
            left: 0,
            top: 0
        };
        opts.animIn = {
            left: 0
        };
    };
    $.fn.cycle.transitions.wipe = function ($cont, $slides, opts) {
        var w = $cont.css("overflow", "hidden").width();
        var h = $cont.height();
        opts.cssBefore = opts.cssBefore || {};
        var clip;
        if (opts.clip) {
            if (/l2r/.test(opts.clip)) {
                clip = "rect(0px 0px " + h + "px 0px)";
            } else {
                if (/r2l/.test(opts.clip)) {
                    clip = "rect(0px " + w + "px " + h + "px " + w + "px)";
                } else {
                    if (/t2b/.test(opts.clip)) {
                        clip = "rect(0px " + w + "px 0px 0px)";
                    } else {
                        if (/b2t/.test(opts.clip)) {
                            clip = "rect(" + h + "px " + w + "px " + h + "px 0px)";
                        } else {
                            if (/zoom/.test(opts.clip)) {
                                var top = parseInt(h / 2);
                                var left = parseInt(w / 2);
                                clip = "rect(" + top + "px " + left + "px " + top + "px " + left + "px)";
                            }
                        }
                    }
                }
            }
        }
        opts.cssBefore.clip = opts.cssBefore.clip || clip || "rect(0px 0px 0px 0px)";
        var d = opts.cssBefore.clip.match(/(\d+)/g);
        var t = parseInt(d[0]),
            r = parseInt(d[1]),
            b = parseInt(d[2]),
            l = parseInt(d[3]);
        opts.before.push(function (curr, next, opts) {
            if (curr == next) {
                return;
            }
            var $curr = $(curr),
                $next = $(next);
            $.fn.cycle.commonReset(curr, next, opts, true, true, false);
            opts.cssAfter.display = "block";
            var step = 1,
                count = parseInt((opts.speedIn / 13)) - 1;
            (function f() {
                var tt = t ? t - parseInt(step * (t / count)) : 0;
                var ll = l ? l - parseInt(step * (l / count)) : 0;
                var bb = b < h ? b + parseInt(step * ((h - b) / count || 1)) : h;
                var rr = r < w ? r + parseInt(step * ((w - r) / count || 1)) : w;
                $next.css({
                    clip: "rect(" + tt + "px " + rr + "px " + bb + "px " + ll + "px)"
                });
                (step++ <= count) ? setTimeout(f, 13) : $curr.css("display", "none");
            })();
        });
        opts.cssBefore = {
            display: "block",
            opacity: 1,
            top: 0,
            left: 0
        };
        opts.animIn = {
            left: 0
        };
        opts.animOut = {
            left: 0
        };
    };
})(jQuery);
(function (jQuery) {
    function stripFiletype(ref) {
        var x = ref.replace('.html', '');
        return x.replace('#', '');
    }

    function initOrigin(l) {
        if (l.xorigin == 'left') {
            l.xorigin = 0;
        } else if (l.xorigin == 'middle' || l.xorigin == 'centre' || l.xorigin == 'center') {
            l.xorigin = 0.5;
        } else if (l.xorigin == 'right') {
            l.xorigin = 1;
        }
        if (l.yorigin == 'top') {
            l.yorigin = 0;
        } else if (l.yorigin == 'middle' || l.yorigin == 'centre' || l.yorigin == 'center') {
            l.yorigin = 0.5;
        } else if (l.yorigin == 'bottom') {
            l.yorigin = 1;
        }
    }

    function positionMouse(mouseport, localmouse, virtualmouse) {
        var difference = {
            x: 0,
            y: 0,
            sum: 0
        };
        if (!mouseport.ontarget) {
            difference.x = virtualmouse.x - localmouse.x;
            difference.y = virtualmouse.y - localmouse.y;
            difference.sum = Math.sqrt(difference.x * difference.x + difference.y * difference.y);
            virtualmouse.x = localmouse.x + difference.x * mouseport.takeoverFactor;
            virtualmouse.y = localmouse.y + difference.y * mouseport.takeoverFactor;
            if (difference.sum < mouseport.takeoverThresh && difference.sum > mouseport.takeoverThresh * -1) {
                mouseport.ontarget = true;
            }
        } else {
            virtualmouse.x = localmouse.x;
            virtualmouse.y = localmouse.y;
        }
    }

    function setupPorts(viewport, mouseport) {
        var offset = mouseport.element.offset();
        jQuery.extend(viewport, {
            width: viewport.element.width(),
            height: viewport.element.height()
        });
        jQuery.extend(mouseport, {
            width: mouseport.element.width(),
            height: mouseport.element.height(),
            top: offset.top,
            left: offset.left
        });
    }

    function parseTravel(travel, origin, dimension) {
        var offset;
        var cssPos;
        if (typeof(travel) === 'string') {
            if (travel.search(/^\d+\s?px$/) != -1) {
                travel = travel.replace('px', '');
                travel = parseInt(travel, 10);
                offset = origin * (dimension - travel);
                cssPos = origin * 100 + '%';
                return {
                    travel: travel,
                    travelpx: true,
                    offset: offset,
                    cssPos: cssPos
                };
            } else if (travel.search(/^\d+\s?%$/) != -1) {
                travel.replace('%', '');
                travel = parseInt(travel, 10) / 100;
            } else {
                travel = 1;
            }
        }
        offset = origin * (1 - travel);
        return {
            travel: travel,
            travelpx: false,
            offset: offset
        }
    }

    function setupLayer(layer, i, mouseport) {
        var xStuff;
        var yStuff;
        var cssObject = {};
        layer[i] = jQuery.extend({}, {
            width: layer[i].element.width(),
            height: layer[i].element.height()
        }, layer[i]);
        xStuff = parseTravel(layer[i].xtravel, layer[i].xorigin, layer[i].width);
        yStuff = parseTravel(layer[i].ytravel, layer[i].yorigin, layer[i].height);
        jQuery.extend(layer[i], {
            diffxrat: mouseport.width / (layer[i].width - mouseport.width),
            diffyrat: mouseport.height / (layer[i].height - mouseport.height),
            xtravel: xStuff.travel,
            ytravel: yStuff.travel,
            xtravelpx: xStuff.travelpx,
            ytravelpx: yStuff.travelpx,
            xoffset: xStuff.offset,
            yoffset: yStuff.offset
        });
        if (xStuff.travelpx) {
            cssObject.left = xStuff.cssPos;
        }
        if (yStuff.travelpx) {
            cssObject.top = yStuff.cssPos;
        }
        if (xStuff.travelpx || yStuff.travelpx) {
            layer[i].element.css(cssObject);
        }
    }

    function setupLayerContents(layer, i, viewportOffset) {
        var contentOffset;
        jQuery.extend(layer[i], {
            content: []
        });
        for (var n = 0; n < layer[i].element.children().length; n++) {
            if (!layer[i].content[n]) layer[i].content[n] = {};
            if (!layer[i].content[n].element) layer[i].content[n]['element'] = layer[i].element.children().eq(n);
            if (!layer[i].content[n].anchor && layer[i].content[n].element.children('a').attr('name')) {
                layer[i].content[n]['anchor'] = layer[i].content[n].element.children('a').attr('name');
            }
            if (layer[i].content[n].anchor) {
                contentOffset = layer[i].content[n].element.offset();
                jQuery.extend(layer[i].content[n], {
                    width: layer[i].content[n].element.width(),
                    height: layer[i].content[n].element.height(),
                    x: contentOffset.left - viewportOffset.left,
                    y: contentOffset.top - viewportOffset.top
                });
                jQuery.extend(layer[i].content[n], {
                    posxrat: (layer[i].content[n].x + layer[i].content[n].width / 2) / layer[i].width,
                    posyrat: (layer[i].content[n].y + layer[i].content[n].height / 2) / layer[i].height
                });
            }
        }
    }

    function moveLayers(layer, xratio, yratio) {
        var xpos;
        var ypos;
        var cssObject;
        for (var i = 0; i < layer.length; i++) {
            xpos = layer[i].xtravel * xratio + layer[i].xoffset;
            ypos = layer[i].ytravel * yratio + layer[i].yoffset;
            cssObject = {};
            if (layer[i].xparallax) {
                if (layer[i].xtravelpx) {
                    cssObject.marginLeft = xpos * -1 + 'px';
                } else {
                    cssObject.left = xpos * 100 + '%';
                    cssObject.marginLeft = xpos * layer[i].width * -1 + 'px';
                }
            }
            if (layer[i].yparallax) {
                if (layer[i].ytravelpx) {
                    cssObject.marginTop = ypos * -1 + 'px';
                } else {
                    cssObject.top = ypos * 100 + '%';
                    cssObject.marginTop = ypos * layer[i].height * -1 + 'px';
                }
            }
            layer[i].element.css(cssObject);
        }
    }
    jQuery.fn.jparallax = function (options) {
        var settings = jQuery().extend({}, jQuery.fn.jparallax.settings, options);
        var settingsLayer = {
            xparallax: settings.xparallax,
            yparallax: settings.yparallax,
            xorigin: settings.xorigin,
            yorigin: settings.yorigin,
            xtravel: settings.xtravel,
            ytravel: settings.ytravel
        };
        var settingsMouseport = {
            element: settings.mouseport,
            takeoverFactor: settings.takeoverFactor,
            takeoverThresh: settings.takeoverThresh
        };
        if (settings.mouseport) settingsMouseport['element'] = settings.mouseport;
        var layersettings = [];
        for (var a = 1; a < arguments.length; a++) {
            layersettings.push(jQuery.extend({}, settingsLayer, arguments[a]));
        }
        return this.each(function () {
            var localmouse = {
                x: 0.5,
                y: 0.5
            };
            var virtualmouse = {
                x: 0.5,
                y: 0.5
            };
            var timer = {
                running: false,
                frame: settings.frameDuration,
                fire: function (x, y) {
                    positionMouse(mouseport, localmouse, virtualmouse);
                    moveLayers(layer, virtualmouse.x, virtualmouse.y);
                    this.running = setTimeout(function () {
                        if (localmouse.x != x || localmouse.y != y || !mouseport.ontarget) {
                            timer.fire(localmouse.x, localmouse.y);
                        } else if (timer.running) {
                            timer.running = false;
                        }
                    }, timer.frame);
                }
            };
            var viewport = {
                element: jQuery(this)
            };
            var mouseport = jQuery.extend({}, {
                element: viewport.element
            }, settingsMouseport, {
                xinside: false,
                yinside: false,
                active: false,
                ontarget: false
            });
            var layer = [];

            function matrixSearch(layer, ref, callback) {
                for (var i = 0; i < layer.length; i++) {
                    var gotcha = false;
                    for (var n = 0; n < layer[i].content.length; n++) {
                        if (layer[i].content[n].anchor == ref) {
                            callback(i, n);
                            return [i, n];
                        }
                    }
                }
                return false;
            }
            setupPorts(viewport, mouseport);
            for (var i = 0; i < viewport.element.children().length; i++) {
                layer[i] = jQuery.extend({}, settingsLayer, layersettings[i], {
                    element: viewport.element.children('*:eq(' + i + ')')
                });
                setupLayer(layer, i, mouseport);
                if (settings.triggerResponse) {
                    setupLayerContents(layer, i, viewport.element.offset());
                }
            }
            viewport.element.children().css('position', 'absolute');
            moveLayers(layer, 0.5, 0.5);
            if (settings.mouseResponse) {
                jQuery().mousemove(function (mouse) {
                    mouseport.xinside = (mouse.pageX >= mouseport.left && mouse.pageX < mouseport.width + mouseport.left) ? true : false;
                    mouseport.yinside = (mouse.pageY >= mouseport.top && mouse.pageY < mouseport.height + mouseport.top) ? true : false;
                    if (mouseport.xinside && mouseport.yinside && !mouseport.active) {
                        mouseport.ontarget = false;
                        mouseport.active = true;
                    }
                    if (mouseport.active) {
                        if (mouseport.xinside) {
                            localmouse.x = (mouse.pageX - mouseport.left) / mouseport.width;
                        } else {
                            localmouse.x = (mouse.pageX < mouseport.left) ? 0 : 1;
                        }
                        if (mouseport.yinside) {
                            localmouse.y = (mouse.pageY - mouseport.top) / mouseport.height;
                        } else {
                            localmouse.y = (mouse.pageY < mouseport.top) ? 0 : 1;
                        }
                    }
                    if (mouseport.xinside && mouseport.yinside) {
                        if (!timer.running) timer.fire(localmouse.x, localmouse.y);
                    } else if (mouseport.active) {
                        mouseport.active = false;
                    }
                });
            }
            if (settings.triggerResponse) {
                viewport.element.bind("jparallax", function (event, ref) {
                    ref = stripFiletype(ref);
                    matrixSearch(layer, ref, function (i, n) {
                        localmouse.x = layer[i].content[n].posxrat * (layer[i].diffxrat + 1) - (0.5 * layer[i].diffxrat);
                        localmouse.y = layer[i].content[n].posyrat * (layer[i].diffyrat + 1) - (0.5 * layer[i].diffyrat);
                        if (!settings.triggerExposesEdges) {
                            if (localmouse.x < 0) localmouse.x = 0;
                            if (localmouse.x > 1) localmouse.x = 1;
                            if (localmouse.y < 0) localmouse.y = 0;
                            if (localmouse.y > 1) localmouse.y = 1;
                        }
                        mouseport.ontarget = false;
                        if (!timer.running) timer.fire(localmouse.x, localmouse.y);
                    });
                });
            }
            jQuery(window).resize(function () {
                setupPorts(viewport, mouseport);
                for (var i = 0; i < layer.length; i++) {
                    setupLayer(layer, i, mouseport);
                }
            });
        });
    };
    jQuery.fn.jparallax.settings = {
        mouseResponse: true,
        mouseActiveOutside: false,
        triggerResponse: true,
        triggerExposesEdges: false,
        xparallax: true,
        yparallax: true,
        xorigin: 0.5,
        yorigin: 0.5,
        xtravel: 1,
        ytravel: 1,
        takeoverFactor: 0.65,
        takeoverThresh: 0.002,
        frameDuration: 25
    };
    initOrigin(jQuery.fn.jparallax.settings);
    jQuery(function () {});
})(jQuery);
(function (c) {
    function r(b, d) {
        d = d === "x" ? m.width() : m.height();
        return typeof b === "string" ? Math.round(b.match(/%/) ? d / 100 * parseInt(b, 10) : parseInt(b, 10)) : b
    }
    function M(b) {
        b = c.isFunction(b) ? b.call(i) : b;
        return a.photo || b.match(/\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?$/i)
    }
    function Y() {
        for (var b in a) if (c.isFunction(a[b]) && b.substring(0, 2) !== "on") a[b] = a[b].call(i);
        a.rel = a.rel || i.rel;
        a.href = a.href || i.href;
        a.title = a.title || i.title
    }
    function Z(b) {
        i = b;
        a = c(i).data(q);
        Y();
        if (a.rel && a.rel !== "nofollow") {
            g = c(".cboxElement").filter(function () {
                return (c(this).data(q).rel || this.rel) === a.rel
            });
            j = g.index(i);
            if (j < 0) {
                g = g.add(i);
                j = g.length - 1
            }
        } else {
            g = c(i);
            j = 0
        }
        if (!B) {
            C = B = n;
            N = i;
            N.blur();
            c(document).bind("keydown.cbox_close", function (d) {
                if (d.keyCode === 27) {
                    d.preventDefault();
                    e.close()
                }
            }).bind("keydown.cbox_arrows", function (d) {
                if (g.length > 1) if (d.keyCode === 37) {
                    d.preventDefault();
                    D.click()
                } else if (d.keyCode === 39) {
                    d.preventDefault();
                    E.click()
                }
            });
            a.overlayClose && s.css({
                cursor: "pointer"
            }).one("click", e.close);
            c.event.trigger(aa);
            a.onOpen && a.onOpen.call(i);
            s.css({
                opacity: a.opacity
            }).show();
            a.w = r(a.initialWidth, "x");
            a.h = r(a.initialHeight, "y");
            e.position(0);
            O && m.bind("resize.cboxie6 scroll.cboxie6", function () {
                s.css({
                    width: m.width(),
                    height: m.height(),
                    top: m.scrollTop(),
                    left: m.scrollLeft()
                })
            }).trigger("scroll.cboxie6")
        }
        P.add(D).add(E).add(t).add(Q).hide();
        R.html(a.close).show();
        e.slideshow();
        e.load()
    }
    var q = "colorbox",
        F = "hover",
        n = true,
        e, x = c.browser.msie && !c.support.opacity,
        O = x && c.browser.version < 7,
        aa = "cbox_open",
        H = "cbox_load",
        S = "cbox_complete",
        T = "resize.cbox_resize",
        s, k, u, p, U, V, W, X, g, m, l, I, J, K, Q, P, t, E, D, R, y, z, v, w, i, N, j, a, B, C, $ = {
            transition: "elastic",
            speed: 350,
            width: false,
            height: false,
            innerWidth: false,
            innerHeight: false,
            initialWidth: "400",
            initialHeight: "400",
            maxWidth: false,
            maxHeight: false,
            scalePhotos: n,
            scrolling: n,
            inline: false,
            html: false,
            iframe: false,
            photo: false,
            href: false,
            title: false,
            rel: false,
            opacity: 0.5,
            preloading: n,
            current: "Image {current} of {total}",
            previous: "previous",
            next: "next",
            close: "close",
            open: false,
            overlayClose: n,
            slideshow: false,
            slideshowAuto: n,
            slideshowSpeed: 2500,
            slideshowStart: "start slideshow",
            slideshowStop: "stop slideshow",
            onOpen: false,
            onLoad: false,
            onComplete: false,
            onCleanup: false,
            onClosed: false
        };
    e = c.fn.colorbox = function (b, d) {
        var h = this;
        if (!h.length) if (h.selector === "") {
            h = c("<a/>");
            b.open = n
        } else return this;
        h.each(function () {
            var f = c.extend({}, c(this).data(q) ? c(this).data(q) : $, b);
            c(this).data(q, f).addClass("cboxElement");
            if (d) c(this).data(q).onComplete = d
        });
        b && b.open && Z(h);
        return this
    };
    e.init = function () {
        function b(d) {
            return c('<div id="cbox' + d + '"/>')
        }
        m = c(window);
        k = c('<div id="colorbox"/>');
        s = b("Overlay").hide();
        u = b("Wrapper");
        p = b("Content").append(l = b("LoadedContent").css({
            width: 0,
            height: 0
        }), J = b("LoadingOverlay"), K = b("LoadingGraphic"), Q = b("Title"), P = b("Current"), t = b("Slideshow"), E = b("Next"), D = b("Previous"), R = b("Close"));
        u.append(c("<div/>").append(b("TopLeft"), U = b("TopCenter"), b("TopRight")), c("<div/>").append(V = b("MiddleLeft"), p, W = b("MiddleRight")), c("<div/>").append(b("BottomLeft"), X = b("BottomCenter"), b("BottomRight"))).children().children().css({
            "float": "left"
        });
        I = c("<div style='position:absolute; top:0; left:0; width:9999px; height:0;'/>");
        c("body").prepend(s, k.append(u, I));
        if (x) {
            k.addClass("cboxIE");
            O && s.css("position", "absolute")
        }
        p.children().bind("mouseover mouseout", function () {
            c(this).toggleClass(F)
        }).addClass(F);
        y = U.height() + X.height() + p.outerHeight(n) - p.height();
        z = V.width() + W.width() + p.outerWidth(n) - p.width();
        v = l.outerHeight(n);
        w = l.outerWidth(n);
        k.css({
            "padding-bottom": y,
            "padding-right": z
        }).hide();
        E.click(e.next);
        D.click(e.prev);
        R.click(e.close);
        p.children().removeClass(F);
        c(".cboxElement").live("click", function (d) {
            if (d.button !== 0 && typeof d.button !== "undefined") return n;
            else {
                Z(this);
                return false
            }
        })
    };
    e.position = function (b, d) {
        function h(A) {
            U[0].style.width = X[0].style.width = p[0].style.width = A.style.width;
            K[0].style.height = J[0].style.height = p[0].style.height = V[0].style.height = W[0].style.height = A.style.height
        }
        var f = m.height();
        f = Math.max(f - a.h - v - y, 0) / 2 + m.scrollTop();
        var o = Math.max(document.documentElement.clientWidth - a.w - w - z, 0) / 2 + m.scrollLeft();
        b = k.width() === a.w + w && k.height() === a.h + v ? 0 : b;
        u[0].style.width = u[0].style.height = "9999px";
        k.dequeue().animate({
            width: a.w + w,
            height: a.h + v,
            top: f,
            left: o
        }, {
            duration: b,
            complete: function () {
                h(this);
                C = false;
                u[0].style.width = a.w + w + z + "px";
                u[0].style.height = a.h + v + y + "px";
                d && d()
            },
            step: function () {
                h(this)
            }
        })
    };
    e.resize = function (b) {
        function d() {
            a.w = a.w || l.width();
            a.w = a.mw && a.mw < a.w ? a.mw : a.w;
            return a.w
        }
        function h() {
            a.h = a.h || l.height();
            a.h = a.mh && a.mh < a.h ? a.mh : a.h;
            return a.h
        }
        function f(G) {
            e.position(G, function () {
                if (B) {
                    if (x) {
                        A && l.fadeIn(100);
                        k[0].style.removeAttribute("filter")
                    }
                    if (a.iframe) l.append("<iframe id='cboxIframe'" + (a.scrolling ? " " : "scrolling='no'") + " name='iframe_" + (new Date).getTime() + "' frameborder=0 src='" + a.href + "' " + (x ? "allowtransparency='true'" : "") + " />");
                    l.show();
                    Q.show().html(a.title);
                    if (g.length > 1) {
                        P.html(a.current.replace(/\{current\}/, j + 1).replace(/\{total\}/, g.length)).show();
                        E.html(a.next).show();
                        D.html(a.previous).show();
                        a.slideshow && t.show()
                    }
                    J.hide();
                    K.hide();
                    c.event.trigger(S);
                    a.onComplete && a.onComplete.call(i);
                    a.transition === "fade" && k.fadeTo(L, 1, function () {
                        x && k[0].style.removeAttribute("filter")
                    });
                    m.bind(T, function () {
                        e.position(0)
                    })
                }
            })
        }
        if (B) {
            var o, A, L = a.transition === "none" ? 0 : a.speed;
            m.unbind(T);
            if (b) {
                l.remove();
                l = c('<div id="cboxLoadedContent"/>').html(b);
                l.hide().appendTo(I).css({
                    width: d(),
                    overflow: a.scrolling ? "auto" : "hidden"
                }).css({
                    height: h()
                }).prependTo(p);
                c("#cboxPhoto").css({
                    cssFloat: "none"
                });
                O && c("select:not(#colorbox select)").filter(function () {
                    return this.style.visibility !== "hidden"
                }).css({
                    visibility: "hidden"
                }).one("cbox_cleanup", function () {
                    this.style.visibility = "inherit"
                });
                a.transition === "fade" && k.fadeTo(L, 0, function () {
                    f(0)
                }) || f(L);
                if (a.preloading && g.length > 1) {
                    b = j > 0 ? g[j - 1] : g[g.length - 1];
                    o = j < g.length - 1 ? g[j + 1] : g[0];
                    o = c(o).data(q).href || o.href;
                    b = c(b).data(q).href || b.href;
                    M(o) && c("<img />").attr("src", o);
                    M(b) && c("<img />").attr("src", b)
                }
            } else setTimeout(function () {
                var G = l.wrapInner("<div style='overflow:auto'></div>").children();
                a.h = G.height();
                l.css({
                    height: a.h
                });
                G.replaceWith(G.children());
                e.position(L)
            }, 1)
        }
    };
    e.load = function () {
        var b, d, h, f = e.resize;
        C = n;
        i = g[j];
        a = c(i).data(q);
        Y();
        c.event.trigger(H);
        a.onLoad && a.onLoad.call(i);
        a.h = a.height ? r(a.height, "y") - v - y : a.innerHeight ? r(a.innerHeight, "y") : false;
        a.w = a.width ? r(a.width, "x") - w - z : a.innerWidth ? r(a.innerWidth, "x") : false;
        a.mw = a.w;
        a.mh = a.h;
        if (a.maxWidth) {
            a.mw = r(a.maxWidth, "x") - w - z;
            a.mw = a.w && a.w < a.mw ? a.w : a.mw
        }
        if (a.maxHeight) {
            a.mh = r(a.maxHeight, "y") - v - y;
            a.mh = a.h && a.h < a.mh ? a.h : a.mh
        }
        b = a.href;
        J.show();
        K.show();
        if (a.inline) {
            c('<div id="cboxInlineTemp" />').hide().insertBefore(c(b)[0]).bind(H + " cbox_cleanup", function () {
                c(this).replaceWith(l.children())
            });
            f(c(b))
        } else if (a.iframe) f(" ");
        else if (a.html) f(a.html);
        else if (M(b)) {
            d = new Image;
            d.onload = function () {
                var o;
                d.onload = null;
                d.id = "cboxPhoto";
                c(d).css({
                    margin: "auto",
                    border: "none",
                    display: "block",
                    cssFloat: "left"
                });
                if (a.scalePhotos) {
                    h = function () {
                        d.height -= d.height * o;
                        d.width -= d.width * o
                    };
                    if (a.mw && d.width > a.mw) {
                        o = (d.width - a.mw) / d.width;
                        h()
                    }
                    if (a.mh && d.height > a.mh) {
                        o = (d.height - a.mh) / d.height;
                        h()
                    }
                }
                if (a.h) d.style.marginTop = Math.max(a.h - d.height, 0) / 2 + "px";
                f(d);
                g.length > 1 && c(d).css({
                    cursor: "pointer"
                }).click(e.next);
                if (x) d.style.msInterpolationMode = "bicubic"
            };
            d.src = b
        } else c("<div />").appendTo(I).load(b, function (o, A) {
            A === "success" ? f(this) : f(c("<p>Request unsuccessful.</p>"))
        })
    };
    e.next = function () {
        if (!C) {
            j = j < g.length - 1 ? j + 1 : 0;
            e.load()
        }
    };
    e.prev = function () {
        if (!C) {
            j = j > 0 ? j - 1 : g.length - 1;
            e.load()
        }
    };
    e.slideshow = function () {
        function b() {
            t.text(a.slideshowStop).bind(S, function () {
                h = setTimeout(e.next, a.slideshowSpeed)
            }).bind(H, function () {
                clearTimeout(h)
            }).one("click", function () {
                d();
                c(this).removeClass(F)
            });
            k.removeClass(f + "off").addClass(f + "on")
        }
        var d, h, f = "cboxSlideshow_";
        t.bind("cbox_closed", function () {
            t.unbind();
            clearTimeout(h);
            k.removeClass(f + "off " + f + "on")
        });
        d = function () {
            clearTimeout(h);
            t.text(a.slideshowStart).unbind(S + " " + H).one("click", function () {
                b();
                h = setTimeout(e.next, a.slideshowSpeed);
                c(this).removeClass(F)
            });
            k.removeClass(f + "on").addClass(f + "off")
        };
        if (a.slideshow && g.length > 1) a.slideshowAuto ? b() : d()
    };
    e.close = function () {
        c.event.trigger("cbox_cleanup");
        a.onCleanup && a.onCleanup.call(i);
        B = false;
        c(document).unbind("keydown.cbox_close keydown.cbox_arrows");
        m.unbind(T + " resize.cboxie6 scroll.cboxie6");
        s.css({
            cursor: "auto"
        }).fadeOut("fast");
        k.stop(n, false).fadeOut("fast", function () {
            c("#colorbox iframe").attr("src", "about:blank");
            l.remove();
            k.css({
                opacity: 1
            });
            try {
                N.focus()
            } catch (b) {}
            c.event.trigger("cbox_closed");
            a.onClosed && a.onClosed.call(i)
        })
    };
    e.element = function () {
        return c(i)
    };
    e.settings = $;
    c(e.init)
})(jQuery);


(function (a) {
    a.fn.tinyTips = function (h, b) {
        if (h === "null") {
            h = "light"
        }
        var d = h + "Tip";
        var c = '<div class="' + d + '"><div class="content"></div><div class="bottom">&nbsp;</div></div>';
        var e = 300;
        var f;
        var g;
        a(this).hover(function () {
            a("body").append(c);
            var k = "div." + d;
            f = a(k);
            f.hide();
            if (b === "title") {
                var i = a(this).attr("title")
            } else {
                if (b !== "title") {
                    var i = b
                }
            }
            a(k + " .content").html(i);
            g = a(this).attr("title");
            a(this).attr("title", "");
            var m = f.height() + 2;
            var j = (f.width() / 2) - (a(this).width() / 2);
            var n = a(this).offset();
            var l = n;
            l.top = n.top - m;
            l.left = n.left - j;
            f.css("position", "absolute").css("z-index", "1000");
            f.css(l).fadeIn(e)
        }, function () {
            a(this).attr("title", g);
            f.fadeOut(e, function () {
                a(this).remove()
            })
        })
    }
})(jQuery);

$(document).ready(function () {
	
	
	
/*-----------------------------------------------------------------------------------*/
/*	Image hover
/*-----------------------------------------------------------------------------------*/
	

	
	jQuery('#thumbnail-container .thumbnail').hover( function () {
		jQuery(this).find('.thumbnail-overlay').css('display', 'block');
		jQuery(this).find('.thumbnail-overlay').css('opacity', 0.0);
		jQuery(this).find('.thumbnail-overlay').stop().animate({opacity: 0.5}, 300);
		
		jQuery(this).find('.thumbnail-overlay .link-wrap').stop().animate({opacity: 1}, 300);
		
	}, function () {
		
		jQuery(this).find('.thumbnail-overlay').stop().animate({opacity: 1}, 300);
		jQuery(this).find('.thumbnail-overlay .link-wrap').stop().animate({opacity: 0}, 300);
		jQuery(this).find('.thumbnail-overlay').css('display', 'none');
		jQuery(this).find('.thumbnail-overlay').css('opacity', 0.0);
		
	});
	
	
	//When page loads...
	$(".tab_content").hide(); //Hide all content
	$("ul#tab-menu li a:first").addClass("selected"); //Activate first tab
	$(".tab_content:first").show(); //Show first tab content

	//On Click Event
	$("ul#tab-menu li a").click(function() {

		$("ul#tab-menu li a").removeClass("selected"); //Remove any "active" class
		$(this).addClass("selected"); //Add "active" class to selected tab
		$(".tab_content").hide(); //Hide all tab content

		var activeTab = $(this).attr("href"); //Find the href attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active ID content
		return false;
	});

	

$('[placeholder]').focus(function() {
  var input = $(this);
  if (input.val() == input.attr('placeholder')) {
    input.val('');
    input.removeClass('placeholder');
  }
}).blur(function() {
  var input = $(this);
  if (input.val() == '' || input.val() == input.attr('placeholder')) {
    input.addClass('placeholder');
    input.val(input.attr('placeholder'));
  }
}).blur().parents('form').submit(function() {
  $(this).find('[placeholder]').each(function() {
    var input = $(this);
    if (input.val() == input.attr('placeholder')) {
      input.val('');
    }
  })
});



$('input#sendButton').click(function(){
			var requiredFields = 'input#subject, input#email, textarea#message';
	
		var success = true;
		$(requiredFields).each(function(){
			if (!$(this).val() || $(this).val() == $(this).attr('placeholder')) {
				
				$(this).addClass('error').prev('label').addClass('error');
				$(this).focus(function(){
					$(this).removeClass('error').prev('label').removeClass('error');
				});
				success = false;
			}
		});
		if (!success) return false;
});
    $('#VenturesForm').ajaxForm(function (data) {
        if (data == 1) {
            $('#sendButton').fadeOut("fast");
            $('#success').fadeIn("slow");
            $('#VenturesForm').resetForm();
        } else if (data == 2) {
            $('#badserver').fadeIn("slow");
        } else if (data == 3) {
            $('#email').addClass('error').prev('label').addClass('error');
        }
    });
	
			
    $("a[rel='colorbox']").colorbox();

    externalLinks();
});

function externalLinks() {
    if (!document.getElementsByTagName) return;
    var anchors = document.getElementsByTagName("a");
    for (var i = 0; i < anchors.length; i++) {
        var anchor = anchors[i];
        if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") anchor.target = "_blank";
    }
} 
