/*!
 * jQuery UI 1.8.5
 *
 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI
 */
(function (c, j) {
    function k(a) {
        return!c(a).parents().andSelf().filter(
            function () {
                return c.curCSS(this, "visibility") === "hidden" || c.expr.filters.hidden(this)
            }).length
    }

    c.ui = c.ui || {};
    if (!c.ui.version) {
        c.extend(c.ui, {version:"1.8.5", keyCode:{ALT:18, BACKSPACE:8, CAPS_LOCK:20, COMMA:188, COMMAND:91, COMMAND_LEFT:91, COMMAND_RIGHT:93, CONTROL:17, DELETE:46, DOWN:40, END:35, ENTER:13, ESCAPE:27, HOME:36, INSERT:45, LEFT:37, MENU:93, NUMPAD_ADD:107, NUMPAD_DECIMAL:110, NUMPAD_DIVIDE:111, NUMPAD_ENTER:108, NUMPAD_MULTIPLY:106,
            NUMPAD_SUBTRACT:109, PAGE_DOWN:34, PAGE_UP:33, PERIOD:190, RIGHT:39, SHIFT:16, SPACE:32, TAB:9, UP:38, WINDOWS:91}});
        c.fn.extend({_focus:c.fn.focus, focus:function (a, b) {
            return typeof a === "number" ? this.each(function () {
                var d = this;
                setTimeout(function () {
                    c(d).focus();
                    b && b.call(d)
                }, a)
            }) : this._focus.apply(this, arguments)
        }, scrollParent:function () {
            var a;
            a = c.browser.msie && /(static|relative)/.test(this.css("position")) || /absolute/.test(this.css("position")) ? this.parents().filter(
                function () {
                    return/(relative|absolute|fixed)/.test(c.curCSS(this,
                        "position", 1)) && /(auto|scroll)/.test(c.curCSS(this, "overflow", 1) + c.curCSS(this, "overflow-y", 1) + c.curCSS(this, "overflow-x", 1))
                }).eq(0) : this.parents().filter(
                function () {
                    return/(auto|scroll)/.test(c.curCSS(this, "overflow", 1) + c.curCSS(this, "overflow-y", 1) + c.curCSS(this, "overflow-x", 1))
                }).eq(0);
            return/fixed/.test(this.css("position")) || !a.length ? c(document) : a
        }, zIndex:function (a) {
            if (a !== j)return this.css("zIndex", a);
            if (this.length) {
                a = c(this[0]);
                for (var b; a.length && a[0] !== document;) {
                    b = a.css("position");
                    if (b === "absolute" || b === "relative" || b === "fixed") {
                        b = parseInt(a.css("zIndex"));
                        if (!isNaN(b) && b != 0)return b
                    }
                    a = a.parent()
                }
            }
            return 0
        }, disableSelection:function () {
            return this.bind("mousedown.ui-disableSelection selectstart.ui-disableSelection", function (a) {
                a.preventDefault()
            })
        }, enableSelection:function () {
            return this.unbind(".ui-disableSelection")
        }});
        c.each(["Width", "Height"], function (a, b) {
            function d(f, g, l, m) {
                c.each(e, function () {
                    g -= parseFloat(c.curCSS(f, "padding" + this, true)) || 0;
                    if (l)g -= parseFloat(c.curCSS(f,
                        "border" + this + "Width", true)) || 0;
                    if (m)g -= parseFloat(c.curCSS(f, "margin" + this, true)) || 0
                });
                return g
            }

            var e = b === "Width" ? ["Left", "Right"] : ["Top", "Bottom"], h = b.toLowerCase(), i = {innerWidth:c.fn.innerWidth, innerHeight:c.fn.innerHeight, outerWidth:c.fn.outerWidth, outerHeight:c.fn.outerHeight};
            c.fn["inner" + b] = function (f) {
                if (f === j)return i["inner" + b].call(this);
                return this.each(function () {
                    c.style(this, h, d(this, f) + "px")
                })
            };
            c.fn["outer" + b] = function (f, g) {
                if (typeof f !== "number")return i["outer" + b].call(this, f);
                return this.each(function () {
                    c.style(this,
                        h, d(this, f, true, g) + "px")
                })
            }
        });
        c.extend(c.expr[":"], {data:function (a, b, d) {
            return!!c.data(a, d[3])
        }, focusable:function (a) {
            var b = a.nodeName.toLowerCase(), d = c.attr(a, "tabindex");
            if ("area" === b) {
                b = a.parentNode;
                d = b.name;
                if (!a.href || !d || b.nodeName.toLowerCase() !== "map")return false;
                a = c("img[usemap=#" + d + "]")[0];
                return!!a && k(a)
            }
            return(/input|select|textarea|button|object/.test(b) ? !a.disabled : "a" == b ? a.href || !isNaN(d) : !isNaN(d)) && k(a)
        }, tabbable:function (a) {
            var b = c.attr(a, "tabindex");
            return(isNaN(b) || b >= 0) && c(a).is(":focusable")
        }});
        c(function () {
            var a = document.createElement("div"), b = document.body;
            c.extend(a.style, {minHeight:"100px", height:"auto", padding:0, borderWidth:0});
            c.support.minHeight = b.appendChild(a).offsetHeight === 100;
            b.removeChild(a).style.display = "none"
        });
        c.extend(c.ui, {plugin:{add:function (a, b, d) {
            a = c.ui[a].prototype;
            for (var e in d) {
                a.plugins[e] = a.plugins[e] || [];
                a.plugins[e].push([b, d[e]])
            }
        }, call:function (a, b, d) {
            if ((b = a.plugins[b]) && a.element[0].parentNode)for (var e = 0; e < b.length; e++)a.options[b[e][0]] && b[e][1].apply(a.element,
                d)
        }}, contains:function (a, b) {
            return document.compareDocumentPosition ? a.compareDocumentPosition(b) & 16 : a !== b && a.contains(b)
        }, hasScroll:function (a, b) {
            if (c(a).css("overflow") === "hidden")return false;
            b = b && b === "left" ? "scrollLeft" : "scrollTop";
            var d = false;
            if (a[b] > 0)return true;
            a[b] = 1;
            d = a[b] > 0;
            a[b] = 0;
            return d
        }, isOverAxis:function (a, b, d) {
            return a > b && a < b + d
        }, isOver:function (a, b, d, e, h, i) {
            return c.ui.isOverAxis(a, d, h) && c.ui.isOverAxis(b, e, i)
        }})
    }
})(jQuery);
;
/*!
 * jQuery UI Widget 1.8.5
 *
 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Widget
 */
