
/*
 * jQuery Easing v1.1 - http://gsgd.co.uk/sandbox/jquery.easing.php
 *
 * Uses the built in easing capabilities added in jQuery 1.1
 * to offer multiple easing options
 *
 * Copyright (c) 2007 George Smith
 * Licensed under the MIT License:
 *   http://www.opensource.org/licenses/mit-license.php
 */

jQuery.easing = {
	easein: function(x, t, b, c, d) {
		return c*(t/=d)*t + b; // in
	},
	easeinout: function(x, t, b, c, d) {
		if (t < d/2) return 2*c*t*t/(d*d) + b;
		var ts = t - d/2;
		return -2*c*ts*ts/(d*d) + 2*c*ts/d + c/2 + b;		
	},
	easeout: function(x, t, b, c, d) {
		return -c*t*t/(d*d) + 2*c*t/d + b;
	},
	expoin: function(x, t, b, c, d) {
		var flip = 1;
		if (c < 0) {
			flip *= -1;
			c *= -1;
		}
		return flip * (Math.exp(Math.log(c)/d * t)) + b;		
	},
	expoout: function(x, t, b, c, d) {
		var flip = 1;
		if (c < 0) {
			flip *= -1;
			c *= -1;
		}
		return flip * (-Math.exp(-Math.log(c)/d * (t-d)) + c + 1) + b;
	},
	expoinout: function(x, t, b, c, d) {
		var flip = 1;
		if (c < 0) {
			flip *= -1;
			c *= -1;
		}
		if (t < d/2) return flip * (Math.exp(Math.log(c/2)/(d/2) * t)) + b;
		return flip * (-Math.exp(-2*Math.log(c/2)/d * (t-d)) + c + 1) + b;
	},
	bouncein: function(x, t, b, c, d) {
		return c - jQuery.easing['bounceout'](x, d-t, 0, c, d) + b;
	},
	bounceout: function(x, t, b, c, d) {
		if ((t/=d) < (1/2.75)) {
			return c*(7.5625*t*t) + b;
		} else if (t < (2/2.75)) {
			return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
		} else if (t < (2.5/2.75)) {
			return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
		} else {
			return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
		}
	},
	bounceinout: function(x, t, b, c, d) {
		if (t < d/2) return jQuery.easing['bouncein'] (x, t*2, 0, c, d) * .5 + b;
		return jQuery.easing['bounceout'] (x, t*2-d,0, c, d) * .5 + c*.5 + b;
	},
	elasin: function(x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
	},
	elasout: function(x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
	},
	elasinout: function(x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
		return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
	},
	backin: function(x, t, b, c, d) {
		var s=1.70158;
		return c*(t/=d)*t*((s+1)*t - s) + b;
	},
	backout: function(x, t, b, c, d) {
		var s=1.70158;
		return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
	},
	backinout: function(x, t, b, c, d) {
		var s=1.70158;
		if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
		return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
	},
	linear: function(x, t, b, c, d) {
		return c*t/d + b; //linear
	}
};



/**
 * jCarouselLite - jQuery plugin to navigate images/any content in a carousel style widget.
 * @requires jQuery v1.2 or above
 *
 * http://gmarwaha.com/jquery/jcarousellite/
 *
 * Copyright (c) 2007 Ganeshji Marwaha (gmarwaha.com)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 * Version: 1.0.1
 * Note: Requires jquery 1.2 or above from version 1.0.1
 */
/**
 * Creates a carousel-style navigation widget for images/any-content from a simple HTML markup.
 *
 * The HTML markup that is used to build the carousel can be as simple as...
 *
 *  <div class="carousel">
 *      <ul>
 *          <li><img src="image/1.jpg" alt="1"></li>
 *          <li><img src="image/2.jpg" alt="2"></li>
 *          <li><img src="image/3.jpg" alt="3"></li>
 *      </ul>
 *  </div>
 *
 * As you can see, this snippet is nothing but a simple div containing an unordered list of images.
 * You don't need any special "class" attribute, or a special "css" file for this plugin.
 * I am using a class attribute just for the sake of explanation here.
 *
 * To navigate the elements of the carousel, you need some kind of navigation buttons.
 * For example, you will need a "previous" button to go backward, and a "next" button to go forward.
 * This need not be part of the carousel "div" itself. It can be any element in your page.
 * Lets assume that the following elements in your document can be used as next, and prev buttons...
 *
 * <button class="prev">&lt;&lt;</button>
 * <button class="next">&gt;&gt;</button>
 *
 * Now, all you need to do is call the carousel component on the div element that represents it, and pass in the
 * navigation buttons as options.
 *
 * $(".carousel").jCarouselLite({
 *      btnNext: ".next",
 *      btnPrev: ".prev"
 * });
 *
 * That's it, you would have now converted your raw div, into a magnificient carousel.
 *
 * There are quite a few other options that you can use to customize it though.
 * Each will be explained with an example below.
 *
 * @param an options object - You can specify all the options shown below as an options object param.
 *
 * @option btnPrev, btnNext : string - no defaults
 * @example
 * $(".carousel").jCarouselLite({
 *      btnNext: ".next",
 *      btnPrev: ".prev"
 * });
 * @desc Creates a basic carousel. Clicking "btnPrev" navigates backwards and "btnNext" navigates forward.
 *
 * @option btnGo - array - no defaults
 * @example
 * $(".carousel").jCarouselLite({
 *      btnNext: ".next",
 *      btnPrev: ".prev",
 *      btnGo: [".0", ".1", ".2"]
 * });
 * @desc If you don't want next and previous buttons for navigation, instead you prefer custom navigation based on
 * the item number within the carousel, you can use this option. Just supply an array of selectors for each element
 * in the carousel. The index of the array represents the index of the element. What i mean is, if the
 * first element in the array is ".0", it means that when the element represented by ".0" is clicked, the carousel
 * will slide to the first element and so on and so forth. This feature is very powerful. For example, i made a tabbed
 * interface out of it by making my navigation elements styled like tabs in css. As the carousel is capable of holding
 * any content, not just images, you can have a very simple tabbed navigation in minutes without using any other plugin.
 * The best part is that, the tab will "slide" based on the provided effect. :-)
 *
 * @option mouseWheel : boolean - default is false
 * @example
 * $(".carousel").jCarouselLite({
 *      mouseWheel: true
 * });
 * @desc The carousel can also be navigated using the mouse wheel interface of a scroll mouse instead of using buttons.
 * To get this feature working, you have to do 2 things. First, you have to include the mouse-wheel plugin from brandon.
 * Second, you will have to set the option "mouseWheel" to true. That's it, now you will be able to navigate your carousel
 * using the mouse wheel. Using buttons and mouseWheel or not mutually exclusive. You can still have buttons for navigation
 * as well. They complement each other. To use both together, just supply the options required for both as shown below.
 * @example
 * $(".carousel").jCarouselLite({
 *      btnNext: ".next",
 *      btnPrev: ".prev",
 *      mouseWheel: true
 * });
 *
 * @option auto : number - default is null, meaning autoscroll is disabled by default
 * @example
 * $(".carousel").jCarouselLite({
 *      auto: 800,
 *      speed: 500
 * });
 * @desc You can make your carousel auto-navigate itself by specfying a millisecond value in this option.
 * The value you specify is the amount of time between 2 slides. The default is null, and that disables auto scrolling.
 * Specify this value and magically your carousel will start auto scrolling.
 *
 * @option speed : number - 200 is default
 * @example
 * $(".carousel").jCarouselLite({
 *      btnNext: ".next",
 *      btnPrev: ".prev",
 *      speed: 800
 * });
 * @desc Specifying a speed will slow-down or speed-up the sliding speed of your carousel. Try it out with
 * different speeds like 800, 600, 1500 etc. Providing 0, will remove the slide effect.
 *
 * @option easing : string - no easing effects by default.
 * @example
 * $(".carousel").jCarouselLite({
 *      btnNext: ".next",
 *      btnPrev: ".prev",
 *      easing: "bounceout"
 * });
 * @desc You can specify any easing effect. Note: You need easing plugin for that. Once specified,
 * the carousel will slide based on the provided easing effect.
 *
 * @option vertical : boolean - default is false
 * @example
 * $(".carousel").jCarouselLite({
 *      btnNext: ".next",
 *      btnPrev: ".prev",
 *      vertical: true
 * });
 * @desc Determines the direction of the carousel. true, means the carousel will display vertically. The next and
 * prev buttons will slide the items vertically as well. The default is false, which means that the carousel will
 * display horizontally. The next and prev items will slide the items from left-right in this case.
 *
 * @option circular : boolean - default is true
 * @example
 * $(".carousel").jCarouselLite({
 *      btnNext: ".next",
 *      btnPrev: ".prev",
 *      circular: false
 * });
 * @desc Setting it to true enables circular navigation. This means, if you click "next" after you reach the last
 * element, you will automatically slide to the first element and vice versa. If you set circular to false, then
 * if you click on the "next" button after you reach the last element, you will stay in the last element itself
 * and similarly for "previous" button and first element.
 *
 * @option visible : number - default is 3
 * @example
 * $(".carousel").jCarouselLite({
 *      btnNext: ".next",
 *      btnPrev: ".prev",
 *      visible: 4
 * });
 * @desc This specifies the number of items visible at all times within the carousel. The default is 3.
 * You are even free to experiment with real numbers. Eg: "3.5" will have 3 items fully visible and the
 * last item half visible. This gives you the effect of showing the user that there are more images to the right.
 *
 * @option start : number - default is 0
 * @example
 * $(".carousel").jCarouselLite({
 *      btnNext: ".next",
 *      btnPrev: ".prev",
 *      start: 2
 * });
 * @desc You can specify from which item the carousel should start. Remember, the first item in the carousel
 * has a start of 0, and so on.
 *
 * @option scrool : number - default is 1
 * @example
 * $(".carousel").jCarouselLite({
 *      btnNext: ".next",
 *      btnPrev: ".prev",
 *      scroll: 2
 * });
 * @desc The number of items that should scroll/slide when you click the next/prev navigation buttons. By
 * default, only one item is scrolled, but you may set it to any number. Eg: setting it to "2" will scroll
 * 2 items when you click the next or previous buttons.
 *
 * @option beforeStart, afterEnd : function - callbacks
 * @example
 * $(".carousel").jCarouselLite({
 *      btnNext: ".next",
 *      btnPrev: ".prev",
 *      beforeStart: function(a) {
 *          alert("Before animation starts:" + a);
 *      },
 *      afterEnd: function(a) {
 *          alert("After animation ends:" + a);
 *      }
 * });
 * @desc If you wanted to do some logic in your page before the slide starts and after the slide ends, you can
 * register these 2 callbacks. The functions will be passed an argument that represents an array of elements that
 * are visible at the time of callback.
 *
 *
 * @cat Plugins/Image Gallery
 * @author Ganeshji Marwaha/ganeshread@gmail.com
 */
(function ($) {                                          // Compliant with jquery.noConflict()
  $.fn.jCarouselLite = function (o) {
    o = $.extend({
      btnPrev: null,
      btnNext: null,
      btnGo: null,
      mouseWheel: false,
      auto: false,
      speed: 400,
      easing: null,
      vertical: false,
      circular: true,
      visible: 6,
      start: 0,
      scroll: 6,
      beforeStart: null,
      afterEnd: null
    }, o || {});
    return this.each(function () {                           // Returns the element collection. Chainable.
      var running = false, animCss = o.vertical ? "top" : "left", sizeCss = o.vertical ? "height" : "width";
      var div = $(this), ul = $("ul", div), tLi = $("li", ul), tl = tLi.size(), v = o.visible;
      if (o.circular) {
        ul.prepend(tLi.slice(tl - v - 1 + 1).clone()).append(tLi.slice(0, v).clone());
        o.start += v;
      }
      var li = $("li", ul), itemLength = li.size(), curr = o.start;
      div.css("visibility", "visible");
      li.css({ overflow: "hidden", float: o.vertical ? "none" : "left" });
      ul.css({ padding: "0", position: "relative", "list-style-type": "none", "z-index": "1" });
      div.css({ overflow: "hidden", position: "relative", "z-index": "2", left: "39px" });
      var liSize = o.vertical ? height(li) : width(li);   // Full li size(incl margin)-Used for animation
      var ulSize = liSize * itemLength;                   // size of full ul(total length, not just for the visible items)
      var divSize = liSize * v;                           // size of entire div(total length for just the visible items)
      li.css({ width: li.width(), height: li.height() });
      ul.css(sizeCss, ulSize + "px").css(animCss, -(curr * liSize));
      div.css(sizeCss, divSize + "px");                     // Width of the DIV. length of visible images
      if (o.btnPrev)
        $(o.btnPrev).click(function () {
          return go(curr - o.scroll);
        });
      if (o.btnNext)
        $(o.btnNext).click(function () {
          return go(curr + o.scroll);
        });
      if (o.btnGo)
        $.each(o.btnGo, function (i, val) {
          $(val).click(function () {
            return go(o.circular ? o.visible + i : i);
          });
        });
      if (o.mouseWheel && div.mousewheel)
        div.mousewheel(function (e, d) {
          return d > 0 ? go(curr - o.scroll) : go(curr + o.scroll);
        });
      if (o.auto)
        setInterval(function () {
          go(curr + o.scroll);
        }, o.auto + o.speed);
      function vis() {
        return li.slice(curr).slice(0, v);
      };
      function go(to) {
        if (!running) {
          if (o.beforeStart)
            o.beforeStart.call(this, vis());
          if (o.circular) {            // If circular we are in first or last, then goto the other end
            if (to <= o.start - v - 1) {           // If first, then goto last
              ul.css(animCss, -((itemLength - (v * 2)) * liSize) + "px");
              // If "scroll" > 1, then the "to" might not be equal to the condition; it can be lesser depending on the number of elements.
              curr = to == o.start - v - 1 ? itemLength - (v * 2) - 1 : itemLength - (v * 2) - o.scroll;
            } else if (to >= itemLength - v + 1) { // If last, then goto first
              ul.css(animCss, -((v) * liSize) + "px");
              // If "scroll" > 1, then the "to" might not be equal to the condition; it can be greater depending on the number of elements.
              curr = to == itemLength - v + 1 ? v + 1 : v + o.scroll;
            } else curr = to;
          } else {                    // If non-circular and to points to first or last, we just return.
            if (to < 0 || to > itemLength - v) return;
            else curr = to;
          }                           // If neither overrides it, the curr will still be "to" and we can proceed.
          running = true;
          ul.animate(animCss == "left" ? { left: -(curr * liSize)} : { top: -(curr * liSize) }, o.speed, o.easing,function () {
            if (o.afterEnd)
              o.afterEnd.call(this, vis());
            running = false;
          });
          // Disable buttons when the carousel reaches the last/first, and enable when not
          if (!o.circular) {
            $(o.btnPrev + "," + o.btnNext).removeClass("disabled");
            $((curr - o.scroll < 0 && o.btnPrev) ||(curr + o.scroll > itemLength - v && o.btnNext) ||[]).addClass("disabled");
          }
        }
        return false;
      };
    });
  };
  function css(el, prop) {
    return parseInt($.css(el[0], prop)) || 0;
  };
  function width(el) {
    return el[0].offsetWidth + css(el, 'marginLeft') + css(el, 'marginRight');
  };
  function height(el) {
    return el[0].offsetHeight + css(el, 'marginTop') + css(el, 'marginBottom');
  };
})(jQuery);






