
/**
* jQuery.timers - Timer abstractions for jQuery
* Written by Blair Mitchelmore (blair DOT mitchelmore AT gmail DOT com)
* Licensed under the WTFPL (http://sam.zoy.org/wtfpl/).
* Date: 2009/10/16
*
* @author Blair Mitchelmore
* @version 1.2
*
**/

jQuery.fn.extend({
    everyTime: function(interval, label, fn, times) {
        return this.each(function() {
            jQuery.timer.add(this, interval, label, fn, times);
        });
    },
    oneTime: function(interval, label, fn) {
        return this.each(function() {
            jQuery.timer.add(this, interval, label, fn, 1);
        });
    },
    stopTime: function(label, fn) {
        return this.each(function() {
            jQuery.timer.remove(this, label, fn);
        });
    }
});

jQuery.extend({
    timer: {
        global: [],
        guid: 1,
        dataKey: "jQuery.timer",
        regex: /^([0-9]+(?:\.[0-9]*)?)\s*(.*s)?$/,
        powers: {
            // Yeah this is major overkill...
            'ms': 1,
            'cs': 10,
            'ds': 100,
            's': 1000,
            'das': 10000,
            'hs': 100000,
            'ks': 1000000
        },
        timeParse: function(value) {
            if (value == undefined || value == null)
                return null;
            var result = this.regex.exec(jQuery.trim(value.toString()));
            if (result[2]) {
                var num = parseFloat(result[1]);
                var mult = this.powers[result[2]] || 1;
                return num * mult;
            } else {
                return value;
            }
        },
        add: function(element, interval, label, fn, times) {
            var counter = 0;

            if (jQuery.isFunction(label)) {
                if (!times)
                    times = fn;
                fn = label;
                label = interval;
            }

            interval = jQuery.timer.timeParse(interval);

            if (typeof interval != 'number' || isNaN(interval) || interval < 0)
                return;

            if (typeof times != 'number' || isNaN(times) || times < 0)
                times = 0;

            times = times || 0;

            var timers = jQuery.data(element, this.dataKey) || jQuery.data(element, this.dataKey, {});

            if (!timers[label])
                timers[label] = {};

            fn.timerID = fn.timerID || this.guid++;

            var handler = function() {
                if ((++counter > times && times !== 0) || fn.call(element, counter) === false)
                    jQuery.timer.remove(element, label, fn);
            };

            handler.timerID = fn.timerID;

            if (!timers[label][fn.timerID])
                timers[label][fn.timerID] = window.setInterval(handler, interval);

            this.global.push(element);

        },
        remove: function(element, label, fn) {
            var timers = jQuery.data(element, this.dataKey), ret;

            if (timers) {

                if (!label) {
                    for (label in timers)
                        this.remove(element, label, fn);
                } else if (timers[label]) {
                    if (fn) {
                        if (fn.timerID) {
                            window.clearInterval(timers[label][fn.timerID]);
                            delete timers[label][fn.timerID];
                        }
                    } else {
                        for (var fn in timers[label]) {
                            window.clearInterval(timers[label][fn]);
                            delete timers[label][fn];
                        }
                    }

                    for (ret in timers[label]) break;
                    if (!ret) {
                        ret = null;
                        delete timers[label];
                    }
                }

                for (ret in timers) break;
                if (!ret)
                    jQuery.removeData(element, this.dataKey);
            }
        }
    }
});

jQuery(window).bind("unload", function() {
    jQuery.each(jQuery.timer.global, function(index, item) {
        jQuery.timer.remove(item);
    });
});









/**
* jQuery (PNG Fix) v1.2
* Microsoft Internet Explorer 24bit PNG Fix
*
* The MIT License
* 
* Copyright (c) 2007 Paul Campbell (pauljamescampbell.co.uk)
* 
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* 
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
* 
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* @param		Object
* @return		Array
*/
(function($) {

    $.fn.pngfix = function(options) {

        // Review the Microsoft IE developer library for AlphaImageLoader reference 
        // http://msdn2.microsoft.com/en-us/library/ms532969(VS.85).aspx

        // ECMA scope fix
        var elements = this;
        var settings = $.extend({
            imageFixSrc: false,
            sizingMethod: false
        }, options);

        if (!$.browser.msie || ($.browser.msie && $.browser.version >= 7)) {
            return (elements);
        }

        function setFilter(el, path, mode) {
            var fs = el.attr("filters");
            var alpha = "DXImageTransform.Microsoft.AlphaImageLoader";
            if (fs[alpha]) {
                fs[alpha].enabled = true;
                fs[alpha].src = path;
                fs[alpha].sizingMethod = mode;
            } else {
                el.css("filter", 'progid:' + alpha + '(enabled="true", sizingMethod="' + mode + '", src="' + path + '")');
            }
        }

        function setDOMElementWidth(el) {
            if (el.css("width") == "auto" & el.css("height") == "auto") {
                el.css("width", el.attr("offsetWidth") + "px");
            }
        }

        return (
			elements.each(function() {

			    // Scope
			    var el = $(this);

			    if (el.attr("tagName").toUpperCase() == "IMG" && (/\.png/i).test(el.attr("src"))) {
			        if (!settings.imageFixSrc) {

			            // Wrap the <img> in a <span> then apply style/filters, 
			            // removing the <img> tag from the final render 
			            el.wrap("<span></span>");
			            var par = el.parent();
			            par.css({
			                height: el.height(),
			                width: el.width(),
			                display: "inline-block"
			            });
			            setFilter(par, el.attr("src"), "scale");
			            el.remove();
			        } else if ((/\.gif/i).test(settings.imageFixSrc)) {

			            // Replace the current image with a transparent GIF
			            // and apply the filter to the background of the 
			            // <img> tag (not the preferred route)
			            setDOMElementWidth(el);
			            setFilter(el, el.attr("src"), "image");
			            el.attr("src", settings.imageFixSrc);
			        }

			    } else {
			        var bg = new String(el.css("backgroundImage"));
			        var matches = bg.match(/^url\("(.*)"\)$/);
			        if (matches && matches.length) {

			            // Elements with a PNG as a backgroundImage have the
			            // filter applied with a sizing method relevant to the 
			            // background repeat type
			            setDOMElementWidth(el);
			            el.css("backgroundImage", "none");

			            // Restrict scaling methods to valid MSDN defintions (or one custom)
			            var sc = "crop";
			            if (settings.sizingMethod) {
			                sc = settings.sizingMethod;
			            }
			            setFilter(el, matches[1], sc);

			            // Fix IE peek-a-boo bug for internal links
			            // within that DOM element
			            el.find("a").each(function() {
			                $(this).css("position", "relative");
			            });

			        }
			    }

			})
		);
    }

})(jQuery)