(function (b, j) {
    if (b.cleanData) {
        var k = b.cleanData;
        b.cleanData = function (a) {
            for (var c = 0, d; (d = a[c]) != null; c++)b(d).triggerHandler("remove");
            k(a)
        }
    } else {
        var l = b.fn.remove;
        b.fn.remove = function (a, c) {
            return this.each(function () {
                if (!c)if (!a || b.filter(a, [this]).length)b("*", this).add([this]).each(function () {
                    b(this).triggerHandler("remove")
                });
                return l.call(b(this), a, c)
            })
        }
    }
    b.widget = function (a, c, d) {
        var e = a.split(".")[0], f;
        a = a.split(".")[1];
        f = e + "-" + a;
        if (!d) {
            d = c;
            c = b.Widget
        }
        b.expr[":"][f] = function (h) {
            return!!b.data(h,
                a)
        };
        b[e] = b[e] || {};
        b[e][a] = function (h, g) {
            arguments.length && this._createWidget(h, g)
        };
        c = new c;
        c.options = b.extend(true, {}, c.options);
        b[e][a].prototype = b.extend(true, c, {namespace:e, widgetName:a, widgetEventPrefix:b[e][a].prototype.widgetEventPrefix || a, widgetBaseClass:f}, d);
        b.widget.bridge(a, b[e][a])
    };
    b.widget.bridge = function (a, c) {
        b.fn[a] = function (d) {
            var e = typeof d === "string", f = Array.prototype.slice.call(arguments, 1), h = this;
            d = !e && f.length ? b.extend.apply(null, [true, d].concat(f)) : d;
            if (e && d.substring(0, 1) ===
                "_")return h;
            e ? this.each(function () {
                var g = b.data(this, a);
                if (!g)throw"cannot call methods on " + a + " prior to initialization; attempted to call method '" + d + "'";
                if (!b.isFunction(g[d]))throw"no such method '" + d + "' for " + a + " widget instance";
                var i = g[d].apply(g, f);
                if (i !== g && i !== j) {
                    h = i;
                    return false
                }
            }) : this.each(function () {
                var g = b.data(this, a);
                g ? g.option(d || {})._init() : b.data(this, a, new c(d, this))
            });
            return h
        }
    };
    b.Widget = function (a, c) {
        arguments.length && this._createWidget(a, c)
    };
    b.Widget.prototype = {widgetName:"widget",
        widgetEventPrefix:"", options:{disabled:false}, _createWidget:function (a, c) {
            b.data(c, this.widgetName, this);
            this.element = b(c);
            this.options = b.extend(true, {}, this.options, b.metadata && b.metadata.get(c)[this.widgetName], a);
            var d = this;
            this.element.bind("remove." + this.widgetName, function () {
                d.destroy()
            });
            this._create();
            this._init()
        }, _create:function () {
        }, _init:function () {
        }, destroy:function () {
            this.element.unbind("." + this.widgetName).removeData(this.widgetName);
            this.widget().unbind("." + this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass +
                "-disabled ui-state-disabled")
        }, widget:function () {
            return this.element
        }, option:function (a, c) {
            var d = a, e = this;
            if (arguments.length === 0)return b.extend({}, e.options);
            if (typeof a === "string") {
                if (c === j)return this.options[a];
                d = {};
                d[a] = c
            }
            b.each(d, function (f, h) {
                e._setOption(f, h)
            });
            return e
        }, _setOption:function (a, c) {
            this.options[a] = c;
            if (a === "disabled")this.widget()[c ? "addClass" : "removeClass"](this.widgetBaseClass + "-disabled ui-state-disabled").attr("aria-disabled", c);
            return this
        }, enable:function () {
            return this._setOption("disabled",
                false)
        }, disable:function () {
            return this._setOption("disabled", true)
        }, _trigger:function (a, c, d) {
            var e = this.options[a];
            c = b.Event(c);
            c.type = (a === this.widgetEventPrefix ? a : this.widgetEventPrefix + a).toLowerCase();
            d = d || {};
            if (c.originalEvent) {
                a = b.event.props.length;
                for (var f; a;) {
                    f = b.event.props[--a];
                    c[f] = c.originalEvent[f]
                }
            }
            this.element.trigger(c, d);
            return!(b.isFunction(e) && e.call(this.element[0], c, d) === false || c.isDefaultPrevented())
        }}
})(jQuery);
;
/*
 * jQuery UI Accordion 1.8.5
 *
 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Accordion
 *
 * Depends:
 *	jquery.ui.core.js
 *	jquery.ui.widget.js
 */