/*
*  Sudo Slider ver 2.0.6 - jQuery plugin 
*  Written by Erik Kristensen info@webbies.dk. 
*  Based on Easy Slider 1.7 by Alen Grakalic http://cssglobe.com/post/5780/easy-slider-17-numeric-navigation-jquery-slider
*	
*	 Dual licensed under the MIT
*	 and GPL licenses.
* 
*	 Built for jQuery library
*	 http://jquery.com
*
*/
/* 
TODO:
Finding and fixing bugs. (No known bugs atm.) 
 
Komprimer after og beforeani for continuous
AJAX.
 
*/
(function ($) {
  $.fn.sudoSlider = function (options) {
    // Saves space in the minified version.
    var truev = true;
    var falsev = !truev;
    // default configuration properties 
    var defaults = {
      prevNext: falsev,
      prevHtml: '<a href="#" class="prevBtn"> previous </a>',
      nextHtml: '<a href="#" class="nextBtn"> next </a>',
      controlsShow: truev,
      controlsAttr: 'class="preview"',
      controlsFadeSpeed: '400',
      controlsFade: truev,
      insertAfter: truev,
      firstShow: falsev,
      firstHtml: '<a href="#" class="firstBtn"> first </a>',
      lastShow: falsev,
      lastHtml: '<a href="#" class="lastBtn"> last </a>',
      numericAttr: 'class="controls"',
      numericText: ['1'],
      vertical: falsev,
      speed: '800',
      ease: 'linear',
      auto: truev,
      pause: '2000',
      continuous: truev,
      clickableAni: falsev,
      numeric: falsev,
      updateBefore: falsev,
      history: falsev,
      speedhistory: '400',
      autoheight: truev,
      customLink: falsev,
      fade: truev,
      crossFade: truev,
      fadespeed: '1000',
      ajax: falsev,
      loadingText: 'Loading Content...',
      preloadAjax: falsev,
      startSlide: falsev,
      ajaxLoadFunction: falsev,
      beforeAniFunc: falsev,
      afterAniFunc: falsev,
      uncurrentFunc: falsev,
      currentFunc: falsev,
      autowidth: truev,
      slideCount: 1
    };
    var options = $.extend(defaults, options);

    // To make it smaller. 
    // There is a way to make it even smaller, but that doesn't work with the public functions setOption() and getOption(). 
    var option = [
			options.controlsShow, /* option[0]/*controlsShow*/
			options.controlsFadeSpeed, /* option[1]/*controlsFadeSpeed*/
			options.controlsFade, /* option[2]/*controlsFade*/
			options.insertAfter, /* option[3]/*insertAfter*/
			options.firstShow, /* option[4]/*firstShow*/
			options.lastShow, /* option[5]/*lastShow*/
			options.vertical, /* option[6]/*vertical*/
			options.speed, /* option[7]/*speed*/
			options.ease, /* option[8]/*ease*/
			options.auto, /* option[9]/*auto*/
			options.pause, /* option[10]/*pause*/
			options.continuous, /* option[11]/*continuous*/
			options.prevNext, /* option[12]/*prevNext*/
			options.numeric, /* option[13]/*numeric*/
			options.numericAttr, /* option[14]/*numericAttr*/
			options.numericText, /* option[15]/*numericText*/
			options.clickableAni, /* option[16]/*clickableAni*/
			options.history, /* option[17]/*history*/
			options.speedhistory, /* option[18]/*speedhistory*/
			options.autoheight, /* option[19]/*autoheight*/
			options.customLink, /* option[20]/*customLink*/
			options.fade, /* option[21]/*fade*/
			options.crossFade, /* option[22]/*crossFade*/
			options.fadespeed, /* option[23]/*fadespeed*/
			options.updateBefore, /* option[24]/*updateBefore*/
			options.ajax, /* option[25]/*ajax*/
			options.preloadAjax, /* option[26]/*preloadAjax*/
			options.startSlide, /* option[27]/*startSlide*/
			options.ajaxLoadFunction, /* option[28]/*ajaxLoadFunction*/
			options.beforeAniFunc, /* option[29]/*beforeAniFunc*/
			options.afterAniFunc, /* option[30]/*afterAniFunc*/
			options.uncurrentFunc, /* option[31]/*uncurrentFunc*/
			options.currentFunc, /* option[32]/*currentFunc*/
			options.prevHtml, /* option[33]/*prevHtml*/
			options.nextHtml, /* option[34]/*nextHtml*/
			options.loadingText, /* option[35]/*loadingText*/
			options.firstHtml, /* option[36]/*firstHtml*/
			options.controlsAttr, /* option[37]/*controlsAttr*/
			options.lastHtml, /* option[38]/*lastHtml*/
			options.autowidth, /*  option[39]/*autowidth*/
			options.slideCount/*  option[40]/*slideCount*/
		];

    // Defining the base element. 
    // This is needed if i want to have public functions (And i want public functions).
    var baseSlider = this;

    return this.each(function () {
      /*
      * Lets start this baby. 
      */
      // First we declare a lot of variables. 
      // Some of the names may be long, but they get minified. 
      var init,
				ul,
				li,
				liConti,
				s,
				w,
				h,
				t,
				ot,
				nt,
				ts,
				clickable,
				buttonclicked,
				fading,
				ajaxloading,
				autoheightdocument,
				numericControls,
				numericContainer,
				destroyed,
				fontsmoothing,
				controls,
				html,
				firstbutton,
				lastbutton,
				nextbutton,
				prevbutton,
				timeout,
				destroyT,
				obj = $(this);
      initSudoSlider(obj, falsev);
      function initSudoSlider(obj, destroyT) {
        //if (option[6]/*vertical*/) option[19]/*autoheight*/ = falsev;
        destroyed = falsev; // In case this isn't the first init. 
        // There are some things we don't do at init. 
        init = truev; // I know it's an ugly workaround, but it works. 
        // If auto is on, so is continuous. (People tend to forget things they don't think about :p)
        if (option[9]/*auto*/) option[11]/*continuous*/ = truev;

        // Fix for nested list items
        ul = obj.children("ul");
        li = ul.children("li");
        liConti = li;
        // Some variables i'm gonna use alot. 
        s = li.length;
        w = li.eq(0).outerWidth(truev); // All slides must be same width, so this shouldn't be a problem. And it makes it posibble to mave multiple slides pr. "page" (2 slides in the viewport).
        h = li.eq(0).outerHeight(truev); // Same, just the height. 

        // Now we are going to fix the document, if it's 'broken'. (No <ul> or no <li>). 
        // I assume that it's can only be broken, if ajax is enabled. If it's broken without Ajax being enabled, the script doesn't have anything to fill the holes. 
        if (option[25]/*ajax*/) {
          // Is the ul element there?
          if (ul.length == 0) {
            // No it's not, lets create it. 
            obj.append('<ul></ul>');
            ul = obj.children("ul");
          }

          // Do we have enough list elements to fill out all the ajax documents. 
          if (option[25]/*ajax*/.length > s) {
            // No we dont. 
            for (var i = 1; i <= option[25]/*ajax*/.length - s; i++) ul.append('<li><p>' + option[35] + '</p></li>');
            li = ul.children("li");
            s = li.length;
            w = li.eq(0).width();
          }
        }

        // Continuing with the variables. 
        t = 0;
        ot = t;
        nt = t;
        ts = s - 1;

        clickable = truev;
        buttonclicked = falsev;
        fading = falsev;
        ajaxloading = falsev;
        autoheightdocument = 0;
        numericControls = new Array();
        numericContainer = falsev;
        destroyed = falsev;
        fontsmoothing = screen.fontSmoothingEnabled;

        // Set obj overflow to hidden (and position to relative <strike>, if fade is enabled. </strike>)
        obj.css("overflow", "hidden");
        if (obj.css("position") == "static") obj.css("position", "relative"); // Fixed a lot of IE6 + IE7 bugs. 

        // Float items to the left
        li.css('float', 'left');

        // The user doens't always put a text in the numericText. 
        // With this, if the user dont, the code will. 
        for (var i = 0; i < s; i++) {
          if (option[15]/*numericText*/[i] == undefined) option[15]/*numericText*/[i] = (i + 1);
          // Same thing for ajax thingy. 
          if (option[25]/*ajax*/ && option[25]/*ajax*/[i] == undefined) option[25]/*ajax*/[i] = falsev;
        }

        // Clone elements for continuous scrolling ( option[40]/*slideCount*/ ) 
        if (option[11]/*continuous*/) {
          //høns
          if (option[6]/*vertical*/) {
            a = 0;
            for (i = option[40]/*slideCount*/; i >= 1; i--) {
              // First we create the elements, pretending AJAX is a city in Russia. 
              var tmpchild = li.eq(-option[40]/*slideCount*/ + i - 1).clone();
              a = a + tmpchild.outerHeight(truev);
              ul.prepend(tmpchild);
              ul.append(li.eq(option[40]/*slideCount*/ - i).clone().css({ 'z-index': '0' }));
            }
          } else {
            a = 0;
            for (i = option[40]/*slideCount*/; i >= 1; i--) {
              // First we create the elements, pretending AJAX is a city in Russia. 
              var tmpchild = li.eq(-option[40]/*slideCount*/ + i - 1).clone();
              a = a + tmpchild.outerWidth(truev);
              ul.prepend(tmpchild);
              ul.append(li.eq(option[40]/*slideCount*/ - i).clone().css({ 'z-index': '0' }));
            }

          }
          // Now, lets check if AJAX really is a city in Russia.
          if (option[25]/*ajax*/) {
            // Now we move from Russia back to reallity (nothing bad about the Russians, it's just a saying in Denmark.)
            // Starting with putting the first document after the last. 
            if (option[25]/*ajax*/[0]) ajaxLoad('last', 0, falsev, 0, falsev);
            // And putting the last document before the first. 
            if (option[25]/*ajax*/[s - 1]) {
              ajaxLoad('first', (s - 1), falsev, 0, falsev);
              // And then preloading the last document (the same document, but into it's entended position). No need to preload the first slide, it gets loaded elsewhere. 
              ajaxLoad(ts, ts, falsev, 0, falsev);
              option[25]/*ajax*/[s - 1] = falsev;
            }
          }
        }

        // Now that the slide content is in place, some adjustments can be made. 
        heightWidthAdjust();

        // And i can make this variable for later use. 
        // The variable contains every <li> element. 
        liConti = ul.children("li");

        // Display the controls.
        if (option[0]/*controlsShow*/) {
          controls = $('<span ' + option[37]/*controlsAttr*/ + '></span>');

          if (option[13]/*numeric*/) {
            numericContainer = controls.prepend('<ol ' + option[14]/*numericAttr*/ + '></ol>').children();
            for (var i = 0; i < s - option[40]/*slideCount*/ + 1; i++) {
              numericControls[i] = $(".preview .controls li:eq("+i+")")
							.click(function () {
							  goToSlide($(this).attr('rel') - 1, truev);
							  return falsev;
							});
            };
          }
          if (option[4]/*firstShow*/) firstbutton = makecontrol(option[36]/*firstHtml*/, "first");
          if (option[5]/*lastShow*/) lastbutton = makecontrol(option[38]/*lastHtml*/, "last");
          if (option[12]/*prevNext*/) {
            nextbutton = makecontrol(option[34]/*nextHtml*/, "next");
            prevbutton = makecontrol(option[33]/*prevHtml*/, "prev");
          }
        };

        // Preload elements. 
        if (option[26]/*preloadAjax*/) {
          preloadEverything();
        }


        // Lets make those fast/normal/fast into some numbers we can make calculations with.
        option[1]/*controlsFadeSpeed*/ = textSpeedToNumber(option[1]/*controlsFadeSpeed*/);
        option[7]/*speed*/ = textSpeedToNumber(option[7]/*speed*/);
        option[10]/*pause*/ = textSpeedToNumber(option[10]/*pause*/);
        option[18]/*speedhistory*/ = textSpeedToNumber(option[18]/*speedhistory*/);
        option[23]/*fadespeed*/ = textSpeedToNumber(option[23]/*fadespeed*/);

        // Starting auto. 
        if (option[9]/*auto*/) timeout = startAuto(option[10]/*pause*/);

        // customLinks. Easy to make, great to use. 
        if (option[20]/*customLink*/) {
          // Using live, that way javascript ajax-loaded buttons and javascript generated content will work.
          $(option[20]/*customLink*/).live('click', function () {
            a = $(this).attr('rel');
            if (a) {
              // Check for special events
              if (a == 'stop') clearTimeout(timeout)
              else if (a == 'start') {
                timeout = startAuto(option[10]/*pause*/);
                option[9]/*auto*/ = truev;
              }
              else if (a == 'block') clickable = falsev; // Simple, beautifull.
              else if (a == 'unblock') clickable = truev; // -||-
              // The general case. 
              // That means, typeof(a) == numbers and first,last,next,prev
              // I dont make any kind of input validation, meaning that it's quite easy to break the script with non-valid input. 
              else if (clickable) goToSlide((a == parseInt(a)) ? a - 1 : a, truev);
            }
            return falsev;
          });
        }

        // Lets make those bookmarks and back/forward buttons work. 
        // And startslide etc. 
        // + If re-initiated, the slider will be at the same slide. 
        if (destroyT) animate(destroyT, falsev, falsev);
        else if (option[17]/*history*/) {
          // Going to the correct slide at load. 
          $.address.init(function (e) {
            if (!destroyT) animate(filterUrlHash(e.value), falsev, falsev);
          })
          // Sliding/fading to the correct slide, on url change. 
					.change(function (e) {
					  var i = filterUrlHash(e.value);
					  if (i != t) goToSlide(i, falsev);
					});
        }
        // The startSlide setting only require one line of code. And here it is:
        else if (option[27]/*startSlide*/) animate(option[27]/*startSlide*/ - 1, falsev, falsev);
        // doing it anyway. good way to fix bugs. 
        // And i only preload the next and previous slide after init (which this is). So i'm doing it. 
        // + if i didn't do this, a lot of things wouldn't happen on page load. By always animating, i ensure that everthing that's supposed to happen, do happen. 
        else animate(0, falsev, falsev);
      }


      /*
      * The functions do the magic. 
      */
      function preloadEverything() {
        for (var i = 0; i <= ts; i++) // Preload everything.
        {
          if (option[25]/*ajax*/[i]) {
            // If somethings is to be loaded, lets load it. 
            ajaxLoad(i, i, falsev, 0, falsev);
            // Making sure it aint loaded again. 
            option[25]/*ajax*/[i] = falsev;
          }
        }
      }

      function heightWidthAdjust() {
        a = 0;
        if (option[6]/*vertical*/) {
          for (var i = -1; i <= s; i++) a = a + li.eq(i).outerHeight(truev);
          ul.height(a * 4);
        }
        else {
          for (var i = -1; i <= s; i++) a = a + li.eq(i).outerWidth(truev);
          ul.width(a * 4);
        }
      }
      function startAuto(pause) {
        return setTimeout(function () {
          goToSlide("next", falsev);
        }, pause);
      }
      function textSpeedToNumber(speed) {
        if (parseInt(speed)) var returnspeed = parseInt(speed);
        else {
          var returnspeed = 400;
          switch (speed) {
            case 'fast':
              returnspeed = 200;
            case 'normal':
              returnspeed = 400;
            case 'medium':
              returnspeed = 400;
            case 'slow':
              returnspeed = 600;
          }
        }
        return returnspeed;
      };
      // I go a long way to save lines of code. 
      function makecontrol(html, action) {
        return $(html).prependTo(controls).click(function () {
          goToSlide(action, truev);
          return falsev;
        });
      }
      // Simple function, great work. 
      function goToSlide(i, clicked) {
        if (!destroyed) {
          if (option[21]/*fade*/) fadeto(i, clicked);
          else animate(i, clicked, truev);
        }
      };
      function runOnImagesLoaded(e, _cb) {
        // This function is based on the onImagesLoaded plugin by soundphed, that was in a comment on this page "http://engineeredweb.com/blog/09/12/preloading-images-jquery-and-javascript#comment-92". 
        e.each(function () {
          var $imgs = (this.tagName.toLowerCase() === 'img') ? $(this) : $('img', this),
					_cont = this,
					i = 0,
					_done = function () {
					  if (typeof _cb === 'function') _cb(_cont);
					};

          if ($imgs.length) {
            $imgs.each(function () {
              var _img = this,
							_checki = function (e) {
							  if ((_img.complete) || (_img.readyState == 'complete' && e.type == 'readystatechange')) {
							    if (++i === $imgs.length) _done();
							  }
							  else if (_img.readyState === undefined) // dont for IE
							  {
							    $(_img).attr('src', $(_img).attr('src')); // re-fire load event
							  }
							}; // _checki \\
              $(_img).bind('load readystatechange', function (e) { _checki(e); });
              _checki({ type: 'readystatechange' }); // bind to 'load' event...
            });
          } else _done();
        });
      };

      // Is the file a image? (This function is not only used in the Ajaxload function)
      function imageCheck(file) {
        var image = falsev;

        var len = file.length;
        var ext = file.substr(len - 4, 4);

        if (ext == '.jpg' || ext == '.png' || ext == '.bmp' || ext == '.gif') image = truev;

        var ext = file.substr(len - 5, 5);
        if (ext == '.jpeg') image = truev;

        return image;
      }
      function fadeControl(fadeOpacity, fadetime, nextcontrol) {
        if (!option[11]/*continuous*/) {
          if (nextcontrol) {
            var eA = nextbutton,
						eB = lastbutton,
						directionA = 'next',
						directionB = 'last',
						firstlastshow = option[5]/*lastShow*/;
          }
          else {
            var eA = prevbutton,
						eB = firstbutton,
						directionA = 'prev',
						directionB = 'first',
						firstlastshow = option[4]/*firstShow*/;
          }

          if (option[12]/*prevNext*/) {
            if (fadeOpacity == 0) eA.fadeOut(fadetime);
            else eA.fadeIn(fadetime);
          }
          if (firstlastshow) {
            if (fadeOpacity == 0) eB.fadeOut(fadetime);
            else eB.fadeIn(fadetime);
          }
          if (option[20]/*customLink*/) {
            $(option[20]/*customLink*/)
						.filter(function (index) {
						  return ($(this).attr("rel") == directionA || $(this).attr("rel") == directionB);
						})
						.fadeTo(fadetime, fadeOpacity, function () { if (fadeOpacity == 0) $(this).hide(); });
          }
        }
      };
      // Fade the controls, if we are at the end of the slide. 
      // It's all the different kind of controls. 
      function fadeControls(a, fadetime) {
        if (a == 0) fadeControl(0, fadetime, falsev);
        else fadeControl(1, fadetime, falsev);

        /* if(a==ts) fadeControl (0,fadetime,truev);
        else fadeControl (1,fadetime,truev);*/
        //høns
        if (a >= s - parseInt(option[40]/*slideCount*/, 10)) fadeControl(0, fadetime, truev);
        else fadeControl(1, fadetime, truev);
      };



      // Updating the 'current' class
      function setCurrent(i) {
        i = parseInt((i > ts) ? i = 0 : ((i < 0) ? i = ts : i)) + 1;
        for (var a = 0; a < numericControls.length; a++) setCurrentElement(numericControls[a], i);
        if (option[20]/*customLink*/) setCurrentElement(option[20]/*customLink*/, i);
      };
      function setCurrentElement(element, i) {
        $(element)
					.filter(".current")
					.removeClass("current")
					.each(function () {
					  if ($.isFunction(option[31]/*uncurrentFunc*/)) { option[31]/*uncurrentFunc*/.call(this, $(this).attr("rel")); }
					});
        $(element)
					.filter(function () {
					  return $(this).attr("rel") == i;
					})
					.addClass("current")
					.each(function (index) {
					  if ($.isFunction(option[32]/*currentFunc*/)) { option[32]/*currentFunc*/.call(this, i); }
					});
      };
      // Find out wich numericText fits the current url. 
      function filterUrlHash(t) {
        var te = 0;
        for (var i = 0; i <= s; i = i + 1) if (option[15]/*numericText*/[i] == t) te = i;
        return te;
      };
      function autoadjust(i, speed) {
        if (option[19]/*autoheight*/) autoheight(i, speed);
        if (option[39]/*autowidth*/) autowidth(i, speed);
      }
      // Automaticly adjust the height, i love this function. 
      function autoheight(i, speed) {
        obj.ready(function () {
          if (i == s) i = 0;
          // First i run it. In case there are no images. 
          var nheight = li.eq(i).height();
          if (nheight != 0) setHeight(nheight, speed);
          // Then i run it again after the images has been loaded. (If any)
          runOnImagesLoaded(li.eq(i), function (imgtarget) {
            obj.ready(function () {
              nheight = $(imgtarget).height();
              if (nheight != 0) setHeight(nheight, speed);
            });
          });
        });
      };
      // Automaticly adjust the width (sick). 
      function autowidth(i, speed) {
        obj.ready(function () {
          if (i == s) i = 0;
          // First i run it. In case there are no images. 
          var nwidth = li.eq(i).width();
          if (nwidth != 0) setWidth(nwidth, speed);
          // Then i run it again after the images has been loaded. (If any)
          runOnImagesLoaded(li.eq(i), function (imgtarget) {
            obj.ready(function () {
              nwidth = $(imgtarget).width();
              if (nwidth != 0) setWidth(nwidth, speed);
            });
          });
        });
      };
      function setWidth(nwidth, speed) {
        obj.animate(
					{ width: nwidth },
					{
					  queue: falsev,
					  duration: speed,
					  easing: option[8]/*ease*/
					}
				);
      };
      function setHeight(nheight, speed) {
        obj.animate(
					{ height: nheight },
					{
					  queue: falsev,
					  duration: speed,
					  easing: option[8]/*ease*/
					}
				);
      };
      function adjustPosition() {
        a = 0; //høns
        var substract = 1;
        if (option[11]/*continuous*/) substract = 1 - option[40]/*slideCount*/;

        var add = 0;
        if (option[11]/*continuous*/) add = option[40]/*slideCount*/;
        if (option[6]/*vertical*/) ul.css("margin-top", -li.eq(t).position().top + ul.position().top);
        else {
          for (var i = 0; i <= t - substract; i++) {
            a = a + liConti.eq(i + add).outerWidth(truev);
          }
          ul.css("margin-left", -a);

        }
      }

      // When the animation finishes (fade or sliding), we need to adjust the slider. 
      function adjust() {
        if (option[11]/*continuous*/) {
          if (t > ts) t = 0;
          if (t < 1 - option[40]/*slideCount*/) t = s - option[40]/*slideCount*/;
        }
        else {
          if (t > ts) t = 0;
          if (t < 0) t = ts;
        }
        if (t == ts) preloadEverything();
        if (!option[24]/*updateBefore*/) setCurrent(t);
        adjustPosition();
        clickable = truev;
        if (option[17]/*history*/ && buttonclicked) window.location.hash = option[15]/*numericText*/[t];
        if (!fading) {
          a = t + 1;
          if (a < 1) a = s - a;
          // Lets run the after animation function.
          if ($.isFunction(option[30]/*afterAniFunc*/)) {
            afterAniCall(li.eq(t), a)
            if (option[11]/*continuous*/) {
              if (t < option[40]/*slideCount*/) afterAniCall(liConti.eq(t - 2), a)
              else if (t > ts - option[40]/*slideCount*/) afterAniCall(liConti.eq(t - (option[40]/*slideCount*/ + 1)), a)
            }
          }
        }
      };
      function afterAniCall(el, a) {
        option[30]/*afterAniFunc*/.call(el, a);
      };
      function beforeAniCall(el, a) {
        option[29]/*beforeAniFunc*/.call(el, a);
      };
      // Convert the direction into a usefull number.
      function filterDir(dir, ot) {
        var nt = t; // i dont want to mess with the 't' variable. This function doens't allways return the t-value, it can be used for other things.
        switch (dir) {
          case "next":
            nt = (ot >= ts) ? (option[11]/*continuous*/ ? nt + 1 : ts) : nt + 1;
            break;
          case "prev":
            nt = (nt <= 0) ? (option[11]/*continuous*/ ? nt - 1 : 0) : nt - 1;
            break;
          case "first":
            nt = 0;
            break;
          case "last":
            nt = ts;
            break;
          default:
            nt = parseInt(dir);
            break;
        };
        return nt;
      };
      // Load a ajax document (or i image) into a list element. 
      // If testing this locally (loading everything from a harddisk instead of the internet), it may not work. 
      // But then try to upload it to a server, and see it shine. 
      function ajaxLoad(i, l, adjust, speed, fadeCallBack) {
        var targetslide = falsev;
        if (parseInt(i) || i == 0) targetslide = li.eq(i);
        else {
          if (i == 'last') targetslide = $('li:last', obj);
          else targetslide = $('li:first', obj);
          var conti = truev; // This could get complicated. 
        }
        // What speed should the autoheight function animate with?
        var ajaxspeed = (fading) ? (!option[22]/*crossFade*/ ? parseInt(option[23]/*fadespeed*/ * (2 / 5)) : option[23]/*fadespeed*/) : speed;
        // The script itself is not using the 'tt' variable. But a custom function can use it. 
        var tt = l + 1;
        if (imageCheck(option[25]/*ajax*/[l])) {
          // Load the image.
          targetslide.html(' ').append($(new Image()).attr('src', option[25]/*ajax*/[l]));
          // When the document is ready again, we launch a autoheight event. 
          runOnImagesLoaded(targetslide, function (img) {
            var target = $(img).children();
            // If the image is to wide, shrink it. 
            finishImageLoading(target);
            function finishImageLoading(target) {
              var width = target.width(),
							height = target.height(),
							slidewidth = target.parent().width();
              // If width == 0, that means it's not ready yet. 
              // So we waint 5 ms. 
              if (width == 0) setTimeout(function () { finishImageLoading(target); }, 5);
              else {

                target.attr({ 'oldheight': height, 'oldwidth': width });
                // The last part (height:auto) forces the browser to think about the <li> elements height. 
                if (width > slidewidth) target.animate({ width: slidewidth, height: (height / width) * slidewidth }, 0).parent().animate({ height: (height / width) * slidewidth }, 0).css('height', 'auto');
                // If we want, we can launch a function here. 
                if ($.isFunction(option[28]/*ajaxLoadFunction*/)) { option[28]/*ajaxLoadFunction*/.call($(img), tt, truev); }
                // Lets just make some adjustments
                ajaxAdjust(target.parent(), conti);
                if (adjust) autoadjust(i, ajaxspeed);
                if (fadeCallBack) {
                  option[25]/*ajax*/[l] = false;
                  clickable = true;
                  adjustPosition();
                  fadeto(fadeCallBack, true);
                }
              }
            }

          });
        }
        else {

          // Load the document into the list element. 
          targetslide.load(option[25]/*ajax*/[l], function (response, status, xhr) {
            // Lets just make some adjustments
            ajaxAdjust($(this), conti);
            if (adjust) adjustPosition();

            if (status == "error" || !$(this).html()) $(this).html("Sorry but there was an error: " + (xhr.status ? xhr.status : 'no content') + " " + xhr.statusText);
            // If we want, we can launch a function here. 
            if (status != "error" && $.isFunction(option[28]/*ajaxLoadFunction*/)) { option[28]/*ajaxLoadFunction*/.call($(this), tt, falsev); }
            // Lets adjust the height, i don't care if there's an error or not. 
            // var nheight = $(this).height(); // Why did i put that there??? Delete this comment when reason is found. 
            if (adjust) autoadjust(l, ajaxspeed);
            if (fadeCallBack) {
              option[25]/*ajax*/[l] = false;
              clickable = true;
              adjustPosition();
              fadeto(fadeCallBack, true);
            }
          });
        }
      };
      function ajaxAdjust(target, conti) //hønse
      {
        // If this is the "continuous" elements (the ones before the first and after the last). 
        if (conti) {
          adjustPosition();
          //if(option[6]/*vertical*/) target.css("margin-top","-"+ target.outerHeight(truev) +"px");
          //else target.css("margin-left","-"+ target.outerWidth(truev) +"px");
        }
        heightWidthAdjust();

      };
      // It's not only a slider, it can also fade from slide to slide. 
      function fadeto(i, clicked) {
        if (i != t && !destroyed && clickable) // We doesn't want something to happen all the time. The URL can change a lot, and cause som "flickering". 
        {
          ajaxloading = falsev;
          // Stop auto if cliked.
          if (clicked) clearTimeout(timeout);
          // Update the current class of the buttons. 
          if (option[24]/*updateBefore*/) setCurrent(filterDir(i, ot));
          // Only clickable if not clicked.
          clickable = !clicked;
          // Setting the speed. 
          var speed = (!clicked && !option[9]/*auto*/ && option[17]/*history*/) ? option[23]/*fadespeed*/ * (option[18]/*speedhistory*/ / option[7]/*speed*/) : option[23]/*fadespeed*/;
          var ll = filterDir(i, ot);
          // Lets make sure that the target actually exists. 
          if (ll > ts) ll = 0;
          if (ll < 0) ll = ts;
          // Lets make sure the prev/next buttons also fade. 
          if (option[2]/*controlsFade*/) fadeControls(ll, option[1]/*controlsFadeSpeed*/);

          // autoadjust
          if (option[25]/*ajax*/ && option[25]/*ajax*/[ll]) ajaxLoad(ll, ll, false, speed, ll);
          else {
            autoadjust(ll, option[23]/*fadespeed*/); // The height animation takes the full lenght of the fade animation (fadein + fadeout if it's not crossfading).  

            // Define the target. 
            var target = li.eq(ll);
            // So lets run the function.
            if ($.isFunction(option[29]/*beforeAniFunc*/)) beforeAniCall(target, ll + 1)
            // Crossfading?
            if (option[22]/*crossFade*/) {
              // I clone the target, and fade it in, then hide the cloned element while adjusting the slider to show the real target.
              target.clone().prependTo(obj).css({ 'z-index': '100000', 'position': 'absolute', 'list-style': 'none', 'top': '0', 'left': '0' }).
              // Lets fade it in. 
							hide().fadeIn(option[23]/*fadespeed*/, function () {
							  if (fontsmoothing) this.style.removeAttribute("filter"); // Fix clearype
							  // So the animate function knows what to do. 
							  clickable = truev;
							  fading = truev;
							  animate(i, falsev, falsev); // Moving to the correct place.
							  // Removing it again, if i dont, it will just be a pain in the ....
							  $(this).remove();
							  if (option[17]/*history*/ && clicked) window.location.hash = option[15]/*numericText*/[t]; // It's just one line of code, no need to make a function of it. 
							  // Lets put that variable back to the default (and not during animation) value. 
							  fading = falsev;
							  // Now run that after animation function.
							  // We already got the target and the slider number from earlier.
							  // So lets run the function.
							  if ($.isFunction(option[30]/*afterAniFunc*/)) { option[30]/*afterAniFunc*/.call(target, ll + 1); }
							});
            }
            else {
              // fadeOut and fadeIn.
              var fadeinspeed = parseInt((speed) * (3 / 5)),
							fadeoutspeed = speed - fadeinspeed,
              // I set the opacity to something higher than 0, because if it's 0, the content that i try to read (to make the autoheight work etc.) aint there.
							noncrossfadetargets = li.children();
              noncrossfadetargets.stop().fadeTo(fadeoutspeed, 0.0001, function () {
                // So the animation function knows what to do. 
                clickable = truev;
                fading = truev;
                animate(i, falsev, falsev); // Moving to the correct place.
                // Only clickable if not clicked.
                clickable = !clicked;
                // Now, lets fade the slider back in. 
                // Got no idea why the .add(li) is nesecary, but it is. (If it isn't there, the first slide never fades back in). 
                noncrossfadetargets.add(li).stop().fadeTo(fadeinspeed, 1, function () {
                  if (fontsmoothing) this.style.removeAttribute("filter"); // Fix clearype
                  if (option[17]/*history*/ && clicked) window.location.hash = option[15]/*numericText*/[t]; // It's just one line of code, no need to make a function of it. 
                  clickable = truev;
                  fading = falsev;
                  // Now run that after animation function.
                  // We already got the target and the slider number from earlier.
                  // So lets run the function.
                  if ($.isFunction(option[30]/*afterAniFunc*/)) { option[30]/*afterAniFunc*/.call(target, ll + 1); }
                });
              });
            }
          }
        }
      };
      function animate(dir, clicked, time) // (Direction, did the user click something, is this to be done in >1ms?) 
      {
        if (clickable && !destroyed && (filterDir(dir, ot) != t || init)) {
          ajaxloading = falsev;
          clickable = (!clicked && !option[9]/*auto*/) ? truev : option[16]/*clickableAni*/;
          // to the adjust function. 
          buttonclicked = clicked;
          ot = t;
          t = filterDir(dir, ot);
          if (option[24]/*updateBefore*/) setCurrent(t);
          // Calculating the speed to do the animation with. 
          var diff = Math.sqrt(Math.abs(ot - t)),
					speed = parseInt(diff * option[7]/*speed*/);
          if (!clicked && !option[9]/*auto*/) speed = parseInt(diff * option[18]/*speedhistory*/); // Auto:truev and history:truev doens't work well together, and they ain't supposed to. 
          if (!time) speed = 0;

          // Ajax begins here 
          // I also these variables in the below code (running custom function).
          var i = t;
          if (t > ts) i = 0;
          if (t < 0) i = ts;
          if (option[25]/*ajax*/) {
            // Loading the target slide, if not already loaded. 
            if (option[25]/*ajax*/[i]) {
              ajaxLoad(i, i, truev, speed, falsev);
              option[25]/*ajax*/[i] = falsev;
              ajaxloading = truev;
            }
            // It can look stupid the script scroll over some not-loaded slides. Therefore, they are loaded. 
            // It can produce some heavy load, so the script wont do it, it it's more than 10 slides.
            if (!fading) {
              var countajax = 0;

              var aa = (ot > t) ? t : ot,
							ab = (ot > t) ? ot : t;

              for (var a = aa; a <= ab; a++) {
                if (a <= ts && a >= 0 && option[25]/*ajax*/[a]) {
                  ajaxLoad(a, a, falsev, speed, falsev);
                  option[25]/*ajax*/[a] = falsev;
                  countajax++;
                }
                if (countajax == 10) a = ot; // break;
              }
            }
            // Then we have to preload the next one. 
            if (i + 1 <= ts && option[25]/*ajax*/[i + 1]) {
              ajaxLoad(i + 1, i + 1, falsev, 0, falsev);
              option[25]/*ajax*/[i + 1] = falsev;
            }
            // And the previous one. 
            if (i - 1 >= 0 && option[25]/*ajax*/[i - 1]) {
              ajaxLoad(i - 1, i - 1, falsev, 0, falsev);
              option[25]/*ajax*/[i - 1] = falsev;
            }
          }
          // Lets create a variable for later use
          if (t < 0)//hønse
          {
            var contiElement = liConti.eq(option[40]/*slideCount*/ + t);
            // t == s || t == -1.
            //var contiElement = liConti.eq((t == -1) ? 0 : -1);
          }
          if (t > ts) {
            var contiElement = liConti.eq(t - s - option[40]/*slideCount*/);
          }
          // Ajax ends here
          if (!fading) {
            if (t < -1) i = s - option[40]/*slideCount*/;
            // Lets run the before animation function.
            if ($.isFunction(option[29]/*beforeAniFunc*/)) {
              beforeAniCall(li.eq(i), i + 1)
              if (t < 0 || t > ts) beforeAniCall(contiElement, i + 1)
              else if (option[11]/*continuous*/) {
                if (t < option[40]/*slideCount*/) beforeAniCall(liConti.eq(t - 2), i + 1);
                else if (t > ts - option[40]/*slideCount*/) beforeAniCall(liConti.eq(t - (option[40]/*slideCount*/ + 1)), i + 1);
              }
            }

          }
          // Start animation. 
          if (!fading && !ajaxloading) autoadjust(t, speed);
          if (!option[6]/*vertical*/) {
            if (t < 0 || t == s) var p = -contiElement.position().left - parseFloat(contiElement.css('marginLeft'), 10) + ul.position().left;
            else {
              // This can be merged with positionadjust. 
              var p = 0;
              var substract = 1;
              if (option[11]/*continuous*/) substract = 1 - option[40]/*slideCount*/;
              var add = 0;
              if (option[11]/*continuous*/) add = option[40]/*slideCount*/;
              for (var i = 0; i <= t - substract; i++) p = p - liConti.eq(i + add).outerWidth(truev);
            }
            ul.animate(
							{ marginLeft: p },
							{
							  queue: falsev,
							  duration: speed,
							  easing: option[8]/*ease*/,
							  complete: adjust
							}
						);
          } else {
            if (t == -1 || t == s) var p = -contiElement.position().top - parseFloat(contiElement.css('marginTop'), 10) + ul.position().top;
            else var p = -li.eq(t).position().top + ul.position().top;
            ul.animate(
							{ marginTop: p },
							{
							  queue: falsev,
							  duration: speed,
							  easing: option[8]/*ease*/,
							  complete: adjust
							}
						);
          };
          // End animation. 

          // Fading the next/prev/last/first controls in/out if needed. 
          if (option[2]/*controlsFade*/) {
            var fadetime = option[1]/*controlsFadeSpeed*/;
            if (!clicked && !option[9]/*auto*/) fadetime = (option[18]/*speedhistory*/ / option[7]/*speed*/) * option[1]/*controlsFadeSpeed*/;
            if (!time) fadetime = 0;
            if (fading) fadetime = parseInt((option[23]/*fadespeed*/) * (3 / 5));
            fadeControls(t, fadetime);
          }

          // Stopping auto if clicked. 
          if (clicked) clearTimeout(timeout);
          // Continuing if not clicked.
          if (option[9]/*auto*/ && dir == "next" && !clicked) timeout = startAuto(option[10]/*pause*/ + option[7]/*speed*/);
          // Stop init, first animation is done. 
          init = falsev; //nasty workaround, but it works. 
        };
      };
      function returnOptionNumber(name) // Get the number from the name. 
      {
        var optionsUserName = [
					'controlsShow',
					'controlsFadeSpeed',
					'controlsFade',
					'insertAfter',
					'firstShow',
					'lastShow',
					'vertical',
					'speed',
					'ease',
					'auto',
					'pause',
					'continuous',
					'prevNext',
					'numeric',
					'numericAttr',
					'numericText',
					'clickableAni',
					'history',
					'speedhistory',
					'autoheight',
					'customLink',
					'fade',
					'crossFade',
					'fadespeed',
					'updateBefore',
					'ajax',
					'preloadAjax',
					'startSlide',
					'ajaxLoadFunction',
					'beforeAniFunc',
					'afterAniFunc',
					'uncurrentFunc',
					'currentFunc',
					'prevHtml',
					'nextHtml',
					'loadingText',
					'firstHtml',
					'controlsAttr',
					'lastHtml',
					'autowidth',
					'slideCount'
				];
        for (var i = 0; i < optionsUserName.length; i++) if (optionsUserName[i] == name) var optionnumber = i;
        return optionnumber;
      }
      /*
      * Public functions. 
      */
      baseSlider.getOption = function (a) {
        return option[returnOptionNumber(a)];
      }
      baseSlider.setOption = function (a, val) {
        baseSlider.destroy();
        option[returnOptionNumber(a)] = val;
        baseSlider.init();
      }
      baseSlider.insertSlide = function (html, pos, numtext) {
        // First we make it easier to work. 
        baseSlider.destroy();
        // pos = 0 means before everything else. 
        // pos = 1 means after the first slide.
        if (pos > s) pos = s; // If you try to add a slide after the last slide fix. 
        var html = '<li>' + html + '</li>';
        if (!pos || pos == 0) ul.prepend(html);
        else li.eq(pos - 1).after(html);
        // Finally, we make it work again. 
        if (pos < destroyT || (!pos || pos == 0)) destroyT++;
        // Maybe i'll do somethings before init. option[15]/*numericText*/
        if (option[15]/*numericText*/.length < pos) { option[15]/*numericText*/.length = pos; }
        if (!numtext) numtext = parseInt(pos, 10) + 1;
        option[15]/*numericText*/.splice(pos, 0, numtext);
        baseSlider.init();
      }
      baseSlider.removeSlide = function (pos) {
        pos--; // 1 == the first. 
        // First we make it easier to work. 
        baseSlider.destroy();
        // Then we work. 
        li.eq(pos).remove();
        option[15]/*numericText*/.splice(pos, 1);
        if (pos < destroyT) destroyT--;
        // Finally, we make it work again. 
        baseSlider.init();
      }
      baseSlider.goToSlide = function (a) {
        goToSlide((a == parseInt(a)) ? a - 1 : a, truev);
      }
      baseSlider.block = function () {
        clickable = falsev; // Simple, beautifull.
      }

      baseSlider.unblock = function () {
        clickable = truev; // Simple, beautifull.
      }

      baseSlider.startAuto = function () {
        option[9]/*auto*/ = truev;
        timeout = startAuto(option[10]/*pause*/);
      }

      baseSlider.stopAuto = function () {
        clearTimeout(timeout);
      }

      baseSlider.destroy = function () {
        destroyT = t;
        // First, i remove the controls. 
        controls.remove(); // that's it.
        // Now to set a variable, so nothing is run. 
        destroyed = truev; // No animation, no fading, no clicking from now. 
        // Then remove the customLink bindings:
        $(option[20]/*customLink*/).die("click");
        // Now remove the "continuous clones". 
        if (option[11]/*continuous*/) {
          for (a = 1; a <= option[40]/*slideCount*/; a++) {
            liConti.eq(a - 1).remove();
            liConti.eq(-a).remove();
          }
        }
      }
      baseSlider.init = function () {
        if (destroyed) {
          initSudoSlider(obj, destroyT);
        }
      }
      baseSlider.adjust = function (speed) {
        if (!speed) speed = 0;
        heightWidthAdjust();
        autoadjust(i, speed)
      }
      baseSlider.getValue = function (a) {
        switch (a) {
          case 'currentSlide':
            return t + 1;
          case 'totalSlides':
            return s;
          case 'clickable':
            return clickable;
          case 'destroyed':
            return destroyed;
        }
        return undefined;
      }

    });
  };
})(jQuery);