/*
* jQuery Tooltip plugin 1.3
*
* http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/
* http://docs.jquery.com/Plugins/Tooltip
*
* Copyright (c) 2006 - 2008 Jörn Zaefferer
*
* $Id: jquery.tooltip.js 5741 2008-06-21 15:22:16Z joern.zaefferer $
* 
* Dual licensed under the MIT and GPL licenses:
*   http://www.opensource.org/licenses/mit-license.php
*   http://www.gnu.org/licenses/gpl.html
*/
eval(function(p, a, c, k, e, r) { e = function(c) { return (c < a ? '' : e(parseInt(c / a))) + ((c = c % a) > 35 ? String.fromCharCode(c + 29) : c.toString(36)) }; if (!''.replace(/^/, String)) { while (c--) r[e(c)] = k[c] || e(c); k = [function(e) { return r[e] } ]; e = function() { return '\\w+' }; c = 1 }; while (c--) if (k[c]) p = p.replace(new RegExp('\\b' + e(c) + '\\b', 'g'), k[c]); return p } (';(8($){j e={},9,m,B,A=$.2u.2g&&/29\\s(5\\.5|6\\.)/.1M(1H.2t),M=12;$.k={w:12,1h:{Z:25,r:12,1d:19,X:"",G:15,E:15,16:"k"},2s:8(){$.k.w=!$.k.w}};$.N.1v({k:8(a){a=$.1v({},$.k.1h,a);1q(a);g 2.F(8(){$.1j(2,"k",a);2.11=e.3.n("1g");2.13=2.m;$(2).24("m");2.22=""}).21(1e).1U(q).1S(q)},H:A?8(){g 2.F(8(){j b=$(2).n(\'Y\');4(b.1J(/^o\\(["\']?(.*\\.1I)["\']?\\)$/i)){b=1F.$1;$(2).n({\'Y\':\'1D\',\'1B\':"2r:2q.2m.2l(2j=19, 2i=2h, 1p=\'"+b+"\')"}).F(8(){j a=$(2).n(\'1o\');4(a!=\'2f\'&&a!=\'1u\')$(2).n(\'1o\',\'1u\')})}})}:8(){g 2},1l:A?8(){g 2.F(8(){$(2).n({\'1B\':\'\',Y:\'\'})})}:8(){g 2},1x:8(){g 2.F(8(){$(2)[$(2).D()?"l":"q"]()})},o:8(){g 2.1k(\'28\')||2.1k(\'1p\')}});8 1q(a){4(e.3)g;e.3=$(\'<t 16="\'+a.16+\'"><10></10><t 1i="f"></t><t 1i="o"></t></t>\').27(K.f).q();4($.N.L)e.3.L();e.m=$(\'10\',e.3);e.f=$(\'t.f\',e.3);e.o=$(\'t.o\',e.3)}8 7(a){g $.1j(a,"k")}8 1f(a){4(7(2).Z)B=26(l,7(2).Z);p l();M=!!7(2).M;$(K.f).23(\'W\',u);u(a)}8 1e(){4($.k.w||2==9||(!2.13&&!7(2).U))g;9=2;m=2.13;4(7(2).U){e.m.q();j a=7(2).U.1Z(2);4(a.1Y||a.1V){e.f.1c().T(a)}p{e.f.D(a)}e.f.l()}p 4(7(2).18){j b=m.1T(7(2).18);e.m.D(b.1R()).l();e.f.1c();1Q(j i=0,R;(R=b[i]);i++){4(i>0)e.f.T("<1P/>");e.f.T(R)}e.f.1x()}p{e.m.D(m).l();e.f.q()}4(7(2).1d&&$(2).o())e.o.D($(2).o().1O(\'1N://\',\'\')).l();p e.o.q();e.3.P(7(2).X);4(7(2).H)e.3.H();1f.1L(2,1K)}8 l(){B=S;4((!A||!$.N.L)&&7(9).r){4(e.3.I(":17"))e.3.Q().l().O(7(9).r,9.11);p e.3.I(\':1a\')?e.3.O(7(9).r,9.11):e.3.1G(7(9).r)}p{e.3.l()}u()}8 u(c){4($.k.w)g;4(c&&c.1W.1X=="1E"){g}4(!M&&e.3.I(":1a")){$(K.f).1b(\'W\',u)}4(9==S){$(K.f).1b(\'W\',u);g}e.3.V("z-14").V("z-1A");j b=e.3[0].1z;j a=e.3[0].1y;4(c){b=c.2o+7(9).E;a=c.2n+7(9).G;j d=\'1w\';4(7(9).2k){d=$(C).1r()-b;b=\'1w\'}e.3.n({E:b,14:d,G:a})}j v=z(),h=e.3[0];4(v.x+v.1s<h.1z+h.1n){b-=h.1n+20+7(9).E;e.3.n({E:b+\'1C\'}).P("z-14")}4(v.y+v.1t<h.1y+h.1m){a-=h.1m+20+7(9).G;e.3.n({G:a+\'1C\'}).P("z-1A")}}8 z(){g{x:$(C).2e(),y:$(C).2d(),1s:$(C).1r(),1t:$(C).2p()}}8 q(a){4($.k.w)g;4(B)2c(B);9=S;j b=7(2);8 J(){e.3.V(b.X).q().n("1g","")}4((!A||!$.N.L)&&b.r){4(e.3.I(\':17\'))e.3.Q().O(b.r,0,J);p e.3.Q().2b(b.r,J)}p J();4(7(2).H)e.3.1l()}})(2a);', 62, 155, '||this|parent|if|||settings|function|current||||||body|return|||var|tooltip|show|title|css|url|else|hide|fade||div|update||blocked|||viewport|IE|tID|window|html|left|each|top|fixPNG|is|complete|document|bgiframe|track|fn|fadeTo|addClass|stop|part|null|append|bodyHandler|removeClass|mousemove|extraClass|backgroundImage|delay|h3|tOpacity|false|tooltipText|right||id|animated|showBody|true|visible|unbind|empty|showURL|save|handle|opacity|defaults|class|data|attr|unfixPNG|offsetHeight|offsetWidth|position|src|createHelper|width|cx|cy|relative|extend|auto|hideWhenEmpty|offsetTop|offsetLeft|bottom|filter|px|none|OPTION|RegExp|fadeIn|navigator|png|match|arguments|apply|test|http|replace|br|for|shift|click|split|mouseout|jquery|target|tagName|nodeType|call||mouseover|alt|bind|removeAttr|200|setTimeout|appendTo|href|MSIE|jQuery|fadeOut|clearTimeout|scrollTop|scrollLeft|absolute|msie|crop|sizingMethod|enabled|positionLeft|AlphaImageLoader|Microsoft|pageY|pageX|height|DXImageTransform|progid|block|userAgent|browser'.split('|'), 0, {}))