(function (c) {
    c.widget("ui.accordion", {options:{active:0, animated:"slide", autoHeight:true, clearStyle:false, collapsible:false, event:"click", fillSpace:false, header:"> li > :first-child,> :not(li):even", icons:{header:"ui-icon-triangle-1-e", headerSelected:"ui-icon-triangle-1-s"}, navigation:false, navigationFilter:function () {
        return this.href.toLowerCase() === location.href.toLowerCase()
    }}, _create:function () {
        var a = this, b = a.options;
        a.running = 0;
        a.element.addClass("ui-accordion ui-widget ui-helper-reset").children("li").addClass("ui-accordion-li-fix");
        a.headers = a.element.find(b.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all").bind("mouseenter.accordion",
            function () {
                b.disabled || c(this).addClass("ui-state-hover")
            }).bind("mouseleave.accordion",
            function () {
                b.disabled || c(this).removeClass("ui-state-hover")
            }).bind("focus.accordion",
            function () {
                b.disabled || c(this).addClass("ui-state-focus")
            }).bind("blur.accordion", function () {
            b.disabled || c(this).removeClass("ui-state-focus")
        });
        a.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom");
        if (b.navigation) {
            var d = a.element.find("a").filter(b.navigationFilter).eq(0);
            if (d.length) {
                var f = d.closest(".ui-accordion-header");
                a.active = f.length ? f : d.closest(".ui-accordion-content").prev()
            }
        }
        a.active = a._findActive(a.active || b.active).addClass("ui-state-default ui-state-active").toggleClass("ui-corner-all ui-corner-top");
        a.active.next().addClass("ui-accordion-content-active");
        a._createIcons();
        a.resize();
        a.element.attr("role", "tablist");
        a.headers.attr("role", "tab").bind("keydown.accordion",
            function (g) {
                return a._keydown(g)
            }).next().attr("role",
            "tabpanel");
        a.headers.not(a.active || "").attr({"aria-expanded":"false", tabIndex:-1}).next().hide();
        a.active.length ? a.active.attr({"aria-expanded":"true", tabIndex:0}) : a.headers.eq(0).attr("tabIndex", 0);
        c.browser.safari || a.headers.find("a").attr("tabIndex", -1);
        b.event && a.headers.bind(b.event.split(" ").join(".accordion ") + ".accordion", function (g) {
            a._clickHandler.call(a, g, this);
            g.preventDefault()
        })
    }, _createIcons:function () {
        var a = this.options;
        if (a.icons) {
            c("<span></span>").addClass("ui-icon " + a.icons.header).prependTo(this.headers);
            this.active.children(".ui-icon").toggleClass(a.icons.header).toggleClass(a.icons.headerSelected);
            this.element.addClass("ui-accordion-icons")
        }
    }, _destroyIcons:function () {
        this.headers.children(".ui-icon").remove();
        this.element.removeClass("ui-accordion-icons")
    }, destroy:function () {
        var a = this.options;
        this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role");
        this.headers.unbind(".accordion").removeClass("ui-accordion-header ui-accordion-disabled ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("tabIndex");
        this.headers.find("a").removeAttr("tabIndex");
        this._destroyIcons();
        var b = this.headers.next().css("display", "").removeAttr("role").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-accordion-disabled ui-state-disabled");
        if (a.autoHeight || a.fillHeight)b.css("height", "");
        return c.Widget.prototype.destroy.call(this)
    }, _setOption:function (a, b) {
        c.Widget.prototype._setOption.apply(this, arguments);
        a == "active" && this.activate(b);
        if (a == "icons") {
            this._destroyIcons();
            b && this._createIcons()
        }
        if (a == "disabled")this.headers.add(this.headers.next())[b ? "addClass" : "removeClass"]("ui-accordion-disabled ui-state-disabled")
    }, _keydown:function (a) {
        if (!(this.options.disabled || a.altKey || a.ctrlKey)) {
            var b = c.ui.keyCode, d = this.headers.length, f = this.headers.index(a.target), g = false;
            switch (a.keyCode) {
                case b.RIGHT:
                case b.DOWN:
                    g = this.headers[(f + 1) % d];
                    break;
                case b.LEFT:
                case b.UP:
                    g = this.headers[(f - 1 + d) % d];
                    break;
                case b.SPACE:
                case b.ENTER:
                    this._clickHandler({target:a.target}, a.target);
                    a.preventDefault()
            }
            if (g) {
                c(a.target).attr("tabIndex", -1);
                c(g).attr("tabIndex", 0);
                g.focus();
                return false
            }
            return true
        }
    }, resize:function () {
        var a = this.options, b;
        if (a.fillSpace) {
            if (c.browser.msie) {
                var d = this.element.parent().css("overflow");
                this.element.parent().css("overflow", "hidden")
            }
            b = this.element.parent().height();
            c.browser.msie && this.element.parent().css("overflow", d);
            this.headers.each(function () {
                b -= c(this).outerHeight(true)
            });
            this.headers.next().each(
                function () {
                    c(this).height(Math.max(0, b - c(this).innerHeight() +
                        c(this).height()))
                }).css("overflow", "auto")
        } else if (a.autoHeight) {
            b = 0;
            this.headers.next().each(
                function () {
                    b = Math.max(b, c(this).height("").height())
                }).height(b)
        }
        return this
    }, activate:function (a) {
        this.options.active = a;
        a = this._findActive(a)[0];
        this._clickHandler({target:a}, a);
        return this
    }, _findActive:function (a) {
        return a ? typeof a === "number" ? this.headers.filter(":eq(" + a + ")") : this.headers.not(this.headers.not(a)) : a === false ? c([]) : this.headers.filter(":eq(0)")
    }, _clickHandler:function (a, b) {
        var d = this.options;
        if (!d.disabled)if (a.target) {
            a = c(a.currentTarget || b);
            b = a[0] === this.active[0];
            d.active = d.collapsible && b ? false : this.headers.index(a);
            if (!(this.running || !d.collapsible && b)) {
                this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header);
                if (!b) {
                    a.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top").children(".ui-icon").removeClass(d.icons.header).addClass(d.icons.headerSelected);
                    a.next().addClass("ui-accordion-content-active")
                }
                h = a.next();
                f = this.active.next();
                g = {options:d, newHeader:b && d.collapsible ? c([]) : a, oldHeader:this.active, newContent:b && d.collapsible ? c([]) : h, oldContent:f};
                d = this.headers.index(this.active[0]) > this.headers.index(a[0]);
                this.active = b ? c([]) : a;
                this._toggle(h, f, g, b, d)
            }
        } else if (d.collapsible) {
            this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header);
            this.active.next().addClass("ui-accordion-content-active");
            var f = this.active.next(), g = {options:d, newHeader:c([]), oldHeader:d.active, newContent:c([]), oldContent:f}, h = this.active = c([]);
            this._toggle(h, f, g)
        }
    }, _toggle:function (a, b, d, f, g) {
        var h = this, e = h.options;
        h.toShow = a;
        h.toHide = b;
        h.data = d;
        var j = function () {
            if (h)return h._completed.apply(h, arguments)
        };
        h._trigger("changestart", null, h.data);
        h.running = b.size() === 0 ? a.size() : b.size();
        if (e.animated) {
            d = {};
            d = e.collapsible && f ? {toShow:c([]), toHide:b, complete:j,
                down:g, autoHeight:e.autoHeight || e.fillSpace} : {toShow:a, toHide:b, complete:j, down:g, autoHeight:e.autoHeight || e.fillSpace};
            if (!e.proxied)e.proxied = e.animated;
            if (!e.proxiedDuration)e.proxiedDuration = e.duration;
            e.animated = c.isFunction(e.proxied) ? e.proxied(d) : e.proxied;
            e.duration = c.isFunction(e.proxiedDuration) ? e.proxiedDuration(d) : e.proxiedDuration;
            f = c.ui.accordion.animations;
            var i = e.duration, k = e.animated;
            if (k && !f[k] && !c.easing[k])k = "slide";
            f[k] || (f[k] = function (l) {
                this.slide(l, {easing:k, duration:i || 700})
            });
            f[k](d)
        } else {
            if (e.collapsible && f)a.toggle(); else {
                b.hide();
                a.show()
            }
            j(true)
        }
        b.prev().attr({"aria-expanded":"false", tabIndex:-1}).blur();
        a.prev().attr({"aria-expanded":"true", tabIndex:0}).focus()
    }, _completed:function (a) {
        this.running = a ? 0 : --this.running;
        if (!this.running) {
            this.options.clearStyle && this.toShow.add(this.toHide).css({height:"", overflow:""});
            this.toHide.removeClass("ui-accordion-content-active");
            this._trigger("change", null, this.data)
        }
    }});
    c.extend(c.ui.accordion, {version:"1.8.5", animations:{slide:function (a, b) {
        a = c.extend({easing:"swing", duration:300}, a, b);
        if (a.toHide.size())if (a.toShow.size()) {
            var d = a.toShow.css("overflow"), f = 0, g = {}, h = {}, e;
            b = a.toShow;
            e = b[0].style.width;
            b.width(parseInt(b.parent().width(), 10) - parseInt(b.css("paddingLeft"), 10) - parseInt(b.css("paddingRight"), 10) - (parseInt(b.css("borderLeftWidth"), 10) || 0) - (parseInt(b.css("borderRightWidth"), 10) || 0));
            c.each(["height", "paddingTop", "paddingBottom"], function (j, i) {
                h[i] = "hide";
                j = ("" + c.css(a.toShow[0], i)).match(/^([\d+-.]+)(.*)$/);
                g[i] = {value:j[1],
                    unit:j[2] || "px"}
            });
            a.toShow.css({height:0, overflow:"hidden"}).show();
            a.toHide.filter(":hidden").each(a.complete).end().filter(":visible").animate(h, {step:function (j, i) {
                if (i.prop == "height")f = i.end - i.start === 0 ? 0 : (i.now - i.start) / (i.end - i.start);
                a.toShow[0].style[i.prop] = f * g[i.prop].value + g[i.prop].unit
            }, duration:a.duration, easing:a.easing, complete:function () {
                a.autoHeight || a.toShow.css("height", "");
                a.toShow.css({width:e, overflow:d});
                a.complete()
            }})
        } else a.toHide.animate({height:"hide", paddingTop:"hide",
            paddingBottom:"hide"}, a); else a.toShow.animate({height:"show", paddingTop:"show", paddingBottom:"show"}, a)
    }, bounceslide:function (a) {
        this.slide(a, {easing:a.down ? "easeOutBounce" : "swing", duration:a.down ? 1E3 : 200})
    }}})
})(jQuery);
;
/*
 * jQuery UI Position 1.8.5
 *
 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Position
 */