/*!
 * jQuery UI 1.8.2
 *
 * Copyright (c) 2010 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
 */

(function($) {

// prevent duplicate loading
// this is only a problem because we proxy existing functions
// and we don't want to double proxy them
$.ui = $.ui || {};
if ($.ui.version) {
	return;
}

//Helper functions and ui object
$.extend($.ui, {
	version: "1.8.2",

	// $.ui.plugin is deprecated.  Use the proxy pattern instead.
	plugin: {
		add: function(module, option, set) {
			var proto = $.ui[module].prototype;
			for(var i in set) {
				proto.plugins[i] = proto.plugins[i] || [];
				proto.plugins[i].push([option, set[i]]);
			}
		},
		call: function(instance, name, args) {
			var set = instance.plugins[name];
			if(!set || !instance.element[0].parentNode) { return; }

			for (var i = 0; i < set.length; i++) {
				if (instance.options[set[i][0]]) {
					set[i][1].apply(instance.element, args);
				}
			}
		}
	},

	contains: function(a, b) {
		return document.compareDocumentPosition
			? a.compareDocumentPosition(b) & 16
			: a !== b && a.contains(b);
	},

	hasScroll: function(el, a) {

		//If overflow is hidden, the element might have extra content, but the user wants to hide it
		if ($(el).css('overflow') == 'hidden') { return false; }

		var scroll = (a && a == 'left') ? 'scrollLeft' : 'scrollTop',
			has = false;

		if (el[scroll] > 0) { return true; }

		// TODO: determine which cases actually cause this to happen
		// if the element doesn't have the scroll set, see if it's possible to
		// set the scroll
		el[scroll] = 1;
		has = (el[scroll] > 0);
		el[scroll] = 0;
		return has;
	},

	isOverAxis: function(x, reference, size) {
		//Determines when x coordinate is over "b" element axis
		return (x > reference) && (x < (reference + size));
	},

	isOver: function(y, x, top, left, height, width) {
		//Determines when x, y coordinates is over "b" element
		return $.ui.isOverAxis(y, top, height) && $.ui.isOverAxis(x, left, width);
	},

	keyCode: {
		ALT: 18,
		BACKSPACE: 8,
		CAPS_LOCK: 20,
		COMMA: 188,
		COMMAND: 91,
		COMMAND_LEFT: 91, // COMMAND
		COMMAND_RIGHT: 93,
		CONTROL: 17,
		DELETE: 46,
		DOWN: 40,
		END: 35,
		ENTER: 13,
		ESCAPE: 27,
		HOME: 36,
		INSERT: 45,
		LEFT: 37,
		MENU: 93, // COMMAND_RIGHT
		NUMPAD_ADD: 107,
		NUMPAD_DECIMAL: 110,
		NUMPAD_DIVIDE: 111,
		NUMPAD_ENTER: 108,
		NUMPAD_MULTIPLY: 106,
		NUMPAD_SUBTRACT: 109,
		PAGE_DOWN: 34,
		PAGE_UP: 33,
		PERIOD: 190,
		RIGHT: 39,
		SHIFT: 16,
		SPACE: 32,
		TAB: 9,
		UP: 38,
		WINDOWS: 91 // COMMAND
	}
});

//jQuery plugins
$.fn.extend({
	_focus: $.fn.focus,
	focus: function(delay, fn) {
		return typeof delay === 'number'
			? this.each(function() {
				var elem = this;
				setTimeout(function() {
					$(elem).focus();
					(fn && fn.call(elem));
				}, delay);
			})
			: this._focus.apply(this, arguments);
	},
	
	enableSelection: function() {
		return this
			.attr('unselectable', 'off')
			.css('MozUserSelect', '');
	},

	disableSelection: function() {
		return this
			.attr('unselectable', 'on')
			.css('MozUserSelect', 'none');
	},

	scrollParent: function() {
		var scrollParent;
		if(($.browser.msie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) {
			scrollParent = this.parents().filter(function() {
				return (/(relative|absolute|fixed)/).test($.curCSS(this,'position',1)) && (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));
			}).eq(0);
		} else {
			scrollParent = this.parents().filter(function() {
				return (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));
			}).eq(0);
		}

		return (/fixed/).test(this.css('position')) || !scrollParent.length ? $(document) : scrollParent;
	},

	zIndex: function(zIndex) {
		if (zIndex !== undefined) {
			return this.css('zIndex', zIndex);
		}
		
		if (this.length) {
			var elem = $(this[0]), position, value;
			while (elem.length && elem[0] !== document) {
				// Ignore z-index if position is set to a value where z-index is ignored by the browser
				// This makes behavior of this function consistent across browsers
				// WebKit always returns auto if the element is positioned
				position = elem.css('position');
				if (position == 'absolute' || position == 'relative' || position == 'fixed')
				{
					// IE returns 0 when zIndex is not specified
					// other browsers return a string
					// we ignore the case of nested elements with an explicit value of 0
					// <div style="z-index: -10;"><div style="z-index: 0;"></div></div>
					value = parseInt(elem.css('zIndex'));
					if (!isNaN(value) && value != 0) {
						return value;
					}
				}
				elem = elem.parent();
			}
		}

		return 0;
	}
});


//Additional selectors
$.extend($.expr[':'], {
	data: function(elem, i, match) {
		return !!$.data(elem, match[3]);
	},

	focusable: function(element) {
		var nodeName = element.nodeName.toLowerCase(),
			tabIndex = $.attr(element, 'tabindex');
		return (/input|select|textarea|button|object/.test(nodeName)
			? !element.disabled
			: 'a' == nodeName || 'area' == nodeName
				? element.href || !isNaN(tabIndex)
				: !isNaN(tabIndex))
			// the element and all of its ancestors must be visible
			// the browser may report that the area is hidden
			&& !$(element)['area' == nodeName ? 'parents' : 'closest'](':hidden').length;
	},

	tabbable: function(element) {
		var tabIndex = $.attr(element, 'tabindex');
		return (isNaN(tabIndex) || tabIndex >= 0) && $(element).is(':focusable');
	}
});

})(jQuery);


