/*
 * jQuery UI Accordion 1.6
 * 
 * Copyright (c) 2007 JÃ¶rn Zaefferer
 *
 * http://docs.jquery.com/UI/Accordion
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 *
 * Revision: $Id: jquery.accordion.js 4878 2008-03-08 11:58:32Z joern.zaefferer $
 *
 */

;(function($) {
	
// If the UI scope is not available, add it
$.ui = $.ui || {};

$.fn.extend({
	accordion: function(options, data) {
		var args = Array.prototype.slice.call(arguments, 1);

		return this.each(function() {
			if (typeof options == "string") {
				var accordion = $.data(this, "ui-accordion");
				accordion[options].apply(accordion, args);
			// INIT with optional options
			} else if (!$(this).is(".ui-accordion"))
				$.data(this, "ui-accordion", new $.ui.accordion(this, options));
		});
	},
	// deprecated, use accordion("activate", index) instead
	activate: function(index) {
		return this.accordion("activate", index);
	}
});

$.ui.accordion = function(container, options) {
	
	// setup configuration
	this.options = options = $.extend({}, $.ui.accordion.defaults, options);
	this.element = container;
	
	$(container).addClass("ui-accordion");
	
	if ( options.navigation ) {
		var current = $(container).find("a").filter(options.navigationFilter);
		if ( current.length ) {
			if ( current.filter(options.header).length ) {
				options.active = current;
			} else {
				options.active = current.parent().parent().prev();
				current.addClass("current");
			}
		}
	}
	
	// calculate active if not specified, using the first header
	options.headers = $(container).find(options.header);
	options.active = findActive(options.headers, options.active);

	if ( options.fillSpace ) {
		var maxHeight = $(container).parent().height();
		options.headers.each(function() {
			maxHeight -= $(this).outerHeight();
		});
		var maxPadding = 0;
		options.headers.next().each(function() {
			maxPadding = Math.max(maxPadding, $(this).innerHeight() - $(this).height());
		}).height(maxHeight - maxPadding);
	} else if ( options.autoheight ) {
		var maxHeight = 0;
		options.headers.next().each(function() {
			maxHeight = Math.max(maxHeight, $(this).outerHeight());
		}).height(maxHeight);
	}

	options.headers
		.not(options.active || "")
		.next()
		.hide();
	options.active.parent().andSelf().addClass(options.selectedClass);
	
	if (options.event)
		$(container).bind((options.event) + ".ui-accordion", clickHandler);
};

$.ui.accordion.prototype = {
	activate: function(index) {
		// call clickHandler with custom event
		clickHandler.call(this.element, {
			target: findActive( this.options.headers, index )[0]
		});
	},
	
	enable: function() {
		this.options.disabled = false;
	},
	disable: function() {
		this.options.disabled = true;
	},
	destroy: function() {
		this.options.headers.next().css("display", "");
		if ( this.options.fillSpace || this.options.autoheight ) {
			this.options.headers.next().css("height", "");
		}
		$.removeData(this.element, "ui-accordion");
		$(this.element).removeClass("ui-accordion").unbind(".ui-accordion");
	}
}

function scopeCallback(callback, scope) {
	return function() {
		return callback.apply(scope, arguments);
	};
}

function completed(cancel) {
	// if removed while animated data can be empty
	if (!$.data(this, "ui-accordion"))
		return;
	var instance = $.data(this, "ui-accordion");
	var options = instance.options;
	options.running = cancel ? 0 : --options.running;
	if ( options.running )
		return;
	if ( options.clearStyle ) {
		options.toShow.add(options.toHide).css({
			height: "",
			overflow: ""
		});
	}
	$(this).triggerHandler("change.ui-accordion", [options.data], options.change);
}

function toggle(toShow, toHide, data, clickedActive, down) {
	var options = $.data(this, "ui-accordion").options;
	options.toShow = toShow;
	options.toHide = toHide;
	options.data = data;
	var complete = scopeCallback(completed, this);
	
	// count elements to animate
	options.running = toHide.size() == 0 ? toShow.size() : toHide.size();
	
	if ( options.animated ) {
		if ( !options.alwaysOpen && clickedActive ) {
			$.ui.accordion.animations[options.animated]({
				toShow: jQuery([]),
				toHide: toHide,
				complete: complete,
				down: down,
				autoheight: options.autoheight
			});
		} else {
			$.ui.accordion.animations[options.animated]({
				toShow: toShow,
				toHide: toHide,
				complete: complete,
				down: down,
				autoheight: options.autoheight
			});
		}
	} else {
		if ( !options.alwaysOpen && clickedActive ) {
			toShow.toggle();
		} else {
			toHide.hide();
			toShow.show();
		}
		complete(true);
	}
}

function clickHandler(event) {
	var options = $.data(this, "ui-accordion").options;
	if (options.disabled)
		return false;
	
	// called only when using activate(false) to close all parts programmatically
	if ( !event.target && !options.alwaysOpen ) {
		options.active.parent().andSelf().toggleClass(options.selectedClass);
		var toHide = options.active.next(),
			data = {
				instance: this,
				options: options,
				newHeader: jQuery([]),
				oldHeader: options.active,
				newContent: jQuery([]),
				oldContent: toHide
			},
			toShow = options.active = $([]);
		toggle.call(this, toShow, toHide, data );
		return false;
	}
	// get the click target
	var clicked = $(event.target);
	
	// due to the event delegation model, we have to check if one
	// of the parent elements is our actual header, and find that
	if ( clicked.parents(options.header).length )
		while ( !clicked.is(options.header) )
			clicked = clicked.parent();
	
	var clickedActive = clicked[0] == options.active[0];
	
	// if animations are still active, or the active header is the target, ignore click
	if (options.running || (options.alwaysOpen && clickedActive))
		return false;
	if (!clicked.is(options.header))
		return;

	// switch classes
	options.active.parent().andSelf().toggleClass(options.selectedClass);
	if ( !clickedActive ) {
		clicked.parent().andSelf().addClass(options.selectedClass);
	}

	// find elements to show and hide
	var toShow = clicked.next(),
		toHide = options.active.next(),
		//data = [clicked, options.active, toShow, toHide],
		data = {
			instance: this,
			options: options,
			newHeader: clicked,
			oldHeader: options.active,
			newContent: toShow,
			oldContent: toHide
		},
		down = options.headers.index( options.active[0] ) > options.headers.index( clicked[0] );
	
	options.active = clickedActive ? $([]) : clicked;
	toggle.call(this, toShow, toHide, data, clickedActive, down );

	return false;
};

function findActive(headers, selector) {
	return selector != undefined
		? typeof selector == "number"
			? headers.filter(":eq(" + selector + ")")
			: headers.not(headers.not(selector))
		: selector === false
			? $([])
			: headers.filter(":eq(0)");
}

$.extend($.ui.accordion, {
	defaults: {
		selectedClass: "selected",
		alwaysOpen: true,
		animated: 'slide',
		event: "click",
		header: "a",
		autoheight: true,
		running: 0,
		navigationFilter: function() {
			return this.href.toLowerCase() == location.href.toLowerCase();
		}
	},
	animations: {
		slide: function(options, additions) {
			options = $.extend({
				easing: "swing",
				duration: 300
			}, options, additions);
			if ( !options.toHide.size() ) {
				options.toShow.animate({height: "show"}, options);
				return;
			}
			var hideHeight = options.toHide.height(),
				showHeight = options.toShow.height(),
				difference = showHeight / hideHeight;
			options.toShow.css({ height: 0, overflow: 'hidden' }).show();
			options.toHide.filter(":hidden").each(options.complete).end().filter(":visible").animate({height:"hide"},{
				step: function(now) {
					var current = (hideHeight - now) * difference;
					if ($.browser.msie || $.browser.opera) {
						current = Math.ceil(current);
					}
					options.toShow.height( current );
				},
				duration: options.duration,
				easing: options.easing,
				complete: function() {
					if ( !options.autoheight ) {
						options.toShow.css("height", "auto");
					}
					options.complete();
				}
			});
		},
		bounceslide: function(options) {
			this.slide(options, {
				easing: options.down ? "bounceout" : "swing",
				duration: options.down ? 1000 : 200
			});
		},
		easeslide: function(options) {
			this.slide(options, {
				easing: "easeinout",
				duration: 700
			})
		}
	}
});

})(jQuery);