(function (c) {
    c.ui = c.ui || {};
    var n = /left|center|right/, o = /top|center|bottom/, t = c.fn.position, u = c.fn.offset;
    c.fn.position = function (b) {
        if (!b || !b.of)return t.apply(this, arguments);
        b = c.extend({}, b);
        var a = c(b.of), d = a[0], g = (b.collision || "flip").split(" "), e = b.offset ? b.offset.split(" ") : [0, 0], h, k, j;
        if (d.nodeType === 9) {
            h = a.width();
            k = a.height();
            j = {top:0, left:0}
        } else if (d.scrollTo && d.document) {
            h = a.width();
            k = a.height();
            j = {top:a.scrollTop(), left:a.scrollLeft()}
        } else if (d.preventDefault) {
            b.at = "left top";
            h = k = 0;
            j =
            {top:b.of.pageY, left:b.of.pageX}
        } else {
            h = a.outerWidth();
            k = a.outerHeight();
            j = a.offset()
        }
        c.each(["my", "at"], function () {
            var f = (b[this] || "").split(" ");
            if (f.length === 1)f = n.test(f[0]) ? f.concat(["center"]) : o.test(f[0]) ? ["center"].concat(f) : ["center", "center"];
            f[0] = n.test(f[0]) ? f[0] : "center";
            f[1] = o.test(f[1]) ? f[1] : "center";
            b[this] = f
        });
        if (g.length === 1)g[1] = g[0];
        e[0] = parseInt(e[0], 10) || 0;
        if (e.length === 1)e[1] = e[0];
        e[1] = parseInt(e[1], 10) || 0;
        if (b.at[0] === "right")j.left += h; else if (b.at[0] === "center")j.left += h /
            2;
        if (b.at[1] === "bottom")j.top += k; else if (b.at[1] === "center")j.top += k / 2;
        j.left += e[0];
        j.top += e[1];
        return this.each(function () {
            var f = c(this), l = f.outerWidth(), m = f.outerHeight(), p = parseInt(c.curCSS(this, "marginLeft", true)) || 0, q = parseInt(c.curCSS(this, "marginTop", true)) || 0, v = l + p + parseInt(c.curCSS(this, "marginRight", true)) || 0, w = m + q + parseInt(c.curCSS(this, "marginBottom", true)) || 0, i = c.extend({}, j), r;
            if (b.my[0] === "right")i.left -= l; else if (b.my[0] === "center")i.left -= l / 2;
            if (b.my[1] === "bottom")i.top -= m; else if (b.my[1] ===
                "center")i.top -= m / 2;
            i.left = parseInt(i.left);
            i.top = parseInt(i.top);
            r = {left:i.left - p, top:i.top - q};
            c.each(["left", "top"], function (s, x) {
                c.ui.position[g[s]] && c.ui.position[g[s]][x](i, {targetWidth:h, targetHeight:k, elemWidth:l, elemHeight:m, collisionPosition:r, collisionWidth:v, collisionHeight:w, offset:e, my:b.my, at:b.at})
            });
            c.fn.bgiframe && f.bgiframe();
            f.offset(c.extend(i, {using:b.using}))
        })
    };
    c.ui.position = {fit:{left:function (b, a) {
        var d = c(window);
        d = a.collisionPosition.left + a.collisionWidth - d.width() - d.scrollLeft();
        b.left = d > 0 ? b.left - d : Math.max(b.left - a.collisionPosition.left, b.left)
    }, top:function (b, a) {
        var d = c(window);
        d = a.collisionPosition.top + a.collisionHeight - d.height() - d.scrollTop();
        b.top = d > 0 ? b.top - d : Math.max(b.top - a.collisionPosition.top, b.top)
    }}, flip:{left:function (b, a) {
        if (a.at[0] !== "center") {
            var d = c(window);
            d = a.collisionPosition.left + a.collisionWidth - d.width() - d.scrollLeft();
            var g = a.my[0] === "left" ? -a.elemWidth : a.my[0] === "right" ? a.elemWidth : 0, e = a.at[0] === "left" ? a.targetWidth : -a.targetWidth, h = -2 * a.offset[0];
            b.left += a.collisionPosition.left < 0 ? g + e + h : d > 0 ? g + e + h : 0
        }
    }, top:function (b, a) {
        if (a.at[1] !== "center") {
            var d = c(window);
            d = a.collisionPosition.top + a.collisionHeight - d.height() - d.scrollTop();
            var g = a.my[1] === "top" ? -a.elemHeight : a.my[1] === "bottom" ? a.elemHeight : 0, e = a.at[1] === "top" ? a.targetHeight : -a.targetHeight, h = -2 * a.offset[1];
            b.top += a.collisionPosition.top < 0 ? g + e + h : d > 0 ? g + e + h : 0
        }
    }}};
    if (!c.offset.setOffset) {
        c.offset.setOffset = function (b, a) {
            if (/static/.test(c.curCSS(b, "position")))b.style.position = "relative";
            var d =
                c(b), g = d.offset(), e = parseInt(c.curCSS(b, "top", true), 10) || 0, h = parseInt(c.curCSS(b, "left", true), 10) || 0;
            g = {top:a.top - g.top + e, left:a.left - g.left + h};
            "using"in a ? a.using.call(b, g) : d.css(g)
        };
        c.fn.offset = function (b) {
            var a = this[0];
            if (!a || !a.ownerDocument)return null;
            if (b)return this.each(function () {
                c.offset.setOffset(this, b)
            });
            return u.call(this)
        }
    }
})(jQuery);
;
/*
 * jQuery UI Autocomplete 1.8.5
 *
 * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Autocomplete
 *
 * Depends:
 *	jquery.ui.core.js
 *	jquery.ui.widget.js
 *	jquery.ui.position.js
 */