/*
 * jQuery UI Datepicker 1.8.2
 *
 * Copyright (c) 2010 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/Datepicker
 *
 * Depends:
 *	jquery.ui.core.js
 */

(function($) { // hide the namespace

$.extend($.ui, { datepicker: { version: "1.8.2" } });

var PROP_NAME = 'datepicker';
var dpuuid = new Date().getTime();

/* Date picker manager.
   Use the singleton instance of this class, $.datepicker, to interact with the date picker.
   Settings for (groups of) date pickers are maintained in an instance object,
   allowing multiple different settings on the same page. */

function Datepicker() {
	this.debug = false; // Change this to true to start debugging
	this._curInst = null; // The current instance in use
	this._keyEvent = false; // If the last event was a key event
	this._disabledInputs = []; // List of date picker inputs that have been disabled
	this._datepickerShowing = false; // True if the popup picker is showing , false if not
	this._inDialog = false; // True if showing within a "dialog", false if not
	this._mainDivId = 'ui-datepicker-div'; // The ID of the main datepicker division
	this._inlineClass = 'ui-datepicker-inline'; // The name of the inline marker class
	this._appendClass = 'ui-datepicker-append'; // The name of the append marker class
	this._triggerClass = 'ui-datepicker-trigger'; // The name of the trigger marker class
	this._dialogClass = 'ui-datepicker-dialog'; // The name of the dialog marker class
	this._disableClass = 'ui-datepicker-disabled'; // The name of the disabled covering marker class
	this._unselectableClass = 'ui-datepicker-unselectable'; // The name of the unselectable cell marker class
	this._currentClass = 'ui-datepicker-current-day'; // The name of the current day marker class
	this._dayOverClass = 'ui-datepicker-days-cell-over'; // The name of the day hover marker class
	this.regional = []; // Available regional settings, indexed by language code
	this.regional[''] = { // Default regional settings
		closeText: 'Done', // Display text for close link
		prevText: '&laquo;', // Display text for previous month link
		nextText: '&raquo;', // Display text for next month link
		currentText: 'Today', // Display text for current month link
		monthNames: ['Jänner','Februar','März','April','Mai','Juni',
			'Juli','August','September','Oktober','November','Dezember'], // Names of months for drop-down and formatting
		monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], // For formatting
		dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], // For formatting
		dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], // For formatting
		dayNamesMin: ['So','Mo','Di','Mi','Do','Fr','Sa'], // Column headings for days starting at Sunday
		weekHeader: 'Wk', // Column header for week of the year
		dateFormat: 'mm/dd/yy', // See format options on parseDate
		firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...
		isRTL: false, // True if right-to-left language, false if left-to-right
		showMonthAfterYear: false, // True if the year select precedes month, false for month then year
		yearSuffix: '' // Additional text to append to the year in the month headers
	};
	this._defaults = { // Global defaults for all the date picker instances
		showOn: 'focus', // 'focus' for popup on focus,
			// 'button' for trigger button, or 'both' for either
		showAnim: 'fadeIn', // Name of jQuery animation for popup
		showOptions: {}, // Options for enhanced animations
		defaultDate: null, // Used when field is blank: actual date,
			// +/-number for offset from today, null for today
		appendText: '', // Display text following the input box, e.g. showing the format
		buttonText: '...', // Text for trigger button
		buttonImage: '', // URL for trigger button image
		buttonImageOnly: false, // True if the image appears alone, false if it appears on a button
		hideIfNoPrevNext: false, // True to hide next/previous month links
			// if not applicable, false to just disable them
		navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links
		gotoCurrent: false, // True if today link goes back to current selection instead
		changeMonth: false, // True if month can be selected directly, false if only prev/next
		changeYear: false, // True if year can be selected directly, false if only prev/next
		yearRange: 'c-10:c+10', // Range of years to display in drop-down,
			// either relative to today's year (-nn:+nn), relative to currently displayed year
			// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)
		showOtherMonths: false, // True to show dates in other months, false to leave blank
		selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable
		showWeek: false, // True to show week of the year, false to not show it
		calculateWeek: this.iso8601Week, // How to calculate the week of the year,
			// takes a Date and returns the number of the week for it
		shortYearCutoff: '+10', // Short year values < this are in the current century,
			// > this are in the previous century,
			// string value starting with '+' for current year + value
		minDate: null, // The earliest selectable date, or null for no limit
		maxDate: null, // The latest selectable date, or null for no limit
		duration: 'fast', // Duration of display/closure
		beforeShowDay: null, // Function that takes a date and returns an array with
			// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or '',
			// [2] = cell title (optional), e.g. $.datepicker.noWeekends
		beforeShow: null, // Function that takes an input field and
			// returns a set of custom settings for the date picker
		onSelect: null, // Define a callback function when a date is selected
		onChangeMonthYear: null, // Define a callback function when the month or year is changed
		onClose: null, // Define a callback function when the datepicker is closed
		numberOfMonths: 1, // Number of months to show at a time
		showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)
		stepMonths: 1, // Number of months to step back/forward
		stepBigMonths: 12, // Number of months to step back/forward for the big links
		altField: '', // Selector for an alternate field to store selected dates into
		altFormat: '', // The date format to use for the alternate field
		constrainInput: true, // The input is constrained by the current date format
		showButtonPanel: false, // True to show button panel, false to not show it
		autoSize: false // True to size the input for the date format, false to leave as is
	};
	$.extend(this._defaults, this.regional['']);
	this.dpDiv = $('<div id="' + this._mainDivId + '" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all ui-helper-hidden-accessible"></div>');
}