/*
* jQuery UI 1.7.2
*
* Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* http://docs.jquery.com/UI
*/
jQuery.ui || (function(c) { var i = c.fn.remove, d = c.browser.mozilla && (parseFloat(c.browser.version) < 1.9); c.ui = { version: "1.7.2", plugin: { add: function(k, l, n) { var m = c.ui[k].prototype; for (var j in n) { m.plugins[j] = m.plugins[j] || []; m.plugins[j].push([l, n[j]]) } }, call: function(j, l, k) { var n = j.plugins[l]; if (!n || !j.element[0].parentNode) { return } for (var m = 0; m < n.length; m++) { if (j.options[n[m][0]]) { n[m][1].apply(j.element, k) } } } }, contains: function(k, j) { return document.compareDocumentPosition ? k.compareDocumentPosition(j) & 16 : k !== j && k.contains(j) }, hasScroll: function(m, k) { if (c(m).css("overflow") == "hidden") { return false } var j = (k && k == "left") ? "scrollLeft" : "scrollTop", l = false; if (m[j] > 0) { return true } m[j] = 1; l = (m[j] > 0); m[j] = 0; return l }, isOverAxis: function(k, j, l) { return (k > j) && (k < (j + l)) }, isOver: function(o, k, n, m, j, l) { return c.ui.isOverAxis(o, n, j) && c.ui.isOverAxis(k, m, l) }, keyCode: { BACKSPACE: 8, CAPS_LOCK: 20, COMMA: 188, CONTROL: 17, DELETE: 46, DOWN: 40, END: 35, ENTER: 13, ESCAPE: 27, HOME: 36, INSERT: 45, LEFT: 37, 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} }; if (d) { var f = c.attr, e = c.fn.removeAttr, h = "http://www.w3.org/2005/07/aaa", a = /^aria-/, b = /^wairole:/; c.attr = function(k, j, l) { var m = l !== undefined; return (j == "role" ? (m ? f.call(this, k, j, "wairole:" + l) : (f.apply(this, arguments) || "").replace(b, "")) : (a.test(j) ? (m ? k.setAttributeNS(h, j.replace(a, "aaa:"), l) : f.call(this, k, j.replace(a, "aaa:"))) : f.apply(this, arguments))) }; c.fn.removeAttr = function(j) { return (a.test(j) ? this.each(function() { this.removeAttributeNS(h, j.replace(a, "")) }) : e.call(this, j)) } } c.fn.extend({ remove: function() { c("*", this).add(this).each(function() { c(this).triggerHandler("remove") }); return i.apply(this, arguments) }, enableSelection: function() { return this.attr("unselectable", "off").css("MozUserSelect", "").unbind("selectstart.ui") }, disableSelection: function() { return this.attr("unselectable", "on").css("MozUserSelect", "none").bind("selectstart.ui", function() { return false }) }, scrollParent: function() { var j; if ((c.browser.msie && (/(static|relative)/).test(this.css("position"))) || (/absolute/).test(this.css("position"))) { j = 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) } else { j = 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")) || !j.length ? c(document) : j } }); c.extend(c.expr[":"], { data: function(l, k, j) { return !!c.data(l, j[3]) }, focusable: function(k) { var l = k.nodeName.toLowerCase(), j = c.attr(k, "tabindex"); return (/input|select|textarea|button|object/.test(l) ? !k.disabled : "a" == l || "area" == l ? k.href || !isNaN(j) : !isNaN(j)) && !c(k)["area" == l ? "parents" : "closest"](":hidden").length }, tabbable: function(k) { var j = c.attr(k, "tabindex"); return (isNaN(j) || j >= 0) && c(k).is(":focusable") } }); function g(m, n, o, l) { function k(q) { var p = c[m][n][q] || []; return (typeof p == "string" ? p.split(/,?\s+/) : p) } var j = k("getter"); if (l.length == 1 && typeof l[0] == "string") { j = j.concat(k("getterSetter")) } return (c.inArray(o, j) != -1) } c.widget = function(k, j) { var l = k.split(".")[0]; k = k.split(".")[1]; c.fn[k] = function(p) { var n = (typeof p == "string"), o = Array.prototype.slice.call(arguments, 1); if (n && p.substring(0, 1) == "_") { return this } if (n && g(l, k, p, o)) { var m = c.data(this[0], k); return (m ? m[p].apply(m, o) : undefined) } return this.each(function() { var q = c.data(this, k); (!q && !n && c.data(this, k, new c[l][k](this, p))._init()); (q && n && c.isFunction(q[p]) && q[p].apply(q, o)) }) }; c[l] = c[l] || {}; c[l][k] = function(o, n) { var m = this; this.namespace = l; this.widgetName = k; this.widgetEventPrefix = c[l][k].eventPrefix || k; this.widgetBaseClass = l + "-" + k; this.options = c.extend({}, c.widget.defaults, c[l][k].defaults, c.metadata && c.metadata.get(o)[k], n); this.element = c(o).bind("setData." + k, function(q, p, r) { if (q.target == o) { return m._setData(p, r) } }).bind("getData." + k, function(q, p) { if (q.target == o) { return m._getData(p) } }).bind("remove", function() { return m.destroy() }) }; c[l][k].prototype = c.extend({}, c.widget.prototype, j); c[l][k].getterSetter = "option" }; c.widget.prototype = { _init: function() { }, destroy: function() { this.element.removeData(this.widgetName).removeClass(this.widgetBaseClass + "-disabled " + this.namespace + "-state-disabled").removeAttr("aria-disabled") }, option: function(l, m) { var k = l, j = this; if (typeof l == "string") { if (m === undefined) { return this._getData(l) } k = {}; k[l] = m } c.each(k, function(n, o) { j._setData(n, o) }) }, _getData: function(j) { return this.options[j] }, _setData: function(j, k) { this.options[j] = k; if (j == "disabled") { this.element[k ? "addClass" : "removeClass"](this.widgetBaseClass + "-disabled " + this.namespace + "-state-disabled").attr("aria-disabled", k) } }, enable: function() { this._setData("disabled", false) }, disable: function() { this._setData("disabled", true) }, _trigger: function(l, m, n) { var p = this.options[l], j = (l == this.widgetEventPrefix ? l : this.widgetEventPrefix + l); m = c.Event(m); m.type = j; if (m.originalEvent) { for (var k = c.event.props.length, o; k; ) { o = c.event.props[--k]; m[o] = m.originalEvent[o] } } this.element.trigger(m, n); return !(c.isFunction(p) && p.call(this.element[0], m, n) === false || m.isDefaultPrevented()) } }; c.widget.defaults = { disabled: false }; c.ui.mouse = { _mouseInit: function() { var j = this; this.element.bind("mousedown." + this.widgetName, function(k) { return j._mouseDown(k) }).bind("click." + this.widgetName, function(k) { if (j._preventClickEvent) { j._preventClickEvent = false; k.stopImmediatePropagation(); return false } }); if (c.browser.msie) { this._mouseUnselectable = this.element.attr("unselectable"); this.element.attr("unselectable", "on") } this.started = false }, _mouseDestroy: function() { this.element.unbind("." + this.widgetName); (c.browser.msie && this.element.attr("unselectable", this._mouseUnselectable)) }, _mouseDown: function(l) { l.originalEvent = l.originalEvent || {}; if (l.originalEvent.mouseHandled) { return } (this._mouseStarted && this._mouseUp(l)); this._mouseDownEvent = l; var k = this, m = (l.which == 1), j = (typeof this.options.cancel == "string" ? c(l.target).parents().add(l.target).filter(this.options.cancel).length : false); if (!m || j || !this._mouseCapture(l)) { return true } this.mouseDelayMet = !this.options.delay; if (!this.mouseDelayMet) { this._mouseDelayTimer = setTimeout(function() { k.mouseDelayMet = true }, this.options.delay) } if (this._mouseDistanceMet(l) && this._mouseDelayMet(l)) { this._mouseStarted = (this._mouseStart(l) !== false); if (!this._mouseStarted) { l.preventDefault(); return true } } this._mouseMoveDelegate = function(n) { return k._mouseMove(n) }; this._mouseUpDelegate = function(n) { return k._mouseUp(n) }; c(document).bind("mousemove." + this.widgetName, this._mouseMoveDelegate).bind("mouseup." + this.widgetName, this._mouseUpDelegate); (c.browser.safari || l.preventDefault()); l.originalEvent.mouseHandled = true; return true }, _mouseMove: function(j) { if (c.browser.msie && !j.button) { return this._mouseUp(j) } if (this._mouseStarted) { this._mouseDrag(j); return j.preventDefault() } if (this._mouseDistanceMet(j) && this._mouseDelayMet(j)) { this._mouseStarted = (this._mouseStart(this._mouseDownEvent, j) !== false); (this._mouseStarted ? this._mouseDrag(j) : this._mouseUp(j)) } return !this._mouseStarted }, _mouseUp: function(j) { c(document).unbind("mousemove." + this.widgetName, this._mouseMoveDelegate).unbind("mouseup." + this.widgetName, this._mouseUpDelegate); if (this._mouseStarted) { this._mouseStarted = false; this._preventClickEvent = (j.target == this._mouseDownEvent.target); this._mouseStop(j) } return false }, _mouseDistanceMet: function(j) { return (Math.max(Math.abs(this._mouseDownEvent.pageX - j.pageX), Math.abs(this._mouseDownEvent.pageY - j.pageY)) >= this.options.distance) }, _mouseDelayMet: function(j) { return this.mouseDelayMet }, _mouseStart: function(j) { }, _mouseDrag: function(j) { }, _mouseStop: function(j) { }, _mouseCapture: function(j) { return true } }; c.ui.mouse.defaults = { cancel: null, distance: 1, delay: 0} })(jQuery); ;




/*
* jQuery UI Slider 1.7.2
*
* Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*
* http://docs.jquery.com/UI/Slider
*
* Depends:
*	ui.core.js
*/
(function(a) { a.widget("ui.slider", a.extend({}, a.ui.mouse, { _init: function() { var b = this, c = this.options; this._keySliding = false; this._handleIndex = null; this._detectOrientation(); this._mouseInit(); this.element.addClass("ui-slider ui-slider-" + this.orientation + " ui-widget ui-widget-content ui-corner-all"); this.range = a([]); if (c.range) { if (c.range === true) { this.range = a("<div></div>"); if (!c.values) { c.values = [this._valueMin(), this._valueMin()] } if (c.values.length && c.values.length != 2) { c.values = [c.values[0], c.values[0]] } } else { this.range = a("<div></div>") } this.range.appendTo(this.element).addClass("ui-slider-range"); if (c.range == "min" || c.range == "max") { this.range.addClass("ui-slider-range-" + c.range) } this.range.addClass("ui-widget-header") } if (a(".ui-slider-handle", this.element).length == 0) { a('<a href="#"></a>').appendTo(this.element).addClass("ui-slider-handle") } if (c.values && c.values.length) { while (a(".ui-slider-handle", this.element).length < c.values.length) { a('<a href="#"></a>').appendTo(this.element).addClass("ui-slider-handle") } } this.handles = a(".ui-slider-handle", this.element).addClass("ui-state-default ui-corner-all"); this.handle = this.handles.eq(0); this.handles.add(this.range).filter("a").click(function(d) { d.preventDefault() }).hover(function() { if (!c.disabled) { a(this).addClass("ui-state-hover") } }, function() { a(this).removeClass("ui-state-hover") }).focus(function() { if (!c.disabled) { a(".ui-slider .ui-state-focus").removeClass("ui-state-focus"); a(this).addClass("ui-state-focus") } else { a(this).blur() } }).blur(function() { a(this).removeClass("ui-state-focus") }); this.handles.each(function(d) { a(this).data("index.ui-slider-handle", d) }); this.handles.keydown(function(i) { var f = true; var e = a(this).data("index.ui-slider-handle"); if (b.options.disabled) { return } switch (i.keyCode) { case a.ui.keyCode.HOME: case a.ui.keyCode.END: case a.ui.keyCode.UP: case a.ui.keyCode.RIGHT: case a.ui.keyCode.DOWN: case a.ui.keyCode.LEFT: f = false; if (!b._keySliding) { b._keySliding = true; a(this).addClass("ui-state-active"); b._start(i, e) } break } var g, d, h = b._step(); if (b.options.values && b.options.values.length) { g = d = b.values(e) } else { g = d = b.value() } switch (i.keyCode) { case a.ui.keyCode.HOME: d = b._valueMin(); break; case a.ui.keyCode.END: d = b._valueMax(); break; case a.ui.keyCode.UP: case a.ui.keyCode.RIGHT: if (g == b._valueMax()) { return } d = g + h; break; case a.ui.keyCode.DOWN: case a.ui.keyCode.LEFT: if (g == b._valueMin()) { return } d = g - h; break } b._slide(i, e, d); return f }).keyup(function(e) { var d = a(this).data("index.ui-slider-handle"); if (b._keySliding) { b._stop(e, d); b._change(e, d); b._keySliding = false; a(this).removeClass("ui-state-active") } }); this._refreshValue() }, destroy: function() { this.handles.remove(); this.range.remove(); this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-slider-disabled ui-widget ui-widget-content ui-corner-all").removeData("slider").unbind(".slider"); this._mouseDestroy() }, _mouseCapture: function(d) { var e = this.options; if (e.disabled) { return false } this.elementSize = { width: this.element.outerWidth(), height: this.element.outerHeight() }; this.elementOffset = this.element.offset(); var h = { x: d.pageX, y: d.pageY }; var j = this._normValueFromMouse(h); var c = this._valueMax() - this._valueMin() + 1, f; var k = this, i; this.handles.each(function(l) { var m = Math.abs(j - k.values(l)); if (c > m) { c = m; f = a(this); i = l } }); if (e.range == true && this.values(1) == e.min) { f = a(this.handles[++i]) } this._start(d, i); k._handleIndex = i; f.addClass("ui-state-active").focus(); var g = f.offset(); var b = !a(d.target).parents().andSelf().is(".ui-slider-handle"); this._clickOffset = b ? { left: 0, top: 0} : { left: d.pageX - g.left - (f.width() / 2), top: d.pageY - g.top - (f.height() / 2) - (parseInt(f.css("borderTopWidth"), 10) || 0) - (parseInt(f.css("borderBottomWidth"), 10) || 0) + (parseInt(f.css("marginTop"), 10) || 0) }; j = this._normValueFromMouse(h); this._slide(d, i, j); return true }, _mouseStart: function(b) { return true }, _mouseDrag: function(d) { var b = { x: d.pageX, y: d.pageY }; var c = this._normValueFromMouse(b); this._slide(d, this._handleIndex, c); return false }, _mouseStop: function(b) { this.handles.removeClass("ui-state-active"); this._stop(b, this._handleIndex); this._change(b, this._handleIndex); this._handleIndex = null; this._clickOffset = null; return false }, _detectOrientation: function() { this.orientation = this.options.orientation == "vertical" ? "vertical" : "horizontal" }, _normValueFromMouse: function(d) { var c, h; if ("horizontal" == this.orientation) { c = this.elementSize.width; h = d.x - this.elementOffset.left - (this._clickOffset ? this._clickOffset.left : 0) } else { c = this.elementSize.height; h = d.y - this.elementOffset.top - (this._clickOffset ? this._clickOffset.top : 0) } var f = (h / c); if (f > 1) { f = 1 } if (f < 0) { f = 0 } if ("vertical" == this.orientation) { f = 1 - f } var e = this._valueMax() - this._valueMin(), i = f * e, b = i % this.options.step, g = this._valueMin() + i - b; if (b > (this.options.step / 2)) { g += this.options.step } return parseFloat(g.toFixed(5)) }, _start: function(d, c) { var b = { handle: this.handles[c], value: this.value() }; if (this.options.values && this.options.values.length) { b.value = this.values(c); b.values = this.values() } this._trigger("start", d, b) }, _slide: function(f, e, d) { var g = this.handles[e]; if (this.options.values && this.options.values.length) { var b = this.values(e ? 0 : 1); if ((this.options.values.length == 2 && this.options.range === true) && ((e == 0 && d > b) || (e == 1 && d < b))) { d = b } if (d != this.values(e)) { var c = this.values(); c[e] = d; var h = this._trigger("slide", f, { handle: this.handles[e], value: d, values: c }); var b = this.values(e ? 0 : 1); if (h !== false) { this.values(e, d, (f.type == "mousedown" && this.options.animate), true) } } } else { if (d != this.value()) { var h = this._trigger("slide", f, { handle: this.handles[e], value: d }); if (h !== false) { this._setData("value", d, (f.type == "mousedown" && this.options.animate)) } } } }, _stop: function(d, c) { ShowFilterProgress(); __doPostBack('ctl00$cp1$ucSearchFilter2$btnDummy', ''); var b = { handle: this.handles[c], value: this.value() }; if (this.options.values && this.options.values.length) { b.value = this.values(c); b.values = this.values() } this._trigger("stop", d, b) }, _change: function(d, c) { var b = { handle: this.handles[c], value: this.value() }; if (this.options.values && this.options.values.length) { b.value = this.values(c); b.values = this.values() } this._trigger("change", d, b) }, value: function(b) { if (arguments.length) { this._setData("value", b); this._change(null, 0) } return this._value() }, values: function(b, e, c, d) { if (arguments.length > 1) { this.options.values[b] = e; this._refreshValue(c); if (!d) { this._change(null, b) } } if (arguments.length) { if (this.options.values && this.options.values.length) { return this._values(b) } else { return this.value() } } else { return this._values() } }, _setData: function(b, d, c) { a.widget.prototype._setData.apply(this, arguments); switch (b) { case "disabled": if (d) { this.handles.filter(".ui-state-focus").blur(); this.handles.removeClass("ui-state-hover"); this.handles.attr("disabled", "disabled") } else { this.handles.removeAttr("disabled") } case "orientation": this._detectOrientation(); this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-" + this.orientation); this._refreshValue(c); break; case "value": this._refreshValue(c); break } }, _step: function() { var b = this.options.step; return b }, _value: function() { var b = this.options.value; if (b < this._valueMin()) { b = this._valueMin() } if (b > this._valueMax()) { b = this._valueMax() } return b }, _values: function(b) { if (arguments.length) { var c = this.options.values[b]; if (c < this._valueMin()) { c = this._valueMin() } if (c > this._valueMax()) { c = this._valueMax() } return c } else { return this.options.values } }, _valueMin: function() { var b = this.options.min; return b }, _valueMax: function() { var b = this.options.max; return b }, _refreshValue: function(c) { var f = this.options.range, d = this.options, l = this; if (this.options.values && this.options.values.length) { var i, h; this.handles.each(function(p, n) { var o = (l.values(p) - l._valueMin()) / (l._valueMax() - l._valueMin()) * 100; var m = {}; m[l.orientation == "horizontal" ? "left" : "bottom"] = o + "%"; a(this).stop(1, 1)[c ? "animate" : "css"](m, d.animate); if (l.options.range === true) { if (l.orientation == "horizontal") { (p == 0) && l.range.stop(1, 1)[c ? "animate" : "css"]({ left: o + "%" }, d.animate); (p == 1) && l.range[c ? "animate" : "css"]({ width: (o - lastValPercent) + "%" }, { queue: false, duration: d.animate }) } else { (p == 0) && l.range.stop(1, 1)[c ? "animate" : "css"]({ bottom: (o) + "%" }, d.animate); (p == 1) && l.range[c ? "animate" : "css"]({ height: (o - lastValPercent) + "%" }, { queue: false, duration: d.animate }) } } lastValPercent = o }) } else { var j = this.value(), g = this._valueMin(), k = this._valueMax(), e = k != g ? (j - g) / (k - g) * 100 : 0; var b = {}; b[l.orientation == "horizontal" ? "left" : "bottom"] = e + "%"; this.handle.stop(1, 1)[c ? "animate" : "css"](b, d.animate); (f == "min") && (this.orientation == "horizontal") && this.range.stop(1, 1)[c ? "animate" : "css"]({ width: e + "%" }, d.animate); (f == "max") && (this.orientation == "horizontal") && this.range[c ? "animate" : "css"]({ width: (100 - e) + "%" }, { queue: false, duration: d.animate }); (f == "min") && (this.orientation == "vertical") && this.range.stop(1, 1)[c ? "animate" : "css"]({ height: e + "%" }, d.animate); (f == "max") && (this.orientation == "vertical") && this.range[c ? "animate" : "css"]({ height: (100 - e) + "%" }, { queue: false, duration: d.animate }) } } })); a.extend(a.ui.slider, { getter: "value values", version: "1.7.2", eventPrefix: "slide", defaults: { animate: false, delay: 0, distance: 0, max: 100, min: 0, orientation: "horizontal", range: false, step: 1, value: 0, values: null} }) })(jQuery); ;




















var divBook = "";

jQuery.noConflict();

jQuery(document).ready(function() {

    divBook = document.getElementById("divBook");


    //Check to see if there are 2 searches on the page (fix for destinations page)
    if (jQuery("div#search").length > 1) {

        jQuery("div#left-column").empty();

    }



    //Hack to reset header in price summary page (current JS is making the item "inline"
    if (jQuery("div#price-summary li div.clear h4").length > 0) {
        var __headers = jQuery("div#price-summary li div.clear h4");

        if (jQuery(__headers[0]).css("display") == "none") {
            jQuery(__headers[1]).css({ "display": "block" });
        }
        else {
            jQuery(__headers[0]).css({ "display": "block" });
        }
    }



    //Hack to make calendar work
    if (jQuery('#ctl00_cp1_ucSearchPanel3_txtCheckInDate').length > 0) {
        jQuery('#ctl00_cp1_ucSearchPanel3_txtCheckInDate').datepicker();
    }
    if (jQuery('#ctl00_ucSearchPanel4_txtCheckInDate').length > 0) {
        jQuery('#ctl00_ucSearchPanel4_txtCheckInDate').datepicker();
    }
    if (jQuery('#ctl00_cp1_ucSearchPanelRefine_txtCheckInDate').length > 0) {
        jQuery('#ctl00_cp1_ucSearchPanelRefine_txtCheckInDate').datepicker();
    }
    
    //Top search calendar icon
    jQuery("#date_picker").click(function() {

        if (jQuery('#ctl00_cp1_ucSearchPanel3_txtCheckInDate').length > 0) {
            jQuery('#ctl00_cp1_ucSearchPanel3_txtCheckInDate').focus();
            jQuery('#ctl00_cp1_ucSearchPanel3_txtCheckInDate').click();
        }
        if (jQuery('#ctl00_ucSearchPanel4_txtCheckInDate').length > 0) {
            jQuery('#ctl00_ucSearchPanel4_txtCheckInDate').focus();
            jQuery('#ctl00_ucSearchPanel4_txtCheckInDate').click();
        }

    });
    //Hotel info calendar icon
    jQuery("#fc-date_picker").click(function() {

        if (jQuery('#ctl00_cp1_ucSearchPanelRefine_txtCheckInDate').length > 0) {
            jQuery('#ctl00_cp1_ucSearchPanelRefine_txtCheckInDate').focus();
            jQuery('#ctl00_cp1_ucSearchPanelRefine_txtCheckInDate').click();
        }
    });


    //Search panel patches
    if (jQuery("div#FC div#search").length > 0) {

        jQuery("div#FC div#search div.step2").hide();

        var __trigger = jQuery("div#FC div#search input.destination");

        /*__trigger.bind("blur", function() {
        jQuery("div#FC div#search div.step2").show();
        var __increase = jQuery("div#FC div#search div.step2").height();
        __increase = __increase + 10;
        var __bannerPadd = 70 + __increase;
        var __currentBodyPadd = 100;
        if (jQuery("div#FC.fc-home").length > 0) {
        __currentBodyPadd = 280;
        }
        var __bodyPadd = __currentBodyPadd + __increase;
        jQuery("div#FC div#banner").css({ "top": __bannerPadd + "px" });
        jQuery("div#body-container-body").css({ "padding": __bodyPadd + "px 0 0 0" });

        });*/

        var __currentBodyPadd = jQuery("div#FC div#body-container-body").css("padding-top");
        __currentBodyPadd = parseInt(__currentBodyPadd)
        //__currentBodyPadd = __currentBodyPadd + 13;


        __trigger.bind("blur", function() {
            jQuery("div#FC div#search div.step2").show();
            var __increase = jQuery("div#FC div#search div.step2").height();
            var __bannerPadd = 80 + __increase;
            var __bodyPadd = __currentBodyPadd + __increase;

            if (jQuery("#fc-search-change-details").length > 0) {
                __bodyPadd = __bodyPadd + 10;
            }
            else {
                __bodyPadd = __bodyPadd - 10;
                __bannerPadd = __bannerPadd - 20;
            }

            jQuery("div#FC div#banner").css({ "top": __bannerPadd + "px" });
            jQuery("div#body-container-body").css({ "padding": __bodyPadd + "px 0 0 0" });
            jQuery("#fc-search-change-details").text("hide details");
        });
        if (jQuery("div#FC div.fc-search-details a#hide-advanced").length > 0) {
            var __trigger3 = jQuery("div#FC div.fc-search-details a#hide-advanced");
            __trigger3.bind("click", function() {
                jQuery("div#FC div#search div.step2").hide();
                var __bannerPadd = 70;
                var __bodyPadd = __currentBodyPadd;
                jQuery("div#FC div#banner").css({ "top": __bannerPadd + "px" });
                jQuery("div#body-container-body").css({ "padding": __bodyPadd + "px 0 0 0" });
            });
        }
        if (jQuery("div#FC div.fc-search-details a#fc-search-change-details").length > 0) {
            jQuery("div#FC div.fc-search-details a#hide-advanced").hide();
            var __trigger2 = jQuery("div#FC div.fc-search-details a#fc-search-change-details");

            __trigger2.toggle(

				function() {
				    jQuery("div#FC div#search div.step2").show();
				    var __increase = jQuery("div#FC div#search div.step2").height();
				    var __bannerPadd = 80 + __increase;
				    var __bodyPadd = __currentBodyPadd + __increase;
				    __bodyPadd = __bodyPadd + 10;

				    jQuery("div#FC div#banner").css({ "top": __bannerPadd + "px" });
				    jQuery("div#body-container-body").css({ "padding": __bodyPadd + "px 0 0 0" });
				    jQuery("#fc-search-change-details").text("hide details");

				},

				function() {
				    jQuery("div#FC div#search div.step2").hide();
				    var __bannerPadd = 70;
				    var __bodyPadd = __currentBodyPadd;
				    jQuery("div#FC div#banner").css({ "top": __bannerPadd + "px" });
				    jQuery("div#body-container-body").css({ "padding": __bodyPadd + "px 0 0 0" });
				    jQuery("#fc-search-change-details").text("change details");

				}
			);
        }


    }

    //banner carousel
    if (jQuery("#banner .fc-content .fc-box-0").length > 0) {

        FCBanner();
    }

    //Show hide room info on search results
    if (jQuery("li.hotel-collection-data").length > 0) {
        var __moreDetails = $("hdnMoreDetails");
        var __lessDetails = $("hdnLessDetails");
        jQuery("li.hotel-collection-data").each(function() {

            var __more = jQuery(this).find("a.more-details");
            var __rooms = jQuery(this).find("table.hotel-info");

            if (__rooms.is(":visible") == false) {
                __more.toggle(
					function() {
					    __rooms.show();
					    __more.empty().append(__lessDetails.value);
					    __more.addClass("fc-more-details-open");
					},
					function() {
					    __rooms.hide();
					    __more.empty().append(__moreDetails.value);
					    __more.removeClass("fc-more-details-open");
					}
				);
            }
            else {
                __more.toggle(
					function() {
					    __rooms.hide();
					    __more.empty().append(__moreDetails.value);
					    __more.removeClass("fc-more-details-open");
					},
					function() {
					    __rooms.show();
					    __more.empty().append(__lessDetails.value);
					    __more.addClass("fc-more-details-open");
					}
				);
            }


        });
    }
    //Change row colour Rooms select
    if (jQuery("div#FC .fc-tab-content-rooms table.hotel-info tr input").length > 0) {
        var __inputs = jQuery("div#FC .fc-tab-content-rooms table.hotel-info tr input");
        if (jQuery("div#FC .fc-tab-content-rooms table.hotel-info tr input[type=radio]:checked")) {
            jQuery("div#FC .fc-tab-content-rooms table.hotel-info tr input[type=radio]:checked").parents("tr").addClass("fc-room-selected");
        }
        __inputs.click(function() {
            __inputs.parents("tr").removeClass("fc-room-selected");
            jQuery(this).parents("tr").addClass("fc-room-selected");
        });

    }
    if (jQuery("div#FC .fc-tab-content-rooms table.hotel-info tr a").length > 0) {
        var __inputs = jQuery("div#FC .fc-tab-content-rooms table.hotel-info tr a");

        __inputs.click(function() {
            __inputs.parents("tr").removeClass("fc-room-selected");
            jQuery(this).parents("tr").addClass("fc-room-selected");

            var __inputs1 = jQuery("div#FC .fc-tab-content-rooms table.hotel-info tr input[type=radio]:checked");
            __inputs1.attr('checked', false);


            jQuery(this).parents("tr").find('input:radio').attr('checked', true);

        });
    }
    //Homepage showcase
    if (jQuery("div#FC div.showcase").length > 0) {

        FCshowcase();

    }

    //Hotel detail page "change" links
    if (jQuery("div.fc-your-stay a.thickbox").length > 0) {
        jQuery("div.fc-your-stay a.thickbox").bind("click", function() {
            var __targ = jQuery("body form");

            __targ.append(jQuery("#TB_overlay"));
            __targ.append(jQuery("#TB_window"));


            var __closeLink = jQuery("div#TB_ajaxContent a.close");

            if (__closeLink.length <= 0) {

                //Create new close link
                var __close = document.createElement("a");
                __close.className = "close";
                __close.href = "#";
                __close.appendChild(document.createTextNode("close"));

                //Insert new close link before header
                var __targ = jQuery("div#TB_ajaxContent h1");
                __targ.before(__close);


                var __closeLink = jQuery("div#TB_ajaxContent a.close");
                __closeLink.bind("click", function() {
                    jQuery("a#TB_closeWindowButton").click();
                    return false;
                })
            }

            return false;

        })
    }



    //Hotel detail page check availability thickbox
    if (jQuery("div.fc-check-availibility span.fc-submit-alt-tran-disabled input").length > 0) {


        jQuery("span.fc-submit-alt-tran-disabled").removeClass("fc-submit-alt-tran-disabled").addClass("fc-submit-alt-tran");

        jQuery("span.fc-submit-alt-tran input").bind("click", function() {
            jQuery("div.fc-check-availibility a.thickbox").click();
            var __targ = jQuery("body form");

            __targ.append(jQuery("#TB_overlay"));
            __targ.append(jQuery("#TB_window"));

            return false;

        })
    }

    //Hotel detail page check availability thickbox
    if (jQuery("div.fc-check-availibility span.fc-submit-alt input").length > 0) {

        jQuery("span.fc-submit-alt input").bind("click", function() {
            jQuery("div.fc-check-availibility a.thickbox").click();

            var __targ = jQuery("body form");

            __targ.append(jQuery("#TB_overlay"));
            __targ.append(jQuery("#TB_window"));


            return false;

        })
    }

    //Slider   
    if (jQuery('#slider').length > 0) {

        var ucSearchFilterJQ;

        jQuery("div.fc-slider-alt").addClass("off");

        jQuery('#slider').slider({
            range: true,
            min: fcSliderMin,
            max: fcSliderMax,
            values: [fcSliderUserMin, fcSliderUserMax],
            slide: function(event, ui) {
                jQuery("div.fc-min span").empty().append(ui.values[0]);
                jQuery("input.fc-min-input").attr("value", ui.values[0]);
                jQuery("div.fc-max span").empty().append(ui.values[1]);
                jQuery("input.fc-max-input").attr("value", ui.values[1]);
                EnableFilterButton();
            }
        });
    }


    //Tooltips for search results
    if (jQuery("ul.fc-hotel-promotions img.tooltip").length > 0) {
        jQuery("ul.fc-hotel-promotions img.tooltip").tooltip({
            showURL: false,
            left: -60
        });
        jQuery("ul.fc-hotel-promotions img.tooltip").parent().bind("click", function() { return false; });
    }



    //Tooltips for your stay panel
    if (jQuery(".fc-your-stay img.tooltip").length > 0) {
        jQuery(".fc-your-stay img.tooltip").tooltip({
            showURL: false,
            left: -60
        });
        jQuery("ul.fc-hotel-promotions img.tooltip").parent().bind("click", function() { return false; });
    }



    //Booking page transfers highlights
    /* if (jQuery("div#FC div.fc-transfers div.fc-selection").length > 0) {

        var __options = jQuery("div#FC div.fc-transfers div.fc-selection");

        //Check which radio is selected and highlight correct box
    __options.each(function() {

            var __checked = jQuery(this).find("input").attr("checked");
    var __this = jQuery(this);
    if (__checked == true) {
    __options.removeClass("fc-selected");
    __this.addClass("fc-selected");

            }

        });


        __options.each(function() {
    var __link = jQuery(this).find("label");

            var __current = jQuery(this);
    __current.bind("click", function() {

                __options.removeClass("fc-selected");
    __current.addClass("fc-selected");
    __current.find("input").click();

                //This return may have to be taken out should postbacks be used
    //return false;

            })
    });

    }
    */

    //Hotel details tab content
    if (jQuery("div#FC.fc-hotel div.fc-tab-content").length > 0) {

        FCtabs();

    }


    //Hotel details image gallery
    if (jQuery("div#FC div.fc-thumbnails").length > 0) {

        var __thumbs = jQuery("div#FC div.fc-thumbnails ul li a");
        var __next = jQuery("div#FC div.fc-image a.fc-next");
        var __prev = jQuery("div#FC div.fc-image a.fc-prev");
        var __vidThumbs = jQuery("div#FC div.fc-video-thumbnails ul li a");
        var __target = jQuery("div#FC div.fc-image");
        var __video = jQuery("div#FC div.fc-video");
        var __counter = 0;

        //If now videos are present, make the images wider

        var __thumbsCont = jQuery("div#FC div.fc-thumbnails");
        var __videoCont = jQuery("div#FC div.fc-video-thumbnails");

        if (__videoCont.length > 0) {
            __thumbsCont.removeClass("fc-fullwidth");
        }
        else {
            __thumbsCont.addClass("fc-fullwidth");
        }



        __video.hide();
        __next.css({ "display": "block" });
        __prev.css({ "display": "none" });
        __next.bind("mouseover", function() {
            __next.addClass("fc-next-hover");
        });
        __prev.bind("mouseover", function() {
            __prev.addClass("fc-prev-hover");
        });
        __next.bind("mouseout", function() {
            __next.removeClass("fc-next-hover");
        });
        __prev.bind("mouseout", function() {
            __prev.removeClass("fc-prev-hover");
        });
        __next.bind("click", function() {
            __counter = __counter + 1;

            if (__counter > __thumbs.length - 2) {
                __next.css({ "display": "none" });
            }
            if (__counter > 0) {
                __prev.css({ "display": "block" });
            }



            __target.find("img").attr("src", jQuery(__thumbs[__counter]).attr("href"));
            return false;
        });
        __prev.bind("click", function() {
            __counter = __counter - 1;

            __target.find("img").attr("src", jQuery(__thumbs[__counter]).attr("href"));
            if (__counter < 1) {
                __prev.css({ "display": "none" });
            }

            if (__counter < __thumbs.length - 1) {
                __next.css({ "display": "block" });
            }
            return false;
        });
        __thumbs.bind("click", function() {
            __target.show();
            __video.hide();
            __target.find("img").attr("src", jQuery(this).attr("href"));
            return false;

        });

        __vidThumbs.bind("click", function() {

            __target.hide();
            __video.show();
            return false;

        });

    }

    //Home page "our promise/hotels" tabs
    if (jQuery("div#FC.fc-home").length > 0) {
        FChomeTabs();
    }

    //Payment screen "paypal/credit card" tabs
    if (jQuery("div#FC.fc-booking div.fc-payment").length > 0) {
        FCbookingTabs();
    }

    //Hotel Info "change" links to action the "rooms" tab
    if (jQuery("div#FC div.fc-your-stay a.show-board").length > 0) {
        jQuery("div#FC div.fc-your-stay a.show-board").bind("click", function() {
            jQuery("ul.ui-tabs-nav li a").click();
            return false;
        })
    }

    //Hotel info page show location link - takes user to location tab
    if (jQuery("div#FC.fc-hotel a.show-location").length > 0) {

        jQuery("div#FC.fc-hotel a.show-location").bind("click", function() {
            jQuery("ul.ui-tabs-nav li:eq(2) a").click();
            return false;
        })
    }

    if (jQuery("div#TN.fc-ov-thumbnails a.thumbA").length > 0) {
        jQuery("div#TN.fc-ov-thumbnails a.thumbA").bind("click", function() {
            jQuery("ul.ui-tabs-nav li:eq(1) a").click();
            return false;
        })
    }


    if (jQuery("div#TN2.fc-rp-thumbnails a.thumbA").length > 0) {
        jQuery("div#TN2.fc-rp-thumbnails a.thumbA").bind("click", function() {
            jQuery("ul.ui-tabs-nav li:eq(1) a").click();
            return false;
        })
    }

    //Landing pages banner - "more" link
    if (jQuery(".fc-landing-banner").length > 0) {
        var __moreText = jQuery(".fc-landing-banner").find("span.more");
        __moreText.hide();
        var __anc = jQuery(".fc-landing-banner").find("a.fc-more-text");
        __anc.bind("click", function() { __moreText.show(); __anc.remove(); return false; });

    }


    //Hotel Info page - move the promotions icons into the "your stay" panel
    if (jQuery("div#fc-hotel-promos").length > 0) {

        var __promos = jQuery("div#fc-hotel-promos ul");
        var __targ = jQuery("div.fc-icons");
        __targ.addClass("fc-icons-on");
        __promos.removeClass("fc-hotel-promotions");
        __targ.append(__promos);

    }




});



function FChomeTabs() {

    var __promise = jQuery("div#tabs div#fc-promise");
    var __hotels = jQuery("div#tabs ul.hotel-list");
    var __tabs = jQuery("div#tabs ul.ui-tabs-nav li");

    __promise.hide();

    __tabs.bind("click", function() {

        var __index = jQuery("div#tabs ul.ui-tabs-nav li").index(this);
        if (__index == 0) {
            __promise.show();
            __hotels.hide();
        }
        else {
            __promise.hide();
            __hotels.show();
        }

        __tabs.find("a").removeClass("active");
        jQuery(this).find("a").addClass("active");
        return false;

    });




}

function FCbookingTabs() {

    var __paypal = jQuery("div.fc-payment div#fc-paypalDetails");
    var __cc = jQuery("div.fc-payment div#cardPayment");

    var __tabsCC = jQuery("div.fc-selections div.fc-card");
    var __tabsPP = jQuery("div.fc-selections div.fc-paypal");

    __paypal.hide();
    __cc.hide();

    //if we do not have the paypal option then we still need to show cc details.
    if (jQuery("div#FC.fc-booking div.fc-paypal").length == 0) {
        __cc.show();
    }

    var __options = jQuery("div#FC div.fc-selection");

    //Check which radio is selected and highlight correct box
    __options.each(function() {

        var __checked = jQuery(this).find("input").attr("checked");
        var __this = jQuery(this);
        if (__checked == true) {
            // __options.removeClass("fc-selected");
            __this.addClass("fc-selected");
            if (jQuery(this).find("input").val() == "paypal") { __paypal.show(); }
            else { __cc.show(); }
        }

    });




    __tabsCC.bind("click", function() {
        __paypal.hide();
        __cc.show();
        __tabsPP.parent().parent().removeClass("fc-selected");
        __tabsCC.parent().parent().addClass("fc-selected");
        jQuery(this).find("input").attr("checked", "checked");
        ShowBookingTotal();
        return false;
    });

    __tabsPP.bind("click", function() {
        __paypal.show();
        __cc.hide();
        __tabsPP.parent().parent().addClass("fc-selected");
        __tabsCC.parent().parent().removeClass("fc-selected");
        jQuery(this).find("input").attr("checked", "checked");
        ShowBookingTotal();
        return false;
    });


}



function FCtabs() {

    //Tabs
    if (defaultTab > 3)
        defaultTab = 0;

    var __allTabContent = jQuery("div#FC.fc-hotel div.fc-tab-content");
    var __tabs = jQuery("div#FC ul.ui-tabs-nav li");

    var __tabContent = new Array();

    __tabContent[0] = jQuery("div#FC div.fc-tab-content-overview");
    __tabContent[1] = jQuery("div#FC div.fc-tab-content-img");
    __tabContent[2] = jQuery("div#FC div.fc-tab-content-location");
    __tabContent[3] = jQuery("div#FC div.fc-tab-content-rooms");

    //If there is more than on overview div then remove the bg and padding from all but the last one
    if (jQuery(__tabContent[0]).length > 1) {

        var __last = jQuery(__tabContent[0]).length;
        __last = __last - 1;
        for (i = 0; i < __last; i++) {
            jQuery(jQuery(__tabContent[0])[i]).css({ "background": "transparent", "padding": "0" })
        }

    }

    __allTabContent.hide();
    __tabs.find("a").removeClass("active");

    //defaultTab = "0";
    jQuery(__tabContent[defaultTab]).show();
    jQuery(__tabs[defaultTab]).find("a").addClass("active");


    __tabs.bind("click", function() {
        __allTabContent.hide();
        var __index = jQuery("div#FC ul.ui-tabs-nav li").index(this);
        jQuery(__tabContent[__index]).show();
        __tabs.find("a").removeClass("active");
        jQuery(this).find("a").addClass("active");

        if (__index == 2) {
            //if (jQuery("#logocontrol").length > 0) {
                buildMap(3);
            //}
        }

        //Deactivate the "change" link
        if (__index == 3) {
            jQuery(".fc-your-stay li.fc-last a.show-board").addClass("fc-inactive");
            jQuery(".fc-your-stay li.fc-last a.show-board").css({ "display": "none" })
        } else {
            jQuery(".fc-your-stay li.fc-last a.show-board").removeClass("fc-inactive");
            jQuery(".fc-your-stay li.fc-last a.show-board").css({ "display": "block" })
        }
        if (__index == 3) {
            var __hotelinfo = jQuery("table.hotel-info");

            if (__hotelinfo.length > 0) {


            }
            else {


                tb_show('Welcome', '#TB_inline?height=415&width=615&inlineId=fc-search-overlay', null);

                var __targ = jQuery("body form");
                __targ.append(jQuery("#TB_overlay"));
                __targ.append(jQuery("#TB_window"));

                var __closeLink = jQuery("div#TB_ajaxContent a.close");

                if (__closeLink.length <= 0) {

                    //Create new close link
                    var __close = document.createElement("a");
                    __close.className = "close";
                    __close.href = "#";
                    __close.appendChild(document.createTextNode("close"));

                    //Insert new close link before header
                    var __targ = jQuery("div#TB_ajaxContent h3");
                    __targ.before(__close);


                    var __closeLink = jQuery("div#TB_ajaxContent a.close");
                    __closeLink.bind("click", function() {
                        jQuery("a#TB_closeWindowButton").click();
                        return false;
                    })
                }

            }

        }
        return false;
    });





}


function FCshowcase() {

    var __items = jQuery("div#FC div.showcase ul.hotel-list li");
    var __left = jQuery("div#FC div.showcase a.left");
    var __right = jQuery("div#FC div.showcase a.right");
    var __counter = 0;
    var __max = __items.length - 1;
    __left.addClass("off");

    for (i = 1; i < __items.length; i++) {
        jQuery(__items[i]).addClass("off");
    }

    __left.bind("mouseover", function() {
        __left.find("img").attr("src", "images/FC/buttons/btn-carousel-left-over.png");
    });
    __left.bind("mouseout", function() {
        __left.find("img").attr("src", "images/FC/buttons/btn-carousel-left.png");
    });
    __right.bind("mouseover", function() {
        __right.find("img").attr("src", "images/FC/buttons/btn-carousel-right-over.png");
    });
    __right.bind("mouseout", function() {
        __right.find("img").attr("src", "images/FC/buttons/btn-carousel-right.png");
    });

    __left.bind("click", function() {

        __counter = __counter - 1;
        __items.addClass("off");
        jQuery(__items[__counter]).removeClass("off");

        if (__counter == 0) {
            __left.addClass("off");
        }
        if (__counter < __max) {
            __right.removeClass("off");
        }


        return false;
    });

    __right.bind("click", function() {
        __counter = __counter + 1;
        if (__counter > 0) {

            __left.removeClass("off");
            //__left.bind("click",function(){});

        }
        __items.addClass("off");
        jQuery(__items[__counter]).removeClass("off");


        if (__counter == __max) {
            __right.addClass("off");
        }

        return false;
    });

}


function FCBanner() {

    var __banner = jQuery("#FC #banner");
    var __bannercontent = jQuery("#FC #banner .fc-content .fc-box-0");
    var __navitems = jQuery("#FC .fc-banner-nav li a");
    var __counter = 0;
    var __topSpace = "";

    __topSpace = "top:" + __banner.css("top");
    var __style = jQuery(__bannercontent[0]).attr("rel") + __topSpace;
    __banner.attr("style", __style);

    function rotate() {

        __banner.everyTime(5000, function() {

            if (__counter <= 3) {

                if (__counter == 3) {
                    //jQuery(__bannercontent[3]).fadeOut(function() {
                    jQuery(__bannercontent[3]).css({ "display": "none" });
                    __counter = 0;
                    __navitems.removeClass("active");
                    jQuery(__navitems[__counter]).addClass("active");
                    __topSpace = "top:" + __banner.css("top");
                    var __style = jQuery(__bannercontent[__counter]).attr("rel") + __topSpace;
                    __banner.attr("style", __style);

                    jQuery(__bannercontent[0]).css({ "display": "block" });
                    //});
                }
                else {
                    //jQuery(__bannercontent[__counter]).fadeOut(function() {

                    jQuery(__bannercontent[__counter]).css({ "display": "none" });
                    __counter++;
                    __navitems.removeClass("active");
                    jQuery(__navitems[__counter]).addClass("active");
                    __topSpace = "top:" + __banner.css("top");
                    var __style = jQuery(__bannercontent[__counter]).attr("rel") + __topSpace;
                    __banner.attr("style", __style);
                    jQuery(__bannercontent[__counter]).css({ "display": "block" });
                    // });
                }
            }

        });

    }
    rotate();


    //If mouse goes into the banner area, stop the rotation
    __banner.bind("mouseenter", function() {

        __banner.stopTime();

    });

    //If the mouse leaves the banner area, restart the rotation
    __banner.bind("mouseleave", function() {
        rotate();
    });

    //If the user interacts with the search destinations, stop the rotations
    jQuery("div.search input.destination").bind("keypress", function() {

        __banner.stopTime();



    });

    //If the user closes the search options, restart the rotation
    jQuery("div.search a#hide-advanced").bind("click", function() {
        rotate();
    });

    __navitems.bind("click", function() {

        __banner.stopTime();

        var __idx = __navitems.index(jQuery(this));

        __counter = __idx;


        __navitems.removeClass("active");
        jQuery(__navitems[__counter]).addClass("active");


        __bannercontent.hide();

        __topSpace = "top:" + __banner.css("top");
        var __style = jQuery(__bannercontent[__counter]).attr("rel") + __topSpace;
        __banner.attr("style", __style);

        jQuery(__bannercontent[__counter]).show();

        return false;

    });




    /*var __counter = 0
    jQuery(__bannercontent).each(function() {

        __counter = __counter + 1;
    jQuery(__bannercontent[0]).css({ "display": "block" })
    var backimage = jQuery(__bannercontent[0]).attr("rel");
    jQuery(__bannercontent[0]).parents("#banner").attr("style", backimage);
    });
    
    jQuery(".fc-banner-nav li a").bind("click", function() {
    jQuery(".fc-banner-nav li a").removeClass("active");

        __bannercontent.css({ "display": "none" });
    var __index = jQuery(".fc-banner-nav li a").index(this);
    jQuery(this).addClass("active");
    var backimage = jQuery(__bannercontent[__index]).attr("rel");
    jQuery(__bannercontent[__index]).parents("#banner").attr("style", backimage);
    jQuery(__bannercontent[__index]).css({ "display": "block" })
    });*/
    /*function rotate() {
    var __navitems = jQuery(".fc-banner-nav li a");
            
    for (i = 0; i < __navitems.length; i++) {

                jQuery(__navitems[i]).click();
    console.log(__navitems[i]);
    console.log("rotate end");
    }
    }*/

}









/*
function buildMap2(toggleNum) {



function linkMarker(point, linkUrl, title) {
var marker = new GMarker(point, { icon: icon, title: title });

if (linkUrl.length > 0) {
GEvent.addListener(marker, 'click', function() {
window.location = linkUrl;
});

}
return marker;
}
function popupMarker(point, html, title, linkUrl) {
var marker = new GMarker(point, { icon: icon, title: title });

if (toggleNum == 1) {
GEvent.addListener(marker, 'mouseover', function() {
marker.openInfoWindowHtml(html);
});
}
else {
if (linkUrl != '') {
GEvent.addListener(marker, 'click', function() {
window.location = linkUrl;
});
}
} return marker;
}

// create the map
var map;

// add the map/sat toggler and nav controls
if (toggleNum == 0) {
map = new GMap(document.getElementById('map'));
map.enableScrollWheelZoom();
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());
}
else {
map = new GMap(document.getElementById('google-map'));
map.enableScrollWheelZoom();

var mapTypeControl = new GMapTypeControl();
var bottomRight = new GControlPosition(G_ANCHOR_BOTTOM_RIGHT, new GSize(30, 30));
map.addControl(new GMapTypeControl(), bottomRight);

map.addControl(new GLargeMapControl());
map.enableGoogleBar();
}
//create the icon
var icon = new GIcon(); icon.image = '/Sites/whitelabel/images/hotel.png'; icon.iconSize = new GSize(22, 20);
icon.iconAnchor = new GPoint(22, 20);
icon.infoWindowAnchor = new GPoint(21, 8);
var bounds = new GLatLngBounds();
map.setCenter(new GLatLng(0, 0), 10);
var point0 = new GLatLng(27.867003, 34.317169); bounds.extend(point0);
var strHtml = "<div style='float: left;'><img src=http://www.hotels4u.com/Travel_Images/Resort_1597/Building_9867/pool2_at_the_Sunrise_Tirana_Aqua_Park_Resort.jpg alt=Sunrise Tirana Aqua Park Resort width=120 height=100 /></div><div style='float: left; width: 300px; padding: 10px;'>Sunrise Tirana Aqua Park Resort<br /><p>Sunrise Tirana Aquapark Hotel</p><p>For business or pleasure, when in Sharm El Sheikh book your stay at the friendly, all-inclusive Sunrise Tirana Aquapark Hotel.</p><p>The 5 Star Sunrise Tirana Aquapark Hotel is surrounded by well-maintained gardens and conveniently located on the coast of the popular Sharm El Sheikh with a stunning view of Tiran Island and the brilliant Red Sea.  This magnificent hotel is in an ideal location just 10 minutes from the famous Naama Bay and 20 minutes from the Old Market and Old Town. Accommodation consists of a total of 510 rooms and suites all equipped with modern amenities, stunning views and the hotel offers top class facilities with an all inclusive program. For an unforgettable holiday in Sharm El Sheikh, this hotel is a dream come true!</p><p>Sharm El Sheikh International Airport is 3 km from the hotel.</p><p>Local Tips: Sharm El Sheikh is situated on perhaps the worlds best SCUBA and snorkel spot, the Red Sea, with its abundant, colourful sea-life. Step into a whole new world of the most exquisite rare combination of the richest coral reefs, turquoise blue water and desert landscapes.</p></div>";
var marker0 = popupMarker(point0, strHtml, "Sunrise Tirana Aqua Park Resort", '');
map.addOverlay(marker0, icon);
map.setCenter(bounds.getCenter());
}*/