(function (e) {
    e.widget("ui.autocomplete", {options:{appendTo:"body", delay:300, minLength:1, position:{my:"left top", at:"left bottom", collision:"none"}, source:null}, _create:function () {
        var a = this, b = this.element[0].ownerDocument;
        this.element.addClass("ui-autocomplete-input").attr("autocomplete", "off").attr({role:"textbox", "aria-autocomplete":"list", "aria-haspopup":"true"}).bind("keydown.autocomplete",
            function (c) {
                if (!a.options.disabled) {
                    var d = e.ui.keyCode;
                    switch (c.keyCode) {
                        case d.PAGE_UP:
                            a._move("previousPage",
                                c);
                            break;
                        case d.PAGE_DOWN:
                            a._move("nextPage", c);
                            break;
                        case d.UP:
                            a._move("previous", c);
                            c.preventDefault();
                            break;
                        case d.DOWN:
                            a._move("next", c);
                            c.preventDefault();
                            break;
                        case d.ENTER:
                        case d.NUMPAD_ENTER:
                            a.menu.element.is(":visible") && c.preventDefault();
                        case d.TAB:
                            if (!a.menu.active)return;
                            a.menu.select(c);
                            break;
                        case d.ESCAPE:
                            a.element.val(a.term);
                            a.close(c);
                            break;
                        default:
                            clearTimeout(a.searching);
                            a.searching = setTimeout(function () {
                                if (a.term != a.element.val()) {
                                    a.selectedItem = null;
                                    a.search(null, c)
                                }
                            }, a.options.delay);
                            break
                    }
                }
            }).bind("focus.autocomplete",
            function () {
                if (!a.options.disabled) {
                    a.selectedItem = null;
                    a.previous = a.element.val()
                }
            }).bind("blur.autocomplete", function (c) {
                if (!a.options.disabled) {
                    clearTimeout(a.searching);
                    a.closing = setTimeout(function () {
                        a.close(c);
                        a._change(c)
                    }, 150)
                }
            });
        this._initSource();
        this.response = function () {
            return a._response.apply(a, arguments)
        };
        this.menu = e("<ul></ul>").addClass("ui-autocomplete").appendTo(e(this.options.appendTo || "body", b)[0]).mousedown(
            function (c) {
                var d = a.menu.element[0];
                c.target === d && setTimeout(function () {
                    e(document).one("mousedown", function (f) {
                        f.target !== a.element[0] && f.target !== d && !e.ui.contains(d, f.target) && a.close()
                    })
                }, 1);
                setTimeout(function () {
                    clearTimeout(a.closing)
                }, 13)
            }).menu({focus:function (c, d) {
                d = d.item.data("item.autocomplete");
                false !== a._trigger("focus", null, {item:d}) && /^key/.test(c.originalEvent.type) && a.element.val(d.value)
            }, selected:function (c, d) {
                d = d.item.data("item.autocomplete");
                var f = a.previous;
                if (a.element[0] !== b.activeElement) {
                    a.element.focus();
                    a.previous = f
                }
                if (false !== a._trigger("select", c, {item:d})) {
                    a.term = d.value;
                    a.element.val(d.value)
                }
                a.close(c);
                a.selectedItem = d
            }, blur:function () {
                a.menu.element.is(":visible") && a.element.val() !== a.term && a.element.val(a.term)
            }}).zIndex(this.element.zIndex() + 1).css({top:0, left:0}).hide().data("menu");
        e.fn.bgiframe && this.menu.element.bgiframe()
    }, destroy:function () {
        this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete").removeAttr("role").removeAttr("aria-autocomplete").removeAttr("aria-haspopup");
        this.menu.element.remove();
        e.Widget.prototype.destroy.call(this)
    }, _setOption:function (a, b) {
        e.Widget.prototype._setOption.apply(this, arguments);
        a === "source" && this._initSource();
        if (a === "appendTo")this.menu.element.appendTo(e(b || "body", this.element[0].ownerDocument)[0])
    }, _initSource:function () {
        var a = this, b, c;
        if (e.isArray(this.options.source)) {
            b = this.options.source;
            this.source = function (d, f) {
                f(e.ui.autocomplete.filter(b, d.term))
            }
        } else if (typeof this.options.source === "string") {
            c = this.options.source;
            this.source =
                function (d, f) {
                    a.xhr && a.xhr.abort();
                    a.xhr = e.getJSON(c, d, function (g, i, h) {
                        h === a.xhr && f(g);
                        a.xhr = null
                    })
                }
        } else this.source = this.options.source
    }, search:function (a, b) {
        a = a != null ? a : this.element.val();
        this.term = this.element.val();
        if (a.length < this.options.minLength)return this.close(b);
        clearTimeout(this.closing);
        if (this._trigger("search") !== false)return this._search(a)
    }, _search:function (a) {
        this.element.addClass("ui-autocomplete-loading");
        this.source({term:a}, this.response)
    }, _response:function (a) {
        if (a.length) {
            a =
                this._normalize(a);
            this._suggest(a);
            this._trigger("open")
        } else this.close();
        this.element.removeClass("ui-autocomplete-loading")
    }, close:function (a) {
        clearTimeout(this.closing);
        if (this.menu.element.is(":visible")) {
            this._trigger("close", a);
            this.menu.element.hide();
            this.menu.deactivate()
        }
    }, _change:function (a) {
        this.previous !== this.element.val() && this._trigger("change", a, {item:this.selectedItem})
    }, _normalize:function (a) {
        if (a.length && a[0].label && a[0].value)return a;
        return e.map(a, function (b) {
            if (typeof b ===
                "string")return{label:b, value:b};
            return e.extend({label:b.label || b.value, value:b.value || b.label}, b)
        })
    }, _suggest:function (a) {
        var b = this.menu.element.empty().zIndex(this.element.zIndex() + 1), c;
        this._renderMenu(b, a);
        this.menu.deactivate();
        this.menu.refresh();
        this.menu.element.show().position(e.extend({of:this.element}, this.options.position));
        a = b.width("").outerWidth();
        c = this.element.outerWidth();
        b.outerWidth(Math.max(a, c))
    }, _renderMenu:function (a, b) {
        var c = this;
        e.each(b, function (d, f) {
            c._renderItem(a, f)
        })
    },
        _renderItem:function (a, b) {
            return e("<li></li>").data("item.autocomplete", b).append(e("<a></a>").text(b.label)).appendTo(a)
        }, _move:function (a, b) {
            if (this.menu.element.is(":visible"))if (this.menu.first() && /^previous/.test(a) || this.menu.last() && /^next/.test(a)) {
                this.element.val(this.term);
                this.menu.deactivate()
            } else this.menu[a](b); else this.search(null, b)
        }, widget:function () {
            return this.menu.element
        }});
    e.extend(e.ui.autocomplete, {escapeRegex:function (a) {
        return a.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&")
    },
        filter:function (a, b) {
            var c = new RegExp(e.ui.autocomplete.escapeRegex(b), "i");
            return e.grep(a, function (d) {
                return c.test(d.label || d.value || d)
            })
        }})
})(jQuery);
(function (e) {
    e.widget("ui.menu", {_create:function () {
        var a = this;
        this.element.addClass("ui-menu ui-widget ui-widget-content ui-corner-all").attr({role:"listbox", "aria-activedescendant":"ui-active-menuitem"}).click(function (b) {
            if (e(b.target).closest(".ui-menu-item a").length) {
                b.preventDefault();
                a.select(b)
            }
        });
        this.refresh()
    }, refresh:function () {
        var a = this;
        this.element.children("li:not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role", "menuitem").children("a").addClass("ui-corner-all").attr("tabindex",
            -1).mouseenter(
            function (b) {
                a.activate(b, e(this).parent())
            }).mouseleave(function () {
                a.deactivate()
            })
    }, activate:function (a, b) {
        this.deactivate();
        if (this.hasScroll()) {
            var c = b.offset().top - this.element.offset().top, d = this.element.attr("scrollTop"), f = this.element.height();
            if (c < 0)this.element.attr("scrollTop", d + c); else c >= f && this.element.attr("scrollTop", d + c - f + b.height())
        }
        this.active = b.eq(0).children("a").addClass("ui-state-hover").attr("id", "ui-active-menuitem").end();
        this._trigger("focus", a, {item:b})
    },
        deactivate:function () {
            if (this.active) {
                this.active.children("a").removeClass("ui-state-hover").removeAttr("id");
                this._trigger("blur");
                this.active = null
            }
        }, next:function (a) {
            this.move("next", ".ui-menu-item:first", a)
        }, previous:function (a) {
            this.move("prev", ".ui-menu-item:last", a)
        }, first:function () {
            return this.active && !this.active.prevAll(".ui-menu-item").length
        }, last:function () {
            return this.active && !this.active.nextAll(".ui-menu-item").length
        }, move:function (a, b, c) {
            if (this.active) {
                a = this.active[a + "All"](".ui-menu-item").eq(0);
                a.length ? this.activate(c, a) : this.activate(c, this.element.children(b))
            } else this.activate(c, this.element.children(b))
        }, nextPage:function (a) {
            if (this.hasScroll())if (!this.active || this.last())this.activate(a, this.element.children(":first")); else {
                var b = this.active.offset().top, c = this.element.height(), d = this.element.children("li").filter(function () {
                    var f = e(this).offset().top - b - c + e(this).height();
                    return f < 10 && f > -10
                });
                d.length || (d = this.element.children(":last"));
                this.activate(a, d)
            } else this.activate(a, this.element.children(!this.active ||
                this.last() ? ":first" : ":last"))
        }, previousPage:function (a) {
            if (this.hasScroll())if (!this.active || this.first())this.activate(a, this.element.children(":last")); else {
                var b = this.active.offset().top, c = this.element.height();
                result = this.element.children("li").filter(function () {
                    var d = e(this).offset().top - b + c - e(this).height();
                    return d < 10 && d > -10
                });
                result.length || (result = this.element.children(":first"));
                this.activate(a, result)
            } else this.activate(a, this.element.children(!this.active || this.first() ? ":last" : ":first"))
        },
        hasScroll:function () {
            return this.element.height() < this.element.attr("scrollHeight")
        }, select:function (a) {
            this._trigger("selected", a, {item:this.active})
        }})
})(jQuery);