$.extend(Datepicker.prototype, {
	/* Class name added to elements to indicate already configured with a date picker. */
	markerClassName: 'hasDatepicker',

	/* Debug logging (if enabled). */
	log: function () {
		if (this.debug)
			console.log.apply('', arguments);
	},
	
	// TODO rename to "widget" when switching to widget factory
	_widgetDatepicker: function() {
		return this.dpDiv;
	},

	/* Override the default settings for all instances of the date picker.
	   @param  settings  object - the new settings to use as defaults (anonymous object)
	   @return the manager object */
	setDefaults: function(settings) {
		extendRemove(this._defaults, settings || {});
		return this;
	},

	/* Attach the date picker to a jQuery selection.
	   @param  target    element - the target input field or division or span
	   @param  settings  object - the new settings to use for this date picker instance (anonymous) */
	_attachDatepicker: function(target, settings) {
		// check for settings on the control itself - in namespace 'date:'
		var inlineSettings = null;
		for (var attrName in this._defaults) {
			var attrValue = target.getAttribute('date:' + attrName);
			if (attrValue) {
				inlineSettings = inlineSettings || {};
				try {
					inlineSettings[attrName] = eval(attrValue);
				} catch (err) {
					inlineSettings[attrName] = attrValue;
				}
			}
		}
		var nodeName = target.nodeName.toLowerCase();
		var inline = (nodeName == 'div' || nodeName == 'span');
		if (!target.id) {
			this.uuid += 1;
			target.id = 'dp' + this.uuid;
		}
		var inst = this._newInst($(target), inline);
		inst.settings = $.extend({}, settings || {}, inlineSettings || {});
		if (nodeName == 'input') {
			this._connectDatepicker(target, inst);
		} else if (inline) {
			this._inlineDatepicker(target, inst);
		}
	},

	/* Create a new instance object. */
	_newInst: function(target, inline) {
		var id = target[0].id.replace(/([^A-Za-z0-9_])/g, '\\\\$1'); // escape jQuery meta chars
		return {id: id, input: target, // associated target
			selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection
			drawMonth: 0, drawYear: 0, // month being drawn
			inline: inline, // is datepicker inline or not
			dpDiv: (!inline ? this.dpDiv : // presentation div
			$('<div class="' + this._inlineClass + ' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'))};
	},

	/* Attach the date picker to an input field. */
	_connectDatepicker: function(target, inst) {
		var input = $(target);
		inst.append = $([]);
		inst.trigger = $([]);
		if (input.hasClass(this.markerClassName))
			return;
		this._attachments(input, inst);
		input.addClass(this.markerClassName).keydown(this._doKeyDown).
			keypress(this._doKeyPress).keyup(this._doKeyUp).
			bind("setData.datepicker", function(event, key, value) {
				inst.settings[key] = value;
			}).bind("getData.datepicker", function(event, key) {
				return this._get(inst, key);
			});
		this._autoSize(inst);
		$.data(target, PROP_NAME, inst);
	},

	/* Make attachments based on settings. */
	_attachments: function(input, inst) {
		var appendText = this._get(inst, 'appendText');
		var isRTL = this._get(inst, 'isRTL');
		if (inst.append)
			inst.append.remove();
		if (appendText) {
			inst.append = $('<span class="' + this._appendClass + '">' + appendText + '</span>');
			input[isRTL ? 'before' : 'after'](inst.append);
		}
		input.unbind('focus', this._showDatepicker);
		if (inst.trigger)
			inst.trigger.remove();
		var showOn = this._get(inst, 'showOn');
		if (showOn == 'focus' || showOn == 'both') // pop-up date picker when in the marked field
			input.focus(this._showDatepicker);
		if (showOn == 'button' || showOn == 'both') { // pop-up date picker when button clicked
			var buttonText = this._get(inst, 'buttonText');
			var buttonImage = this._get(inst, 'buttonImage');
			inst.trigger = $(this._get(inst, 'buttonImageOnly') ?
				$('<img/>').addClass(this._triggerClass).
					attr({ src: buttonImage, alt: buttonText, title: buttonText }) :
				$('<button type="button"></button>').addClass(this._triggerClass).
					html(buttonImage == '' ? buttonText : $('<img/>').attr(
					{ src:buttonImage, alt:buttonText, title:buttonText })));
			input[isRTL ? 'before' : 'after'](inst.trigger);
			inst.trigger.click(function() {
				if ($.datepicker._datepickerShowing && $.datepicker._lastInput == input[0])
					$.datepicker._hideDatepicker();
				else
					$.datepicker._showDatepicker(input[0]);
				return false;
			});
		}
	},

	/* Apply the maximum length for the date format. */
	_autoSize: function(inst) {
		if (this._get(inst, 'autoSize') && !inst.inline) {
			var date = new Date(2009, 12 - 1, 20); // Ensure double digits
			var dateFormat = this._get(inst, 'dateFormat');
			if (dateFormat.match(/[DM]/)) {
				var findMax = function(names) {
					var max = 0;
					var maxI = 0;
					for (var i = 0; i < names.length; i++) {
						if (names[i].length > max) {
							max = names[i].length;
							maxI = i;
						}
					}
					return maxI;
				};
				date.setMonth(findMax(this._get(inst, (dateFormat.match(/MM/) ?
					'monthNames' : 'monthNamesShort'))));
				date.setDate(findMax(this._get(inst, (dateFormat.match(/DD/) ?
					'dayNames' : 'dayNamesShort'))) + 20 - date.getDay());
			}
			inst.input.attr('size', this._formatDate(inst, date).length);
		}
	},

	/* Attach an inline date picker to a div. */
	_inlineDatepicker: function(target, inst) {
		var divSpan = $(target);
		if (divSpan.hasClass(this.markerClassName))
			return;
		divSpan.addClass(this.markerClassName).append(inst.dpDiv).
			bind("setData.datepicker", function(event, key, value){
				inst.settings[key] = value;
			}).bind("getData.datepicker", function(event, key){
				return this._get(inst, key);
			});
		$.data(target, PROP_NAME, inst);
		this._setDate(inst, this._getDefaultDate(inst), true);
		this._updateDatepicker(inst);
		this._updateAlternate(inst);
	},

	/* Pop-up the date picker in a "dialog" box.
	   @param  input     element - ignored
	   @param  date      string or Date - the initial date to display
	   @param  onSelect  function - the function to call when a date is selected
	   @param  settings  object - update the dialog date picker instance's settings (anonymous object)
	   @param  pos       int[2] - coordinates for the dialog's position within the screen or
	                     event - with x/y coordinates or
	                     leave empty for default (screen centre)
	   @return the manager object */
	_dialogDatepicker: function(input, date, onSelect, settings, pos) {
		var inst = this._dialogInst; // internal instance
		if (!inst) {
			this.uuid += 1;
			var id = 'dp' + this.uuid;
			this._dialogInput = $('<input type="text" id="' + id +
				'" style="position: absolute; top: -100px; width: 0px; z-index: -10;"/>');
			this._dialogInput.keydown(this._doKeyDown);
			$('body').append(this._dialogInput);
			inst = this._dialogInst = this._newInst(this._dialogInput, false);
			inst.settings = {};
			$.data(this._dialogInput[0], PROP_NAME, inst);
		}
		extendRemove(inst.settings, settings || {});
		date = (date && date.constructor == Date ? this._formatDate(inst, date) : date);
		this._dialogInput.val(date);

		this._pos = (pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null);
		if (!this._pos) {
			var browserWidth = document.documentElement.clientWidth;
			var browserHeight = document.documentElement.clientHeight;
			var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
			var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
			this._pos = // should use actual width/height below
				[(browserWidth / 2) - 100 + scrollX, (browserHeight / 2) - 150 + scrollY];
		}

		// move input on screen for focus, but hidden behind dialog
		this._dialogInput.css('left', (this._pos[0] + 20) + 'px').css('top', this._pos[1] + 'px');
		inst.settings.onSelect = onSelect;
		this._inDialog = true;
		this.dpDiv.addClass(this._dialogClass);
		this._showDatepicker(this._dialogInput[0]);
		if ($.blockUI)
			$.blockUI(this.dpDiv);
		$.data(this._dialogInput[0], PROP_NAME, inst);
		return this;
	},

	/* Detach a datepicker from its control.
	   @param  target    element - the target input field or division or span */
	_destroyDatepicker: function(target) {
		var $target = $(target);
		var inst = $.data(target, PROP_NAME);
		if (!$target.hasClass(this.markerClassName)) {
			return;
		}
		var nodeName = target.nodeName.toLowerCase();
		$.removeData(target, PROP_NAME);
		if (nodeName == 'input') {
			inst.append.remove();
			inst.trigger.remove();
			$target.removeClass(this.markerClassName).
				unbind('focus', this._showDatepicker).
				unbind('keydown', this._doKeyDown).
				unbind('keypress', this._doKeyPress).
				unbind('keyup', this._doKeyUp);
		} else if (nodeName == 'div' || nodeName == 'span')
			$target.removeClass(this.markerClassName).empty();
	},

	/* Enable the date picker to a jQuery selection.
	   @param  target    element - the target input field or division or span */
	_enableDatepicker: function(target) {
		var $target = $(target);
		var inst = $.data(target, PROP_NAME);
		if (!$target.hasClass(this.markerClassName)) {
			return;
		}
		var nodeName = target.nodeName.toLowerCase();
		if (nodeName == 'input') {
			target.disabled = false;
			inst.trigger.filter('button').
				each(function() { this.disabled = false; }).end().
				filter('img').css({opacity: '1.0', cursor: ''});
		}
		else if (nodeName == 'div' || nodeName == 'span') {
			var inline = $target.children('.' + this._inlineClass);
			inline.children().removeClass('ui-state-disabled');
		}
		this._disabledInputs = $.map(this._disabledInputs,
			function(value) { return (value == target ? null : value); }); // delete entry
	},

	/* Disable the date picker to a jQuery selection.
	   @param  target    element - the target input field or division or span */
	_disableDatepicker: function(target) {
		var $target = $(target);
		var inst = $.data(target, PROP_NAME);
		if (!$target.hasClass(this.markerClassName)) {
			return;
		}
		var nodeName = target.nodeName.toLowerCase();
		if (nodeName == 'input') {
			target.disabled = true;
			inst.trigger.filter('button').
				each(function() { this.disabled = true; }).end().
				filter('img').css({opacity: '0.5', cursor: 'default'});
		}
		else if (nodeName == 'div' || nodeName == 'span') {
			var inline = $target.children('.' + this._inlineClass);
			inline.children().addClass('ui-state-disabled');
		}
		this._disabledInputs = $.map(this._disabledInputs,
			function(value) { return (value == target ? null : value); }); // delete entry
		this._disabledInputs[this._disabledInputs.length] = target;
	},

	/* Is the first field in a jQuery collection disabled as a datepicker?
	   @param  target    element - the target input field or division or span
	   @return boolean - true if disabled, false if enabled */
	_isDisabledDatepicker: function(target) {
		if (!target) {
			return false;
		}
		for (var i = 0; i < this._disabledInputs.length; i++) {
			if (this._disabledInputs[i] == target)
				return true;
		}
		return false;
	},

	/* Retrieve the instance data for the target control.
	   @param  target  element - the target input field or division or span
	   @return  object - the associated instance data
	   @throws  error if a jQuery problem getting data */
	_getInst: function(target) {
		try {
			return $.data(target, PROP_NAME);
		}
		catch (err) {
			throw 'Missing instance data for this datepicker';
		}
	},

	/* Update or retrieve the settings for a date picker attached to an input field or division.
	   @param  target  element - the target input field or division or span
	   @param  name    object - the new settings to update or
	                   string - the name of the setting to change or retrieve,
	                   when retrieving also 'all' for all instance settings or
	                   'defaults' for all global defaults
	   @param  value   any - the new value for the setting
	                   (omit if above is an object or to retrieve a value) */
	_optionDatepicker: function(target, name, value) {
		var inst = this._getInst(target);
		if (arguments.length == 2 && typeof name == 'string') {
			return (name == 'defaults' ? $.extend({}, $.datepicker._defaults) :
				(inst ? (name == 'all' ? $.extend({}, inst.settings) :
				this._get(inst, name)) : null));
		}
		var settings = name || {};
		if (typeof name == 'string') {
			settings = {};
			settings[name] = value;
		}
		if (inst) {
			if (this._curInst == inst) {
				this._hideDatepicker();
			}
			var date = this._getDateDatepicker(target, true);
			extendRemove(inst.settings, settings);
			this._attachments($(target), inst);
			this._autoSize(inst);
			this._setDateDatepicker(target, date);
			this._updateDatepicker(inst);
		}
	},

	// change method deprecated
	_changeDatepicker: function(target, name, value) {
		this._optionDatepicker(target, name, value);
	},

	/* Redraw the date picker attached to an input field or division.
	   @param  target  element - the target input field or division or span */
	_refreshDatepicker: function(target) {
		var inst = this._getInst(target);
		if (inst) {
			this._updateDatepicker(inst);
		}
	},

	/* Set the dates for a jQuery selection.
	   @param  target   element - the target input field or division or span
	   @param  date     Date - the new date */
	_setDateDatepicker: function(target, date) {
		var inst = this._getInst(target);
		if (inst) {
			this._setDate(inst, date);
			this._updateDatepicker(inst);
			this._updateAlternate(inst);
		}
	},

	/* Get the date(s) for the first entry in a jQuery selection.
	   @param  target     element - the target input field or division or span
	   @param  noDefault  boolean - true if no default date is to be used
	   @return Date - the current date */
	_getDateDatepicker: function(target, noDefault) {
		var inst = this._getInst(target);
		if (inst && !inst.inline)
			this._setDateFromField(inst, noDefault);
		return (inst ? this._getDate(inst) : null);
	},

	/* Handle keystrokes. */
	_doKeyDown: function(event) {
		var inst = $.datepicker._getInst(event.target);
		var handled = true;
		var isRTL = inst.dpDiv.is('.ui-datepicker-rtl');
		inst._keyEvent = true;
		if ($.datepicker._datepickerShowing)
			switch (event.keyCode) {
				case 9: $.datepicker._hideDatepicker();
						handled = false;
						break; // hide on tab out
				case 13: var sel = $('td.' + $.datepicker._dayOverClass, inst.dpDiv).
							add($('td.' + $.datepicker._currentClass, inst.dpDiv));
						if (sel[0])
							$.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0]);
						else
							$.datepicker._hideDatepicker();
						return false; // don't submit the form
						break; // select the value on enter
				case 27: $.datepicker._hideDatepicker();
						break; // hide on escape
				case 33: $.datepicker._adjustDate(event.target, (event.ctrlKey ?
							-$.datepicker._get(inst, 'stepBigMonths') :
							-$.datepicker._get(inst, 'stepMonths')), 'M');
						break; // previous month/year on page up/+ ctrl
				case 34: $.datepicker._adjustDate(event.target, (event.ctrlKey ?
							+$.datepicker._get(inst, 'stepBigMonths') :
							+$.datepicker._get(inst, 'stepMonths')), 'M');
						break; // next month/year on page down/+ ctrl
				case 35: if (event.ctrlKey || event.metaKey) $.datepicker._clearDate(event.target);
						handled = event.ctrlKey || event.metaKey;
						break; // clear on ctrl or command +end
				case 36: if (event.ctrlKey || event.metaKey) $.datepicker._gotoToday(event.target);
						handled = event.ctrlKey || event.metaKey;
						break; // current on ctrl or command +home
				case 37: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, (isRTL ? +1 : -1), 'D');
						handled = event.ctrlKey || event.metaKey;
						// -1 day on ctrl or command +left
						if (event.originalEvent.altKey) $.datepicker._adjustDate(event.target, (event.ctrlKey ?
									-$.datepicker._get(inst, 'stepBigMonths') :
									-$.datepicker._get(inst, 'stepMonths')), 'M');
						// next month/year on alt +left on Mac
						break;
				case 38: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, -7, 'D');
						handled = event.ctrlKey || event.metaKey;
						break; // -1 week on ctrl or command +up
				case 39: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, (isRTL ? -1 : +1), 'D');
						handled = event.ctrlKey || event.metaKey;
						// +1 day on ctrl or command +right
						if (event.originalEvent.altKey) $.datepicker._adjustDate(event.target, (event.ctrlKey ?
									+$.datepicker._get(inst, 'stepBigMonths') :
									+$.datepicker._get(inst, 'stepMonths')), 'M');
						// next month/year on alt +right
						break;
				case 40: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, +7, 'D');
						handled = event.ctrlKey || event.metaKey;
						break; // +1 week on ctrl or command +down
				default: handled = false;
			}
		else if (event.keyCode == 36 && event.ctrlKey) // display the date picker on ctrl+home
			$.datepicker._showDatepicker(this);
		else {
			handled = false;
		}
		if (handled) {
			event.preventDefault();
			event.stopPropagation();
		}
	},

	/* Filter entered characters - based on date format. */
	_doKeyPress: function(event) {
		var inst = $.datepicker._getInst(event.target);
		if ($.datepicker._get(inst, 'constrainInput')) {
			var chars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat'));
			var chr = String.fromCharCode(event.charCode == undefined ? event.keyCode : event.charCode);
			return event.ctrlKey || (chr < ' ' || !chars || chars.indexOf(chr) > -1);
		}
	},

	/* Synchronise manual entry and field/alternate field. */
	_doKeyUp: function(event) {
		var inst = $.datepicker._getInst(event.target);
		if (inst.input.val() != inst.lastVal) {
			try {
				var date = $.datepicker.parseDate($.datepicker._get(inst, 'dateFormat'),
					(inst.input ? inst.input.val() : null),
					$.datepicker._getFormatConfig(inst));
				if (date) { // only if valid
					$.datepicker._setDateFromField(inst);
					$.datepicker._updateAlternate(inst);
					$.datepicker._updateDatepicker(inst);
				}
			}
			catch (event) {
				$.datepicker.log(event);
			}
		}
		return true;
	},

	/* Pop-up the date picker for a given input field.
	   @param  input  element - the input field attached to the date picker or
	                  event - if triggered by focus */
	_showDatepicker: function(input) {
		input = input.target || input;
		if (input.nodeName.toLowerCase() != 'input') // find from button/image trigger
			input = $('input', input.parentNode)[0];
		if ($.datepicker._isDisabledDatepicker(input) || $.datepicker._lastInput == input) // already here
			return;
		var inst = $.datepicker._getInst(input);
		if ($.datepicker._curInst && $.datepicker._curInst != inst) {
			$.datepicker._curInst.dpDiv.stop(true, true);
		}
		var beforeShow = $.datepicker._get(inst, 'beforeShow');
		extendRemove(inst.settings, (beforeShow ? beforeShow.apply(input, [input, inst]) : {}));
		inst.lastVal = null;
		$.datepicker._lastInput = input;
		$.datepicker._setDateFromField(inst);
		if ($.datepicker._inDialog) // hide cursor
			input.value = '';
		if (!$.datepicker._pos) { // position below input
			$.datepicker._pos = $.datepicker._findPos(input);
			$.datepicker._pos[1] += input.offsetHeight; // add the height
		}
		var isFixed = false;
		$(input).parents().each(function() {
			isFixed |= $(this).css('position') == 'fixed';
			return !isFixed;
		});
		if (isFixed && $.browser.opera) { // correction for Opera when fixed and scrolled
			$.datepicker._pos[0] -= document.documentElement.scrollLeft;
			$.datepicker._pos[1] -= document.documentElement.scrollTop;
		}
		var offset = {left: $.datepicker._pos[0], top: $.datepicker._pos[1]};
		$.datepicker._pos = null;
		// determine sizing offscreen
		inst.dpDiv.css({position: 'absolute', display: 'block', top: '-1000px'});
		$.datepicker._updateDatepicker(inst);
		// fix width for dynamic number of date pickers
		// and adjust position before showing
		offset = $.datepicker._checkOffset(inst, offset, isFixed);
		inst.dpDiv.css({position: ($.datepicker._inDialog && $.blockUI ?
			'static' : (isFixed ? 'fixed' : 'absolute')), display: 'none',
			left: offset.left + 'px', top: offset.top + 'px'});
		if (!inst.inline) {
			var showAnim = $.datepicker._get(inst, 'showAnim');
			var duration = $.datepicker._get(inst, 'duration');
			var postProcess = function() {
				$.datepicker._datepickerShowing = true;
				var borders = $.datepicker._getBorders(inst.dpDiv);
				inst.dpDiv.find('iframe.ui-datepicker-cover'). // IE6- only
					css({left: -borders[0], top: -borders[1],
						width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight()});
			};
			inst.dpDiv.zIndex($(input).zIndex()+1);
			if ($.effects && $.effects[showAnim])
				inst.dpDiv.show(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess);
			else
				inst.dpDiv[showAnim || 'show']((showAnim ? duration : null), postProcess);
			if (!showAnim || !duration)
				postProcess();
			if (inst.input.is(':visible') && !inst.input.is(':disabled'))
				inst.input.focus();
			$.datepicker._curInst = inst;
		}
	},

	/* Generate the date picker content. */
	_updateDatepicker: function(inst) {
		var self = this;
		var borders = $.datepicker._getBorders(inst.dpDiv);
		inst.dpDiv.empty().append(this._generateHTML(inst))
			.find('iframe.ui-datepicker-cover') // IE6- only
				.css({left: -borders[0], top: -borders[1],
					width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight()})
			.end()
			.find('button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a')
				.bind('mouseout', function(){
					$(this).removeClass('ui-state-hover');
					if(this.className.indexOf('ui-datepicker-prev') != -1) $(this).removeClass('ui-datepicker-prev-hover');
					if(this.className.indexOf('ui-datepicker-next') != -1) $(this).removeClass('ui-datepicker-next-hover');
				})
				.bind('mouseover', function(){
					if (!self._isDisabledDatepicker( inst.inline ? inst.dpDiv.parent()[0] : inst.input[0])) {
						$(this).parents('.ui-datepicker-calendar').find('a').removeClass('ui-state-hover');
						$(this).addClass('ui-state-hover');
						if(this.className.indexOf('ui-datepicker-prev') != -1) $(this).addClass('ui-datepicker-prev-hover');
						if(this.className.indexOf('ui-datepicker-next') != -1) $(this).addClass('ui-datepicker-next-hover');
					}
				})
			.end()
			.find('.' + this._dayOverClass + ' a')
				.trigger('mouseover')
			.end();
		var numMonths = this._getNumberOfMonths(inst);
		var cols = numMonths[1];
		var width = 17;
		if (cols > 1)
			inst.dpDiv.addClass('ui-datepicker-multi-' + cols).css('width', (width * cols) + 'em');
		else
			inst.dpDiv.removeClass('ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4').width('');
		inst.dpDiv[(numMonths[0] != 1 || numMonths[1] != 1 ? 'add' : 'remove') +
			'Class']('ui-datepicker-multi');
		inst.dpDiv[(this._get(inst, 'isRTL') ? 'add' : 'remove') +
			'Class']('ui-datepicker-rtl');
		if (inst == $.datepicker._curInst && $.datepicker._datepickerShowing && inst.input &&
				inst.input.is(':visible') && !inst.input.is(':disabled'))
			inst.input.focus();
	},

	/* Retrieve the size of left and top borders for an element.
	   @param  elem  (jQuery object) the element of interest
	   @return  (number[2]) the left and top borders */
	_getBorders: function(elem) {
		var convert = function(value) {
			return {thin: 1, medium: 2, thick: 3}[value] || value;
		};
		return [parseFloat(convert(elem.css('border-left-width'))),
			parseFloat(convert(elem.css('border-top-width')))];
	},

	/* Check positioning to remain on screen. */
	_checkOffset: function(inst, offset, isFixed) {
		var dpWidth = inst.dpDiv.outerWidth();
		var dpHeight = inst.dpDiv.outerHeight();
		var inputWidth = inst.input ? inst.input.outerWidth() : 0;
		var inputHeight = inst.input ? inst.input.outerHeight() : 0;
		var viewWidth = document.documentElement.clientWidth + $(document).scrollLeft();
		var viewHeight = document.documentElement.clientHeight + $(document).scrollTop();

		offset.left -= (this._get(inst, 'isRTL') ? (dpWidth - inputWidth) : 0);
		offset.left -= (isFixed && offset.left == inst.input.offset().left) ? $(document).scrollLeft() : 0;
		offset.top -= (isFixed && offset.top == (inst.input.offset().top + inputHeight)) ? $(document).scrollTop() : 0;

		// now check if datepicker is showing outside window viewport - move to a better place if so.
		offset.left -= Math.min(offset.left, (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ?
			Math.abs(offset.left + dpWidth - viewWidth) : 0);
		offset.top -= Math.min(offset.top, (offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ?
			Math.abs(dpHeight + inputHeight) : 0);

		return offset;
	},

	/* Find an object's position on the screen. */
	_findPos: function(obj) {
		var inst = this._getInst(obj);
		var isRTL = this._get(inst, 'isRTL');
        while (obj && (obj.type == 'hidden' || obj.nodeType != 1)) {
            obj = obj[isRTL ? 'previousSibling' : 'nextSibling'];
        }
        var position = $(obj).offset();
	    return [position.left, position.top];
	},

	/* Hide the date picker from view.
	   @param  input  element - the input field attached to the date picker */
	_hideDatepicker: function(input) {
		var inst = this._curInst;
		if (!inst || (input && inst != $.data(input, PROP_NAME)))
			return;
		if (this._datepickerShowing) {
			var showAnim = this._get(inst, 'showAnim');
			var duration = this._get(inst, 'duration');
			var postProcess = function() {
				$.datepicker._tidyDialog(inst);
				this._curInst = null;
			};
			if ($.effects && $.effects[showAnim])
				inst.dpDiv.hide(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess);
			else
				inst.dpDiv[(showAnim == 'slideDown' ? 'slideUp' :
					(showAnim == 'fadeIn' ? 'fadeOut' : 'hide'))]((showAnim ? duration : null), postProcess);
			if (!showAnim)
				postProcess();
			var onClose = this._get(inst, 'onClose');
			if (onClose)
				onClose.apply((inst.input ? inst.input[0] : null),
					[(inst.input ? inst.input.val() : ''), inst]);  // trigger custom callback
			this._datepickerShowing = false;
			this._lastInput = null;
			if (this._inDialog) {
				this._dialogInput.css({ position: 'absolute', left: '0', top: '-100px' });
				if ($.blockUI) {
					$.unblockUI();
					$('body').append(this.dpDiv);
				}
			}
			this._inDialog = false;
		}
	},

	/* Tidy up after a dialog display. */
	_tidyDialog: function(inst) {
		inst.dpDiv.removeClass(this._dialogClass).unbind('.ui-datepicker-calendar');
	},

	/* Close date picker if clicked elsewhere. */
	_checkExternalClick: function(event) {
		if (!$.datepicker._curInst)
			return;
		var $target = $(event.target);
		if ($target[0].id != $.datepicker._mainDivId &&
				$target.parents('#' + $.datepicker._mainDivId).length == 0 &&
				!$target.hasClass($.datepicker.markerClassName) &&
				!$target.hasClass($.datepicker._triggerClass) &&
				$.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI))
			$.datepicker._hideDatepicker();
	},

	/* Adjust one of the date sub-fields. */
	_adjustDate: function(id, offset, period) {
		var target = $(id);
		var inst = this._getInst(target[0]);
		if (this._isDisabledDatepicker(target[0])) {
			return;
		}
		this._adjustInstDate(inst, offset +
			(period == 'M' ? this._get(inst, 'showCurrentAtPos') : 0), // undo positioning
			period);
		this._updateDatepicker(inst);
	},

	/* Action for current link. */
	_gotoToday: function(id) {
		var target = $(id);
		var inst = this._getInst(target[0]);
		if (this._get(inst, 'gotoCurrent') && inst.currentDay) {
			inst.selectedDay = inst.currentDay;
			inst.drawMonth = inst.selectedMonth = inst.currentMonth;
			inst.drawYear = inst.selectedYear = inst.currentYear;
		}
		else {
			var date = new Date();
			inst.selectedDay = date.getDate();
			inst.drawMonth = inst.selectedMonth = date.getMonth();
			inst.drawYear = inst.selectedYear = date.getFullYear();
		}
		this._notifyChange(inst);
		this._adjustDate(target);
	},

	/* Action for selecting a new month/year. */
	_selectMonthYear: function(id, select, period) {
		var target = $(id);
		var inst = this._getInst(target[0]);
		inst._selectingMonthYear = false;
		inst['selected' + (period == 'M' ? 'Month' : 'Year')] =
		inst['draw' + (period == 'M' ? 'Month' : 'Year')] =
			parseInt(select.options[select.selectedIndex].value,10);
		this._notifyChange(inst);
		this._adjustDate(target);
	},

	/* Restore input focus after not changing month/year. */
	_clickMonthYear: function(id) {
		var target = $(id);
		var inst = this._getInst(target[0]);
		if (inst.input && inst._selectingMonthYear && !$.browser.msie)
			inst.input.focus();
		inst._selectingMonthYear = !inst._selectingMonthYear;
	},

	/* Action for selecting a day. */
	_selectDay: function(id, month, year, td) {
		var target = $(id);
		if ($(td).hasClass(this._unselectableClass) || this._isDisabledDatepicker(target[0])) {
			return;
		}
		var inst = this._getInst(target[0]);
		inst.selectedDay = inst.currentDay = $('a', td).html();
		inst.selectedMonth = inst.currentMonth = month;
		inst.selectedYear = inst.currentYear = year;
		this._selectDate(id, this._formatDate(inst,
			inst.currentDay, inst.currentMonth, inst.currentYear));
	},

	/* Erase the input field and hide the date picker. */
	_clearDate: function(id) {
		var target = $(id);
		var inst = this._getInst(target[0]);
		this._selectDate(target, '');
	},

	/* Update the input field with the selected date. */
	_selectDate: function(id, dateStr) {
		var target = $(id);
		var inst = this._getInst(target[0]);
		dateStr = (dateStr != null ? dateStr : this._formatDate(inst));
		if (inst.input)
			inst.input.val(dateStr);
		this._updateAlternate(inst);
		var onSelect = this._get(inst, 'onSelect');
		if (onSelect)
			onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]);  // trigger custom callback
		else if (inst.input)
			inst.input.trigger('change'); // fire the change event
		if (inst.inline)
			this._updateDatepicker(inst);
		else {
			this._hideDatepicker();
			this._lastInput = inst.input[0];
			if (typeof(inst.input[0]) != 'object')
				inst.input.focus(); // restore focus
			this._lastInput = null;
		}
	},

	/* Update any alternate field to synchronise with the main field. */
	_updateAlternate: function(inst) {
		var altField = this._get(inst, 'altField');
		if (altField) { // update alternate field too
			var altFormat = this._get(inst, 'altFormat') || this._get(inst, 'dateFormat');
			var date = this._getDate(inst);
			var dateStr = this.formatDate(altFormat, date, this._getFormatConfig(inst));
			$(altField).each(function() { $(this).val(dateStr); });
		}
	},

	/* Set as beforeShowDay function to prevent selection of weekends.
	   @param  date  Date - the date to customise
	   @return [boolean, string] - is this date selectable?, what is its CSS class? */
	noWeekends: function(date) {
		var day = date.getDay();
		return [(day > 0 && day < 6), ''];
	},

	/* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition.
	   @param  date  Date - the date to get the week for
	   @return  number - the number of the week within the year that contains this date */
	iso8601Week: function(date) {
		var checkDate = new Date(date.getTime());
		// Find Thursday of this week starting on Monday
		checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7));
		var time = checkDate.getTime();
		checkDate.setMonth(0); // Compare with Jan 1
		checkDate.setDate(1);
		return Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1;
	},

	/* Parse a string value into a date object.
	   See formatDate below for the possible formats.

	   @param  format    string - the expected format of the date
	   @param  value     string - the date in the above format
	   @param  settings  Object - attributes include:
	                     shortYearCutoff  number - the cutoff year for determining the century (optional)
	                     dayNamesShort    string[7] - abbreviated names of the days from Sunday (optional)
	                     dayNames         string[7] - names of the days from Sunday (optional)
	                     monthNamesShort  string[12] - abbreviated names of the months (optional)
	                     monthNames       string[12] - names of the months (optional)
	   @return  Date - the extracted date value or null if value is blank */
	parseDate: function (format, value, settings) {
		if (format == null || value == null)
			throw 'Invalid arguments';
		value = (typeof value == 'object' ? value.toString() : value + '');
		if (value == '')
			return null;
		var shortYearCutoff = (settings ? settings.shortYearCutoff : null) || this._defaults.shortYearCutoff;
		var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort;
		var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames;
		var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort;
		var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames;
		var year = -1;
		var month = -1;
		var day = -1;
		var doy = -1;
		var literal = false;
		// Check whether a format character is doubled
		var lookAhead = function(match) {
			var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
			if (matches)
				iFormat++;
			return matches;
		};
		// Extract a number from the string value
		var getNumber = function(match) {
			lookAhead(match);
			var size = (match == '@' ? 14 : (match == '!' ? 20 :
				(match == 'y' ? 4 : (match == 'o' ? 3 : 2))));
			var digits = new RegExp('^\\d{1,' + size + '}');
			var num = value.substring(iValue).match(digits);
			if (!num)
				throw 'Missing number at position ' + iValue;
			iValue += num[0].length;
			return parseInt(num[0], 10);
		};
		// Extract a name from the string value and convert to an index
		var getName = function(match, shortNames, longNames) {
			var names = (lookAhead(match) ? longNames : shortNames);
			for (var i = 0; i < names.length; i++) {
				if (value.substr(iValue, names[i].length) == names[i]) {
					iValue += names[i].length;
					return i + 1;
				}
			}
			throw 'Unknown name at position ' + iValue;
		};
		// Confirm that a literal character matches the string value
		var checkLiteral = function() {
			if (value.charAt(iValue) != format.charAt(iFormat))
				throw 'Unexpected literal at position ' + iValue;
			iValue++;
		};
		var iValue = 0;
		for (var iFormat = 0; iFormat < format.length; iFormat++) {
			if (literal)
				if (format.charAt(iFormat) == "'" && !lookAhead("'"))
					literal = false;
				else
					checkLiteral();
			else
				switch (format.charAt(iFormat)) {
					case 'd':
						day = getNumber('d');
						break;
					case 'D':
						getName('D', dayNamesShort, dayNames);
						break;
					case 'o':
						doy = getNumber('o');
						break;
					case 'm':
						month = getNumber('m');
						break;
					case 'M':
						month = getName('M', monthNamesShort, monthNames);
						break;
					case 'y':
						year = getNumber('y');
						break;
					case '@':
						var date = new Date(getNumber('@'));
						year = date.getFullYear();
						month = date.getMonth() + 1;
						day = date.getDate();
						break;
					case '!':
						var date = new Date((getNumber('!') - this._ticksTo1970) / 10000);
						year = date.getFullYear();
						month = date.getMonth() + 1;
						day = date.getDate();
						break;
					case "'":
						if (lookAhead("'"))
							checkLiteral();
						else
							literal = true;
						break;
					default:
						checkLiteral();
				}
		}
		if (year == -1)
			year = new Date().getFullYear();
		else if (year < 100)
			year += new Date().getFullYear() - new Date().getFullYear() % 100 +
				(year <= shortYearCutoff ? 0 : -100);
		if (doy > -1) {
			month = 1;
			day = doy;
			do {
				var dim = this._getDaysInMonth(year, month - 1);
				if (day <= dim)
					break;
				month++;
				day -= dim;
			} while (true);
		}
		var date = this._daylightSavingAdjust(new Date(year, month - 1, day));
		if (date.getFullYear() != year || date.getMonth() + 1 != month || date.getDate() != day)
			throw 'Invalid date'; // E.g. 31/02/*
		return date;
	},

	/* Standard date formats. */
	ATOM: 'yy-mm-dd', // RFC 3339 (ISO 8601)
	COOKIE: 'D, dd M yy',
	ISO_8601: 'yy-mm-dd',
	RFC_822: 'D, d M y',
	RFC_850: 'DD, dd-M-y',
	RFC_1036: 'D, d M y',
	RFC_1123: 'D, d M yy',
	RFC_2822: 'D, d M yy',
	RSS: 'D, d M y', // RFC 822
	TICKS: '!',
	TIMESTAMP: '@',
	W3C: 'yy-mm-dd', // ISO 8601

	_ticksTo1970: (((1970 - 1) * 365 + Math.floor(1970 / 4) - Math.floor(1970 / 100) +
		Math.floor(1970 / 400)) * 24 * 60 * 60 * 10000000),

	/* Format a date object into a string value.
	   The format can be combinations of the following:
	   d  - day of month (no leading zero)
	   dd - day of month (two digit)
	   o  - day of year (no leading zeros)
	   oo - day of year (three digit)
	   D  - day name short
	   DD - day name long
	   m  - month of year (no leading zero)
	   mm - month of year (two digit)
	   M  - month name short
	   MM - month name long
	   y  - year (two digit)
	   yy - year (four digit)
	   @ - Unix timestamp (ms since 01/01/1970)
	   ! - Windows ticks (100ns since 01/01/0001)
	   '...' - literal text
	   '' - single quote

	   @param  format    string - the desired format of the date
	   @param  date      Date - the date value to format
	   @param  settings  Object - attributes include:
	                     dayNamesShort    string[7] - abbreviated names of the days from Sunday (optional)
	                     dayNames         string[7] - names of the days from Sunday (optional)
	                     monthNamesShort  string[12] - abbreviated names of the months (optional)
	                     monthNames       string[12] - names of the months (optional)
	   @return  string - the date in the above format */
	formatDate: function (format, date, settings) {
		if (!date)
			return '';
		var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort;
		var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames;
		var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort;
		var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames;
		// Check whether a format character is doubled
		var lookAhead = function(match) {
			var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
			if (matches)
				iFormat++;
			return matches;
		};
		// Format a number, with leading zero if necessary
		var formatNumber = function(match, value, len) {
			var num = '' + value;
			if (lookAhead(match))
				while (num.length < len)
					num = '0' + num;
			return num;
		};
		// Format a name, short or long as requested
		var formatName = function(match, value, shortNames, longNames) {
			return (lookAhead(match) ? longNames[value] : shortNames[value]);
		};
		var output = '';
		var literal = false;
		if (date)
			for (var iFormat = 0; iFormat < format.length; iFormat++) {
				if (literal)
					if (format.charAt(iFormat) == "'" && !lookAhead("'"))
						literal = false;
					else
						output += format.charAt(iFormat);
				else
					switch (format.charAt(iFormat)) {
						case 'd':
							output += formatNumber('d', date.getDate(), 2);
							break;
						case 'D':
							output += formatName('D', date.getDay(), dayNamesShort, dayNames);
							break;
						case 'o':
							output += formatNumber('o',
								(date.getTime() - new Date(date.getFullYear(), 0, 0).getTime()) / 86400000, 3);
							break;
						case 'm':
							output += formatNumber('m', date.getMonth() + 1, 2);
							break;
						case 'M':
							output += formatName('M', date.getMonth(), monthNamesShort, monthNames);
							break;
						case 'y':
							output += (lookAhead('y') ? date.getFullYear() :
								(date.getYear() % 100 < 10 ? '0' : '') + date.getYear() % 100);
							break;
						case '@':
							output += date.getTime();
							break;
						case '!':
							output += date.getTime() * 10000 + this._ticksTo1970;
							break;
						case "'":
							if (lookAhead("'"))
								output += "'";
							else
								literal = true;
							break;
						default:
							output += format.charAt(iFormat);
					}
			}
		return output;
	},

	/* Extract all possible characters from the date format. */
	_possibleChars: function (format) {
		var chars = '';
		var literal = false;
		// Check whether a format character is doubled
		var lookAhead = function(match) {
			var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
			if (matches)
				iFormat++;
			return matches;
		};
		for (var iFormat = 0; iFormat < format.length; iFormat++)
			if (literal)
				if (format.charAt(iFormat) == "'" && !lookAhead("'"))
					literal = false;
				else
					chars += format.charAt(iFormat);
			else
				switch (format.charAt(iFormat)) {
					case 'd': case 'm': case 'y': case '@':
						chars += '0123456789';
						break;
					case 'D': case 'M':
						return null; // Accept anything
					case "'":
						if (lookAhead("'"))
							chars += "'";
						else
							literal = true;
						break;
					default:
						chars += format.charAt(iFormat);
				}
		return chars;
	},

	/* Get a setting value, defaulting if necessary. */
	_get: function(inst, name) {
		return inst.settings[name] !== undefined ?
			inst.settings[name] : this._defaults[name];
	},

	/* Parse existing date and initialise date picker. */
	_setDateFromField: function(inst, noDefault) {
		if (inst.input.val() == inst.lastVal) {
			return;
		}
		var dateFormat = this._get(inst, 'dateFormat');
		var dates = inst.lastVal = inst.input ? inst.input.val() : null;
		var date, defaultDate;
		date = defaultDate = this._getDefaultDate(inst);
		var settings = this._getFormatConfig(inst);
		try {
			date = this.parseDate(dateFormat, dates, settings) || defaultDate;
		} catch (event) {
			this.log(event);
			dates = (noDefault ? '' : dates);
		}
		inst.selectedDay = date.getDate();
		inst.drawMonth = inst.selectedMonth = date.getMonth();
		inst.drawYear = inst.selectedYear = date.getFullYear();
		inst.currentDay = (dates ? date.getDate() : 0);
		inst.currentMonth = (dates ? date.getMonth() : 0);
		inst.currentYear = (dates ? date.getFullYear() : 0);
		this._adjustInstDate(inst);
	},

	/* Retrieve the default date shown on opening. */
	_getDefaultDate: function(inst) {
		return this._restrictMinMax(inst,
			this._determineDate(inst, this._get(inst, 'defaultDate'), new Date()));
	},

	/* A date may be specified as an exact value or a relative one. */
	_determineDate: function(inst, date, defaultDate) {
		var offsetNumeric = function(offset) {
			var date = new Date();
			date.setDate(date.getDate() + offset);
			return date;
		};
		var offsetString = function(offset) {
			try {
				return $.datepicker.parseDate($.datepicker._get(inst, 'dateFormat'),
					offset, $.datepicker._getFormatConfig(inst));
			}
			catch (e) {
				// Ignore
			}
			var date = (offset.toLowerCase().match(/^c/) ?
				$.datepicker._getDate(inst) : null) || new Date();
			var year = date.getFullYear();
			var month = date.getMonth();
			var day = date.getDate();
			var pattern = /([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g;
			var matches = pattern.exec(offset);
			while (matches) {
				switch (matches[2] || 'd') {
					case 'd' : case 'D' :
						day += parseInt(matches[1],10); break;
					case 'w' : case 'W' :
						day += parseInt(matches[1],10) * 7; break;
					case 'm' : case 'M' :
						month += parseInt(matches[1],10);
						day = Math.min(day, $.datepicker._getDaysInMonth(year, month));
						break;
					case 'y': case 'Y' :
						year += parseInt(matches[1],10);
						day = Math.min(day, $.datepicker._getDaysInMonth(year, month));
						break;
				}
				matches = pattern.exec(offset);
			}
			return new Date(year, month, day);
		};
		date = (date == null ? defaultDate : (typeof date == 'string' ? offsetString(date) :
			(typeof date == 'number' ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : date)));
		date = (date && date.toString() == 'Invalid Date' ? defaultDate : date);
		if (date) {
			date.setHours(0);
			date.setMinutes(0);
			date.setSeconds(0);
			date.setMilliseconds(0);
		}
		return this._daylightSavingAdjust(date);
	},

	/* Handle switch to/from daylight saving.
	   Hours may be non-zero on daylight saving cut-over:
	   > 12 when midnight changeover, but then cannot generate
	   midnight datetime, so jump to 1AM, otherwise reset.
	   @param  date  (Date) the date to check
	   @return  (Date) the corrected date */
	_daylightSavingAdjust: function(date) {
		if (!date) return null;
		date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0);
		return date;
	},

	/* Set the date(s) directly. */
	_setDate: function(inst, date, noChange) {
		var clear = !(date);
		var origMonth = inst.selectedMonth;
		var origYear = inst.selectedYear;
		date = this._restrictMinMax(inst, this._determineDate(inst, date, new Date()));
		inst.selectedDay = inst.currentDay = date.getDate();
		inst.drawMonth = inst.selectedMonth = inst.currentMonth = date.getMonth();
		inst.drawYear = inst.selectedYear = inst.currentYear = date.getFullYear();
		if ((origMonth != inst.selectedMonth || origYear != inst.selectedYear) && !noChange)
			this._notifyChange(inst);
		this._adjustInstDate(inst);
		if (inst.input) {
			inst.input.val(clear ? '' : this._formatDate(inst));
		}
	},

	/* Retrieve the date(s) directly. */
	_getDate: function(inst) {
		var startDate = (!inst.currentYear || (inst.input && inst.input.val() == '') ? null :
			this._daylightSavingAdjust(new Date(
			inst.currentYear, inst.currentMonth, inst.currentDay)));
			return startDate;
	},

	/* Generate the HTML for the current state of the date picker. */
	_generateHTML: function(inst) {
		var today = new Date();
		today = this._daylightSavingAdjust(
			new Date(today.getFullYear(), today.getMonth(), today.getDate())); // clear time
		var isRTL = this._get(inst, 'isRTL');
		var showButtonPanel = this._get(inst, 'showButtonPanel');
		var hideIfNoPrevNext = this._get(inst, 'hideIfNoPrevNext');
		var navigationAsDateFormat = this._get(inst, 'navigationAsDateFormat');
		var numMonths = this._getNumberOfMonths(inst);
		var showCurrentAtPos = this._get(inst, 'showCurrentAtPos');
		var stepMonths = this._get(inst, 'stepMonths');
		var isMultiMonth = (numMonths[0] != 1 || numMonths[1] != 1);
		var currentDate = this._daylightSavingAdjust((!inst.currentDay ? new Date(9999, 9, 9) :
			new Date(inst.currentYear, inst.currentMonth, inst.currentDay)));
		var minDate = this._getMinMaxDate(inst, 'min');
		var maxDate = this._getMinMaxDate(inst, 'max');
		var drawMonth = inst.drawMonth - showCurrentAtPos;
		var drawYear = inst.drawYear;
		if (drawMonth < 0) {
			drawMonth += 12;
			drawYear--;
		}
		if (maxDate) {
			var maxDraw = this._daylightSavingAdjust(new Date(maxDate.getFullYear(),
				maxDate.getMonth() - (numMonths[0] * numMonths[1]) + 1, maxDate.getDate()));
			maxDraw = (minDate && maxDraw < minDate ? minDate : maxDraw);
			while (this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1)) > maxDraw) {
				drawMonth--;
				if (drawMonth < 0) {
					drawMonth = 11;
					drawYear--;
				}
			}
		}
		inst.drawMonth = drawMonth;
		inst.drawYear = drawYear;
		var prevText = this._get(inst, 'prevText');
		prevText = (!navigationAsDateFormat ? prevText : this.formatDate(prevText,
			this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepMonths, 1)),
			this._getFormatConfig(inst)));
		var prev = (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ?
			'<a class="ui-datepicker-prev ui-corner-all" onclick="DP_jQuery_' + dpuuid +
			'.datepicker._adjustDate(\'#' + inst.id + '\', -' + stepMonths + ', \'M\');"' +
			' title="' + prevText + '"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'e' : 'w') + '">' + prevText + '</span></a>' :
			(hideIfNoPrevNext ? '' : '<a class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="'+ prevText +'"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'e' : 'w') + '">' + prevText + '</span></a>'));
		var nextText = this._get(inst, 'nextText');
		nextText = (!navigationAsDateFormat ? nextText : this.formatDate(nextText,
			this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepMonths, 1)),
			this._getFormatConfig(inst)));
		var next = (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ?
			'<a class="ui-datepicker-next ui-corner-all" onclick="DP_jQuery_' + dpuuid +
			'.datepicker._adjustDate(\'#' + inst.id + '\', +' + stepMonths + ', \'M\');"' +
			' title="' + nextText + '"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'w' : 'e') + '">' + nextText + '</span></a>' :
			(hideIfNoPrevNext ? '' : '<a class="ui-datepicker-next ui-corner-all ui-state-disabled" title="'+ nextText + '"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'w' : 'e') + '">' + nextText + '</span></a>'));
		var currentText = this._get(inst, 'currentText');
		var gotoDate = (this._get(inst, 'gotoCurrent') && inst.currentDay ? currentDate : today);
		currentText = (!navigationAsDateFormat ? currentText :
			this.formatDate(currentText, gotoDate, this._getFormatConfig(inst)));
		var controls = (!inst.inline ? '<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" onclick="DP_jQuery_' + dpuuid +
			'.datepicker._hideDatepicker();">' + this._get(inst, 'closeText') + '</button>' : '');
		var buttonPanel = (showButtonPanel) ? '<div class="ui-datepicker-buttonpane ui-widget-content">' + (isRTL ? controls : '') +
			(this._isInRange(inst, gotoDate) ? '<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" onclick="DP_jQuery_' + dpuuid +
			'.datepicker._gotoToday(\'#' + inst.id + '\');"' +
			'>' + currentText + '</button>' : '') + (isRTL ? '' : controls) + '</div>' : '';
		var firstDay = parseInt(this._get(inst, 'firstDay'),10);
		firstDay = (isNaN(firstDay) ? 0 : firstDay);
		var showWeek = this._get(inst, 'showWeek');
		var dayNames = this._get(inst, 'dayNames');
		var dayNamesShort = this._get(inst, 'dayNamesShort');
		var dayNamesMin = this._get(inst, 'dayNamesMin');
		var monthNames = this._get(inst, 'monthNames');
		var monthNamesShort = this._get(inst, 'monthNamesShort');
		var beforeShowDay = this._get(inst, 'beforeShowDay');
		var showOtherMonths = this._get(inst, 'showOtherMonths');
		var selectOtherMonths = this._get(inst, 'selectOtherMonths');
		var calculateWeek = this._get(inst, 'calculateWeek') || this.iso8601Week;
		var defaultDate = this._getDefaultDate(inst);
		var html = '';
		for (var row = 0; row < numMonths[0]; row++) {
			var group = '';
			for (var col = 0; col < numMonths[1]; col++) {
				var selectedDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, inst.selectedDay));
				var cornerClass = ' ui-corner-all';
				var calender = '';
				if (isMultiMonth) {
					calender += '<div class="ui-datepicker-group';
					if (numMonths[1] > 1)
						switch (col) {
							case 0: calender += ' ui-datepicker-group-first';
								cornerClass = ' ui-corner-' + (isRTL ? 'right' : 'left'); break;
							case numMonths[1]-1: calender += ' ui-datepicker-group-last';
								cornerClass = ' ui-corner-' + (isRTL ? 'left' : 'right'); break;
							default: calender += ' ui-datepicker-group-middle'; cornerClass = ''; break;
						}
					calender += '">';
				}
				calender += '<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix' + cornerClass + '">' +
					(/all|left/.test(cornerClass) && row == 0 ? (isRTL ? next : prev) : '') +
					(/all|right/.test(cornerClass) && row == 0 ? (isRTL ? prev : next) : '') +
					this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate,
					row > 0 || col > 0, monthNames, monthNamesShort) + // draw month headers
					'</div><table class="ui-datepicker-calendar"><thead>' +
					'<tr>';
				var thead = (showWeek ? '<th class="ui-datepicker-week-col">' + this._get(inst, 'weekHeader') + '</th>' : '');
				for (var dow = 0; dow < 7; dow++) { // days of the week
					var day = (dow + firstDay) % 7;
					thead += '<th' + ((dow + firstDay + 6) % 7 >= 5 ? ' class="ui-datepicker-week-end"' : '') + '>' +
						'<span title="' + dayNames[day] + '">' + dayNamesMin[day] + '</span></th>';
				}
				calender += thead + '</tr></thead><tbody>';
				var daysInMonth = this._getDaysInMonth(drawYear, drawMonth);
				if (drawYear == inst.selectedYear && drawMonth == inst.selectedMonth)
					inst.selectedDay = Math.min(inst.selectedDay, daysInMonth);
				var leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7;
				var numRows = (isMultiMonth ? 6 : Math.ceil((leadDays + daysInMonth) / 7)); // calculate the number of rows to generate
				var printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays));
				for (var dRow = 0; dRow < numRows; dRow++) { // create date picker rows
					calender += '<tr>';
					var tbody = (!showWeek ? '' : '<td class="ui-datepicker-week-col">' +
						this._get(inst, 'calculateWeek')(printDate) + '</td>');
					for (var dow = 0; dow < 7; dow++) { // create date picker days
						var daySettings = (beforeShowDay ?
							beforeShowDay.apply((inst.input ? inst.input[0] : null), [printDate]) : [true, '']);
						var otherMonth = (printDate.getMonth() != drawMonth);
						var unselectable = (otherMonth && !selectOtherMonths) || !daySettings[0] ||
							(minDate && printDate < minDate) || (maxDate && printDate > maxDate);
						tbody += '<td class="' +
							((dow + firstDay + 6) % 7 >= 5 ? ' ui-datepicker-week-end' : '') + // highlight weekends
							(otherMonth ? ' ui-datepicker-other-month' : '') + // highlight days from other months
							((printDate.getTime() == selectedDate.getTime() && drawMonth == inst.selectedMonth && inst._keyEvent) || // user pressed key
							(defaultDate.getTime() == printDate.getTime() && defaultDate.getTime() == selectedDate.getTime()) ?
							// or defaultDate is current printedDate and defaultDate is selectedDate
							' ' + this._dayOverClass : '') + // highlight selected day
							(unselectable ? ' ' + this._unselectableClass + ' ui-state-disabled': '') +  // highlight unselectable days
							(otherMonth && !showOtherMonths ? '' : ' ' + daySettings[1] + // highlight custom dates
							(printDate.getTime() == currentDate.getTime() ? ' ' + this._currentClass : '') + // highlight selected day
							(printDate.getTime() == today.getTime() ? ' ui-datepicker-today' : '')) + '"' + // highlight today (if different)
							((!otherMonth || showOtherMonths) && daySettings[2] ? ' title="' + daySettings[2] + '"' : '') + // cell title
							(unselectable ? '' : ' onclick="DP_jQuery_' + dpuuid + '.datepicker._selectDay(\'#' +
							inst.id + '\',' + printDate.getMonth() + ',' + printDate.getFullYear() + ', this);return false;"') + '>' + // actions
							(otherMonth && !showOtherMonths ? '&#xa0;' : // display for other months
							(unselectable ? '<span class="ui-state-default">' + printDate.getDate() + '</span>' : '<a class="ui-state-default' +
							(printDate.getTime() == today.getTime() ? ' ui-state-highlight' : '') +
							(printDate.getTime() == currentDate.getTime() ? ' ui-state-active' : '') + // highlight selected day
							(otherMonth ? ' ui-priority-secondary' : '') + // distinguish dates from other months
							'" href="#">' + printDate.getDate() + '</a>')) + '</td>'; // display selectable date
						printDate.setDate(printDate.getDate() + 1);
						printDate = this._daylightSavingAdjust(printDate);
					}
					calender += tbody + '</tr>';
				}
				drawMonth++;
				if (drawMonth > 11) {
					drawMonth = 0;
					drawYear++;
				}
				calender += '</tbody></table>' + (isMultiMonth ? '</div>' + 
							((numMonths[0] > 0 && col == numMonths[1]-1) ? '<div class="ui-datepicker-row-break"></div>' : '') : '');
				group += calender;
			}
			html += group;
		}
		html += buttonPanel + ($.browser.msie && parseInt($.browser.version,10) < 7 && !inst.inline ?
			'<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>' : '');
		inst._keyEvent = false;
		return html;
	},

	/* Generate the month and year header. */
	_generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate,
			secondary, monthNames, monthNamesShort) {
		var changeMonth = this._get(inst, 'changeMonth');
		var changeYear = this._get(inst, 'changeYear');
		var showMonthAfterYear = this._get(inst, 'showMonthAfterYear');
		var html = '<div class="ui-datepicker-title">';
		var monthHtml = '';
		// month selection
		if (secondary || !changeMonth)
			monthHtml += '<span class="ui-datepicker-month">' + monthNames[drawMonth] + '</span>';
		else {
			var inMinYear = (minDate && minDate.getFullYear() == drawYear);
			var inMaxYear = (maxDate && maxDate.getFullYear() == drawYear);
			monthHtml += '<select class="ui-datepicker-month" ' +
				'onchange="DP_jQuery_' + dpuuid + '.datepicker._selectMonthYear(\'#' + inst.id + '\', this, \'M\');" ' +
				'onclick="DP_jQuery_' + dpuuid + '.datepicker._clickMonthYear(\'#' + inst.id + '\');"' +
			 	'>';
			for (var month = 0; month < 12; month++) {
				if ((!inMinYear || month >= minDate.getMonth()) &&
						(!inMaxYear || month <= maxDate.getMonth()))
					monthHtml += '<option value="' + month + '"' +
						(month == drawMonth ? ' selected="selected"' : '') +
						'>' + monthNamesShort[month] + '</option>';
			}
			monthHtml += '</select>';
		}
		if (!showMonthAfterYear)
			html += monthHtml + (secondary || !(changeMonth && changeYear) ? '&#xa0;' : '');
		// year selection
		if (secondary || !changeYear)
			html += '<span class="ui-datepicker-year">' + drawYear + '</span>';
		else {
			// determine range of years to display
			var years = this._get(inst, 'yearRange').split(':');
			var thisYear = new Date().getFullYear();
			var determineYear = function(value) {
				var year = (value.match(/c[+-].*/) ? drawYear + parseInt(value.substring(1), 10) :
					(value.match(/[+-].*/) ? thisYear + parseInt(value, 10) :
					parseInt(value, 10)));
				return (isNaN(year) ? thisYear : year);
			};
			var year = determineYear(years[0]);
			var endYear = Math.max(year, determineYear(years[1] || ''));
			year = (minDate ? Math.max(year, minDate.getFullYear()) : year);
			endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear);
			html += '<select class="ui-datepicker-year" ' +
				'onchange="DP_jQuery_' + dpuuid + '.datepicker._selectMonthYear(\'#' + inst.id + '\', this, \'Y\');" ' +
				'onclick="DP_jQuery_' + dpuuid + '.datepicker._clickMonthYear(\'#' + inst.id + '\');"' +
				'>';
			for (; year <= endYear; year++) {
				html += '<option value="' + year + '"' +
					(year == drawYear ? ' selected="selected"' : '') +
					'>' + year + '</option>';
			}
			html += '</select>';
		}
		html += this._get(inst, 'yearSuffix');
		if (showMonthAfterYear)
			html += (secondary || !(changeMonth && changeYear) ? '&#xa0;' : '') + monthHtml;
		html += '</div>'; // Close datepicker_header
		return html;
	},

	/* Adjust one of the date sub-fields. */
	_adjustInstDate: function(inst, offset, period) {
		var year = inst.drawYear + (period == 'Y' ? offset : 0);
		var month = inst.drawMonth + (period == 'M' ? offset : 0);
		var day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) +
			(period == 'D' ? offset : 0);
		var date = this._restrictMinMax(inst,
			this._daylightSavingAdjust(new Date(year, month, day)));
		inst.selectedDay = date.getDate();
		inst.drawMonth = inst.selectedMonth = date.getMonth();
		inst.drawYear = inst.selectedYear = date.getFullYear();
		if (period == 'M' || period == 'Y')
			this._notifyChange(inst);
	},

	/* Ensure a date is within any min/max bounds. */
	_restrictMinMax: function(inst, date) {
		var minDate = this._getMinMaxDate(inst, 'min');
		var maxDate = this._getMinMaxDate(inst, 'max');
		date = (minDate && date < minDate ? minDate : date);
		date = (maxDate && date > maxDate ? maxDate : date);
		return date;
	},

	/* Notify change of month/year. */
	_notifyChange: function(inst) {
		var onChange = this._get(inst, 'onChangeMonthYear');
		if (onChange)
			onChange.apply((inst.input ? inst.input[0] : null),
				[inst.selectedYear, inst.selectedMonth + 1, inst]);
	},

	/* Determine the number of months to show. */
	_getNumberOfMonths: function(inst) {
		var numMonths = this._get(inst, 'numberOfMonths');
		return (numMonths == null ? [1, 1] : (typeof numMonths == 'number' ? [1, numMonths] : numMonths));
	},

	/* Determine the current maximum date - ensure no time components are set. */
	_getMinMaxDate: function(inst, minMax) {
		return this._determineDate(inst, this._get(inst, minMax + 'Date'), null);
	},

	/* Find the number of days in a given month. */
	_getDaysInMonth: function(year, month) {
		return 32 - new Date(year, month, 32).getDate();
	},

	/* Find the day of the week of the first of a month. */
	_getFirstDayOfMonth: function(year, month) {
		return new Date(year, month, 1).getDay();
	},

	/* Determines if we should allow a "next/prev" month display change. */
	_canAdjustMonth: function(inst, offset, curYear, curMonth) {
		var numMonths = this._getNumberOfMonths(inst);
		var date = this._daylightSavingAdjust(new Date(curYear,
			curMonth + (offset < 0 ? offset : numMonths[0] * numMonths[1]), 1));
		if (offset < 0)
			date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth()));
		return this._isInRange(inst, date);
	},

	/* Is the given date in the accepted range? */
	_isInRange: function(inst, date) {
		var minDate = this._getMinMaxDate(inst, 'min');
		var maxDate = this._getMinMaxDate(inst, 'max');
		return ((!minDate || date.getTime() >= minDate.getTime()) &&
			(!maxDate || date.getTime() <= maxDate.getTime()));
	},

	/* Provide the configuration settings for formatting/parsing. */
	_getFormatConfig: function(inst) {
		var shortYearCutoff = this._get(inst, 'shortYearCutoff');
		shortYearCutoff = (typeof shortYearCutoff != 'string' ? shortYearCutoff :
			new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10));
		return {shortYearCutoff: shortYearCutoff,
			dayNamesShort: this._get(inst, 'dayNamesShort'), dayNames: this._get(inst, 'dayNames'),
			monthNamesShort: this._get(inst, 'monthNamesShort'), monthNames: this._get(inst, 'monthNames')};
	},

	/* Format the given date for display. */
	_formatDate: function(inst, day, month, year) {
		if (!day) {
			inst.currentDay = inst.selectedDay;
			inst.currentMonth = inst.selectedMonth;
			inst.currentYear = inst.selectedYear;
		}
		var date = (day ? (typeof day == 'object' ? day :
			this._daylightSavingAdjust(new Date(year, month, day))) :
			this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay)));
		return this.formatDate(this._get(inst, 'dateFormat'), date, this._getFormatConfig(inst));
	}
});

