/*
 * jQuery UI Datepicker @VERSION
 *
 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Datepicker
 *
 * Depends:
 *	ui.core.js
 */

(function($) { // hide the namespace

$.extend($.ui, { datepicker: { version: "@VERSION" } });
var helper = {},
		// the current tooltipped element
		current,
		// the title of the current element, used for restoring
		title,
		// timeout id for delayed tooltips
		tID,
		// IE 5.5 or 6
		IE = $.browser.msie && /MSIE\s(5\.5|6\.)/.test(navigator.userAgent),
		// flag for mouse tracking
		track = false;

	$.tooltip = {
		blocked: false,
		defaults: {
			delay: 200,
			fade: false,
			showURL: true,
			extraClass: "",
			top: 15,
			left: 15,
			id: "tooltip"
		},
    


    
		block: function() {
			$.tooltip.blocked = !$.tooltip.blocked;
		}
	};

	$.fn.extend({
		tooltip: function(settings) {
			settings = $.extend({}, $.tooltip.defaults, settings);
			createHelper(settings);
			return this.each(function() {
					$.data(this, "tooltip", settings);
					this.tOpacity = helper.parent.css("opacity");
					// copy tooltip into its own expando and remove the title
					this.tooltipText = this.title;
					$(this).removeAttr("title");
					// also remove alt attribute to prevent default tooltip in IE
					this.alt = "";
				})
				.mouseover(save)
				.mouseout(hide)
				.click(hide);
		},
		fixPNG: IE ? function() {
			return this.each(function () {
				var image = $(this).css('backgroundImage');
				if (image.match(/^url\(["']?(.*\.png)["']?\)$/i)) {
					image = RegExp.$1;
					$(this).css({
						'backgroundImage': 'none',
						'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='" + image + "')"
					}).each(function () {
						var position = $(this).css('position');
						if (position != 'absolute' && position != 'relative')
							$(this).css('position', 'relative');
					});
				}
			});
		} : function() { return this; },
		unfixPNG: IE ? function() {
			return this.each(function () {
				$(this).css({'filter': '', backgroundImage: ''});
			});
		} : function() { return this; },
		hideWhenEmpty: function() {
			return this.each(function() {
				$(this)[ $(this).html() ? "show" : "hide" ]();
			});
		},
		url: function() {
			return this.attr('href') || this.attr('src');
		}
	});

	function createHelper(settings) {
		// there can be only one tooltip helper
		if( helper.parent )
			return;
		// create the helper, h3 for title, div for url
		helper.parent = $('<div id="' + settings.id + '"><h3></h3><div class="body"></div><div class="url"></div></div>')
			// add to document
			.appendTo(document.body)
			// hide it at first
			.hide();

		// apply bgiframe if available
		if ( $.fn.bgiframe )
			helper.parent.bgiframe();

		// save references to title and url elements
		helper.title = $('h3', helper.parent);
		helper.body = $('div.body', helper.parent);
		helper.url = $('div.url', helper.parent);
	}

	function settings(element) {
		return $.data(element, "tooltip");
	}

	// main event handler to start showing tooltips
	function handle(event) {
		// show helper, either with timeout or on instant
		if( settings(this).delay )
			tID = setTimeout(show, settings(this).delay);
		else
			show();

		// if selected, update the helper position when the mouse moves
		track = !!settings(this).track;
		$(document.body).bind('mousemove', update);

		// update at least once
		update(event);
	}

	// save elements title before the tooltip is displayed
	function save() {
		// if this is the current source, or it has no title (occurs with click event), stop
		if ( $.tooltip.blocked || this == current || (!this.tooltipText && !settings(this).bodyHandler) )
			return;

		// save current
		current = this;
		title = this.tooltipText;

		if ( settings(this).bodyHandler ) {
			helper.title.hide();
			var bodyContent = settings(this).bodyHandler.call(this);
			if (bodyContent.nodeType || bodyContent.jquery) {
				helper.body.empty().append(bodyContent)
			} else {
				helper.body.html( bodyContent );
			}
			helper.body.show();
		} else if ( settings(this).showBody ) {
			var parts = title.split(settings(this).showBody);
			helper.title.html(parts.shift()).show();
			helper.body.empty();
			for(var i = 0, part; (part = parts[i]); i++) {
				if(i > 0)
					helper.body.append("<br/>");
				helper.body.append(part);
			}
			helper.body.hideWhenEmpty();
		} else {
			helper.title.html(title).show();
			helper.body.hide();
		}

		// if element has href or src, add and show it, otherwise hide it
		if( settings(this).showURL && $(this).url() )
			helper.url.html( $(this).url().replace('http://', '') ).show();
		else
			helper.url.hide();

		// add an optional class for this tip
		helper.parent.addClass(settings(this).extraClass);

		// fix PNG background for IE
		if (settings(this).fixPNG )
			helper.parent.fixPNG();

		handle.apply(this, arguments);
	}

	// delete timeout and show helper
	function show() {
		tID = null;
		if ((!IE || !$.fn.bgiframe) && settings(current).fade) {
			if (helper.parent.is(":animated"))
				helper.parent.stop().show().fadeTo(settings(current).fade, current.tOpacity);
			else
				helper.parent.is(':visible') ? helper.parent.fadeTo(settings(current).fade, current.tOpacity) : helper.parent.fadeIn(settings(current).fade);
		} else {
			helper.parent.show();
		}
		update();
	}

	/**
	 * callback for mousemove
	 * updates the helper position
	 * removes itself when no current element
	 */
	function update(event)	{
		if($.tooltip.blocked)
			return;

		if (event && event.target.tagName == "OPTION") {
			return;
		}

		// stop updating when tracking is disabled and the tooltip is visible
		if ( !track && helper.parent.is(":visible")) {
			$(document.body).unbind('mousemove', update)
		}

		// if no current element is available, remove this listener
		if( current == null ) {
			$(document.body).unbind('mousemove', update);
			return;
		}

		// remove position helper classes
		helper.parent.removeClass("viewport-right").removeClass("viewport-bottom");

		var left = helper.parent[0].offsetLeft;
		var top = helper.parent[0].offsetTop;
		if (event) {
			// position the helper 15 pixel to bottom right, starting from mouse position
			left = event.pageX + settings(current).left;
			top = event.pageY + settings(current).top;
			var right='auto';
			if (settings(current).positionLeft) {
				right = $(window).width() - left;
				left = 'auto';
			}
			helper.parent.css({
				left: left,
				right: right,
				top: top
			});
		}

		var v = viewport(),
			h = helper.parent[0];
		// check horizontal position
		if (v.x + v.cx < h.offsetLeft + h.offsetWidth) {
			left -= h.offsetWidth + 20 + settings(current).left;
			helper.parent.css({left: left + 'px'}).addClass("viewport-right");
		}
		// check vertical position
		if (v.y + v.cy < h.offsetTop + h.offsetHeight) {
			top -= h.offsetHeight + 20 + settings(current).top;
			helper.parent.css({top: top + 'px'}).addClass("viewport-bottom");
		}
	}

	function viewport() {
		return {
			x: $(window).scrollLeft(),
			y: $(window).scrollTop(),
			cx: $(window).width(),
			cy: $(window).height()
		};
	}

	// hide helper and restore added classes and the title
	function hide(event) {
		if($.tooltip.blocked)
			return;
		// clear timeout if possible
		if(tID)
			clearTimeout(tID);
		// no more current element
		current = null;

		var tsettings = settings(this);
		function complete() {
			helper.parent.removeClass( tsettings.extraClass ).hide().css("opacity", "");
		}
		if ((!IE || !$.fn.bgiframe) && tsettings.fade) {
			if (helper.parent.is(':animated'))
				helper.parent.stop().fadeTo(tsettings.fade, 0, complete);
			else
				helper.parent.stop().fadeOut(tsettings.fade, complete);
		} else
			complete();

		if( settings(this).fixPNG )
			helper.parent.unfixPNG();
	}
var PROP_NAME = 'datepicker';

/* 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: 'Prev', // Display text for previous month link
		nextText: 'Next', // Display text for next month link
		currentText: 'Today', // Display text for current month link
		monthNames: ['January','February','March','April','May','June',
			'July','August','September','October','November','December'], // 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: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Column headings for days starting at Sunday
		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: 'show', // 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: '-10:+10', // Range of years to display in drop-down,
			// either relative to current year (-nn:+nn) or absolute (nnnn:nnnn)
		showOtherMonths: false, // True to show dates in other months, false to leave blank
		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: 'normal', // 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
	};
	$.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);
	},

	/* 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)
			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(/([:\[\]\.])/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;
		var appendText = this._get(inst, 'appendText');
		var isRTL = this._get(inst, 'isRTL');
		if (appendText) {
			inst.append = $('<span class="' + this._appendClass + '">' + appendText + '</span>');
			input[isRTL ? 'before' : 'after'](inst.append);
		}
		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 == target)
					$.datepicker._hideDatepicker();
				else
					$.datepicker._showDatepicker(target);
				return false;
			});
		}
		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);
			});
		$.data(target, PROP_NAME, inst);
	},

	/* 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));
		this._updateDatepicker(inst);
		this._updateAlternate(inst);
	},

	/* Pop-up the date picker in a "dialog" box.
	   @param  input     element - ignored
	   @param  dateText  string - the initial date to display (in the current format)
	   @param  onSelect  function - the function(dateText) 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, dateText, onSelect, settings, pos) {
		var inst = this._dialogInst; // internal instance
		if (!inst) {
			var id = 'dp' + (++this.uuid);
			this._dialogInput = $('<input type="text" id="' + id +
				'" size="1" style="position: absolute; top: -100px;"/>');
			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 || {});
		this._dialogInput.val(dateText);

		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] + '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(null);
			}
			var date = this._getDateDatepicker(target);
			extendRemove(inst.settings, settings);
			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
	   @return Date - the current date */
	_getDateDatepicker: function(target) {
		var inst = this._getInst(target);
		if (inst && !inst.inline)
			this._setDateFromField(inst);
		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(null, '');
						break; // hide on tab out
				case 13: var sel = $('td.' + $.datepicker._dayOverClass +
							', td.' + $.datepicker._currentClass, inst.dpDiv);
						if (sel[0])
							$.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0]);
						else
							$.datepicker._hideDatepicker(null, $.datepicker._get(inst, 'duration'));
						return false; // don't submit the form
						break; // select the value on enter
				case 27: $.datepicker._hideDatepicker(null, $.datepicker._get(inst, 'duration'));
						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);
		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);
		var beforeShow = $.datepicker._get(inst, 'beforeShow');
		extendRemove(inst.settings, (beforeShow ? beforeShow.apply(input, [input, inst]) : {}));
		$.datepicker._hideDatepicker(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') || 'show';
			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()});
			};
			if ($.effects && $.effects[showAnim])
				inst.dpDiv.show(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess);
			else
				inst.dpDiv[showAnim](duration, postProcess);
			if (duration == '')
				postProcess();
			if (inst.input[0].type != 'hidden')
				inst.input[0].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.input && inst.input[0].type != 'hidden' && inst == $.datepicker._curInst)
			$(inst.input[0]).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 -= (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ? Math.abs(offset.left + dpWidth - viewWidth) : 0;
		offset.top -= (offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ? Math.abs(offset.top + dpHeight + inputHeight*2 - viewHeight) : 0;

		return offset;
	},

	/* Find an object's position on the screen. */
	_findPos: function(obj) {
        while (obj && (obj.type == 'hidden' || obj.nodeType != 1)) {
            obj = obj.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
	   @param  duration  string - the duration over which to close the date picker */
	_hideDatepicker: function(input, duration) {
		var inst = this._curInst;
		if (!inst || (input && inst != $.data(input, PROP_NAME)))
			return;
		if (this._datepickerShowing) {
			duration = (duration != null ? duration : this._get(inst, 'duration'));
			var showAnim = this._get(inst, 'showAnim');
			var postProcess = function() {
				$.datepicker._tidyDialog(inst);
			};
			if (duration != '' && $.effects && $.effects[showAnim])
				inst.dpDiv.hide(showAnim, $.datepicker._get(inst, 'showOptions'),
					duration, postProcess);
			else
				inst.dpDiv[(duration == '' ? 'hide' : (showAnim == 'slideDown' ? 'slideUp' :
					(showAnim == 'fadeIn' ? 'fadeOut' : 'hide')))](duration, postProcess);
			if (duration == '')
				this._tidyDialog(inst);
			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;
		}
		this._curInst = null;
	},

	/* 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.parents('#' + $.datepicker._mainDivId).length == 0) &&
				!$target.hasClass($.datepicker.markerClassName) &&
				!$target.hasClass($.datepicker._triggerClass) &&
				$.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI))
			$.datepicker._hideDatepicker(null, '');
	},

	/* 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);

        $("#event a").tooltip({ 
            track: true,
            delay: 0,
            showURL: false,opacity: 1, fixPNG: true,showBody: " - ", top: 15, left: -55, fade: 250});
	},

	/* 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[0].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(null, this._get(inst, 'duration'));
			this._lastInput = inst.input[0];
			if (typeof(inst.input[0]) != 'object')
				inst.input[0].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);
			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;
		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) {
		var dateFormat = this._get(inst, 'dateFormat');
		var dates = inst.input ? inst.input.val() : null;
		var date = defaultDate = this._getDefaultDate(inst);
		var settings = this._getFormatConfig(inst);
		try {
			date = this.parseDate(dateFormat, dates, settings) || defaultDate;
		} catch (event) {
			this.log(event);
			date = defaultDate;
		}
		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(this._get(inst, 'defaultDate'), new Date()));
	},

	/* A date may be specified as an exact value or a relative one. */
	_determineDate: function(date, defaultDate) {
		var offsetNumeric = function(offset) {
			var date = new Date();
			date.setDate(date.getDate() + offset);
			return date;
		};
		var offsetString = function(offset, getDaysInMonth) {
			var date = 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, getDaysInMonth(year, month));
						break;
					case 'y': case 'Y' :
						year += parseInt(matches[1],10);
						day = Math.min(day, getDaysInMonth(year, month));
						break;
				}
				matches = pattern.exec(offset);
			}
			return new Date(year, month, day);
		};
		date = (date == null ? defaultDate :
			(typeof date == 'string' ? offsetString(date, this._getDaysInMonth) :
			(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) {
		var clear = !(date);
		var origMonth = inst.selectedMonth;
		var origYear = inst.selectedYear;
		date = this._restrictMinMax(inst, this._determineDate(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)
			this._notifyChange(inst);
		this._adjustInstDate(inst);
		if (inst.input) {
			inst.input.val(clear ? '' : this._formatDate(inst));
		}
	},
    __getEvent: function(day, month, year, event){
        month = month+1;
       // document.write(day+'<br/>');
        var count = 0;
        var a = 0;
        var strToReturn = '';
        for(a=0; a<event.length; a++){
            var idpos = event[a].indexOf('~');
           
            var id = event[a].substr(0, idpos);
            idpos++;
            var eventday = event[a].substr(idpos, 2);
           
            var eventMonth = event[a].substr(idpos+3, 2);
            if(eventMonth.substr(0, 1) == '0'){
                eventMonth = eventMonth.substr(1);
            }
            
            var eventYear = event[a].substr(idpos+6, 4);
           
            var eventDate = eventday+' / '+eventMonth+' / '+eventYear;
            if(day == eventday  && eventMonth == month && year == eventYear){
                 //document.write("The numddber is " + a);
                 //alert(eventday +' - '+ eventMonth+' - ' + eventYear);
                 
                 var pos = event[a].substr(11).indexOf(' - ');
                 var eventname = event[a].substr(idpos+11, pos);
                 return  ' - <b>'+eventname + '</b>'+ ' - Date: '+ eventDate + ' - '+event[a].substr(idpos+11);
            }
            else {
                //return  null;
            }
        }
        //return strToReturn;
    },
    __getEventID: function(day, month, year, event){
        month = month+1;
       // document.write(day+'<br/>');
        var count = 0;
        var a = 0;
        var strToReturn = '';
        for(a=0; a<event.length; a++){
            var idpos = event[a].indexOf('~');

            var id = event[a].substr(0, idpos);
            idpos++;
            var eventday = event[a].substr(idpos, 2);

            var eventMonth = event[a].substr(idpos+3, 2);
            if(eventMonth.substr(0, 1) == '0'){
                eventMonth = eventMonth.substr(1);
            }

            var eventYear = event[a].substr(idpos+6, 4);

            var eventDate = eventday+' / '+eventMonth+' / '+eventYear;
            if(day == eventday  && eventMonth == month && year == eventYear){
     
                 return  id;
            }
            else {
            }
        }
        //return strToReturn;
    },
	/* 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[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) ?
            //onClick="$(function() {$("#event a").tooltip({ track: true,delay: 0,showURL: false,opacity: 1, fixPNG: true,showBody: " - ", top: 15, left: -55, fade: 250});});
            //$(function() {$("#event a").tooltip({ track: true,delay: 0,showURL: false,opacity: 1, fixPNG: true,showBody: " - ", top: 15, left: -55, fade: 250});});
			'<a class="ui-datepicker-prev ui-corner-all" onClick="DP_jQuery.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.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.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.datepicker._gotoToday(\'#' + inst.id + '\');"' +
			'>' + currentText + '</button>' : '') + (isRTL ? '' : controls) + '</div>' : '';
		var firstDay = parseInt(this._get(inst, 'firstDay'),10);
		firstDay = (isNaN(firstDay) ? 0 : firstDay);
		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 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 ui-datepicker-group-';
					switch (col) {
						case 0: calender += 'first'; cornerClass = ' ui-corner-' + (isRTL ? 'right' : 'left'); break;
						case numMonths[1]-1: calender += 'last'; cornerClass = ' ui-corner-' + (isRTL ? 'left' : 'right'); break;
						default: calender += '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 = '';
				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 = '';
					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 || !daySettings[0] ||
							(minDate && printDate < minDate) || (maxDate && printDate > maxDate);
						tbody += '<td '+ 'class="' + (this.__getEvent(printDate.getDate(), inst.selectedMonth, inst.selectedYear, events) != null ? 'ui-datepicker-days-cell-over ui-datepicker-current-day ui-datepicker-today' : '') +
							((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.datepicker._selectDay(\'#' +
							//inst.id + '\',' + drawMonth + ',' + drawYear + ', this);return false;"') + '>' + // actions
							(otherMonth ? (showOtherMonths ? printDate.getDate() : '&#xa0;') : // display for other months
							(unselectable ? '<span class="ui-state-default">' + printDate.getDate()  +'</span>' : '<div id="event"'
                            +'><a id="manual2" class="ui-state-default ' +
							(printDate.getTime() == today.getTime() ? ' ui-state-highlight ' : '') +
                            
                            (this.__getEvent(printDate.getDate(), inst.selectedMonth, inst.selectedYear, events) ? ' ui-state-event ui-state-active' : '') +
							(printDate.getTime() == currentDate.getTime() ? ' ui-state-active' : '') + '"' +
							(this.__getEvent(printDate.getDate(), inst.selectedMonth, inst.selectedYear, events) ? ' title="'+this.__getEvent(printDate.getDate(), inst.selectedMonth, inst.selectedYear, events)+'" onClick="$.nyroModalSmallManual({closeButton: \'<a href=# class=nyroModalSmallClose id=closeBut title=close onClick=\\\'HideFlashMap(visible, flashmap);\\\'>Close</a>\', url: \'event.php?intId='+ this.__getEventID(printDate.getDate(), inst.selectedMonth, inst.selectedYear, events) +'\'});HideFlashMap(hidden, flashmap)" href="#"' : '' ) +'>'+ printDate.getDate() + '</a></div>'))+'</td>'; // display for this month
						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.datepicker._selectMonthYear(\'#' + inst.id + '\', this, \'M\');" ' +
				'onclick="DP_jQuery.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) && (!(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 year = 0;
			var endYear = 0;
			if (years.length != 2) {
				year = drawYear - 10;
				endYear = drawYear + 10;
			} else if (years[0].charAt(0) == '+' || years[0].charAt(0) == '-') {
				year = drawYear + parseInt(years[0], 10);
				endYear = drawYear + parseInt(years[1], 10);
			} else {
				year = parseInt(years[0], 10);
				endYear = parseInt(years[1], 10);
			}
			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.datepicker._selectMonthYear(\'#' + inst.id + '\', this, \'Y\');" ' +
				'onclick="DP_jQuery.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(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[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 >= minDate) && (!maxDate || date <= maxDate));
	},

	/* 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'))
		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 = "@VERSION";

// Workaround for #4055
// Add another global to avoid noConflict issues with inline event handlers
window.DP_jQuery = $;

})(jQuery);

/*
 * nyroModal - jQuery Plugin
 * http://nyromodal.nyrodev.com
 *
 * Copyright (c) 2008 Cedric Nirousset (nyrodev.com)
 * Licensed under the MIT license
 *
 * $Date: 2009-09-21 07:11:16 $
 * $version: 1.5.0
 */
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}('5X(j($){c 1B=5Y.1B.2g();c 3Q=(1B.4X(/.+(?:5Z|4Y|60|4Z|3b)[\\/: ]([\\d.]+)/)||[0,\'0\'])[1];c 1Z=(/3b/.1K(1B)&&!/4Z/.1K(1B)&&51(3Q)<7&&!Z.61);c H=$(\'H\');c 4;c 2B=o;c W={};c 2h=o;c 20;c 2C;c 5={3c:o,1C:o,1i:o,10:o,2i:o,1D:o,1j:o,1E:o,3d:o,1r:o,16:z,21:z,1e:z,11:z,K:z,k:z,m:z,I:z,v:z,3e:1L 2D(),3f:1L 2D()};c 1k={8:o,b:o,2E:o};c 1f={8:z,b:z,2E:n};c 3R;$.1s.G=j(f){6(!M)t o;t M.3g(j(){c 3h=$(M);6(M.2F.2g()==\'1M\'){3h.1t(\'3S.G\').1N(\'3S.G\',j(e){6(3h.J(\'3T\'))t n;6(M.52==\'53/1M-J\'){1O($.P(f,{A:M}));t n}e.1P();1O($.P(f,{A:M}));t o})}q{3h.1t(\'1l.G\').1N(\'1l.G\',j(e){e.1P();1O($.P(f,{A:M}));t o})}})};$.1s.3i=j(f){6(!M.17)1O(f);t M.3g(j(){1O($.P(f,{A:M}))})};$.3i=j(f){1O(f)};$.22=j(f,1g,23){T(f,1g,23);6(!1g&&5.3c){6(5.11&&f.2G)4.3j(5,4,j(){});6(5.v&&f.L)3U();6(!5.1r&&(f.2E||(!5.1E&&((\'8\'3k f&&f.8==4.8)||(\'b\'3k f&&f.b==4.b))))){5.1E=n;6(5.v)3l(n);6(5.v&&5.v.62(\':63\')&&!5.2i){6(2h)5.m.l({X:\'\'});4.2j(5,4,j(){4.2E=o;5.1E=o;6(2h)5.m.l({X:\'3V\'});6($.1F(4.3W))4.3W(5,4)})}}}};$.64=j(){1Q()};$.2k=j(){c 2l=2H(1);6(2l)t 2l.3i(2I());t o};$.2m=j(){c 2l=2H(-1);6(2l)t 2l.3i(2I());t o};$.1s.G.f={D:o,16:o,5:o,B:\'\',A:\'\',2J:\'\',3X:z,2K:\'65\',3m:\'G\',m:z,2G:\'#66\',1R:{},18:{67:\'68\'},8:z,b:z,3Y:2n,3Z:54,41:n,42:n,1h:25,55:\'[^\\.]\\.(69|6a|6b|6c|6d|6e)\\s*$\',56:n,43:\'44\',57:n,58:n,W:z,59:\'<a 19="#" 1a="2m">6f</a><a 19="#"  1a="2k">6g</a>\',2o:2o,2L:1m,l:{11:{X:\'2M\',1n:\'1G\',1b:0,1c:0,b:\'1m%\',8:\'1m%\'},I:{X:\'2M\',1b:\'50%\',1c:\'50%\'},2N:{},m:{1n:\'1u\'},K:{X:\'2M\',1b:\'50%\',1c:\'50%\',Q:\'-3n\',R:\'-3n\'}},2O:{r:\'<r 1a="I"></r>\',1R:\'<r 1a="I"></r>\',1M:\'<r 1a="I"></r>\',45:\'<r 1a="I"></r>\',1v:\'<r 1a="6h"></r>\',18:\'<r 1a="6i"></r>\',u:\'<r 1a="5a"></r>\',3o:\'<r 1a="5a"></r>\',5b:\'<r 1a="I"></r>\'},5c:\'<a 19="#" 1a="3p" 1d="6j" L="6k">5d</a>\',L:z,46:n,47:\'.G\',3q:\'.3p\',5e:\'<a 19="#" 1a="3p">6l</a>\',5f:\'1r\',5g:\'6m 6n m 6o 6p 6q.<48 />6r 6s 6t 6u.<48 /><a 19="#" 1a="3p">5d</a>\',49:z,3r:3r,2p:2p,4a:z,3s:3s,24:z,4b:z,2P:2P,3t:3t,3u:3u,3v:3v,2Q:2Q,2j:2j,3W:z,3j:3j,1S:z};j 1O(f){6(5.1D||5.1j||5.10)t;D(\'1O\');5.3c=n;4c(f);6(!5.1e)5.21=5.16=z;5.1r=o;5.3d=o;5.1i=o;5.3e=1L 2D();5.3f=1L 2D();4.B=5h();6($.1F(4.3X))4.3X(4);A=4.A;p=4.p;1f.8=4.8;1f.b=4.b;6(4.B==\'18\'){T({1n:\'1G\'},\'l\',\'m\');4.m=\'<4d 6v="6w:6x-6y-6z-6A-6B" 8="\'+4.8+\'" b="\'+4.b+\'"><3w 12="6C" 2q="\'+p+\'"></3w>\';c k=\'\';$.3g(4.18,j(12,4e){4.m+=\'<3w 12="\'+12+\'" 2q="\'+4e+\'"></3w>\';k+=\' \'+12+\'="\'+4e+\'"\'});4.m+=\'<4f 1w="\'+p+\'" B="6D/x-6E-6F" 8="\'+4.8+\'" b="\'+4.b+\'"\'+k+\'></4f></4d>\'}6(A){c S=$(A);6(4.B==\'1M\'){c J=$(A).6G();J.2R({12:4.3m,2q:1});6(4.Y)J.2R({12:4.2K,2q:4.Y.1T(1)});$.1R($.P({},4.1R,{p:p,J:J,B:S.E(\'5i\')?S.E(\'5i\'):\'2S\',5j:4g,1r:1o}));D(\'4h 5k 2r: \'+S.E(\'2s\'));1x()}q 6(4.B==\'45\'){1H();S.E(\'2t\',\'26\');S.E(\'2s\',p);S.2T(\'<4i B="1G" 12="\'+4.3m+\'" 2q="1" />\');6(4.Y)S.2T(\'<4i B="1G" 12="\'+4.2K+\'" 2q="\'+4.Y.1T(1)+\'" />\');5.k.N(\'<u 4j="0" 4k="0" 12="26" 1w="5l:o;"></u>\');$(\'u\',5.k).l({8:4.8,b:4.b}).1r(1o).28(4l);D(\'4h 6H 2r: \'+S.E(\'2s\'));1x();1y()}q 6(4.B==\'1v\'){D(\'44 2r: \'+p);c L=S.E(\'L\')||4.43;1H();5.k.N(\'<2U 1d="6I" />\').1U(\'2U\').E(\'5m\',L);5.k.l({5n:0});$(\'2U\',5.k).1r(1o).28(j(){D(\'44 6J: \'+M.1w);$(M).1t(\'28\');c w=5.k.8();c h=5.k.b();5.k.l({5n:\'\'});1k.8=w;1k.b=h;T({8:w,b:h,4m:w,4n:h});1f.8=w;1f.b=h;T({1n:\'1G\'},\'l\',\'m\');5.1i=n;6(5.1D||5.1j)1y()}).E(\'1w\',p);1x()}q 6(4.B==\'3o\'){1H();5.k.N(\'<u 4j="0" 4k="0" 1w="5l:o;" 12="26" 1d="26"></u>\');D(\'5o 4h 2r: \'+p);$(\'u\',5.k).4o(0).l({8:\'1m%\',b:$.5p.5q?\'5r%\':\'1m%\'}).28(j(e){6(4.46&&p.3x(Z.1I.2u)>-1)$.22({L:$(\'u\',5.1e).1p().1U(\'L\').4p()})});5.1i=n;1x()}q 6(4.B==\'u\'){1H();5.k.N(\'<u 4j="0" 4k="0" 1w="\'+p+\'" 12="26" 1d="26"></u>\');D(\'5o 2r: \'+p);$(\'u\',5.k).4o(0).l({8:\'1m%\',b:$.5p.5q?\'5r%\':\'1m%\'}).28(j(e){6(4.46&&p.3x(Z.1I.2u)>-1)$.22({L:$(\'u\',5.1e).1p().1U(\'L\').4p()})});5.1i=n;1x()}q 6(4.B){D(\'5s: \'+4.B);1H();5.k.N(4.m);c w=5.k.8();c h=5.k.b();c r=$(4.B);6(r.17){T({B:\'r\'});w=r.8();h=r.b();6(20)2C=20;20=r;5.k.1z(r.1p())}1f.8=w;1f.b=h;T({8:w,b:h});6(5.k.N())5.1i=n;q 1o();6(!5.1C)1x();q 2v()}q{D(\'5k 2r: \'+p);T({B:\'1R\'});c J=4.1R.J||{};6(4.Y){6(4q J=="4r"){J+=\'&\'+4.2K+\'=\'+4.Y.1T(1)}q{J[4.2K]=4.Y.1T(1)}}$.1R($.P(n,4.1R,{p:p,5j:4g,1r:1o,J:J}));1x()}}q 6(4.m){D(\'5s: \'+4.B);T({B:\'5b\'});1H();5.k.N($(\'<r/>\').N(4.m).1p());6(5.k.N())5.1i=n;q 1o();1x()}q{}}j 4c(f){D(\'4c\');4=$.P(n,{},$.1s.G.f,f);4.Y=\'\';4.3y=0;4.3z=0;4.41=n;3A()}j T(f,1g,23){6(5.3c){6(1g&&23){$.P(n,4[1g][23],f)}q 6(1g){$.P(n,4[1g],f)}q{6(5.2i){6(\'8\'3k f){6(!5.1E){f.4s=f.8;2B=n}3B f[\'8\']}6(\'b\'3k f){6(!5.1E){f.4t=f.b;2B=n}3B f[\'b\']}}$.P(n,4,f)}}q{6(1g&&23){$.P(n,$.1s.G.f[1g][23],f)}q 6(1g){$.P(n,$.1s.G.f[1g],f)}q{$.P(n,$.1s.G.f,f)}}}j 4u(){6(1Z&&!5.16){6(1V.4v){4.29=1V.4v.5t;4.2a=1V.4v.3C}q{4.29=1V.H.5t;4.2a=1V.H.3C}}q{4.29=0;4.2a=0}}j 3A(){4u();4.R=-(4.8+4.3y)/2;4.Q=-(4.b+4.3z)/2;6(!5.16){4.R+=4.29;4.Q+=4.2a}}j 3D(){4u();c 1J=2w(5.K);4.2V=-(5.K.b()+1J.h.13+1J.h.1h)/2;4.3E=-(5.K.8()+1J.w.13+1J.w.1h)/2;6(!5.16){4.6K+=4.29;4.2V+=4.2a}}j 3U(){c L=$(\'4w#5u\',5.v);6(L.17)L.4p(4.L);q 5.v.2T(\'<4w 1d="5u">\'+4.L+\'</4w>\')}j 1H(){D(\'1H\');6(!5.1e){6(4.D)T({6L:\'6M\'},\'l\',\'11\');c 1e={2W:4.2L,X:\'3V\',1b:0,1c:0,8:\'1m%\',b:\'1m%\'};c 4x=H;c 4y=\'\';6(4.16){5.16=4x=$(4.16);c 2X=5.16.6N();c w=5.16.3F();c h=5.16.3G();6(1Z){T({b:\'1m%\',8:\'1m%\',1b:0,1c:0},\'l\',\'11\')}5.21={1b:2X.1b,1c:2X.1c,8:w,b:h};c 5v=(/3b/.1K(1B)?0:14(H.2S(0),\'5w\'));c 5x=(/3b/.1K(1B)?0:14(H.2S(0),\'5y\'));1e={X:\'2M\',1b:2X.1b+5v,1c:2X.1c+5x,8:w,b:h}}q 6(1Z){H.l({b:H.b()+\'C\',8:H.8()+\'C\',X:\'6O\',1n:\'1G\'});$(\'N\').l({1n:\'1G\'});T({l:{11:{X:\'2M\',2W:4.2L+1,b:\'5z%\',8:\'5z%\',1b:4.2a+\'C\',1c:4.29+\'C\'},I:{2W:4.2L+2},K:{2W:4.2L+3}}});4y=$(\'<u 1d="6P"></u>\').l($.P({},4.l.11,{1q:0,2W:50,13:\'4z\'}))}4x.1z($(\'<r 1d="5A"><r 1d="5B"></r><r 1d="5C"><r 1d="5D"></r></r><r 1d="5E"></r><r 1d="5F"></r></r>\').15());5.1e=$(\'#5A\').l(1e).2b();5.11=$(\'#5B\').l($.P({3H:4.2G},4.l.11)).4A(4y);6(!4.5)5.11.1l(1Q);5.K=$(\'#5F\').l(4.l.K).15();5.v=$(\'#5C\').l(4.l.I).15();5.m=$(\'#5D\');5.k=$(\'#5E\').15();6($.1F($.1s.5G)){5.m.5G(j(e,d){c 2Y=5.m.2S(0);6((d>0&&2Y.3C==0)||(d<0&&2Y.6Q-2Y.3C==2Y.6R)){e.1P();e.6S()}})}$(1V).1N(\'4B.G\',4C);5.m.l({8:\'1u\',b:\'1u\'});5.v.l({8:\'1u\',b:\'1u\'});6(!4.16){$(Z).1N(\'2j.G\',j(){Z.6T(3R);3R=Z.6U(5H,5I)})}}}j 5H(){$.22(1f)}j 1x(){D(\'1x\');6(!5.1C){1H();5.10=n;4.3r(5,4,4D)}q{5.10=n;5.1j=n;4.3t(5,4,j(){2v();5.10=o;1y()})}}j 4C(e){6(e.2Z==27){6(!4.5)1Q()}q 6(4.W&&5.1C&&5.1i&&!5.10&&!5.1j){6(e.2Z==39||e.2Z==40){e.1P();$.2k();t o}q 6(e.2Z==37||e.2Z==38){e.1P();$.2m();t o}}}j 5h(){6(4.4E){c k=4.4E;6(!4.m)4.A=n;4.4E=z;t k}c A=4.A;c p;6(A&&A.2F){c S=$(A);p=S.E(A.2F.2g()==\'1M\'?\'2s\':\'19\');6(!p)p=1I.19.1T(Z.1I.6V.17+7);4.p=p;6(S.E(\'5J\')==\'5\')4.5=n;4.L=S.E(\'L\');6(A&&A.30&&A.30.2g()!=\'6W\')4.W=A.30;c 2x=4F(p,A);6(2x)t 2x;6(4G(p))t\'18\';c u=o;6(A.2t&&A.2t.2g()==\'5K\'||(A.2u&&A.2u.4H(/:\\d*$/,\'\')!=Z.1I.2u.4H(/:\\d*$/,\'\'))){u=n}6(A.2F.2g()==\'1M\'){6(u)t\'3o\';T(4I(p));6(S.E(\'52\')==\'53/1M-J\')t\'45\';t\'1M\'}6(u)t\'u\'}q{p=4.p;6(!4.m)4.A=n;6(!p)t z;6(4G(p))t\'18\';c 5L=1L 4J("^6X://","g");6(p.4X(5L))t\'u\'}c 2x=4F(p,A);6(2x)t 2x;c k=4I(p);T(k);6(!k.p)t k.Y}j 4F(p,A){c 1v=1L 4J(4.55,\'i\');6(1v.1K(p)){t\'1v\'}}j 4G(p){c 18=1L 4J(\'[^\\.]\\.(18)\\s*$\',\'i\');t 18.1K(p)}j 4I(p){c F={p:z,Y:z};6(p){c 2J=4K(p);c 5M=4K(Z.1I.19);c 5N=Z.1I.19.1T(0,Z.1I.19.17-5M.17);c 4L=p.1T(0,p.17-2J.17);6(4L==5N){F.Y=2J}q{F.p=4L;F.Y=2J}}t F}j 1o(){D(\'1o\');5.1r=n;6(!5.1C)t;6($.1F(4.49))4.49(5,4);5.K.6Y(4.5f).N(4.5g);$(4.3q,5.K).1t(\'1l.G\').1N(\'1l.G\',1Q);3D();5.K.l({Q:4.2V+\'C\',R:4.3E+\'C\'})}j 3I(){D(\'3I\');6(!5.k.N())t;5.m.N(5.k.1p());5.k.4M();4N();6(4.B==\'3o\'){$(4.A).E(\'2t\',\'26\').J(\'3T\',1).3S().E(\'2t\',\'5K\').6Z(\'3T\')}6(!4.5)5.I.2T(4.5c);6($.1F(4.4a))4.4a(5,4);5.m.1z(5.3e);$(4.3q,5.v).1t(\'1l.G\').1N(\'1l.G\',1Q);$(4.47,5.v).G(2I())}j 2I(){c 1W=$.P(n,{},4);6(1k.8)1W.8=z;q 1W.8=1f.8;6(1k.b)1W.b=z;q 1W.b=1f.b;1W.l.m.1n=\'1u\';t 1W}j 4N(){D(\'4N\');c 2O=$(4.2O[4.B]);5.m.1z(2O.3J().2c());5.v.70(2O);6(4.W){5.m.1z(4.59);W.31=$(\'[30="\'+4.W+\'"]\');W.1X=W.31.1X(4.A);6(4.2o&&$.1F(4.2o))4.2o(W.1X+1,W.31.17,5,4);c 1W=2I();c 4O=2H(-1);6(4O){c 2d=$(\'.2m\',5.v).E(\'19\',4O.E(\'19\')).1l(j(e){e.1P();$.2m();t o});6(1Z&&4.B==\'18\'){2d.4A($(\'<u 1d="71"></u>\').l({X:2d.l(\'X\'),1b:2d.l(\'1b\'),1c:2d.l(\'1c\'),8:2d.8(),b:2d.b(),1q:0,13:\'4z\'}))}}q{$(\'.2m\',5.v).2c()}c 4P=2H(1);6(4P){c 2e=$(\'.2k\',5.v).E(\'19\',4P.E(\'19\')).1l(j(e){e.1P();$.2k();t o});6(1Z&&4.B==\'18\'){2e.4A($(\'<u 1d="72"></u>\').l($.P({},{X:2e.l(\'X\'),1b:2e.l(\'1b\'),1c:2e.l(\'1c\'),8:2e.8(),b:2e.b(),1q:0,13:\'4z\'})))}}q{$(\'.2k\',5.v).2c()}}3l()}j 2H(4Q){6(4.W){6(!4.58)4Q*=-1;c 1X=W.1X+4Q;6(1X>=0&&1X<W.31.17)t W.31.4o(1X)}t o}j 3l(1E){D(\'3l\');5.I=5.v.3J(\'r:73\');1k.8=o;1k.b=o;6(o&&!4.2E){1f.8=4.8;1f.b=4.b}6(4.42&&(!4.8||!4.b)){5.v.l({1q:0,8:\'1u\',b:\'1u\'}).2b();c k={8:\'1u\',b:\'1u\'};6(4.8){k.8=4.8}q 6(4.B==\'u\'){k.8=4.3Y}6(4.b){k.b=4.b}q 6(4.B==\'u\'){k.b=4.3Z}5.m.l(k);6(!4.8){4.8=5.m.3F(n);1k.8=n}6(!4.b){4.b=5.m.3G(n);1k.b=n}5.v.l({1q:1});6(!1E)5.v.15()}6(4.B!=\'1v\'&&4.B!=\'18\'){4.8=2f.5O(4.8,4.3Y);4.b=2f.5O(4.b,4.3Z)}c 32=2w(5.v);c 33=2w(5.I);c 1A=2w(5.m);c k={m:{8:4.8,b:4.b},2N:{8:4.8+1A.w.U,b:4.b+1A.h.U},I:{8:4.8+1A.w.U+33.w.U,b:4.b+1A.h.U+33.h.U}};6(4.41){c 34=5.21?5.21.b:$(Z).b()-32.h.13-(k.I.b-4.b);c 35=5.21?5.21.8:$(Z).8()-32.w.13-(k.I.8-4.8);34-=4.1h*2;35-=4.1h*2;6(k.m.b>34||k.m.8>35){6(4.B==\'1v\'||4.B==\'18\'){c 3K=4.4m?4.4m:4.8;c 3L=4.4n?4.4n:4.b;c 36=k.m.8-3K;c 3a=k.m.b-3L;6(3a<0)3a=0;6(36<0)36=0;c 3M=34-3a;c 3N=35-36;c 4R=2f.4S(3M/3L,3N/3K);3N=2f.5P(3K*4R);3M=2f.5P(3L*4R);k.m.b=3M+3a;k.m.8=3N+36}q{k.m.b=2f.4S(k.m.b,34);k.m.8=2f.4S(k.m.8,35)}k.2N={8:k.m.8+1A.w.U,b:k.m.b+1A.h.U};k.I={8:k.m.8+1A.w.U+33.w.U,b:k.m.b+1A.h.U+33.h.U}}}6(4.B==\'18\'){$(\'4d, 4f\',5.m).E(\'8\',k.m.8).E(\'b\',k.m.b)}q 6(4.B==\'1v\'){$(\'2U\',5.m).l({8:k.m.8,b:k.m.b})}5.m.l($.P({},k.m,4.l.m));5.I.l($.P({},k.2N,4.l.2N));6(!1E)5.v.l($.P({},k.I,4.l.I));6(4.B==\'1v\'&&4.56){$(\'2U\',5.m).74(\'5m\');c 1Y=$(\'r\',5.m);6(4.L!=4.43&&4.L){6(1Y.17==0){1Y=$(\'<r>\'+4.L+\'</r>\');5.m.1z(1Y)}6(4.57){c 5Q=2w(1Y);1Y.l({8:(k.m.8+1A.w.1h-5Q.w.U)+\'C\'})}}q 6(1Y.17=0){1Y.2c()}}6(4.L)3U();k.I.3y=32.w.13;k.I.3z=32.h.13;T(k.I);3A()}j 1Q(e){D(\'1Q\');6(e)e.1P();6(5.1e&&5.1C){$(1V).1t(\'4B.G\');6(!4.16)$(Z).1t(\'2j.G\');5.1C=o;5.10=n;5.3d=n;6(5.1D||5.1j){4.2Q(5,4,j(){5.K.15();5.1D=o;5.1j=o;4.2p(5,4,1S)})}q{6(2h)5.m.l({X:\'\'});5.I.l({1n:\'1G\'});5.m.l({1n:\'1G\'});6($.1F(4.4b)){4.4b(5,4,j(){4.2P(5,4,j(){2v();4.2p(5,4,1S)})})}q{4.2P(5,4,j(){2v();4.2p(5,4,1S)})}}}6(e)t o}j 1y(){D(\'1y\');6(5.1C&&!5.10){6(5.1i){6(5.k.N()){5.10=n;6(5.1j){3I();5.2i=n;4.3u(5,4,j(){5.K.15();5.1j=o;5.1D=o;24()})}q{4.2Q(5,4,j(){5.K.15();5.1D=o;3I();3D();3A();5.2i=n;4.3s(5,4,24)})}}}q 6(!5.1D&&!5.1j){5.10=n;5.1D=n;6(5.1r)1o();q 5.K.N(4.5e);$(4.3q,5.K).1t(\'1l.G\').1N(\'1l.G\',1Q);3D();4.3v(5,4,j(){5.10=o;1y()})}}}j 4g(J){D(\'76: \'+M.p);5.k.N(4.Y?4T($(\'<r>\'+J+\'</r>\').1U(4.Y).1p()):4T(J));6(5.k.N()){5.1i=n;1y()}q 1o()}j 4l(){D(\'4l\');c S=$(4.A);S.E(\'2s\',S.E(\'2s\')+4.Y);S.E(\'2t\',\'\');$(\'4i[12=\'+4.3m+\']\',4.A).2c();c u=5.k.3J(\'u\');c 5R=u.1t(\'28\').1p().1U(4.Y||\'H\').77(\'5S[1w]\');u.E(\'1w\',\'78:79\');5.k.N(5R.N());6(5.k.N()){5.1i=n;1y()}q 1o()}j 2o(5T,U,y,f){f.L+=(f.L?\' - \':\'\')+5T+\'/\'+U}j 2v(){D(\'2v\');5.10=o;6(2C){2C.1z(5.m.1p());2C=z}q 6(20){20.1z(5.m.1p());20=z}5.m.4M();W={};5.v.15().3J().2c().4M().E(\'7a\',\'\').15();6(5.3d||5.1j)5.v.15();5.v.l(4.l.I).1z(5.m);1y()}j 1S(){D(\'1S\');$(1V).1t(\'4B\',4C);5.10=o;5.1e.2c();5.1e=z;6(1Z){H.l({b:\'\',8:\'\',X:\'\',1n:\'\'});$(\'N\').l({1n:\'\'})}6($.1F(4.1S))4.1S(5,4)}j 4D(){D(\'4D\');5.1C=n;5.10=o;1y()}j 24(){D(\'24\');5.10=o;5.2i=o;5.v.l({1q:\'\'});2h=/7b/.1K(1B)&&!/(7c|4Y)/.1K(1B)&&7d(3Q)<1.9&&4.B!=\'1v\';6(2h)5.m.l({X:\'3V\'});5.m.1z(5.3f);6(4.42&&4.B==\'u\'){c u=5.m.1U(\'u\');6(u.17&&u.E(\'1w\').3x(Z.1I.2u)!==-1){c H=u.1p().1U(\'H\');6(H.b()>0){c h=H.3G(n)+1;c w=H.3F(n)+1;$.22({b:h,8:w})}q{u.1N(\'28\',j(){c H=u.1p().1U(\'H\');6(H.17&&H.b()>0){c h=H.3G(n)+1;c w=H.3F(n)+1;$.22({b:h,8:w})}})}}}6($.1F(4.24))4.24(5,4);6(2B){2B=o;$.22({8:4.4s,b:4.4t});3B 4[\'4s\'];3B 4[\'4t\']}6(1k.8)T({8:z});6(1k.b)T({b:z})}j 4K(p){6(4q p==\'4r\'){c 4U=p.3x(\'#\');6(4U>-1)t p.1T(4U)}t\'\'}j 4T(J){6(4q J==\'4r\')J=J.4H(/<\\/?(N|7e|H)([^>]*)>/7f,\'\');c k=1L 2D();$.3g($.7g({0:J},M.7h),j(){6($.2F(M,"5S")){6(!M.1w||$(M).E(\'30\')==\'7i\'){6($(M).E(\'5J\')==\'7j\')5.3f.2R(M);q 5.3e.2R(M)}}q k.2R(M)});t k}j 2w(V){V=V.2S(0);c F={h:{3O:14(V,\'Q\')+14(V,\'7k\'),13:14(V,\'5w\')+14(V,\'7l\'),1h:14(V,\'7m\')+14(V,\'7n\')},w:{3O:14(V,\'R\')+14(V,\'7o\'),13:14(V,\'5y\')+14(V,\'7p\'),1h:14(V,\'7q\')+14(V,\'7r\')}};F.h.1J=F.h.3O+F.h.13;F.w.1J=F.w.3O+F.w.13;F.h.5U=F.h.1h+F.h.13;F.w.5U=F.w.1h+F.w.13;F.h.U=F.h.1J+F.h.1h;F.w.U=F.w.1J+F.w.1h;t F}j 14(V,12){c F=51($.7s(V,12,n));6(7t(F))F=0;t F}j D(3P){6($.1s.G.f.D||4&&4.D)5V(3P,5,4||{})}j 3r(y,f,O){y.11.l({1q:0}).5W(7u,0.75,O)}j 2p(y,f,O){y.11.4V(54,O)}j 3v(y,f,O){y.K.l({Q:f.2V+\'C\',R:f.3E+\'C\',1q:0}).2b().2y({1q:1},{2z:O,2A:2n})}j 2Q(y,f,O){O()}j 3s(y,f,O){y.K.l({Q:f.2V+\'C\',R:f.3E+\'C\'}).2b().2y({8:f.8+\'C\',b:f.b+\'C\',Q:f.Q+\'C\',R:f.R+\'C\'},{2A:4W,2z:j(){y.v.l({8:f.8+\'C\',b:f.b+\'C\',Q:f.Q+\'C\',R:f.R+\'C\'}).2b();y.K.4V(5I,O)}})}j 2P(y,f,O){y.v.2y({b:\'3n\',8:\'3n\',Q:(-(25+f.3z)/2+f.2a)+\'C\',R:(-(25+f.3y)/2+f.29)+\'C\'},{2A:4W,2z:j(){y.v.15();O()}})}j 3t(y,f,O){y.K.l({Q:y.v.l(\'Q\'),R:y.v.l(\'R\'),b:y.v.l(\'b\'),8:y.v.l(\'8\'),1q:0}).2b().5W(2n,1,j(){y.v.15();O()})}j 3u(y,f,O){y.v.15().l({8:f.8+\'C\',b:f.b+\'C\',R:f.R+\'C\',Q:f.Q+\'C\',1q:1});y.K.2y({8:f.8+\'C\',b:f.b+\'C\',R:f.R+\'C\',Q:f.Q+\'C\'},{2z:j(){y.v.2b();y.K.4V(2n,j(){y.K.15();O()})},2A:4W})}j 2j(y,f,O){y.v.2y({8:f.8+\'C\',b:f.b+\'C\',R:f.R+\'C\',Q:f.Q+\'C\'},{2z:O,2A:2n})}j 3j(y,f,O){6(!$.7v.7w.3H){y.11.l({3H:f.2G});O()}q y.11.2y({3H:f.2G},{2z:O,2A:2n})}$($.1s.G.f.47).G()});j 5V(3P,y,f){6(y.1e)y.11.2T(3P+\'<48 />\')}',62,467,'||||currentSettings|modal|if||width|||height|var|||settings||||function|tmp|css|content|true|false|url|else|div||return|iframe|contentWrapper|||elts|null|from|type|px|debug|attr|ret|nyroModalSmall|body|wrapper|data|loading|title|this|html|callback|extend|marginTop|marginLeft|jFrom|setCurrentSettings|total|elm|gallery|position|selector|window|anim|bg|name|border|getCurCSS|hide|blocker|length|swf|href|class|top|left|id|full|initSettingsSize|deep1|padding|dataReady|transition|resized|click|100|overflow|loadingError|contents|opacity|error|fn|unbind|auto|image|src|showModal|showContentOrLoading|append|outerContent|userAgent|ready|loadingShown|resizing|isFunction|hidden|initModal|location|outer|test|new|form|bind|processModal|preventDefault|removeModal|ajax|endRemove|substring|find|document|currentSettingsNew|index|divTitle|isIE6|contentElt|blockerVars|nyroModalSmallSettings|deep2|endShowContent||nyroModalSmallIframe||load|marginScrollLeft|marginScrollTop|show|remove|prev|next|Math|toLowerCase|fixFF|animContent|resize|nyroModalSmallNext|link|nyroModalSmallPrev|400|galleryCounts|hideBackground|value|Load|action|target|hostname|endHideContent|getOuter|imgType|animate|complete|duration|shouldResize|contentEltLast|Array|windowResizing|nodeName|bgColor|getGalleryLink|getCurrentSettingsNew|hash|selIndicator|zIndexStart|absolute|wrapper2|wrap|hideContent|hideLoading|push|get|prepend|img|marginTopLoading|zIndex|pos|elt|keyCode|rel|links|outerWrapper|outerWrapper2|maxHeight|maxWidth|diffW||||diffH|msie|started|closing|scripts|scriptsShown|each|me|nyroModalSmallManual|updateBgColor|in|calculateSize|formIndicator|50px|iframeForm|nyroModalSmallClose|closeSelector|showBackground|showContent|showTransition|hideTransition|showLoading|param|indexOf|borderW|borderH|setMargin|delete|scrollTop|setMarginLoading|marginLeftLoading|outerWidth|outerHeight|backgroundColor|fillContent|children|useW|useH|calcH|calcW|margin|msg|browserVersion|windowResizeTimeout|submit|nyroModalSmallprocessing|setTitle|fixed|endResize|processHandler|minWidth|minHeight||resizable|autoSizable|defaultImgAlt|Image|formData|titleFromIframe|openSelector|br|handleError|endFillContent|beforeHideContent|setDefaultCurrentSettings|object|val|embed|ajaxLoaded|Form|input|frameborder|hspace|formDataLoaded|imgWidth|imgHeight|eq|text|typeof|string|setWidth|setHeight|setMarginScroll|documentElement|h1|contain|iframeHideIE|none|before|keydown|keyHandler|endBackground|forceType|imageType|isSwf|replace|extractUrlSel|RegExp|getHash|req|empty|wrapContent|linkPrev|linkNext|dir|ratio|min|filterScripts|hashPos|fadeOut|350|match|webkit|opera||parseInt|enctype|multipart|300|regexImg|addImageDivTitle|setWidthImgTitle|ltr|galleryLinks|wrapperIframe|manual|closeButton|Close|contentLoading|errorClass|contentError|fileType|method|success|Ajax|javascript|alt|lineHeight|Iframe|support|boxModel|99|Content|scrollLeft|nyroModalSmallTitle|plusTop|borderTopWidth|plusLeft|borderLeftWidth|110|nyroModalSmallFull|nyroModalSmallBg|nyroModalSmallWrapper|nyroModalSmallContent|nyrModalTmp|nyroModalSmallLoading|mousewheel|windowResizeHandler|200|rev|_blank|reg1|hashLoc|curLoc|max|floor|outerDivTitle|iframeContent|script|nb|inner|nyroModalSmallDebug|fadeTo|jQuery|navigator|rv|khtml|XMLHttpRequest|is|visible|nyroModalSmallRemove|nyroModalSmallSel|000000|wmode|transparent|jpg|jpeg|png|tiff|gif|bmp|Prev|Next|wrapperImg|wrapperSwf|closeBut|close|Cancel|The|requested|cannot|be|loaded|Please|try|again|later|classid|clsid|D27CDB6E|AE6D|11cf|96B8|444553540000|movie|application|shockwave|flash|serializeArray|Data|nyroModalSmallImg|Loaded|marginLefttLoading|color|white|offset|static|nyroModalSmallIframeHideIe|scrollHeight|clientHeight|stopPropagation|clearTimeout|setTimeout|host|nofollow|http|addClass|removeData|wrapInner|nyroModalSmallIframeHideIeGalleryPrev|nyroModalSmallIframeHideIeGalleryNext|first|removeAttr||AjaxLoaded|not|about|blank|style|mozilla|compatible|parseFloat|head|gi|clean|ownerDocument|forceLoad|shown|marginBottom|borderBottomWidth|paddingTop|paddingBottom|marginRight|borderRightWidth|paddingLeft|paddingRight|curCSS|isNaN|100|fx|step'.split('|'),0,{}))