function decorate() {
    $('.sprite-button').spriteButton();
    $('.sprite-button, .m, .sb, .rbut').simpleButton();

    $('div.message').each(function () {
        $(this).append('<a href="#" class="button-close-message">Close</a>');
        $('a.button-close-message', $(this)).click(function (event) {
            event.preventDefault();
            $(this).parents('div.message').fadeOut();
        });
    });

    $('.disabled').click(function (event) {
        event.preventDefault();
    });

    $('tr[class!=header]').live('mouseover', function () {
        $(this).addClass('hover');
    });

    $('tr').live('mouseout', function () {
        $(this).removeClass('hover');
    });

    $('input.text[class!=nofocus], input[type=password], textarea, select').focus(
        function (event) {
            $(this).addClass('ffocus');
        }).blur(function (event) {
            $(this).removeClass('ffocus');
        });

    $('a#crowdsound-activate-popup').click(function (event) {
        $this = $(this);
        if ($this.text() == 'Close Window') {
            $this.addClass('hover');
        } else {
            $this.removeClass('hover');
        }
    });

    $('textarea.textarea').autogrow({
        spaceHeight:50
    });
}

(function ($) {
    $.fn.spriteButton = function () {
        this.addClass('sprite-button-full').append('<span class="right">&nbsp;</span>');

        return this;
    };

    $.fn.simpleButton = function () {
        this.mousedown(function (event) {
            $(this).addClass('mousedown');
        })

        this.mouseup(function (event) {
            $(this).removeClass('mousedown');
        });

        this.mouseleave(function (event) {
            $(this).removeClass('mousedown');
        });

        this.mouseover(function (event) {
            $(this).removeClass('mousedown');
        });

        return this;
    }
})(jQuery);

function onBlurInput() {
    $(this).removeClass('active');
}
;

function onFocusInput() {
    $(this).addClass('active');
}
;

function initTourTypeHelp() {
    if ($('.tourtype-help').length) {
        try {
            $('.tourtype-help').bt({
                ajaxCache:false,
                ajaxLoading:'<p><img src="/img/loading.gif" /> Loading help</p>',
                ajaxPath:["$(this).attr('href')"],
                cssClass:'supertip',
                cssStyles:{
                    padding:'10px 10px 0 10px'
                },
                fill:'#feffb5',
                strokeStyle:'#e5e6ab',
                postShow:function () {
                    $('.sidebar').css('zIndex', 10);
                },
                preHide:function () {
                    $('.sidebar').css('zIndex', 1);
                },
                width:'250px'
            });

        }
        catch (err) {

        }
        $('.tourtype-help').click(function (event) {
            event.preventDefault();
        });

    }
}
;