/* jQuery extend now ignores nulls! */
function extendRemove(target, props) {
	$.extend(target, props);
	for (var name in props)
		if (props[name] == null || props[name] == undefined)
			target[name] = props[name];
	return target;
};

/* Determine whether an object is an array. */
function isArray(a) {
	return (a && (($.browser.safari && typeof a == 'object' && a.length) ||
		(a.constructor && a.constructor.toString().match(/\Array\(\)/))));
};

/* Invoke the datepicker functionality.
   @param  options  string - a command, optionally followed by additional parameters or
                    Object - settings for attaching new datepicker functionality
   @return  jQuery object */
$.fn.datepicker = function(options){

	/* Initialise the date picker. */
	if (!$.datepicker.initialized) {
		$(document).mousedown($.datepicker._checkExternalClick).
			find('body').append($.datepicker.dpDiv);
		$.datepicker.initialized = true;
	}

	var otherArgs = Array.prototype.slice.call(arguments, 1);
	if (typeof options == 'string' && (options == 'isDisabled' || options == 'getDate' || options == 'widget'))
		return $.datepicker['_' + options + 'Datepicker'].
			apply($.datepicker, [this[0]].concat(otherArgs));
	if (options == 'option' && arguments.length == 2 && typeof arguments[1] == 'string')
		return $.datepicker['_' + options + 'Datepicker'].
			apply($.datepicker, [this[0]].concat(otherArgs));
	return this.each(function() {
		typeof options == 'string' ?
			$.datepicker['_' + options + 'Datepicker'].
				apply($.datepicker, [this].concat(otherArgs)) :
			$.datepicker._attachDatepicker(this, options);
	});
};