/*
 * Tabs 3 - New Wave Tabs
 *
 * Copyright (c) 2007 Klaus Hartl (stilbuero.de)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Tabs
 */

(function($) {

    // if the UI scope is not availalable, add it
    $.ui = $.ui || {};

    // tabs API methods
    $.fn.tabs = function() {
        var method = typeof arguments[0] == 'string' && arguments[0];
        var args = method && Array.prototype.slice.call(arguments, 1) || arguments;

        return this.each(function() {
            if (method) {
                var tabs = $.data(this, 'ui-tabs');
                tabs[method].apply(tabs, args);
            } else
                new $.ui.tabs(this, args[0] || {});
        });
    };

    // tabs class
    $.ui.tabs = function(el, options) {
        var self = this;

        this.element = el;

        this.options = $.extend({

            // basic setup
            selected: 0,
            unselect: options.selected === null,
            event: 'click',
            disabled: [],
            cookie: null, // pass options object as expected by cookie plugin: { expires: 7, path: '/', domain: 'jquery.com', secure: true }
            // TODO bookmarkable: $.ajaxHistory ? true : false,

            // Ajax
            spinner: 'Loading&#8230;',
            cache: false,
            idPrefix: 'ui-tabs-',
            ajaxOptions: {},

            // animations
            fx: null, /* e.g. { height: 'toggle', opacity: 'toggle', duration: 200 } */

            // templates
            tabTemplate: '<li><a href="#{href}"><span>#{label}</span></a></li>',
            panelTemplate: '<div></div>',

            // CSS classes
            navClass: 'ui-tabs-nav',
            selectedClass: 'ui-tabs-selected',
            unselectClass: 'ui-tabs-unselect',
            disabledClass: 'ui-tabs-disabled',
            panelClass: 'ui-tabs-panel',
            hideClass: 'ui-tabs-hide',
            loadingClass: 'ui-tabs-loading'

        }, options);

        this.options.event += '.ui-tabs'; // namespace event
        this.options.cookie = $.cookie && $.cookie.constructor == Function && this.options.cookie;

        $(el).bind('setData.ui-tabs', function(event, key, value) {
            self.options[key] = value;
            this.tabify();
        }).bind('getData.ui-tabs', function(event, key) {
            return self.options[key];
        });

        // save instance for later
        $.data(el, 'ui-tabs', this);

        // create tabs
        this.tabify(true);
    };

    // instance methods
    $.extend($.ui.tabs.prototype, {
        tabId: function(a) {
            return a.title && a.title.replace(/\s/g, '_').replace(/[^A-Za-z0-9\-_:\.]/g, '')
                || this.options.idPrefix + $.data(a);
        },
        ui: function(tab, panel) {
            return {
                instance: this,
                options: this.options,
                tab: tab,
                panel: panel
            };
        },
        tabify: function(init) {

            this.$lis = $('li:has(a[href])', this.element);
            this.$tabs = this.$lis.map(function() { return $('a', this)[0]; });
            this.$panels = $([]);

            var self = this, o = this.options;

            this.$tabs.each(function(i, a) {
                // inline tab
                if (a.hash && a.hash.replace('#', '')) // Safari 2 reports '#' for an empty hash
                    self.$panels = self.$panels.add(a.hash);
                // remote tab
                else if ($(a).attr('href') != '#') { // prevent loading the page itself if href is just "#"
                    $.data(a, 'href.ui-tabs', a.href); // required for restore on destroy
                    $.data(a, 'load.ui-tabs', a.href); // mutable
                    var id = self.tabId(a);
                    a.href = '#' + id;
                    var $panel = $('#' + id);
                    if (!$panel.length) {
                        $panel = $(o.panelTemplate).attr('id', id).addClass(o.panelClass)
                            .insertAfter( self.$panels[i - 1] || self.element );
                        $panel.data('destroy.ui-tabs', true);
                    }
                    self.$panels = self.$panels.add( $panel );
                }
                // invalid tab href
                else
                    o.disabled.push(i + 1);
            });

            if (init) {

                // attach necessary classes for styling if not present
                $(this.element).hasClass(o.navClass) || $(this.element).addClass(o.navClass);
                this.$panels.each(function() {
                    var $this = $(this);
                    $this.hasClass(o.panelClass) || $this.addClass(o.panelClass);
                });

                // disabled tabs
                for (var i = 0, index; index = o.disabled[i]; i++)
                    this.disable(index);

                // Try to retrieve selected tab:
                // 1. from fragment identifier in url if present
                // 2. from cookie
                // 3. from selected class attribute on <li>
                // 4. otherwise use given "selected" option
                // 5. check if tab is disabled
                this.$tabs.each(function(i, a) {
                    if (location.hash) {
                        if (a.hash == location.hash) {
                            o.selected = i;
                            // prevent page scroll to fragment
                            //if (($.browser.msie || $.browser.opera) && !o.remote) {
                            if ($.browser.msie || $.browser.opera) {
                                var $toShow = $(location.hash), toShowId = $toShow.attr('id');
                                $toShow.attr('id', '');
                                setTimeout(function() {
                                    $toShow.attr('id', toShowId); // restore id
                                }, 500);
                            }
                            scrollTo(0, 0);
                            return false; // break
                        }
                    } else if (o.cookie) {
                        var index = parseInt($.cookie('ui-tabs' + $.data(self.element)),10);
                        if (index && self.$tabs[index]) {
                            o.selected = index;
                            return false; // break
                        }
                    } else if ( self.$lis.eq(i).hasClass(o.selectedClass) ) {
                        o.selected = i;
                        return false; // break
                    }
                });
                var n = this.$lis.length;
                while (this.$lis.eq(o.selected).hasClass(o.disabledClass) && n) {
                    o.selected = ++o.selected < this.$lis.length ? o.selected : 0;
                    n--;
                }
                if (!n) // all tabs disabled, set option unselect to true
                    o.unselect = true;

                // highlight selected tab
                this.$panels.addClass(o.hideClass);
                this.$lis.removeClass(o.selectedClass);
                if (!o.unselect) {
                    this.$panels.eq(o.selected).show().removeClass(o.hideClass); // use show and remove class to show in any case no matter how it has been hidden before
                    this.$lis.eq(o.selected).addClass(o.selectedClass);
                }

                // load if remote tab
                var href = !o.unselect && $.data(this.$tabs[o.selected], 'load.ui-tabs');
                if (href)
                    this.load(o.selected, href);

                // disable click if event is configured to something else
                if (!(/^click/).test(o.event))
                    this.$tabs.bind('click', function(e) { e.preventDefault(); });

            }

            var hideFx, showFx, baseFx = { 'min-width': 0, duration: 1 }, baseDuration = 'normal';
            if (o.fx && o.fx.constructor == Array) {
                hideFx = o.fx[0] || baseFx, showFx = o.fx[1] || baseFx;
            } else {
                hideFx = showFx = o.fx || baseFx;
            }
            // reset some styles to maintain print style sheets etc.
            var resetCSS = { display: '', overflow: '', height: '' };
            if (!$.browser.msie) // not in IE to prevent ClearType font issue
                resetCSS.opacity = '';

            // Hide a tab, animation prevents browser scrolling to fragment,
            // $show is optional.
            function hideTab(clicked, $hide, $show) {
                $hide.animate(hideFx, hideFx.duration || baseDuration, function() { //
                    $hide.addClass(o.hideClass).css(resetCSS); // maintain flexible height and accessibility in print etc.
                    if ($.browser.msie && hideFx.opacity)
                        $hide[0].style.filter = '';
                    if ($show)
                        showTab(clicked, $show, $hide);
                });
            }

            // Show a tab, animation prevents browser scrolling to fragment,
            // $hide is optional.
            function showTab(clicked, $show, $hide) {
                if (showFx === baseFx)
                    $show.css('display', 'block'); // prevent occasionally occuring flicker in Firefox cause by gap between showing and hiding the tab panels
                $show.animate(showFx, showFx.duration || baseDuration, function() {
                    $show.removeClass(o.hideClass).css(resetCSS); // maintain flexible height and accessibility in print etc.
                    if ($.browser.msie && showFx.opacity)
                        $show[0].style.filter = '';

                    // callback
                    $(self.element).triggerHandler("show.ui-tabs", [self.ui(clicked, $show[0])]);

                });
            }

            // switch a tab
            function switchTab(clicked, $li, $hide, $show) {
                /*if (o.bookmarkable && trueClick) { // add to history only if true click occured, not a triggered click
                    $.ajaxHistory.update(clicked.hash);
                }*/
                $li.addClass(o.selectedClass)
                    .siblings().removeClass(o.selectedClass);
                hideTab(clicked, $hide, $show);
            }

            // attach tab event handler, unbind to avoid duplicates from former tabifying...
            this.$tabs.unbind(o.event).bind(o.event, function() {

                //var trueClick = e.clientX; // add to history only if true click occured, not a triggered click
                var $li = $(this).parents('li:eq(0)'),
                    $hide = self.$panels.filter(':visible'),
                    $show = $(this.hash);

                // If tab is already selected and not unselectable or tab disabled or click callback returns false stop here.
                // Check if click handler returns false last so that it is not executed for a disabled tab!
                if (($li.hasClass(o.selectedClass) && !o.unselect) || $li.hasClass(o.disabledClass)
                    || $(self.element).triggerHandler("select.ui-tabs", [self.ui(this, $show[0])]) === false) {
                    this.blur();
                    return false;
                }

                self.options.selected = self.$tabs.index(this);

                // if tab may be closed
                if (o.unselect) {
                    if ($li.hasClass(o.selectedClass)) {
                        self.options.selected = null;
                        $li.removeClass(o.selectedClass);
                        self.$panels.stop();
                        hideTab(this, $hide);
                        this.blur();
                        return false;
                    } else if (!$hide.length) {
                        self.$panels.stop();
                        var a = this;
                        self.load(self.$tabs.index(this), function() {
                            $li.addClass(o.selectedClass).addClass(o.unselectClass);
                            showTab(a, $show);
                        });
                        this.blur();
                        return false;
                    }
                }

                if (o.cookie)
                    $.cookie('ui-tabs' + $.data(self.element), self.options.selected, o.cookie);

                // stop possibly running animations
                self.$panels.stop();

                // show new tab
                if ($show.length) {

                    // prevent scrollbar scrolling to 0 and than back in IE7, happens only if bookmarking/history is enabled
                    /*if ($.browser.msie && o.bookmarkable) {
                        var showId = this.hash.replace('#', '');
                        $show.attr('id', '');
                        setTimeout(function() {
                            $show.attr('id', showId); // restore id
                        }, 0);
                    }*/

                    var a = this;
                    self.load(self.$tabs.index(this), function() {
                        switchTab(a, $li, $hide, $show);
                    });

                    // Set scrollbar to saved position - need to use timeout with 0 to prevent browser scroll to target of hash
                    /*var scrollX = window.pageXOffset || document.documentElement && document.documentElement.scrollLeft || document.body.scrollLeft || 0;
                    var scrollY = window.pageYOffset || document.documentElement && document.documentElement.scrollTop || document.body.scrollTop || 0;
                    setTimeout(function() {
                        scrollTo(scrollX, scrollY);
                    }, 0);*/

                } else
                    throw 'jQuery UI Tabs: Mismatching fragment identifier.';

                // Prevent IE from keeping other link focussed when using the back button
                // and remove dotted border from clicked link. This is controlled in modern
                // browsers via CSS, also blur removes focus from address bar in Firefox
                // which can become a usability and annoying problem with tabsRotate.
                if ($.browser.msie)
                    this.blur();

                //return o.bookmarkable && !!trueClick; // convert trueClick == undefined to Boolean required in IE
                return false;

            });

        },
        add: function(url, label, index) {
            if (url && label) {
                index = index || this.$tabs.length; // append by default

                var o = this.options;
                var $li = $(o.tabTemplate.replace(/#\{href\}/, url).replace(/#\{label\}/, label));
                $li.data('destroy.ui-tabs', true);

                var id = url.indexOf('#') == 0 ? url.replace('#', '') : this.tabId( $('a:first-child', $li)[0] );

                // try to find an existing element before creating a new one
                var $panel = $('#' + id);
                if (!$panel.length) {
                    $panel = $(o.panelTemplate).attr('id', id)
                        .addClass(o.panelClass).addClass(o.hideClass);
                    $panel.data('destroy.ui-tabs', true);
                }
                if (index >= this.$lis.length) {
                    $li.appendTo(this.element);
                    $panel.appendTo(this.element.parentNode);
                } else {
                    $li.insertBefore(this.$lis[index]);
                    $panel.insertBefore(this.$panels[index]);
                }

                this.tabify();

                if (this.$tabs.length == 1) {
                     $li.addClass(o.selectedClass);
                     $panel.removeClass(o.hideClass);
                     var href = $.data(this.$tabs[0], 'load.ui-tabs');
                     if (href)
                         this.load(index, href);
                }

                // callback
                $(this.element).triggerHandler("add.ui-tabs",
                    [this.ui(this.$tabs[index], this.$panels[index])]
                );

            } else
                throw 'jQuery UI Tabs: Not enough arguments to add tab.';
        },
        remove: function(index) {
            if (index && index.constructor == Number) {
                var o = this.options, $li = this.$lis.eq(index).remove(),
                    $panel = this.$panels.eq(index).remove();

                // If selected tab was removed focus tab to the right or
                // tab to the left if last tab was removed.
                if ($li.hasClass(o.selectedClass) && this.$tabs.length > 1)
                    this.click(index + (index < this.$tabs.length ? 1 : -1));
                this.tabify();

                // callback
                $(this.element).triggerHandler("remove.ui-tabs",
                    [this.ui($li.find('a')[0], $panel[0])]
                );

            }
        },
        enable: function(index) {
            var self = this, o = this.options, $li = this.$lis.eq(index);
            $li.removeClass(o.disabledClass);
            if ($.browser.safari) { // fix disappearing tab (that used opacity indicating disabling) after enabling in Safari 2...
                $li.css('display', 'inline-block');
                setTimeout(function() {
                    $li.css('display', 'block');
                }, 0);
            }

            o.disabled = $.map(this.$lis.filter('.' + o.disabledClass),
                function(n, i) { return self.$lis.index(n); } );

            // callback
            $(this.element).triggerHandler("enable.ui-tabs",
                [this.ui(this.$tabs[index], this.$panels[index])]
            );

        },
        disable: function(index) {
            var self = this, o = this.options;
            this.$lis.eq(index).addClass(o.disabledClass);

            o.disabled = $.map(this.$lis.filter('.' + o.disabledClass),
                function(n, i) { return self.$lis.index(n); } );

            // callback
            $(this.element).triggerHandler("disable.ui-tabs",
                [this.ui(this.$tabs[index], this.$panels[index])]
            );

        },
        select: function(index) {
            if (typeof index == 'string')
                index = this.$tabs.index( this.$tabs.filter('[href$=' + index + ']')[0] );
            this.$tabs.eq(index).trigger(this.options.event);
        },
        load: function(index, callback) { // callback is for internal usage only
            var self = this, o = this.options,
                $a = this.$tabs.eq(index), a = $a[0];

            var url = $a.data('load.ui-tabs');

            // no remote - just finish with callback
            if (!url) {
                typeof callback == 'function' && callback();
                return;
            }

            // load remote from here on
            if (o.spinner) {
                var $span = $('span', a), label = $span.html();
                $span.html('<em>' + o.spinner + '</em>');
            }
            var finish = function() {
                self.$tabs.filter('.' + o.loadingClass).each(function() {
                    $(this).removeClass(o.loadingClass);
                    if (o.spinner)
                        $('span', this).html(label);
                });
                self.xhr = null;
            };
            var ajaxOptions = $.extend({}, o.ajaxOptions, {
                url: url,
                success: function(r, s) {
                    $(a.hash).html(r);
                    finish();
                    // This callback is required because the switch has to take
                    // place after loading has completed.
                    typeof callback == 'function' && callback();

                    if (o.cache)
                        $.removeData(a, 'load.ui-tabs'); // if loaded once do not load them again

                    // callback
                    $(self.element).triggerHandler("load.ui-tabs",
                        [self.ui(self.$tabs[index], self.$panels[index])]
                    );

                    o.ajaxOptions.success && o.ajaxOptions.success(r, s);
                }
            });
            if (this.xhr) {
                // terminate pending requests from other tabs and restore tab label
                this.xhr.abort();
                finish();
            }
            $a.addClass(o.loadingClass);
            setTimeout(function() { // timeout is again required in IE, "wait" for id being restored
                self.xhr = $.ajax(ajaxOptions);
            }, 0);

        },
        url: function(index, url) {
            this.$tabs.eq(index).data('load.ui-tabs', url);
        },
        destroy: function() {
            var o = this.options;
            $(this.element).unbind('.ui-tabs')
                .removeClass(o.navClass).removeData('ui-tabs');
            this.$tabs.each(function() {
                var href = $.data(this, 'href.ui-tabs');
                if (href)
                    this.href = href;
                $(this).unbind('.ui-tabs')
                    .removeData('href.ui-tabs').removeData('load.ui-tabs');
            });
            this.$lis.add(this.$panels).each(function() {
                if ($.data(this, 'destroy.ui-tabs'))
                    $(this).remove();
                else
                    $(this).removeClass([o.selectedClass, o.unselectClass,
                        o.disabledClass, o.panelClass, o.hideClass].join(' '));
            });
        }
    });

})(jQuery);

/* Copyright (c) 2007 Paul Bakaus (paul.bakaus@googlemail.com) and Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * $LastChangedDate: 2007-12-20 08:43:48 -0600 (Thu, 20 Dec 2007) $
 * $Rev: 4257 $
 *
 * Version: 1.2
 *
 * Requires: jQuery 1.2+
 */
(function($){$.dimensions={version:'1.2'};$.each(['Height','Width'],function(i,name){$.fn['inner'+name]=function(){if(!this[0])return;var torl=name=='Height'?'Top':'Left',borr=name=='Height'?'Bottom':'Right';return this.is(':visible')?this[0]['client'+name]:num(this,name.toLowerCase())+num(this,'padding'+torl)+num(this,'padding'+borr);};$.fn['outer'+name]=function(options){if(!this[0])return;var torl=name=='Height'?'Top':'Left',borr=name=='Height'?'Bottom':'Right';options=$.extend({margin:false},options||{});var val=this.is(':visible')?this[0]['offset'+name]:num(this,name.toLowerCase())+num(this,'border'+torl+'Width')+num(this,'border'+borr+'Width')+num(this,'padding'+torl)+num(this,'padding'+borr);return val+(options.margin?(num(this,'margin'+torl)+num(this,'margin'+borr)):0);};});$.each(['Left','Top'],function(i,name){$.fn['scroll'+name]=function(val){if(!this[0])return;return val!=undefined?this.each(function(){this==window||this==document?window.scrollTo(name=='Left'?val:$(window)['scrollLeft'](),name=='Top'?val:$(window)['scrollTop']()):this['scroll'+name]=val;}):this[0]==window||this[0]==document?self[(name=='Left'?'pageXOffset':'pageYOffset')]||$.boxModel&&document.documentElement['scroll'+name]||document.body['scroll'+name]:this[0]['scroll'+name];};});$.fn.extend({position:function(){var left=0,top=0,elem=this[0],offset,parentOffset,offsetParent,results;if(elem){offsetParent=this.offsetParent();offset=this.offset();parentOffset=offsetParent.offset();offset.top-=num(elem,'marginTop');offset.left-=num(elem,'marginLeft');parentOffset.top+=num(offsetParent,'borderTopWidth');parentOffset.left+=num(offsetParent,'borderLeftWidth');results={top:offset.top-parentOffset.top,left:offset.left-parentOffset.left};}return results;},offsetParent:function(){var offsetParent=this[0].offsetParent;while(offsetParent&&(!/^body|html$/i.test(offsetParent.tagName)&&$.css(offsetParent,'position')=='static'))offsetParent=offsetParent.offsetParent;return $(offsetParent);}});function num(el,prop){return parseInt($.curCSS(el.jquery?el[0]:el,prop,true))||0;};})(jQuery);

/*
 * jQuery Cycle Plugin (with Transition Definitions)
 * Examples and documentation at: http://malsup.com/jquery/cycle/
 * Copyright (c) 2007 M. Alsup
 * Version: 2.10
 * 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}('(3($){7 n=\'2.10\';7 q=$.2p.2i&&/3c 6.0/.2I(2w.2s);$.y.x=3(m){I 8.18(3(){m=m||{};4(m.2a==28){2N(m){1Z\'2B\':4(8.Z)1J(8.Z);8.Z=0;I;1Z\'1I\':8.1b=1;I;1Z\'3r\':8.1b=0;I;3q:m={1n:m}}}7 c=$(8);7 d=m.1T?$(m.1T,8):c.3i();7 e=d.3a();4(e.E<2)I;7 f=$.31({},$.y.x.2b,m||{},$.29?c.29():$.2V?c.2T():{});4(f.1P)f.26=f.2K||e.E;f.D=f.D?[f.D]:[];f.12=f.12?[f.12]:[];f.12.25(3(){f.1M=0});4(q&&f.1L&&!f.2u)24(d);7 g=8.2r;7 w=1h((g.1s(/w:(\\d+)/)||[])[1])||f.J;7 h=1h((g.1s(/h:(\\d+)/)||[])[1])||f.K;f.O=1h((g.1s(/t:(\\d+)/)||[])[1])||f.O;4(c.A(\'1Y\')==\'3o\')c.A(\'1Y\',\'3l\');4(w)c.J(w);4(h&&h!=\'1W\')c.K(h);4(f.19){f.1a=[];1j(7 i=0;i<e.E;i++)f.1a.L(i);f.1a.3e(3(a,b){I 39.19()-0.5});f.14=0;f.T=f.1a[0]}13 4(f.T>=e.E)f.T=0;7 j=f.T||0;d.A(\'1Y\',\'30\').1y().18(3(i){7 z=j?i>=j?e.E-(i-j):j-i:e.E-i;$(8).A(\'z-1x\',z)});$(e[j]).N();4(f.1k&&w)d.J(w);4(f.1k&&h&&h!=\'1W\')d.K(h);4(f.1I)c.2U(3(){8.1b=1},3(){8.1b=0});7 k=$.y.x.M[f.1n];4($.27(k))k(c,d,f);d.18(3(){7 a=$(8);8.W=(f.1k&&h)?h:a.K();8.V=(f.1k&&w)?w:a.J()});f.G=f.G||{};f.C=f.C||{};f.F=f.F||{};d.1B(\':1C(\'+j+\')\').A(f.G);4(f.S)$(d[j]).A(f.S);4(f.O){4(f.R.2a==28)f.R={2C:2A,2z:2y}[f.R]||2x;4(!f.1v)f.R=f.R/2;2v((f.O-f.R)<2t)f.O+=f.R}4(f.1K)f.1u=f.1F=f.1K;4(!f.1i)f.1i=f.R;4(!f.1o)f.1o=f.R;f.2q=e.E;f.11=j;4(f.19){f.B=f.11;4(++f.14==e.E)f.14=0;f.B=f.1a[f.14]}13 f.B=f.T>=(e.E-1)?0:f.T+1;7 l=d[j];4(f.D.E)f.D[0].1t(l,[l,l,f,23]);4(f.12.E>1)f.12[1].1t(l,[l,l,f,23]);4(f.1d&&!f.Q)f.Q=f.1d;4(f.Q)$(f.Q).22(\'1d\',3(){I 21(e,f,f.1r?-1:1)});4(f.20)$(f.20).22(\'1d\',3(){I 21(e,f,f.1r?1:-1)});4(f.1q)2o(e,f);4(f.O)8.Z=2n(3(){1p(e,f,0,!f.1r)},f.O+(f.2m||0))})};3 1p(a,b,c,d){4(b.1M)I;7 p=a[0].1H,1g=a[b.11],Q=a[b.B];4(p.Z===0&&!c)I;4(!c&&!p.1b&&((b.1P&&(--b.26<=0))||(b.1G&&!b.19&&b.B<b.11)))I;4(c||!p.1b){4(b.D.E)$.18(b.D,3(i,o){o.1t(Q,[1g,Q,b,d])});7 e=3(){4($.2p.2i&&b.1L)8.3n.3m(\'1X\');$.18(b.12,3(i,o){o.1t(Q,[1g,Q,b,d])})};4(b.B!=b.11){b.1M=1;4(b.1E)b.1E(1g,Q,b,e,d);13 4($.27($.y.x[b.1n]))$.y.x[b.1n](1g,Q,b,e);13 $.y.x.2k(1g,Q,b,e)}4(b.19){b.11=b.B;4(++b.14==a.E)b.14=0;b.B=b.1a[b.14]}13{7 f=(b.B+1)==a.E;b.B=f?0:b.B+1;b.11=f?a.E-1:b.B-1}4(b.1q)$(b.1q).2j(\'a\').3k(\'1V\').1X(\'a:1C(\'+b.11+\')\').2h(\'1V\')}4(b.O)p.Z=2n(3(){1p(a,b,0,!b.1r)},b.O)};3 21(a,b,c){7 p=a[0].1H,O=p.Z;4(O){1J(O);p.Z=0}b.B=b.11+c;4(b.B<0){4(b.1G)I 1w;b.B=a.E-1}13 4(b.B>=a.E){4(b.1G)I 1w;b.B=0}4(b.1D&&1U b.1D==\'3\')b.1D(c>0,b.B,a[b.B]);1p(a,b,1,c>=0);I 1w};3 2o(b,c){7 d=$(c.1q);$.18(b,3(i,o){7 a=(1U c.1O==\'3\')?$(c.1O(i,o)):$(\'<a 3j="#">\'+(i+1)+\'</a>\');4(a.3h(\'3g\').E==0)a.3d(d);a.22(\'1d\',3(){c.B=i;7 p=b[0].1H,O=p.Z;4(O){1J(O);p.Z=0}4(1U c.1S==\'3\')c.1S(c.B,b[c.B]);1p(b,c,1,!c.1r);I 1w})});d.2j(\'a\').1X(\'a:1C(\'+c.T+\')\').2h(\'1V\')};3 24(b){3 1A(s){7 s=1h(s).3b(16);I s.E<2?\'0\'+s:s};3 2f(e){1j(;e&&e.38.37()!=\'36\';e=e.1H){7 v=$.A(e,\'2e-2d\');4(v.35(\'34\')>=0){7 a=v.1s(/\\d+/g);I\'#\'+1A(a[0])+1A(a[1])+1A(a[2])}4(v&&v!=\'33\')I v}I\'#32\'};b.18(3(){$(8).A(\'2e-2d\',2f(8))})};$.y.x.2k=3(a,b,c,d){7 e=$(a),$n=$(b);$n.A(c.G);7 f=3(){$n.1z(c.C,c.1i,c.1u,d)};e.1z(c.F,c.1o,c.1F,3(){4(c.P)e.A(c.P);4(!c.1v)f()});4(c.1v)f()};$.y.x.M={2c:3(a,b,c){b.1B(\':1C(\'+c.T+\')\').A(\'1m\',0);c.D.L(3(){$(8).N()});c.C={1m:1};c.F={1m:0};c.P={X:\'Y\'}}};$.y.x.2Z=3(){I n};$.y.x.2b={1n:\'2c\',O:2Y,R:2X,1i:H,1o:H,1d:H,Q:H,20:H,1D:H,1q:H,1S:H,1O:H,D:H,12:H,1K:H,1u:H,1F:H,1l:H,C:H,F:H,G:H,P:H,1E:H,K:\'1W\',T:0,1v:1,19:0,1k:0,1I:0,1P:0,2m:0,1T:H,1L:0,1G:0}})(9);9.y.x.M.2W=3(d,e,f){d.A(\'17\',\'1c\');f.D.L(3(a,b,c){9(8).N();c.G.r=b.1e;c.F.r=0-a.1e});f.S={r:0};f.C={r:0};f.P={X:\'Y\'}};9.y.x.M.2S=3(d,e,f){d.A(\'17\',\'1c\');f.D.L(3(a,b,c){9(8).N();c.G.r=0-b.1e;c.F.r=a.1e});f.S={r:0};f.C={r:0};f.P={X:\'Y\'}};9.y.x.M.2R=3(d,e,f){d.A(\'17\',\'1c\');f.D.L(3(a,b,c){9(8).N();c.G.u=b.1f;c.F.u=0-a.1f});f.S={u:0};f.C={u:0}};9.y.x.M.2Q=3(d,e,f){d.A(\'17\',\'1c\');f.D.L(3(a,b,c){9(8).N();c.G.u=0-b.1f;c.F.u=a.1f});f.S={u:0};f.C={u:0}};9.y.x.M.2P=3(f,g,h){f.A(\'17\',\'1c\').J();h.D.L(3(a,b,c,d){9(8).N();7 e=a.1f,1Q=b.1f;c.G=d?{u:1Q}:{u:-1Q};c.C.u=0;c.F.u=d?-e:e;g.1B(a).A(c.G)});h.S={u:0};h.P={X:\'Y\'}};9.y.x.M.2O=3(f,g,h){f.A(\'17\',\'1c\');h.D.L(3(a,b,c,d){9(8).N();7 e=a.1e,1R=b.1e;c.G=d?{r:-1R}:{r:1R};c.C.r=0;c.F.r=d?e:-e;g.1B(a).A(c.G)});h.S={r:0};h.P={X:\'Y\'}};9.y.x.M.2M=3(a,b,c){c.C={J:\'N\'};c.F={J:\'1y\'}};9.y.x.M.2L=3(a,b,c){c.C={K:\'N\'};c.F={K:\'1y\'}};9.y.x.M.1l=3(g,h,j){7 w=g.A(\'17\',\'3f\').J();h.A({u:0,r:0});j.D.L(3(){9(8).N()});j.R=j.R/2;j.19=0;j.1l=j.1l||{u:-w,r:15};j.U=[];1j(7 i=0;i<h.E;i++)j.U.L(h[i]);1j(7 i=0;i<j.T;i++)j.U.L(j.U.2g());j.1E=3(a,b,c,d,e){7 f=e?9(a):9(b);f.1z(c.1l,c.1i,c.1u,3(){e?c.U.L(c.U.2g()):c.U.25(c.U.2J());4(e)1j(7 i=0,1N=c.U.E;i<1N;i++)9(c.U[i]).A(\'z-1x\',1N-i);13{7 z=9(a).A(\'z-1x\');f.A(\'z-1x\',1h(z)+1)}f.1z({u:0,r:0},c.1o,c.1F,3(){9(e?8:a).1y();4(d)d()})})}};9.y.x.M.2H=3(d,e,f){f.D.L(3(a,b,c){9(8).N();c.G.r=b.W;c.C.K=b.W});f.S={r:0};f.G={K:0};f.C={r:0};f.F={K:0};f.P={X:\'Y\'}};9.y.x.M.2G=3(d,e,f){f.D.L(3(a,b,c){9(8).N();c.C.K=b.W;c.F.r=a.W});f.S={r:0};f.G={r:0,K:0};f.F={K:0};f.P={X:\'Y\'}};9.y.x.M.2F=3(d,e,f){f.D.L(3(a,b,c){9(8).N();c.G.u=b.V;c.C.J=b.V});f.G={J:0};f.C={u:0};f.F={J:0};f.P={X:\'Y\'}};9.y.x.M.2E=3(d,e,f){f.D.L(3(a,b,c){9(8).N();c.C.J=b.V;c.F.u=a.V});f.G={u:0,J:0};f.C={u:0};f.F={J:0};f.P={X:\'Y\'}};9.y.x.M.2D=3(d,e,f){f.S={r:0,u:0};f.P={X:\'Y\'};f.D.L(3(a,b,c){9(8).N();c.G={J:0,K:0,r:b.W/2,u:b.V/2};c.C={r:0,u:0,J:b.V,K:b.W};c.F={J:0,K:0,r:a.W/2,u:a.V/2}})};9.y.x.M.3p=3(d,e,f){f.D.L(3(a,b,c){c.G={J:0,K:0,1m:1,u:b.V/2,r:b.W/2,2l:1};c.C={r:0,u:0,J:b.V,K:b.W}});f.F={1m:0};f.P={2l:0}};',62,214,'|||function|if|||var|this|jQuery||||||||||||||||||top|||left|||cycle|fn||css|nextSlide|animIn|before|length|animOut|cssBefore|null|return|width|height|push|transitions|show|timeout|cssAfter|next|speed|cssFirst|startingSlide|els|cycleW|cycleH|display|none|cycleTimeout||currSlide|after|else|randomIndex|||overflow|each|random|randomMap|cyclePause|hidden|click|offsetHeight|offsetWidth|curr|parseInt|speedIn|for|fit|shuffle|opacity|fx|speedOut|go|pager|rev|match|apply|easeIn|sync|false|index|hide|animate|hex|not|eq|prevNextClick|fxFn|easeOut|nowrap|parentNode|pause|clearTimeout|easing|cleartype|busy|len|pagerAnchorBuilder|autostop|nextW|nextH|pagerClick|slideExpr|typeof|activeSlide|auto|filter|position|case|prev|advance|bind|true|clearTypeFix|unshift|countdown|isFunction|String|metadata|constructor|defaults|fade|color|background|getBg|shift|addClass|msie|find|custom|zIndex|delay|setTimeout|buildPager|browser|slideCount|className|userAgent|250|cleartypeNoBg|while|navigator|400|200|fast|600|stop|slow|zoom|turnRight|turnLeft|turnDown|turnUp|test|pop|autostopCount|slideY|slideX|switch|scrollVert|scrollHorz|scrollRight|scrollLeft|scrollDown|data|hover|meta|scrollUp|1000|4000|ver|absolute|extend|ffffff|transparent|rgb|indexOf|html|toLowerCase|nodeName|Math|get|toString|MSIE|appendTo|sort|visible|body|parents|children|href|removeClass|relative|removeAttribute|style|static|fadeZoom|default|resume'.split('|'),0,{}))

/**
 * Cookie plugin
 *
 * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 */

jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }
        // CAUTION: Needed to parenthesize options.path and options.domain
        // in the following expressions, otherwise they evaluate to undefined
        // in the packed version for some reason...
        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};