function initRequestForm() {
    $('.button-request').click(function (event) {
        event.preventDefault();
        $('.request-block').slideDown(500, function () {
            $('.request-block input[name=name]').focus();
        });
        //$(this).animate({opacity: 0.3}, 500, function(){$('.request-block input[name=name]').focus();});
        $(this).addClass('dimmed');
    });

    $block = $('.request-block');
    $form = $block.find('form');
    $result = $block.find('.result');
    $block.find('a.cancel').click(function (event) {
        event.preventDefault();
        $form.get(0).reset();
        closeRequestForm();
    });

    $block.find('a.submit').click(function (event) {
        event.preventDefault();
        $result.html('<img src="/img/loading.gif" />');
        $form.disable();
        var error = false;
        var focus = false;
        var mandatoryFields = ['name', 'phone', 'email'];
        $.each($form.find(':input'), function () {
            if ($.inArray($(this).attr('name'), mandatoryFields) > -1 && !$(this).val()) {
                if (!error) error = $(this);
            }
            if ($(this).attr('name') == 'email' && $(this).val() && !validate_email($(this).val())) {
                alert('Please check the email field');
                focus = $(this);
            }
        });
        if (!focus) {
            if (error) {
                alert('Please fill in all starred fields.');
                $form.enable();
            } else {
                $result.slideDown();
                var data = $form.serializeFields();
                data.from = 'callrequest';
                $.post($form.attr('action'), data, function (data) {
                    if (data.ok) {
                        $form.enable();
                        $form.get(0).reset();
                        $block.find('.result').text('Thank you for contacting Tour De Force travel company. ' +
                            'We will get back to you shortly.');
                    }
                }, 'json');
            }
        }

        var field = focus || error;
        if (field) {
            $form.enable();
            field.focus();
        }
    });
}
;

function closeRequestForm() {
    $block = $('.request-block');
    $button = $('.button-request');

    $block.slideUp();
    $block.find('.result').slideUp();
    $button.removeClass('dimmed');
}
;

function initWhyHelp() {
    if ($('.icon-why').length) {
        $('.icon-why').click(function (event) {
            event.preventDefault();
        });
        $('.icon-why').each(function () {
            positions = $(this).hasClass('top') ? ['top'] : ['most'];
            $(this).bt({
                cssClass:'supertip',
                fill:'#feffb5',
                strokeStyle:'#e5e6ab',
                width:'300px',
                positions:positions
            });
        });
    }
}
;

(function (jQuery) {
    var self = null;
    jQuery.fn.autogrow = function (o) {
        return this.each(function () {
            new jQuery.autogrow(this, o);
        })
    };

    jQuery.autogrow = function (e, o) {
        this.options = o || {};

        this.dummy = null;
        this.interval = null;
        this.line_height = this.options.lineHeight || parseInt(jQuery(e).css('line-height'));
        this.min_height = this.options.minHeight || parseInt(jQuery(e).css('min-height'));
        this.max_height = this.options.maxHeight || parseInt(jQuery(e).css('max-height'));
        this.space_height = this.options.spaceHeight || this.line_height;
        this.textarea = jQuery(e);
        if (this.line_height == NaN)this.line_height = 0;
        this.init();
    };

    jQuery.autogrow.fn = jQuery.autogrow.prototype = {
        autogrow:'1.2.2'
    };

    jQuery.autogrow.fn.extend = jQuery.autogrow.extend = jQuery.extend;
    jQuery.autogrow.fn.extend({
        init:function () {
            var self = this;
            this.textarea.css({
                overflow:'hidden',
                display:'block'
            });
            this.textarea.bind('focus',
                function () {
                    self.startExpand();
                }).bind('blur', function () {
                    self.stopExpand();
                });
            this.checkExpand();
        },
        startExpand:function () {
            var self = this;
            this.interval = window.setInterval(function () {
                self.checkExpand()
            }, 400)
        },
        stopExpand:function () {
            clearInterval(this.interval);
        },
        checkExpand:function () {
            if (this.dummy == null) {
                this.dummy = jQuery('<div></div>');
                this.dummy.css({
                    'font-size':this.textarea.css('font-size'),
                    'font-family':this.textarea.css('font-family'),
                    'width':this.textarea.css('width'),
                    'overflow-x':'hidden',
                    'position':'absolute',
                    'top':0,
                    'left':-9999
                });
                if (this.line_height)this.dummy.css({
                    'line-height':this.line_height + 'px'
                });
                try {
                    if (this.textarea.css('padding'))this.dummy.css({
                        'padding':this.textarea.css('padding')
                    });
                } catch (e) {
                }
                this.dummy.appendTo('body')
            }
            var html = this.textarea.val().replace(/(<|>)/g, '');
            if ($.browser.msie) {
                html = html.replace(/\n/g, '<BR>new');
            } else {
                html = html.replace(/\n/g, '<br>new');
            }
            if (this.dummy.html() != html) {
                this.dummy.html(html);
                if (this.max_height > 0 && (this.dummy.height() + this.line_height > this.max_height)) {
                    this.textarea.css('overflow-y', 'auto');
                } else {
                    this.textarea.css('overflow-y', 'hidden');
                    if (this.textarea.height() < this.dummy.height() + this.space_height || (this.dummy.height() < this.textarea.height())) {
                        this.textarea.animate({
                            height:(this.dummy.height() + this.space_height) + 'px'
                        }, 100)
                    }
                }
            }
        }
    })
})(jQuery);

function initRequestForm() {
    $('.button-request').click(function (event) {
        event.preventDefault();
        $('.request-block').slideDown();
        $(this).animate({
            opacity:0.3
        }, 500, function () {
            $('.request-block input[name=name]').focus();
        });
    });

    $block = $('.request-block');
    $form = $block.find('form');
    $result = $block.find('.result');
    $block.find('a.cancel').click(function (event) {
        event.preventDefault();
        $form.get(0).reset();
        closeRequestForm();
    });

    $block.find('a.submit').click(function (event) {
        event.preventDefault();
        $result.html('<img src="/img/loading.gif" />');
        $form.disable();
        var error = false;
        var focus = false;
        $.each($form.find(':input'), function () {
            if (!$(this).val()) {
                if (!error) error = $(this);
            } else if ($(this).attr('name') == 'email' && !validate_email($(this).val())) {
                alert('Please check the email field');
                focus = $(this);
            }
        });
        if (!focus) {
            if (error) {
                alert('Please fill in all fields.');
            } else {
                $result.slideDown();
                var data = $form.serializeFields();
                data.from = 'callrequest';
                $.post($form.attr('action'), data, function (data) {
                    if (data.ok) {
                        $block.find('.result').text('Thank you for contacting Tour De Force travel company. ' +
                            'We will get back to you shortly.');
                    }
                }, 'json');
            }
        }
        $form.enable();

        var field = focus || error;
        if (field && field.focus) field.focus();
    });
}

function closeRequestForm() {
    $block = $('.request-block');
    $button = $('.button-request');

    $block.slideUp();
    $block.find('.result').slideUp();
    $button.animate({
        opacity:1
    }, 500);
}

function SwitchGroup() {
    this.ui = {};
    this.defaults = {
        period:5000,
        animationTime:700,
        startIndex:0,
        switchCallback:function () {
        }
    };
    this.params = {};
    this.currentIndex = 0;
    this.total = 0;
    this.timer = null;
    this.currentObj = null;
    this.playing = false;
    this.stopped = false;
    this.waitLoad = false;
}