$.datepicker = new Datepicker(); // singleton instance
$.datepicker.initialized = false;
$.datepicker.uuid = new Date().getTime();
$.datepicker.version = "1.8.2";

// Workaround for #4055
// Add another global to avoid noConflict issues with inline event handlers
window['DP_jQuery_' + dpuuid] = $;

})(jQuery);




/***************** NEW - 18.03.11 */

/*
 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
*/
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}('h.i[\'1a\']=h.i[\'z\'];h.O(h.i,{y:\'D\',z:9(x,t,b,c,d){6 h.i[h.i.y](x,t,b,c,d)},17:9(x,t,b,c,d){6 c*(t/=d)*t+b},D:9(x,t,b,c,d){6-c*(t/=d)*(t-2)+b},13:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t+b;6-c/2*((--t)*(t-2)-1)+b},X:9(x,t,b,c,d){6 c*(t/=d)*t*t+b},U:9(x,t,b,c,d){6 c*((t=t/d-1)*t*t+1)+b},R:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t*t+b;6 c/2*((t-=2)*t*t+2)+b},N:9(x,t,b,c,d){6 c*(t/=d)*t*t*t+b},M:9(x,t,b,c,d){6-c*((t=t/d-1)*t*t*t-1)+b},L:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t*t*t+b;6-c/2*((t-=2)*t*t*t-2)+b},K:9(x,t,b,c,d){6 c*(t/=d)*t*t*t*t+b},J:9(x,t,b,c,d){6 c*((t=t/d-1)*t*t*t*t+1)+b},I:9(x,t,b,c,d){e((t/=d/2)<1)6 c/2*t*t*t*t*t+b;6 c/2*((t-=2)*t*t*t*t+2)+b},G:9(x,t,b,c,d){6-c*8.C(t/d*(8.g/2))+c+b},15:9(x,t,b,c,d){6 c*8.n(t/d*(8.g/2))+b},12:9(x,t,b,c,d){6-c/2*(8.C(8.g*t/d)-1)+b},Z:9(x,t,b,c,d){6(t==0)?b:c*8.j(2,10*(t/d-1))+b},Y:9(x,t,b,c,d){6(t==d)?b+c:c*(-8.j(2,-10*t/d)+1)+b},W:9(x,t,b,c,d){e(t==0)6 b;e(t==d)6 b+c;e((t/=d/2)<1)6 c/2*8.j(2,10*(t-1))+b;6 c/2*(-8.j(2,-10*--t)+2)+b},V:9(x,t,b,c,d){6-c*(8.o(1-(t/=d)*t)-1)+b},S:9(x,t,b,c,d){6 c*8.o(1-(t=t/d-1)*t)+b},Q:9(x,t,b,c,d){e((t/=d/2)<1)6-c/2*(8.o(1-t*t)-1)+b;6 c/2*(8.o(1-(t-=2)*t)+1)+b},P:9(x,t,b,c,d){f s=1.l;f p=0;f a=c;e(t==0)6 b;e((t/=d)==1)6 b+c;e(!p)p=d*.3;e(a<8.w(c)){a=c;f s=p/4}m f s=p/(2*8.g)*8.r(c/a);6-(a*8.j(2,10*(t-=1))*8.n((t*d-s)*(2*8.g)/p))+b},H:9(x,t,b,c,d){f s=1.l;f p=0;f a=c;e(t==0)6 b;e((t/=d)==1)6 b+c;e(!p)p=d*.3;e(a<8.w(c)){a=c;f s=p/4}m f s=p/(2*8.g)*8.r(c/a);6 a*8.j(2,-10*t)*8.n((t*d-s)*(2*8.g)/p)+c+b},T:9(x,t,b,c,d){f s=1.l;f p=0;f a=c;e(t==0)6 b;e((t/=d/2)==2)6 b+c;e(!p)p=d*(.3*1.5);e(a<8.w(c)){a=c;f s=p/4}m f s=p/(2*8.g)*8.r(c/a);e(t<1)6-.5*(a*8.j(2,10*(t-=1))*8.n((t*d-s)*(2*8.g)/p))+b;6 a*8.j(2,-10*(t-=1))*8.n((t*d-s)*(2*8.g)/p)*.5+c+b},F:9(x,t,b,c,d,s){e(s==u)s=1.l;6 c*(t/=d)*t*((s+1)*t-s)+b},E:9(x,t,b,c,d,s){e(s==u)s=1.l;6 c*((t=t/d-1)*t*((s+1)*t+s)+1)+b},16:9(x,t,b,c,d,s){e(s==u)s=1.l;e((t/=d/2)<1)6 c/2*(t*t*(((s*=(1.B))+1)*t-s))+b;6 c/2*((t-=2)*t*(((s*=(1.B))+1)*t+s)+2)+b},A:9(x,t,b,c,d){6 c-h.i.v(x,d-t,0,c,d)+b},v:9(x,t,b,c,d){e((t/=d)<(1/2.k)){6 c*(7.q*t*t)+b}m e(t<(2/2.k)){6 c*(7.q*(t-=(1.5/2.k))*t+.k)+b}m e(t<(2.5/2.k)){6 c*(7.q*(t-=(2.14/2.k))*t+.11)+b}m{6 c*(7.q*(t-=(2.18/2.k))*t+.19)+b}},1b:9(x,t,b,c,d){e(t<d/2)6 h.i.A(x,t*2,0,c,d)*.5+b;6 h.i.v(x,t*2-d,0,c,d)*.5+c*.5+b}});',62,74,'||||||return||Math|function|||||if|var|PI|jQuery|easing|pow|75|70158|else|sin|sqrt||5625|asin|||undefined|easeOutBounce|abs||def|swing|easeInBounce|525|cos|easeOutQuad|easeOutBack|easeInBack|easeInSine|easeOutElastic|easeInOutQuint|easeOutQuint|easeInQuint|easeInOutQuart|easeOutQuart|easeInQuart|extend|easeInElastic|easeInOutCirc|easeInOutCubic|easeOutCirc|easeInOutElastic|easeOutCubic|easeInCirc|easeInOutExpo|easeInCubic|easeOutExpo|easeInExpo||9375|easeInOutSine|easeInOutQuad|25|easeOutSine|easeInOutBack|easeInQuad|625|984375|jswing|easeInOutBounce'.split('|'),0,{}))