SwitchGroup.prototype = {
    init:function (el, options) {
        var self = this;
        self.ui.block = $(el);
        if (!el.length) return false;
        self.params = $.extend({}, self.defaults, options || {});
        self.ui.switchersGroup = self.ui.block.find('.switchers');
        self.ui.switchers = self.ui.switchersGroup.find('.switcher');
        self.ui.switched = self.ui.block.find('.switched').hide();
        $(self.ui.switchers.removeClass('current').get(self.params.startIndex)).addClass('current');
        self.currentIndex = self.params.startIndex;
        self.currentObj = $(self.ui.switched.get(self.currentIndex)).show();
        self.total = self.ui.switched.length;

        self.ui.block.addClass('cur-index-' + self.currentIndex);

        self.ui.switchers.click(function (e, $this) {
            self.setCurrent(this);
            self.stop();
        });

        if (self.ui.block.is('.stopped')) {
            self.stopped = true;
        }

        //self.play();

        self.ui.block.bind('mouseleave startplay',
            function () {
                self.play.apply(self);
            }).bind('mouseenter pauseplay',
            function () {
                self.pause.apply(self);
            }).bind('stopplay', function () {
                self.stop.apply(self);
            });
        ;

    },

    play:function () {
        var self = this;
        if (self.playing || !self.currentObj || self.stopped) return false;
        self.playing = true;
        self.timer = setInterval(function () {
            self.ui.switchers.removeClass('current');
            self.ui.block.removeClass('cur-index-' + self.currentIndex);
            //self.currentObj.find('.over strong, .form').hide().end().fadeOut(self.params.animationTime);//.animate({opacity: 0.0}, 1200);
            self.currentObj.fadeOut(self.params.animationTime);
            self.currentIndex++;
            if (self.currentIndex >= self.total) self.currentIndex = 0;
            self.currentObj = $(self.ui.switched.get(self.currentIndex));
            //self.currentObj.find('.over strong, .form').show();
            self.currentObj.fadeIn(self.params.animationTime);
            $(self.ui.switchers.get(self.currentIndex)).addClass('current');
            self.ui.block.addClass('cur-index-' + self.currentIndex);
            if ($.isFunction(self.params.switchCallback)) {
                self.params.switchCallback.apply(self);
            }
        }, self.params.period);
    },

    setCurrent:function (switcher) {
        var self = this;
        var newIndex = self.ui.switchers.index($(switcher));
        if (newIndex != self.currentIndex) {
            self.ui.switchers.removeClass('current');
            self.ui.block.removeClass('cur-index-' + self.currentIndex);
            self.currentIndex = newIndex;
            $(switcher).addClass('current')
            self.currentObj.fadeOut(self.params.animationTime);
            self.currentObj = $(self.ui.switched.get(self.currentIndex)).fadeIn(self.params.animationTime);
            self.ui.block.addClass('cur-index-' + self.currentIndex);
            if ($.isFunction(self.params.switchCallback)) {
                self.params.switchCallback.apply(self);
            }
        }
        self.pause();
        return false;
    },

    pause:function () {
        var self = this;
        if (!self.playing || !self.timer || self.stopped) return false;
        clearInterval(self.timer);
        self.playing = false;
    },

    stop:function () {
        var self = this;
        if (self.stopped) return false;
        if (self.playing) {
            clearInterval(self.timer);
        }
        self.playing = false;
        self.stopped = true;
    }
}

function initSwitchers() {
    $('.switcher-group').each(function (group) {
        var $this = $(this);
        $this.switchGroup = new SwitchGroup();
        $this.switchGroup.init($this, {startIndex:0});
    });
}

function initSearchAccordion() {


    $('.accordion-search').accordion({
        autoHeight:$.browser.msie && parseInt($.browser.version) < 8 ? true : false,
        collapsible:true,
        //active: 3,
        change:function (event, ui) {
            ui.oldHeader.removeClass('current');
            ui.newHeader.addClass('current');
        }
    });

}

$('#container').ready(function () {
    decorate();
    initRequestForm();
    initTourTypeHelp();
    initWhyHelp();
    initSearchAccordion();
});


$(window).load(function () {
    initSwitchers();
});

$(document).ready(function () {
    /*$("#facebook").find("img:first").after('<iframe src="http://www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2FTourdeforcetravel&amp;width=294&amp;colorscheme=light&amp;connections=10&amp;stream=true&amp;header=false&amp;height=587" scrolling="no" frameBorder="0" style="border:none;overflow:hidden;width:294px;height:587px;margin:0px" allowTransparency="true"></iframe>');*/
});

var blackPopup = {

    $container:null,
    $content:null,
    $fade:null,
    config:{
        title:''
    },
    current_url:'',
    self:null,

    close:function () {
        this.$fade.hide();
        this.$container.hide();
    },

    createBlack:function () {
        if (!$('#fade').length)
            $('body').append('<div id="fade"></div>');
        $fade = $('#fade');
        this.$fade = $fade;
        if ($.fn.bgiframe) $fade.bgiframe();

    },

    createContainer:function () {
        if (!$('#litebox').length) {
            $('body').append('<div id="litebox"><div class="top"></div><div class="center"><div class="header">'
                + '<a href="#" class="button-close d">Close</a><h2 class="title"></h2></div>'
                + '<div class="content"></div></div><div class="bottom"></div></div>');
        }

        $c = $('#litebox');
        if ($.fn.bgiframe) $c.bgiframe();
        this.$container = $c;
        this.$content = $('.content', $c);
        $('a.button-close', $c).click(bind(this, 'onClose'));

    },

    init:function () {
        this.self = this;

        this.createBlack();
        this.createContainer();
    },

    onClose:function (event) {
        event.preventDefault();
        this.close();
        if (this.config.onClose) this.config.onClose();
    },

    onSuccess:function (event) {
        event.preventDefault();
        this.close();
        if (this.config.onSuccess) this.config.onSuccess();
    },

    show:function (settings) {
        if (settings) $.extend(this.config, settings);

        if (!$.fn.bgiframe) this.$fade.show();
        this.$container.center();

        $('h2.title', this.$container).text(this.config.title);

        this.$container.show();

        /*
         if($.fn.bgiframe) {
         var height = document.documentElement.scrollTop + (document.documentElement.clientHeight / 2) - 230;
         $.fn.litebox.container.css('top', height + 'px');
         $.fn.litebox.container.css('marginTop', 0);
         }
         */

    },

    load:function (url) {
        if (this.current_url != url) {
            this.current_url = url;
            this.$content.html('<img src="/img/loading.gif" /> Loading...');
            this.$content.load(url);
        }
    }
}
jQuery(document).ready(function ($) {
//$('#switcher1').addClass('current 23 21 123 3 32');
//$("p").addClass("myClass yourClass");
//	$('#switcher1').click();

});