/*
 * jQuery Easing Compatibility v1 - http://gsgd.co.uk/sandbox/jquery.easing.php
 *
 * Adds compatibility for applications that use the pre 1.2 easing names
 *
 * Copyright (c) 2007 George Smith
 * Licensed under the MIT License:
 *   http://www.opensource.org/licenses/mit-license.php
 */
eval(function(p,a,c,k,e,d){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--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[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}('0.C(0.1,{7:2(x,t,b,c,d){3 0.1.D(x,t,b,c,d)},5:2(x,t,b,c,d){3 0.1.6(x,t,b,c,d)},h:2(x,t,b,c,d){3 0.1.B(x,t,b,c,d)},A:2(x,t,b,c,d){3 0.1.m(x,t,b,c,d)},y:2(x,t,b,c,d){3 0.1.w(x,t,b,c,d)},v:2(x,t,b,c,d){3 0.1.u(x,t,b,c,d)},s:2(x,t,b,c,d){3 0.1.r(x,t,b,c,d)},q:2(x,t,b,c,d){3 0.1.p(x,t,b,c,d)},o:2(x,t,b,c,d){3 0.1.n(x,t,b,c,d)},8:2(x,t,b,c,d){3 0.1.l(x,t,b,c,d)},g:2(x,t,b,c,d){3 0.1.j(x,t,b,c,d)},i:2(x,t,b,c,d){3 0.1.k(x,t,b,c,d)},z:2(x,t,b,c,d){3 0.1.f(x,t,b,c,d)},e:2(x,t,b,c,d){3 0.1.a(x,t,b,c,d)},9:2(x,t,b,c,d){3 0.1.4(x,t,b,c,d)}});',40,40,'jQuery|easing|function|return|easeInOutBack|easeOut|easeOutQuad|easeIn|elasin|backinout|easeOutBack||||backout|easeInBack|elasout|easeInOut|elasinout|easeOutElastic|easeInOutElastic|easeInElastic|easeInExpo|easeInOutBounce|bounceinout|easeOutBounce|bounceout|easeInBounce|bouncein||easeInOutExpo|expoinout|easeOutExpo||expoout|backin|expoin|easeInOutQuad|extend|easeInQuad'.split('|'),0,{}))




/*
	jQuery Coda-Slider v1.1 - http://www.ndoherty.com/coda-slider
	
	Copyright (c) 2007 Niall Doherty
*/
eval(function(p,a,c,k,e,d){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--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[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(d(){3("4.T").1s("<p r=\'O\'>16...<1t /><18 19=\'1a/11-1b.1c\' 1d=\'O...\'/ ></p>")});b j=0;3.1e.1f=d(f){f=3.1g({G:"1h",E:1i,1j:Q},f);P 6.w(d(){b o=3(6);o.7("p.O").1k();o.q("T").l("1l");b m=o.7("4.I").C();b k=o.7("4.I").1m();b U=m*k;o.7("4.t").K("C",U);b N=k*2;F(h.g&&D(h.g.s(1))<=k){b 9=D(h.g.s(1));b e=-(m*(9-1));3(6).7("4.t").K({H:e})}B{b 9=1};o.w(d(i){3(6).W("<4 r=\'J\' M=\'J"+j+"\'><a A=\'#\'>1n</a><\\/4>");3(6).1o("<4 r=\'L\' M=\'L"+j+"\'><a A=\'#\'>1q</a><\\/4>");3(6).W("<4 r=\'c\' M=\'c"+j+"\'><v><\\/v><\\/4>");3(6).7("4.I").w(d(n){3("4#c"+j+" v").X("<x r=\'Z"+(n+1)+"\'><a A=\'#"+(n+1)+"\'>"+3(6).S("10")+"<\\/a><\\/x>")});3("4#c"+j+" a").w(d(z){N+=3(6).5().C();3(6).12("u",d(){3(6).l("8").5().5().7("a").13(3(6)).q("8");b e=-(m*z);9=z+1;3(6).5().5().5().V().7("4.t").R({H:e},f.E,f.G)})});3("4#J"+j+" a").u(d(){F(9==1){b e=-(m*(k-1));9=k;3(6).5().5().7("4.c a.8").q("8").5().5().7("x:14 a").l("8")}B{9-=1;b e=-(m*(9-1));3(6).5().5().7("4.c a.8").q("8").5().15().7("a").l("8")};3(6).5().5().7("4.t").R({H:e},f.E,f.G);h.g=9;P Q});3("4#L"+j+" a").u(d(){F(9==k){b e=0;9=1;3(6).5().5().7("4.c a.8").q("8").5().5().7("a:y(0)").l("8")}B{b e=-(m*9);9+=1;3(6).5().5().7("4.c a.8").q("8").5().V().7("a").l("8")};3(6).5().5().7("4.t").R({H:e},f.E,f.G);h.g=9;P Q});3("a.1p-1r").u(d(){3(6).Y().7(".c v x a:y("+(D(3(6).S("A").s(1))-1)+")").17(\'u\')});3("4#c"+j).K("C",N);F(h.g&&D(h.g.s(1))<=k){3("4#c"+j+" a:y("+(h.g.s(1)-1)+")").l("8")}B{3("4#c"+j+" a:y(0)").l("8")}});j++})};',62,92,'|||jQuery|div|parent|this|find|current|cPanel||var|stripNav|function|cnt|settings|hash|location|||panelCount|addClass|panelWidth||container||removeClass|class|slice|panelContainer|click|ul|each|li|eq||href|else|width|parseInt|easeTime|if|easeFunc|left|panel|stripNavL|css|stripNavR|id|navWidth|loading|return|false|animate|attr|csw|stripViewerWidth|next|before|append|parents|tab|title|ajax|bind|not|last|prev|Loading|trigger|img|src|images|loader|gif|alt|fn|codaSlider|extend|expoinout|750|toolTip|remove|stripViewer|size|Left|after|cross|Right|link|prepend|br'.split('|'),0,{}))

/***************** NEW(ende) - 18.03.11 */
