/**
*
* @package		infoflot-riverlines
* @subpackage	remote-js-general
* @version		2.0			Build 2189
* @author		m157y		<public@m157y.name>
* @copyright	Copyright (c) 2011, m157y
*
*/

/**
* Riverlines loader
*/
(function(window, document, undefined) {

// FIX: [].shift() will cause errors on Prototype 1.4 and below
if (Array.prototype.shift.toString().indexOf('[native code]') === -1)
{
	Array.prototype.shift = function()
	{
		if (this.length == 0)
		{
			return undefined;
		}

		var
			result	= this[0],

			i	= 0,
			il	= this.length - 1;

		for (; i < il; ++i)
		{
			this[i] = this[i + 1];
		}

		this.length--;

		return result;
	}
}

/*******************************************************************
* Prepare riverlines object
********************************************************************/
var riverlines = {
	/**
	* Additional resources handler
	*/
	resources: {},

	/**
	* Loaded templates handlers
	*/
	templates:
	{
		form:		'', // Search form
		results:	'', // Result row at search results page
		result:		'' // Tour page
	},

	/**
	* Language definitions
	*/
	language:
	{
		ru:
		{
			// Data tables
			dataTables:
			{
				sProcessing:	'Подождите...',
				sLengthMenu:	'Показать _MENU_ записей',
				sZeroRecords:	'Записи отсутствуют.',
				sInfo:			'Записи с _START_ до _END_ из _TOTAL_ записей',
				sInfoEmpty:		'Записи с 0 до 0 из 0 записей',
				sInfoFiltered:	'(отфильтровано из _MAX_ записей)',
				sInfoPostFix:	'',
				sSearch:		'Поиск:',
				sUrl:			'',
				oPaginate:
				{
					sFirst:		'&#8676;',
					sPrevious:	'&larr;',
					sNext:		'&rarr;',
					sLast:		'&#8677;'
				}
			},

			/**
			* System variables
			*/
			// Loading message
			loadingMessage:	'Пожалуйста, подождите - идет загрузка...',

			/**
			* General variables
			*/
			// General variables
			priceNotes:	'Цены и расписание могут меняться - следите за объявлениями и уточняйте при бронировании<br />Цены указаны в рублях на 1 человека',

			// Navigation variables
			// Used in single-ship mode
			navTitleShip:				'{count}',
			navTitleShipOneValue:		'{count} круиз', // 1 tour
			navTitleShipTwoValues:		'{count} круиза', // 2/3/4 tours
			navTitleShipLotOfValues:	'{count} круизов', // x tours
			// Used in default mode
			navTitleSearchResults:				'Найдено {count}',
			navTitleSearchResultsOneValue:		'{count} круиз', // 1 tour
			navTitleSearchResultsTwoValues:		'{count} круиза', // 2/3/4 tours
			navTitleSearchResultsLotOfValues:	'{count} круизов', // x tours
			// Used always
			navTitleSearch:	'Поиск',
			navTitleTour:	'Рейс {tour_name} ({ship_name})',
			navTitleOrder:	'Бронирование',

			/**
			* Ship page variables (used in single-ship mode)
			*/
			shipPriceInclude:			'В стоимость включено',
			shipDiscount:				'Особые условия',
			shipScheme:					'Схема теплохода',
			shipCabinTypesPhotos:		'Описание и фотографии кают',
			shipCabinTypesPhotosTitle:	'Каюты класса &laquo; {type_name} &raquo;',
			shipServices:				'Обслуживание на борту (турпродукт)',

			/**
			* Search form variables (used in default mode)
			*/
			// General variables
			formDateStartFrom:	'с',
			formDateStartUntil:	'по',
			formDaysFrom:		'с',
			formDaysUntil:		'по',
			formDaysAppend:		'дней',
			formSubmit:			'Найти круизы',

			// Dialog variables
			formMultiselectError:	'{element} уже выбран(а)!',

			/**
			* Search results page variables
			*/
			// General variables
			noResults:			'Ничего не найдено, попробуйте изменить параметры поиска',
			moreInfoButton:		'Информация о круизе и бронирование &raquo;',
			tourWeekendHelp:	'Круиз выходного дня наилучший вариант для тех, кто не может позволить себе отпуск. Круизы отправляются вечером в пятницу и возвращаются в воскресение. Также данные круизы будут интересны тем, кто хочет открыть для себя этот вид отдыха.',
			tourOnlineHelp:		'На данный круиз Вам доступна информация о реальном количестве свободных мест.',

			// Prices table
			tourPricesFullHelp:
				''.concat(
					'<strong>Со всеми удобствами</strong><br />',
					'<br />',
					'В каютах обязательно присутствует <strong>сан.узел</strong>, т.е. туалет, ',
					'умывальник с горячей и холодной водой, душ.<br />',
					'<br />',
					'<strong>В каждой каюте:</strong> спальные места согласно указанной категории, ',
					'шкаф или вешалки, обзорные окна (или иллюминаторы в каютах на нижней ',
					'палубе, иногда на главной), радио, розетка (обычно маломощная для ',
					'зарядных устройств и электробритв), спасательные жилеты.<br />',
					'<br />',
					'<strong>В остальном комфортабельность кают варьируется, могут быть:</strong> ',
					'вентилятор, кондиционер, стулья, холодильник, телевизор, двуспальная ',
					'кровать. Также бывают каюты увеличенной площади. Каюты категории Люкс ',
					'и полулюкс всегда по площади больше стандартных кают с удобствами. На ',
					'всех четырехпалубных теплоходах и большинстве модернизированных ',
					'трехпалубных и двухпалубных теплоходов - все каюты с удобствами.<br />',
					'<br />',
					'Подробное описание интересующей Вас каюты Вы сможете уточнить при бронировании.'
				),
			tourPricesHalfHelp:
				''.concat(
					'<strong>С частичными удобствами</strong><br />',
					'<br />',
					'В каютах обязательно присутствует <strong>умывальник</strong> (обычно с горячей и ',
					'холодной водой).<br />',
					'<br />',
					'<strong>В каждой каюте:</strong> спальные места согласно указанной категории, шкаф ',
					'или вешалки, обзорные окна (или иллюминаторы в каютах на нижней палубе, ',
					'иногда на главной), радио, спасательные жилеты, иногда розетка (обычно ',
					'маломощная для зарядных устройств и электробритв).<br />',
					'<br />',
					'<strong>В остальном комфортабельность кают варьируется, могут быть:</strong> вентилятор, ',
					'кондиционер, холодильник, телевизор, двуспальная кровать. Для туристов из ',
					'кают с частичными удобствами душ и туалет общественные, расположены чаще ',
					'всего на главной и средней палубах.<br />',
					'<br />',
					'Подробное описание интересующей Вас каюты Вы сможете уточнить при бронировании.'
				),
			tourPricesEmptyHelp:
				''.concat(
					'<strong>Без удобств</strong><br />',
					'<br />',
					'В каютах спальные места, шкаф или вешалки, радио, обзорные окна (или иллюминаторы ',
					'в каютах на нижней палубе, иногда на главной), спасательные жилеты, иногда ',
					'розетка (обычно маломощная для зарядных устройств и электробритв).<br />',
					'<br />',
					'Для туристов из кают без удобств душ, туалет, умывальники – <strong>общественные</strong>, ',
					'расположены чаще всего на главной и средней палубах.',
					'<br />',
					'Подробное описание интересующей Вас каюты Вы сможете уточнить при бронировании.'
				),
			tourPricesFull:			'Со всеми удобствами',
			tourPricesHalf:			'С частичными удобствами',
			tourPricesEmpty:		'Без удоств',
			tourPrices4:			'4местн',
			tourPrices3:			'3местн',
			tourPrices22:			'2местн/2ярус',
			tourPrices21:			'2местн/1ярус',
			tourPrices1:			'1местн',
			tourPricesSuite:		'Люкс',
			tourPricesHalfSuite:	'Полулюкс',

			/**
			* Tour page variables
			*/
			// General variables
			orderButton:	'Оформить заявку',

			// Online places table
			tourPlacesCabin:		'№&nbsp;каюты',
			tourPlacesCabinType:	'Категория',
			tourPlacesDeck:			'Палуба',
			tourPlacesPrice:		'Цена основного<br />места, руб.',
			tourPlacesCount:		'Кол-во осн.мест<br /><em>Кол-во доп.мест</em><br /><small>(свободного/всего)</small>',
			tourPlacesByPlaces:		'Бронь по местам',

			// Excursions table
			tourExcursionsStay:			'Остановка',
			tourExcursionsArrival:		'Прибытие',
			tourExcursionsDeparture:	'Отправление',
			tourExcursionsDescription:	'Описание',

			// Subtabs
			tabTitlePlaces:		'Стоимость путевок и наличие мест',
			tabTitleBreakpoins:	'График движения',
			tabTitleShip:		'О теплоходе',

			/**
			* Order page variables
			*/
			// General variables
			orderSubmit:			'Оформить заявку',
			orderErrorSubmit:		'К сожалению, какие-то из введенных данных были некорректны. Попробуйте снова.',
			orderErrorOnlineCabins:	'Вы должны выбрать хотя бы одну каюту для оформления заявки на бронирование.',
			orderSuccessSubmit:		'Заявка успешно создана. В ближайшее время с Вами свяжуться наши менеджеры.',

			// Customer variables
			orderCustomerName:				'Ваше имя',
			orderCustomerPhone:				'Контактный телефон',
			orderCustomerEmail:				'Контактный email',

			// General request variables
			orderAdditionalInfo:		'Дополнительная информация',

			// Online tour fields
			orderOnlineCabinNumber:			'Номер каюты',
			orderOnlineCabinClass:			'Класс каюты',
			orderOnlinePlacesCount:			'Количество мест (свободно/всего)',
			orderOnlineTouristsDetails:		'Сведения о туристах',
			orderOnlinePlaceDetails:		'Детализация места',
			orderOnlinePlacePrice:			'Цена места(руб.)',
			orderOnlineTouristsNames:		'Ф.И.О. туристов',
			orderOnlinePassport:			'Паспортные данные',
			orderOnlinePassportNumber:		'серия и №',
			orderOnlinePassportBirthday:	'дата рождения',

			// Offline tour fields
			orderOfflineCabin:			'Класс каюты',
			orderOfflinePlaces:			'Количество мест',
			orderOfflinePlacesAdult:	'взрослых',
			orderOfflinePlacesChild:	'детских',

			/**
			* Handbook variables
			*/
			// General variables
			handbookTitle:			'Справочник туриста',
			handbookShips:			'Теплоходы',
			handbookCities:			'Населенные пункты',
			handbookRoutes:			'Маршруты круизов',
			handbookRivers:			'Реки',
			handbookMenuTitle:		'Быстрый переход',
			handbookMenuSelectPage:	'Выберите страницу',
			handbookDialogTitle:	'Справочник туриста',
			handbookDialogLoading:	'Идет загрузка...',

			/**
			* Dialog variables
			*/
			// General variables
			dialogErrorTitle:		'Ошибка',
			dialogInformationTitle:	'Информация',
			dialogClosebutton:		'Закрыть',

			// Image preview
			imagePreviewLoading:	'Пожалуйста, подождите - идет загрузка изображения...',
			shipImageTitle:			'{ship_name} (Проект: {ship_project})'
		}
	},

	/**
	* Loaded RiverLines data handlers
	*/
	data:
	{
		// Pagination handlers
		totalPages:		1,
		currentPage:	1,

		// jQuery additions handlers
		startDatePickers:	null,

		// Action/URLs handlers
		lastSearchURL:	'', // Last search url handler
		searchURL:		'', // Search form url
		tourURL:		'', // Tour base URL
		orderURL:		'', // Request create url
		infoURL:		'', // Information base URL
		handbookURL:	'', // Handbook base URL

		// Content slides
		contentSlides:
		{
			search:		0,
			results:	1,
			tour:		2,
			order:		3
		},

		// Fields data
		fields:
		{
			formDateStartFrom:
			{
				 id:	'Riverlines-Form-DateStartFrom-Input',
				 name:	'dateFrom'
			},
			formDateStartUntil:
			{
				id:		'Riverlines-Form-DateStartUntil-Input',
				name:	'dateTo'
			},
			formDaysFrom:
			{
				id:		'Riverlines-Form-DaysFrom',
				name:	'daysFrom'
			},
			formDaysTo:
			{
				id:		'Riverlines-Form-DaysTo',
				name:	'daysTo'
			},
			formShips:
			{
				id:		'Riverlines-Form-Ships',
				name:	'ships'
			},
			formCitiesFrom:
			{
				id:		'Riverlines-Form-CitiesFrom',
				name:	'citiesFrom'
			},
			formRivers:
			{
				id:		'Riverlines-Form-Rivers',
				name:	'rivers'
			},
			formCitiesInline:
			{
				id:		'Riverlines-Form-CitiesInline',
				name:	'citiesInline'
			},
			formRoutes:
			{
				id:		'Riverlines-Form-Routes',
				name:	'routes'
			},
			formHolidays:
			{
				id:		'Riverlines-Form-Holidays',
				name:	'holidays'
			},
			formOnline:
			{
				id:		'Riverlines-Form-Online',
				name:	'online'
			},
			formWeekend:
			{
				id:		'Riverlines-Form-Weekend',
				name:	'weekend'
			},
			formId:
			{
				id:		'Riverlines-Form-Id',
				name:	'id'
			},
			formSubmit:
			{
				id:		'Riverlines-Form-Submit',
				name:	'submit'
			}
		},

		// Hash handlers
		hash:
		{
			interval:	null, // Hash interval handler
			lastHash:	'#/', // Last hash

			search:		'#/', // Search results hash
			tour:		'#/' // Tour hash
		},

		// Counters
		totalTours:	'',
		totalShips:	'',

		// Input variables
		dateStartFrom:	'',
		dateStartUntil:	'',

		// Selects data
		daysFrom:		[],
		daysTo:			[],
		ships:			[],
		rivers:			[],
		citiesFrom:		[],
		citiesInline:	[],
		routes:			[],
		holidays:		[],

		// Search results
		results:		[],
		resultsCount:	0,
		result:			{},

		// Offers
		offers:			[],

		// Information
		information:	{},

		// Handbook
		handbook:
		{
			parent:	'', // Current parent handler
			page:	'', // Current page handler
			pages:	{}, // Current parent pages
			data:		// Data handler
			{
				'.':	{} // Parents handler
			}
		},

		// Ignored data
		ignore:
		{
			ships:	'' // Ignored ships data
		}
	},

	/**
	* Preferences handlers
	*/
	preferences:
	{
		pagesAtPaginator:	9,
		resultsPerPage:		5,
		language:			'ru',
		theme:				'Cupertino',
		validThru:			0,
		ships:				null
	},

	/**
	* JavaScript additions handlers
	*/
	additions: {},

	/**
	* Elements callbacks handlers
	*/
	callbacks: {},

	/**
	* Actions handlers
	*/
	actions: {},

	/**
	* Cache
	*/
	cache:
	{
		// Page data cache
		page:
		{
			jsFramework:	window.$ || undefined,
			host:			window.location.host,
			url:			''.concat(window.location.protocol, '//', window.location.host, (window.location.pathname || '/'), window.location.search)
		},

		// Elements cache
		elements:
		{
			head:	document.getElementsByTagName('head')[0],
			body:	document.getElementsByTagName('body')[0]
		},

		jQuery: null
	}
};

/*******************************************************************
* Additional resources:
* jQuery v1.7.1
* jQuery UI v1.8.16:
*	- Core
*   - Widget
*   - Mouse
*   - Position
*   - Draggable
*   - Resizable
*   - Button
*   - Dialog
*   - Tabs
*   - Datepicker
*	- Datepicker (Russian translation)
* DataTables v1.8.2 (jQuery plugin)
* Checkbox (jQuery UI plugin)
* Input (jQuery UI plugin)
* Javascript Punycode converter
* jQuery bxSlider 3.0
* Lettering.JS 0.6.1 by Dave Rupert
* Inline Form Validation Engine 2.2.4
********************************************************************/

/*! jQuery v1.7.1 jquery.com | jquery.org/license */
(function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cv(a){if(!ck[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){cl||(cl=c.createElement("iframe"),cl.frameBorder=cl.width=cl.height=0),b.appendChild(cl);if(!cm||!cl.createElement)cm=(cl.contentWindow||cl.contentDocument).document,cm.write((c.compatMode==="CSS1Compat"?"<!doctype html>":"")+"<html><body>"),cm.close();d=cm.createElement(a),cm.body.appendChild(d),e=f.css(d,"display"),b.removeChild(cl)}ck[a]=e}return ck[a]}function cu(a,b){var c={};f.each(cq.concat.apply([],cq.slice(0,b)),function(){c[this]=a});return c}function ct(){cr=b}function cs(){setTimeout(ct,0);return cr=f.now()}function cj(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ci(){try{return new a.XMLHttpRequest}catch(b){}}function cc(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g<i;g++){if(g===1)for(h in a.converters)typeof h=="string"&&(e[h.toLowerCase()]=a.converters[h]);l=k,k=d[g];if(k==="*")k=l;else if(l!=="*"&&l!==k){m=l+" "+k,n=e[m]||e["* "+k];if(!n){p=b;for(o in e){j=o.split(" ");if(j[0]===l||j[0]==="*"){p=e[j[1]+" "+k];if(p){o=e[o],o===!0?n=p:p===!0&&(n=o);break}}}}!n&&!p&&f.error("No conversion from "+m.replace(" "," to ")),n!==!0&&(c=n?n(c):p(o(c)))}}return c}function cb(a,c,d){var e=a.contents,f=a.dataTypes,g=a.responseFields,h,i,j,k;for(i in g)i in d&&(c[g[i]]=d[i]);while(f[0]==="*")f.shift(),h===b&&(h=a.mimeType||c.getResponseHeader("content-type"));if(h)for(i in e)if(e[i]&&e[i].test(h)){f.unshift(i);break}if(f[0]in d)j=f[0];else{for(i in d){if(!f[0]||a.converters[i+" "+f[0]]){j=i;break}k||(k=i)}j=j||k}if(j){j!==f[0]&&f.unshift(j);return d[j]}}function ca(a,b,c,d){if(f.isArray(b))f.each(b,function(b,e){c||bE.test(a)?d(a,e):ca(a+"["+(typeof e=="object"||f.isArray(e)?b:"")+"]",e,c,d)});else if(!c&&b!=null&&typeof b=="object")for(var e in b)ca(a+"["+e+"]",b[e],c,d);else d(a,b)}function b_(a,c){var d,e,g=f.ajaxSettings.flatOptions||{};for(d in c)c[d]!==b&&((g[d]?a:e||(e={}))[d]=c[d]);e&&f.extend(!0,a,e)}function b$(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h=a[f],i=0,j=h?h.length:0,k=a===bT,l;for(;i<j&&(k||!l);i++)l=h[i](c,d,e),typeof l=="string"&&(!k||g[l]?l=b:(c.dataTypes.unshift(l),l=b$(a,c,d,e,l,g)));(k||!l)&&!g["*"]&&(l=b$(a,c,d,e,"*",g));return l}function bZ(a){return function(b,c){typeof b!="string"&&(c=b,b="*");if(f.isFunction(c)){var d=b.toLowerCase().split(bP),e=0,g=d.length,h,i,j;for(;e<g;e++)h=d[e],j=/^\+/.test(h),j&&(h=h.substr(1)||"*"),i=a[h]=a[h]||[],i[j?"unshift":"push"](c)}}}function bC(a,b,c){var d=b==="width"?a.offsetWidth:a.offsetHeight,e=b==="width"?bx:by,g=0,h=e.length;if(d>0){if(c!=="border")for(;g<h;g++)c||(d-=parseFloat(f.css(a,"padding"+e[g]))||0),c==="margin"?d+=parseFloat(f.css(a,c+e[g]))||0:d-=parseFloat(f.css(a,"border"+e[g]+"Width"))||0;return d+"px"}d=bz(a,b,b);if(d<0||d==null)d=a.style[b]||0;d=parseFloat(d)||0;if(c)for(;g<h;g++)d+=parseFloat(f.css(a,"padding"+e[g]))||0,c!=="padding"&&(d+=parseFloat(f.css(a,"border"+e[g]+"Width"))||0),c==="margin"&&(d+=parseFloat(f.css(a,c+e[g]))||0);return d+"px"}function bp(a,b){b.src?f.ajax({url:b.src,async:!1,dataType:"script"}):f.globalEval((b.text||b.textContent||b.innerHTML||"").replace(bf,"/*$0*/")),b.parentNode&&b.parentNode.removeChild(b)}function bo(a){var b=c.createElement("div");bh.appendChild(b),b.innerHTML=a.outerHTML;return b.firstChild}function bn(a){var b=(a.nodeName||"").toLowerCase();b==="input"?bm(a):b!=="script"&&typeof a.getElementsByTagName!="undefined"&&f.grep(a.getElementsByTagName("input"),bm)}function bm(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function bl(a){return typeof a.getElementsByTagName!="undefined"?a.getElementsByTagName("*"):typeof a.querySelectorAll!="undefined"?a.querySelectorAll("*"):[]}function bk(a,b){var c;if(b.nodeType===1){b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase();if(c==="object")b.outerHTML=a.outerHTML;else if(c!=="input"||a.type!=="checkbox"&&a.type!=="radio"){if(c==="option")b.selected=a.defaultSelected;else if(c==="input"||c==="textarea")b.defaultValue=a.defaultValue}else a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value);b.removeAttribute(f.expando)}}function bj(a,b){if(b.nodeType===1&&!!f.hasData(a)){var c,d,e,g=f._data(a),h=f._data(b,g),i=g.events;if(i){delete h.handle,h.events={};for(c in i)for(d=0,e=i[c].length;d<e;d++)f.event.add(b,c+(i[c][d].namespace?".":"")+i[c][d].namespace,i[c][d],i[c][d].data)}h.data&&(h.data=f.extend({},h.data))}}function bi(a,b){return f.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function U(a){var b=V.split("|"),c=a.createDocumentFragment();if(c.createElement)while(b.length)c.createElement(b.pop());return c}function T(a,b,c){b=b||0;if(f.isFunction(b))return f.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return f.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=f.grep(a,function(a){return a.nodeType===1});if(O.test(b))return f.filter(b,d,!c);b=f.filter(b,d)}return f.grep(a,function(a,d){return f.inArray(a,b)>=0===c})}function S(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function K(){return!0}function J(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?parseFloat(d):j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c<d;c++)b[a[c]]=!0;return b}var c=a.document,d=a.navigator,e=a.location,f=function(){function J(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(J,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=/-([a-z]|[0-9])/ig,w=/^-ms-/,x=function(a,b){return(b+"").toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=m.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7.1",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.add(a);return this},eq:function(a){a=+a;return a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j<k;j++)if((a=arguments[j])!=null)for(c in a){d=i[c],f=a[c];if(i===f)continue;l&&f&&(e.isPlainObject(f)||(g=e.isArray(f)))?(g?(g=!1,h=d&&e.isArray(d)?d:[]):h=d&&e.isPlainObject(d)?d:{},i[c]=e.extend(l,h,f)):f!==b&&(i[c]=f)}return i},e.extend({noConflict:function(b){a.$===e&&(a.$=g),b&&a.jQuery===e&&(a.jQuery=f);return e},isReady:!1,readyWait:1,holdReady:function(a){a?e.readyWait++:e.ready(!0)},ready:function(a){if(a===!0&&!--e.readyWait||a!==!0&&!e.isReady){if(!c.body)return setTimeout(e.ready,1);e.isReady=!0;if(a!==!0&&--e.readyWait>0)return;A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").off("ready")}},bindReady:function(){if(!A){A=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||D.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw new Error(a)},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,"ms-").replace(v,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g<h;)if(c.apply(a[g++],d)===!1)break}else if(i){for(f in a)if(c.call(a[f],f,a[f])===!1)break}else for(;g<h;)if(c.call(a[g],g,a[g++])===!1)break;return a},trim:G?function(a){return a==null?"":G.call(a)}:function(a){return a==null?"":(a+"").replace(k,"").replace(l,"")},makeArray:function(a,b){var c=b||[];if(a!=null){var d=e.type(a);a.length==null||d==="string"||d==="function"||d==="regexp"||e.isWindow(a)?E.call(c,a):e.merge(c,a)}return c},inArray:function(a,b,c){var d;if(b){if(H)return H.call(b,a,c);d=b.length,c=c?c<0?Math.max(0,d+c):c:0;for(;c<d;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,c){var d=a.length,e=0;if(typeof c.length=="number")for(var f=c.length;e<f;e++)a[d++]=c[e];else while(c[e]!==b)a[d++]=c[e++];a.length=d;return a},grep:function(a,b,c){var d=[],e;c=!!c;for(var f=0,g=a.length;f<g;f++)e=!!b(a[f],f),c!==e&&d.push(a[f]);return d},map:function(a,c,d){var f,g,h=[],i=0,j=a.length,k=a instanceof e||j!==b&&typeof j=="number"&&(j>0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i<j;i++)f=c(a[i],i,d),f!=null&&(h[h.length]=f);else for(g in a)f=c(a[g],g,d),f!=null&&(h[h.length]=f);return h.concat.apply([],h)},guid:1,proxy:function(a,c){if(typeof c=="string"){var d=a[c];c=a,a=d}if(!e.isFunction(a))return b;var f=F.call(arguments,2),g=function(){return a.apply(c,f.concat(F.call(arguments)))};g.guid=a.guid=a.guid||g.guid||e.guid++;return g},access:function(a,c,d,f,g,h){var i=a.length;if(typeof c=="object"){for(var j in c)e.access(a,j,c[j],f,g,d);return a}if(d!==b){f=!h&&f&&e.isFunction(d);for(var k=0;k<i;k++)g(a[k],c,f?d.call(a[k],k,g(a[k],c)):d,h);return a}return i?g(a[0],c):b},now:function(){return(new Date).getTime()},uaMatch:function(a){a=a.toLowerCase();var b=r.exec(a)||s.exec(a)||t.exec(a)||a.indexOf("compatible")<0&&u.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}e.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function(d,f){f&&f instanceof e&&!(f instanceof a)&&(f=a(f));return e.fn.init.call(this,d,f,b)},a.fn.init.prototype=a.fn;var b=a(c);return a},browser:{}}),e.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){I["[object "+b+"]"]=b.toLowerCase()}),z=e.uaMatch(y),z.browser&&(e.browser[z.browser]=!0,e.browser.version=z.version),e.browser.webkit&&(e.browser.safari=!0),j.test(" ")&&(k=/^[\s\xA0]+/,l=/[\s\xA0]+$/),h=e(c),c.addEventListener?B=function(){c.removeEventListener("DOMContentLoaded",B,!1),e.ready()}:c.attachEvent&&(B=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",B),e.ready())});return e}(),g={};f.Callbacks=function(a){a=a?g[a]||h(a):{};var c=[],d=[],e,i,j,k,l,m=function(b){var d,e,g,h,i;for(d=0,e=b.length;d<e;d++)g=b[d],h=f.type(g),h==="array"?m(g):h==="function"&&(!a.unique||!o.has(g))&&c.push(g)},n=function(b,f){f=f||[],e=!a.memory||[b,f],i=!0,l=j||0,j=0,k=c.length;for(;c&&l<k;l++)if(c[l].apply(b,f)===!1&&a.stopOnFalse){e=!0;break}i=!1,c&&(a.once?e===!0?o.disable():c=[]:d&&d.length&&(e=d.shift(),o.fireWith(e[0],e[1])))},o={add:function(){if(c){var a=c.length;m(arguments),i?k=c.length:e&&e!==!0&&(j=a,n(e[0],e[1]))}return this},remove:function(){if(c){var b=arguments,d=0,e=b.length;for(;d<e;d++)for(var f=0;f<c.length;f++)if(b[d]===c[f]){i&&f<=k&&(k--,f<=l&&l--),c.splice(f--,1);if(a.unique)break}}return this},has:function(a){if(c){var b=0,d=c.length;for(;b<d;b++)if(a===c[b])return!0}return!1},empty:function(){c=[];return this},disable:function(){c=d=e=b;return this},disabled:function(){return!c},lock:function(){d=b,(!e||e===!0)&&o.disable();return this},locked:function(){return!d},fireWith:function(b,c){d&&(i?a.once||d.push([b,c]):(!a.once||!e)&&n(b,c));return this},fire:function(){o.fireWith(this,arguments);return this},fired:function(){return!!e}};return o};var i=[].slice;f.extend({Deferred:function(a){var b=f.Callbacks("once memory"),c=f.Callbacks("once memory"),d=f.Callbacks("memory"),e="pending",g={resolve:b,reject:c,notify:d},h={done:b.add,fail:c.add,progress:d.add,state:function(){return e},isResolved:b.fired,isRejected:c.fired,then:function(a,b,c){i.done(a).fail(b).progress(c);return this},always:function(){i.done.apply(i,arguments).fail.apply(i,arguments);return this},pipe:function(a,b,c){return f.Deferred(function(d){f.each({done:[a,"resolve"],fail:[b,"reject"],progress:[c,"notify"]},function(a,b){var c=b[0],e=b[1],g;f.isFunction(c)?i[a](function(){g=c.apply(this,arguments),g&&f.isFunction(g.promise)?g.promise().then(d.resolve,d.reject,d.notify):d[e+"With"](this===i?d:this,[g])}):i[a](d[e])})}).promise()},promise:function(a){if(a==null)a=h;else for(var b in h)a[b]=h[b];return a}},i=h.promise({}),j;for(j in g)i[j]=g[j].fire,i[j+"With"]=g[j].fireWith;i.done(function(){e="resolved"},c.disable,d.lock).fail(function(){e="rejected"},b.disable,d.lock),a&&a.call(i,i);return i},when:function(a){function m(a){return function(b){e[a]=arguments.length>1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c<d;c++)b[c]&&b[c].promise&&f.isFunction(b[c].promise)?b[c].promise().then(l(c),j.reject,m(c)):--g;g||j.resolveWith(j,b)}else j!==a&&j.resolveWith(j,d?[a]:[]);return k}}),f.support=function(){var b,d,e,g,h,i,j,k,l,m,n,o,p,q=c.createElement("div"),r=c.documentElement;q.setAttribute("className","t"),q.innerHTML="   <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>",d=q.getElementsByTagName("*"),e=q.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=q.getElementsByTagName("input")[0],b={leadingWhitespace:q.firstChild.nodeType===3,tbody:!q.getElementsByTagName("tbody").length,htmlSerialize:!!q.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:q.className!=="t",enctype:!!c.createElement("form").enctype,html5Clone:c.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete q.test}catch(s){b.deleteExpando=!1}!q.addEventListener&&q.attachEvent&&q.fireEvent&&(q.attachEvent("onclick",function(){b.noCloneEvent=!1}),q.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),b.radioValue=i.value==="t",i.setAttribute("checked","checked"),q.appendChild(i),k=c.createDocumentFragment(),k.appendChild(q.lastChild),b.checkClone=k.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=i.checked,k.removeChild(i),k.appendChild(q),q.innerHTML="",a.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",q.style.width="2px",q.appendChild(j),b.reliableMarginRight=(parseInt((a.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0);if(q.attachEvent)for(o in{submit:1,change:1,focusin:1})n="on"+o,p=n in q,p||(q.setAttribute(n,"return;"),p=typeof q[n]=="function"),b[o+"Bubbles"]=p;k.removeChild(q),k=g=h=j=q=i=null,f(function(){var a,d,e,g,h,i,j,k,m,n,o,r=c.getElementsByTagName("body")[0];!r||(j=1,k="position:absolute;top:0;left:0;width:1px;height:1px;margin:0;",m="visibility:hidden;border:0;",n="style='"+k+"border:5px solid #000;padding:0;'",o="<div "+n+"><div></div></div>"+"<table "+n+" cellpadding='0' cellspacing='0'>"+"<tr><td></td></tr></table>",a=c.createElement("div"),a.style.cssText=m+"width:0;height:0;position:static;top:0;margin-top:"+j+"px",r.insertBefore(a,r.firstChild),q=c.createElement("div"),a.appendChild(q),q.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>",l=q.getElementsByTagName("td"),p=l[0].offsetHeight===0,l[0].style.display="",l[1].style.display="none",b.reliableHiddenOffsets=p&&l[0].offsetHeight===0,q.innerHTML="",q.style.width=q.style.paddingLeft="1px",f.boxModel=b.boxModel=q.offsetWidth===2,typeof q.style.zoom!="undefined"&&(q.style.display="inline",q.style.zoom=1,b.inlineBlockNeedsLayout=q.offsetWidth===2,q.style.display="",q.innerHTML="<div style='width:4px;'></div>",b.shrinkWrapBlocks=q.offsetWidth!==2),q.style.cssText=k+m,q.innerHTML=o,d=q.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,i={doesNotAddBorder:e.offsetTop!==5,doesAddBorderForTableAndCells:h.offsetTop===5},e.style.position="fixed",e.style.top="20px",i.fixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",i.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,i.doesNotIncludeMarginInBodyOffset=r.offsetTop!==j,r.removeChild(a),q=a=null,f.extend(b,i))});return b}();var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,g=b.length;e<g;e++)delete d[b[e]];if(!(c?m:f.isEmptyObject)(d))return}}if(!c){delete j[k].data;if(!m(j[k]))return}f.support.deleteExpando||!j.setInterval?delete j[k]:j[k]=null,i&&(f.support.deleteExpando?delete a[h]:a.removeAttribute?a.removeAttribute(h):a[h]=null)}},_data:function(a,b,c){return f.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=f.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),f.fn.extend({data:function(a,c){var d,e,g,h=null;if(typeof a=="undefined"){if(this.length){h=f.data(this[0]);if(this[0].nodeType===1&&!f._data(this[0],"parsedAttrs")){e=this[0].attributes;for(var i=0,j=e.length;i<j;i++)g=e[i].name,g.indexOf("data-")===0&&(g=f.camelCase(g.substring(5)),l(this[0],g,h[g]));f._data(this[0],"parsedAttrs",!0)}}return h}if(typeof a=="object")return this.each(function(){f.data(this,a)});d=a.split("."),d[1]=d[1]?"."+d[1]:"";if(c===b){h=this.triggerHandler("getData"+d[1]+"!",[d[0]]),h===b&&this.length&&(h=f.data(this[0],a),h=l(this[0],a,h));return h===b&&d[1]?this.data(d[0]):h}return this.each(function(){var b=f(this),e=[d[0],c];b.triggerHandler("setData"+d[1]+"!",e),f.data(this,a,c),b.triggerHandler("changeData"+d[1]+"!",e)})},removeData:function(a){return this.each(function(){f.removeData(this,a)})}}),f.extend({_mark:function(a,b){a&&(b=(b||"fx")+"mark",f._data(a,b,(f._data(a,b)||0)+1))},_unmark:function(a,b,c){a!==!0&&(c=b,b=a,a=!1);if(b){c=c||"fx";var d=c+"mark",e=a?0:(f._data(b,d)||1)-1;e?f._data(b,d,e):(f.removeData(b,d,!0),n(b,c,"mark"))}},queue:function(a,b,c){var d;if(a){b=(b||"fx")+"queue",d=f._data(a,b),c&&(!d||f.isArray(c)?d=f._data(a,b,f.makeArray(c)):d.push(c));return d||[]}},dequeue:function(a,b){b=b||"fx";var c=f.queue(a,b),d=c.shift(),e={};d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),f._data(a,b+".run",e),d.call(a,function(){f.dequeue(a,b)},e)),c.length||(f.removeData(a,b+"queue "+b+".run",!0),n(a,b,"queue"))}}),f.fn.extend({queue:function(a,c){typeof a!="string"&&(c=a,a="fx");if(c===b)return f.queue(this[0],a);return this.each(function(){var b=f.queue(this,a,c);a==="fx"&&b[0]!=="inprogress"&&f.dequeue(this,a)})},dequeue:function(a){return this.each(function(){f.dequeue(this,a)})},delay:function(a,b){a=f.fx?f.fx.speeds[a]||a:a,b=b||"fx";return this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){function m(){--h||d.resolveWith(e,[e])}typeof a!="string"&&(c=a,a=b),a=a||"fx";var d=f.Deferred(),e=this,g=e.length,h=1,i=a+"defer",j=a+"queue",k=a+"mark",l;while(g--)if(l=f.data(e[g],i,b,!0)||(f.data(e[g],j,b,!0)||f.data(e[g],k,b,!0))&&f.data(e[g],i,f.Callbacks("once memory"),!0))h++,l.add(m);m();return d.promise()}});var o=/[\n\t\r]/g,p=/\s+/,q=/\r/g,r=/^(?:button|input)$/i,s=/^(?:button|input|object|select|textarea)$/i,t=/^a(?:rea)?$/i,u=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,v=f.support.getSetAttribute,w,x,y;f.fn.extend({attr:function(a,b){return f.access(this,a,b,!0,f.attr)},removeAttr:function(a){return this.each(function(){f.removeAttr(this,a)})},prop:function(a,b){return f.access(this,a,b,!0,f.prop)},removeProp:function(a){a=f.propFix[a]||a;return this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,g,h,i;if(f.isFunction(a))return this.each(function(b){f(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(p);for(c=0,d=this.length;c<d;c++){e=this[c];if(e.nodeType===1)if(!e.className&&b.length===1)e.className=a;else{g=" "+e.className+" ";for(h=0,i=b.length;h<i;h++)~g.indexOf(" "+b[h]+" ")||(g+=b[h]+" ");e.className=f.trim(g)}}}return this},removeClass:function(a){var c,d,e,g,h,i,j;if(f.isFunction(a))return this.each(function(b){f(this).removeClass(a.call(this,b,this.className))});if(a&&typeof a=="string"||a===b){c=(a||"").split(p);for(d=0,e=this.length;d<e;d++){g=this[d];if(g.nodeType===1&&g.className)if(a){h=(" "+g.className+" ").replace(o," ");for(i=0,j=c.length;i<j;i++)h=h.replace(" "+c[i]+" "," ");g.className=f.trim(h)}else g.className=""}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";if(f.isFunction(a))return this.each(function(c){f(this).toggleClass(a.call(this,c,this.className,b),b)});return this.each(function(){if(c==="string"){var e,g=0,h=f(this),i=b,j=a.split(p);while(e=j[g++])i=d?i:!h.hasClass(e),h[i?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&f._data(this,"__className__",this.className),this.className=this.className||a===!1?"":f._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ",c=0,d=this.length;for(;c<d;c++)if(this[c].nodeType===1&&(" "+this[c].className+" ").replace(o," ").indexOf(b)>-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];{if(!!arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}if(g){c=f.valHooks[g.nodeName.toLowerCase()]||f.valHooks[g.type];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}}}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c<d;c++){e=i[c];if(e.selected&&(f.support.optDisabled?!e.disabled:e.getAttribute("disabled")===null)&&(!e.parentNode.disabled||!f.nodeName(e.parentNode,"optgroup"))){b=f(e).val();if(j)return b;h.push(b)}}if(j&&!h.length&&i.length)return f(i[g]).val();return h},set:function(a,b){var c=f.makeArray(b);f(a).find("option").each(function(){this.selected=f.inArray(f(this).val(),c)>=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!!a&&j!==3&&j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute=="undefined")return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g}},removeAttr:function(a,b){var c,d,e,g,h=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;h<g;h++)e=d[h],e&&(c=f.propFix[e]||e,f.attr(a,e,""),a.removeAttribute(v?e:c),u.test(e)&&c in a&&(a[c]=!1))}},attrHooks:{type:{set:function(a,b){if(r.test(a.nodeName)&&a.parentNode)f.error("type property can't be changed");else if(!f.support.radioValue&&b==="radio"&&f.nodeName(a,"input")){var c=a.value;a.setAttribute("type",b),c&&(a.value=c);return b}}},value:{get:function(a,b){if(w&&f.nodeName(a,"button"))return w.get(a,b);return b in a?a.value:null},set:function(a,b,c){if(w&&f.nodeName(a,"button"))return w.set(a,b,c);a.value=b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e,g,h,i=a.nodeType;if(!!a&&i!==3&&i!==8&&i!==2){h=i!==1||!f.isXMLDoc(a),h&&(c=f.propFix[c]||c,g=f.propHooks[c]);return d!==b?g&&"set"in g&&(e=g.set(a,d,c))!==b?e:a[c]=d:g&&"get"in g&&(e=g.get(a,c))!==null?e:a[c]}},propHooks:{tabIndex:{get:function(a){var c=a.getAttributeNode("tabindex");return c&&c.specified?parseInt(c.value,10):s.test(a.nodeName)||t.test(a.nodeName)&&a.href?0:b}}}}),f.attrHooks.tabindex=f.propHooks.tabIndex,x={get:function(a,c){var d,e=f.prop(a,c);return e===!0||typeof e!="boolean"&&(d=a.getAttributeNode(c))&&d.nodeValue!==!1?c.toLowerCase():b},set:function(a,b,c){var d;b===!1?f.removeAttr(a,c):(d=f.propFix[c]||c,d in a&&(a[d]=!0),a.setAttribute(c,c.toLowerCase()));return c}},v||(y={name:!0,id:!0},w=f.valHooks.button={get:function(a,c){var d;d=a.getAttributeNode(c);return d&&(y[c]?d.nodeValue!=="":d.specified)?d.nodeValue:b},set:function(a,b,d){var e=a.getAttributeNode(d);e||(e=c.createAttribute(d),a.setAttributeNode(e));return e.nodeValue=b+""}},f.attrHooks.tabindex.set=w.set,f.each(["width","height"],function(a,b){f.attrHooks[b]=f.extend(f.attrHooks[b],{set:function(a,c){if(c===""){a.setAttribute(b,"auto");return c}}})}),f.attrHooks.contenteditable={get:w.get,set:function(a,b,c){b===""&&(b="false"),w.set(a,b,c)}}),f.support.hrefNormalized||f.each(["href","src","width","height"],function(a,c){f.attrHooks[c]=f.extend(f.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),f.support.style||(f.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),f.support.optSelected||(f.propHooks.selected=f.extend(f.propHooks.selected,{get:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex);return null}})),f.support.enctype||(f.propFix.enctype="encoding"),f.support.checkOn||f.each(["radio","checkbox"],function(){f.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),f.each(["radio","checkbox"],function(){f.valHooks[this]=f.extend(f.valHooks[this],{set:function(a,b){if(f.isArray(b))return a.checked=f.inArray(f(a).val(),b)>=0}})});var z=/^(?:textarea|input|select)$/i,A=/^([^\.]*)?(?:\.(.+))?$/,B=/\bhover(\.\S+)?\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,G=function(a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},H=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c["class"]||{}).value))},I=function(a){return f.event.special.hover?a:a.replace(B,"mouseenter$1 mouseleave$1")};
f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=f.trim(I(c)).split(" ");for(k=0;k<c.length;k++){l=A.exec(c[k])||[],m=l[1],n=(l[2]||"").split(".").sort(),s=f.event.special[m]||{},m=(g?s.delegateType:s.bindType)||m,s=f.event.special[m]||{},o=f.extend({type:m,origType:l[1],data:e,handler:d,guid:d.guid,selector:g,quick:G(g),namespace:n.join(".")},p),r=j[m];if(!r){r=j[m]=[],r.delegateCount=0;if(!s.setup||s.setup.call(a,e,n,i)===!1)a.addEventListener?a.addEventListener(m,i,!1):a.attachEvent&&a.attachEvent("on"+m,i)}s.add&&(s.add.call(a,o),o.handler.guid||(o.handler.guid=d.guid)),g?r.splice(r.delegateCount++,0,o):r.push(o),f.event.global[m]=!0}a=null}},global:{},remove:function(a,b,c,d,e){var g=f.hasData(a)&&f._data(a),h,i,j,k,l,m,n,o,p,q,r,s;if(!!g&&!!(o=g.events)){b=f.trim(I(b||"")).split(" ");for(h=0;h<b.length;h++){i=A.exec(b[h])||[],j=k=i[1],l=i[2];if(!j){for(j in o)f.event.remove(a,j+b[h],c,d,!0);continue}p=f.event.special[j]||{},j=(d?p.delegateType:p.bindType)||j,r=o[j]||[],m=r.length,l=l?new RegExp("(^|\\.)"+l.split(".").sort().join("\\.(?:.*\\.)?")+"(\\.|$)"):null;for(n=0;n<r.length;n++)s=r[n],(e||k===s.origType)&&(!c||c.guid===s.guid)&&(!l||l.test(s.namespace))&&(!d||d===s.selector||d==="**"&&s.selector)&&(r.splice(n--,1),s.selector&&r.delegateCount--,p.remove&&p.remove.call(a,s));r.length===0&&m!==r.length&&((!p.teardown||p.teardown.call(a,l)===!1)&&f.removeEvent(a,j,g.handle),delete o[j])}f.isEmptyObject(o)&&(q=g.handle,q&&(q.elem=null),f.removeData(a,["events","handle"],!0))}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,e,g){if(!e||e.nodeType!==3&&e.nodeType!==8){var h=c.type||c,i=[],j,k,l,m,n,o,p,q,r,s;if(E.test(h+f.event.triggered))return;h.indexOf("!")>=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"";if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,m=E.test(s+h)?e:e.parentNode,n=null;for(;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;l<r.length&&!c.isPropagationStopped();l++)m=r[l][0],c.type=r[l][1],q=(f._data(m,"events")||{})[c.type]&&f._data(m,"handle"),q&&q.apply(m,d),q=o&&m[o],q&&f.acceptData(m)&&q.apply(m,d)===!1&&c.preventDefault();c.type=h,!g&&!c.isDefaultPrevented()&&(!p._default||p._default.apply(e.ownerDocument,d)===!1)&&(h!=="click"||!f.nodeName(e,"a"))&&f.acceptData(e)&&o&&e[h]&&(h!=="focus"&&h!=="blur"||c.target.offsetWidth!==0)&&!f.isWindow(e)&&(n=e[o],n&&(e[o]=null),f.event.triggered=h,e[h](),f.event.triggered=b,n&&(e[o]=n));return c.result}},dispatch:function(c){c=f.event.fix(c||a.event);var d=(f._data(this,"events")||{})[c.type]||[],e=d.delegateCount,g=[].slice.call(arguments,0),h=!c.exclusive&&!c.namespace,i=[],j,k,l,m,n,o,p,q,r,s,t;g[0]=c,c.delegateTarget=this;if(e&&!c.target.disabled&&(!c.button||c.type!=="click")){m=f(this),m.context=this.ownerDocument||this;for(l=c.target;l!=this;l=l.parentNode||this){o={},q=[],m[0]=l;for(j=0;j<e;j++)r=d[j],s=r.selector,o[s]===b&&(o[s]=r.quick?H(l,r.quick):m.is(s)),o[s]&&q.push(r);q.length&&i.push({elem:l,matches:q})}}d.length>e&&i.push({elem:this,matches:d.slice(e)});for(j=0;j<i.length&&!c.isPropagationStopped();j++){p=i[j],c.currentTarget=p.elem;for(k=0;k<p.matches.length&&!c.isImmediatePropagationStopped();k++){r=p.matches[k];if(h||!c.namespace&&!r.namespace||c.namespace_re&&c.namespace_re.test(r.namespace))c.data=r.data,c.handleObj=r,n=((f.event.special[r.origType]||{}).handle||r.handler).apply(p.elem,g),n!==b&&(c.result=n,n===!1&&(c.preventDefault(),c.stopPropagation()))}}return c.result},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){a.which==null&&(a.which=b.charCode!=null?b.charCode:b.keyCode);return a}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,d){var e,f,g,h=d.button,i=d.fromElement;a.pageX==null&&d.clientX!=null&&(e=a.target.ownerDocument||c,f=e.documentElement,g=e.body,a.pageX=d.clientX+(f&&f.scrollLeft||g&&g.scrollLeft||0)-(f&&f.clientLeft||g&&g.clientLeft||0),a.pageY=d.clientY+(f&&f.scrollTop||g&&g.scrollTop||0)-(f&&f.clientTop||g&&g.clientTop||0)),!a.relatedTarget&&i&&(a.relatedTarget=i===a.target?d.toElement:i),!a.which&&h!==b&&(a.which=h&1?1:h&2?3:h&4?2:0);return a}},fix:function(a){if(a[f.expando])return a;var d,e,g=a,h=f.event.fixHooks[a.type]||{},i=h.props?this.props.concat(h.props):this.props;a=f.Event(g);for(d=i.length;d;)e=i[--d],a[e]=g[e];a.target||(a.target=g.srcElement||c),a.target.nodeType===3&&(a.target=a.target.parentNode),a.metaKey===b&&(a.metaKey=a.ctrlKey);return h.filter?h.filter(a,g):a},special:{ready:{setup:f.bindReady},load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(a,b,c){f.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}},simulate:function(a,b,c,d){var e=f.extend(new f.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?f.event.trigger(e,null,b):f.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},f.event.handle=f.event.dispatch,f.removeEvent=c.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent&&a.detachEvent("on"+b,c)},f.Event=function(a,b){if(!(this instanceof f.Event))return new f.Event(a,b);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?K:J):this.type=a,b&&f.extend(this,b),this.timeStamp=a&&a.timeStamp||f.now(),this[f.expando]=!0},f.Event.prototype={preventDefault:function(){this.isDefaultPrevented=K;var a=this.originalEvent;!a||(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=K;var a=this.originalEvent;!a||(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=K,this.stopPropagation()},isDefaultPrevented:J,isPropagationStopped:J,isImmediatePropagationStopped:J},f.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){f.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c=this,d=a.relatedTarget,e=a.handleObj,g=e.selector,h;if(!d||d!==c&&!f.contains(c,d))a.type=e.origType,h=e.handler.apply(this,arguments),a.type=b;return h}}}),f.support.submitBubbles||(f.event.special.submit={setup:function(){if(f.nodeName(this,"form"))return!1;f.event.add(this,"click._submit keypress._submit",function(a){var c=a.target,d=f.nodeName(c,"input")||f.nodeName(c,"button")?c.form:b;d&&!d._submit_attached&&(f.event.add(d,"submit._submit",function(a){this.parentNode&&!a.isTrigger&&f.event.simulate("submit",this.parentNode,a,!0)}),d._submit_attached=!0)})},teardown:function(){if(f.nodeName(this,"form"))return!1;f.event.remove(this,"._submit")}}),f.support.changeBubbles||(f.event.special.change={setup:function(){if(z.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio")f.event.add(this,"propertychange._change",function(a){a.originalEvent.propertyName==="checked"&&(this._just_changed=!0)}),f.event.add(this,"click._change",function(a){this._just_changed&&!a.isTrigger&&(this._just_changed=!1,f.event.simulate("change",this,a,!0))});return!1}f.event.add(this,"beforeactivate._change",function(a){var b=a.target;z.test(b.nodeName)&&!b._change_attached&&(f.event.add(b,"change._change",function(a){this.parentNode&&!a.isSimulated&&!a.isTrigger&&f.event.simulate("change",this.parentNode,a,!0)}),b._change_attached=!0)})},handle:function(a){var b=a.target;if(this!==b||a.isSimulated||a.isTrigger||b.type!=="radio"&&b.type!=="checkbox")return a.handleObj.handler.apply(this,arguments)},teardown:function(){f.event.remove(this,"._change");return z.test(this.nodeName)}}),f.support.focusinBubbles||f.each({focus:"focusin",blur:"focusout"},function(a,b){var d=0,e=function(a){f.event.simulate(b,a.target,f.event.fix(a),!0)};f.event.special[b]={setup:function(){d++===0&&c.addEventListener(a,e,!0)},teardown:function(){--d===0&&c.removeEventListener(a,e,!0)}}}),f.fn.extend({on:function(a,c,d,e,g){var h,i;if(typeof a=="object"){typeof c!="string"&&(d=c,c=b);for(i in a)this.on(i,c,d,a[i],g);return this}d==null&&e==null?(e=c,d=c=b):e==null&&(typeof c=="string"?(e=d,d=b):(e=d,d=c,c=b));if(e===!1)e=J;else if(!e)return this;g===1&&(h=e,e=function(a){f().off(a);return h.apply(this,arguments)},e.guid=h.guid||(h.guid=f.guid++));return this.each(function(){f.event.add(this,a,e,d,c)})},one:function(a,b,c,d){return this.on.call(this,a,b,c,d,1)},off:function(a,c,d){if(a&&a.preventDefault&&a.handleObj){var e=a.handleObj;f(a.delegateTarget).off(e.namespace?e.type+"."+e.namespace:e.type,e.selector,e.handler);return this}if(typeof a=="object"){for(var g in a)this.off(g,c,a[g]);return this}if(c===!1||typeof c=="function")d=c,c=b;d===!1&&(d=J);return this.each(function(){f.event.remove(this,a,d,c)})},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},live:function(a,b,c){f(this.context).on(a,this.selector,b,c);return this},die:function(a,b){f(this.context).off(a,this.selector||"**",b);return this},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return arguments.length==1?this.off(a,"**"):this.off(b,a,c)},trigger:function(a,b){return this.each(function(){f.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return f.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||f.guid++,d=0,e=function(c){var e=(f._data(this,"lastToggle"+a.guid)||0)%d;f._data(this,"lastToggle"+a.guid,e+1),c.preventDefault();return b[e].apply(this,arguments)||!1};e.guid=c;while(d<b.length)b[d++].guid=c;return this.click(e)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}}),f.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){f.fn[b]=function(a,c){c==null&&(c=a,a=null);return arguments.length>0?this.on(b,null,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),C.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),D.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h<i;h++){var j=e[h];if(j){var k=!1;j=j[a];while(j){if(j[d]===c){k=e[j.sizset];break}if(j.nodeType===1){g||(j[d]=c,j.sizset=h);if(typeof b!="string"){if(j===b){k=!0;break}}else if(m.filter(b,[j]).length>0){k=j;break}}j=j[a]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h<i;h++){var j=e[h];if(j){var k=!1;j=j[a];while(j){if(j[d]===c){k=e[j.sizset];break}j.nodeType===1&&!g&&(j[d]=c,j.sizset=h);if(j.nodeName.toLowerCase()===b){k=j;break}j=j[a]}e[h]=k}}}var a=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b<a.length;b++)a[b]===a[b-1]&&a.splice(b--,1)}return a},m.matches=function(a,b){return m(a,null,null,b)},m.matchesSelector=function(a,b){return m(b,null,null,[a]).length>0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e<f;e++){h=o.order[e];if(g=o.leftMatch[h].exec(a)){i=g[1],g.splice(1,1);if(i.substr(i.length-1)!=="\\"){g[1]=(g[1]||"").replace(j,""),d=o.find[h](g,b,c);if(d!=null){a=a.replace(o.match[h],"");break}}}}d||(d=typeof b.getElementsByTagName!="undefined"?b.getElementsByTagName("*"):[]);return{set:d,expr:a}},m.filter=function(a,c,d,e){var f,g,h,i,j,k,l,n,p,q=a,r=[],s=c,t=c&&c[0]&&m.isXML(c[0]);while(a&&c.length){for(h in o.filter)if((f=o.leftMatch[h].exec(a))!=null&&f[2]){k=o.filter[h],l=f[1],g=!1,f.splice(1,1);if(l.substr(l.length-1)==="\\")continue;s===r&&(r=[]);if(o.preFilter[h]){f=o.preFilter[h](f,s,d,r,e,t);if(!f)g=i=!0;else if(f===!0)continue}if(f)for(n=0;(j=s[n])!=null;n++)j&&(i=k(j,f,n,s),p=e^i,d&&i!=null?p?g=!0:s[n]=!1:p&&(r.push(j),g=!0));if(i!==b){d||(s=r),a=a.replace(o.match[h],"");if(!g)return[];break}}if(a===q)if(g==null)m.error(a);else break;q=a}return s},m.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)};var n=m.getText=function(a){var b,c,d=a.nodeType,e="";if(d){if(d===1||d===9){if(typeof a.textContent=="string")return a.textContent;if(typeof a.innerText=="string")return a.innerText.replace(k,"");for(a=a.firstChild;a;a=a.nextSibling)e+=n(a)}else if(d===3||d===4)return a.nodeValue}else for(b=0;c=a[b];b++)c.nodeType!==8&&(e+=n(c));return e},o=m.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")},type:function(a){return a.getAttribute("type")}},relative:{"+":function(a,b){var c=typeof b=="string",d=c&&!l.test(b),e=c&&!d;d&&(b=b.toLowerCase());for(var f=0,g=a.length,h;f<g;f++)if(h=a[f]){while((h=h.previousSibling)&&h.nodeType!==1);a[f]=e||h&&h.nodeName.toLowerCase()===b?h||!1:h===b}e&&m.filter(b,a,!0)},">":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e<f;e++){c=a[e];if(c){var g=c.parentNode;a[e]=g.nodeName.toLowerCase()===b?g:!1}}}else{for(;e<f;e++)c=a[e],c&&(a[e]=d?c.parentNode:c.parentNode===b);d&&m.filter(b,a,!0)}},"":function(a,b,c){var d,f=e++,g=x;typeof b=="string"&&!l.test(b)&&(b=b.toLowerCase(),d=b,g=w),g("parentNode",b,f,a,d,c)},"~":function(a,b,c){var d,f=e++,g=x;typeof b=="string"&&!l.test(b)&&(b=b.toLowerCase(),d=b,g=w),g("previousSibling",b,f,a,d,c)}},find:{ID:function(a,b,c){if(typeof b.getElementById!="undefined"&&!c){var d=b.getElementById(a[1]);return d&&d.parentNode?[d]:[]}},NAME:function(a,b){if(typeof b.getElementsByName!="undefined"){var c=[],d=b.getElementsByName(a[1]);for(var e=0,f=d.length;e<f;e++)d[e].getAttribute("name")===a[1]&&c.push(d[e]);return c.length===0?null:c}},TAG:function(a,b){if(typeof b.getElementsByTagName!="undefined")return b.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,b,c,d,e,f){a=" "+a[1].replace(j,"")+" ";if(f)return a;for(var g=0,h;(h=b[g])!=null;g++)h&&(e^(h.className&&(" "+h.className+" ").replace(/[\t\n\r]/g," ").indexOf(a)>=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return b<c[3]-0},gt:function(a,b,c){return b>c[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h<i;h++)if(g[h]===a)return!1;return!0}m.error(e)},CHILD:function(a,b){var c,e,f,g,h,i,j,k=b[1],l=a;switch(k){case"only":case"first":while(l=l.previousSibling)if(l.nodeType===1)return!1;if(k==="first")return!0;l=a;case"last":while(l=l.nextSibling)if(l.nodeType===1)return!1;return!0;case"nth":c=b[2],e=b[3];if(c===1&&e===0)return!0;f=b[0],g=a.parentNode;if(g&&(g[d]!==f||!a.nodeIndex)){i=0;for(l=g.firstChild;l;l=l.nextSibling)l.nodeType===1&&(l.nodeIndex=++i);g[d]=f}j=a.nodeIndex-e;return c===0?j===0:j%c===0&&j/c>=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c<e;c++)d.push(a[c]);else for(;a[c];c++)d.push(a[c]);return d}}var u,v;c.documentElement.compareDocumentPosition?u=function(a,b){if(a===b){h=!0;return 0}if(!a.compareDocumentPosition||!b.compareDocumentPosition)return a.compareDocumentPosition?-1:1;return a.compareDocumentPosition(b)&4?-1:1}:(u=function(a,b){if(a===b){h=!0;return 0}if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var c,d,e=[],f=[],g=a.parentNode,i=b.parentNode,j=g;if(g===i)return v(a,b);if(!g)return-1;if(!i)return 1;while(j)e.unshift(j),j=j.parentNode;j=i;while(j)f.unshift(j),j=j.parentNode;c=e.length,d=f.length;for(var k=0;k<c&&k<d;k++)if(e[k]!==f[k])return v(e[k],f[k]);return k===c?v(a,f[k],-1):v(e[k],b,1)},v=function(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}),function(){var a=c.createElement("div"),d="script"+(new Date).getTime(),e=c.documentElement;a.innerHTML="<a name='"+d+"'/>",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="<p class='TEST'></p>";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f)}catch(r){}finally{l||k.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)m[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var y=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h<i;h++)m(a,g[h],e,c);return m.filter(f,e)};m.attr=f.attr,m.selectors.attrMap={},f.find=m,f.expr=m.selectors,f.expr[":"]=f.expr.filters,f.unique=m.uniqueSort,f.text=m.getText,f.isXMLDoc=m.isXML,f.contains=m.contains}();var L=/Until$/,M=/^(?:parents|prevUntil|prevAll)/,N=/,/,O=/^.[^:#\[\.,]*$/,P=Array.prototype.slice,Q=f.expr.match.POS,R={children:!0,contents:!0,next:!0,prev:!0};f.fn.extend({find:function(a){var b=this,c,d;if(typeof a!="string")return f(a).filter(function(){for(c=0,d=b.length;c<d;c++)if(f.contains(b[c],this))return!0});var e=this.pushStack("","find",a),g,h,i;for(c=0,d=this.length;c<d;c++){g=e.length,f.find(a,this[c],e);if(c>0)for(h=g;h<e.length;h++)for(i=0;i<g;i++)if(e[i]===e[h]){e.splice(h--,1);break}}return e},has:function(a){var b=f(a);return this.filter(function(){for(var a=0,c=b.length;a<c;a++)if(f.contains(this,b[a]))return!0})},not:function(a){return this.pushStack(T(this,a,!1),"not",a)},filter:function(a){return this.pushStack(T(this,a,!0),"filter",a)},is:function(a){return!!a&&(typeof a=="string"?Q.test(a)?f(a,this.context).index(this[0])>=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d<a.length;d++)f(g).is(a[d])&&c.push({selector:a[d],elem:g,level:h});g=g.parentNode,h++}return c}var i=Q.test(a)||typeof a!="string"?f(a,b||this.context):0;for(d=0,e=this.length;d<e;d++){g=this[d];while(g){if(i?i.index(g)>-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(S(c[0])||S(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c);L.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!R[a]?f.unique(e):e,(this.length>1||N.test(d))&&M.test(a)&&(e=e.reverse());return this.pushStack(e,a,P.call(arguments).join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var V="abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/<tbody/i,_=/<|&#?\w+;/,ba=/<(?:script|style)/i,bb=/<(?:script|object|embed|option|style)/i,bc=new RegExp("<(?:"+V+")","i"),bd=/checked\s*(?:[^=]|=\s*.checked.)/i,be=/\/(java|ecma)script/i,bf=/^\s*<!(?:\[CDATA\[|\-\-)/,bg={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]},bh=U(c);bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div<div>","</div>"]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=f.isFunction(a);return this.each(function(c){f(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f.clean(arguments);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f.clean(arguments));return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function()
{for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1></$2>");try{for(var c=0,d=this.length;c<d;c++)this[c].nodeType===1&&(f.cleanData(this[c].getElementsByTagName("*")),this[c].innerHTML=a)}catch(e){this.empty().append(a)}}else f.isFunction(a)?this.each(function(b){var c=f(this);c.html(a.call(this,b,c.html()))}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(f.isFunction(a))return this.each(function(b){var c=f(this),d=c.html();c.replaceWith(a.call(this,b,d))});typeof a!="string"&&(a=f(a).detach());return this.each(function(){var b=this.nextSibling,c=this.parentNode;f(this).remove(),b?f(b).before(a):f(c).append(a)})}return this.length?this.pushStack(f(f.isFunction(a)?a():a),"replaceWith",a):this},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){var e,g,h,i,j=a[0],k=[];if(!f.support.checkClone&&arguments.length===3&&typeof j=="string"&&bd.test(j))return this.each(function(){f(this).domManip(a,c,d,!0)});if(f.isFunction(j))return this.each(function(e){var g=f(this);a[0]=j.call(this,e,c?g.html():b),g.domManip(a,c,d)});if(this[0]){i=j&&j.parentNode,f.support.parentNode&&i&&i.nodeType===11&&i.childNodes.length===this.length?e={fragment:i}:e=f.buildFragment(a,this,k),h=e.fragment,h.childNodes.length===1?g=h=h.firstChild:g=h.firstChild;if(g){c=c&&f.nodeName(g,"tr");for(var l=0,m=this.length,n=m-1;l<m;l++)d.call(c?bi(this[l],g):this[l],e.cacheable||m>1&&l<n?f.clone(h,!0,!0):h)}k.length&&f.each(k,bp)}return this}}),f.buildFragment=function(a,b,d){var e,g,h,i,j=a[0];b&&b[0]&&(i=b[0].ownerDocument||b[0]),i.createDocumentFragment||(i=c),a.length===1&&typeof j=="string"&&j.length<512&&i===c&&j.charAt(0)==="<"&&!bb.test(j)&&(f.support.checkClone||!bd.test(j))&&(f.support.html5Clone||!bc.test(j))&&(g=!0,h=f.fragments[j],h&&h!==1&&(e=h)),e||(e=i.createDocumentFragment(),f.clean(a,i,e,d)),g&&(f.fragments[j]=h?e:1);return{fragment:e,cacheable:g}},f.fragments={},f.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){f.fn[a]=function(c){var d=[],e=f(c),g=this.length===1&&this[0].parentNode;if(g&&g.nodeType===11&&g.childNodes.length===1&&e.length===1){e[b](this[0]);return this}for(var h=0,i=e.length;h<i;h++){var j=(h>0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d,e,g,h=f.support.html5Clone||!bc.test("<"+a.nodeName)?a.cloneNode(!0):bo(a);if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bk(a,h),d=bl(a),e=bl(h);for(g=0;d[g];++g)e[g]&&bk(d[g],e[g])}if(b){bj(a,h);if(c){d=bl(a),e=bl(h);for(g=0;d[g];++g)bj(d[g],e[g])}}d=e=null;return h},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!_.test(k))k=b.createTextNode(k);else{k=k.replace(Y,"<$1></$2>");var l=(Z.exec(k)||["",""])[1].toLowerCase(),m=bg[l]||bg._default,n=m[0],o=b.createElement("div");b===c?bh.appendChild(o):U(b).appendChild(o),o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=$.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]==="<table>"&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&X.test(k)&&o.insertBefore(b.createTextNode(X.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i<r;i++)bn(k[i]);else bn(k);k.nodeType?h.push(k):h=f.merge(h,k)}if(d){g=function(a){return!a.type||be.test(a.type)};for(j=0;h[j];j++)if(e&&f.nodeName(h[j],"script")&&(!h[j].type||h[j].type.toLowerCase()==="text/javascript"))e.push(h[j].parentNode?h[j].parentNode.removeChild(h[j]):h[j]);else{if(h[j].nodeType===1){var s=f.grep(h[j].getElementsByTagName("script"),g);h.splice.apply(h,[j+1,0].concat(s))}d.appendChild(h[j])}}return h},cleanData:function(a){var b,c,d=f.cache,e=f.event.special,g=f.support.deleteExpando;for(var h=0,i;(i=a[h])!=null;h++){if(i.nodeName&&f.noData[i.nodeName.toLowerCase()])continue;c=i[f.expando];if(c){b=d[c];if(b&&b.events){for(var j in b.events)e[j]?f.event.remove(i,j):f.removeEvent(i,j,b.handle);b.handle&&(b.handle.elem=null)}g?delete i[f.expando]:i.removeAttribute&&i.removeAttribute(f.expando),delete d[c]}}}});var bq=/alpha\([^)]*\)/i,br=/opacity=([^)]*)/,bs=/([A-Z]|^ms)/g,bt=/^-?\d+(?:px)?$/i,bu=/^-?\d/,bv=/^([\-+])=([\-+.\de]+)/,bw={position:"absolute",visibility:"hidden",display:"block"},bx=["Left","Right"],by=["Top","Bottom"],bz,bA,bB;f.fn.css=function(a,c){if(arguments.length===2&&c===b)return this;return f.access(this,a,c,!0,function(a,c,d){return d!==b?f.style(a,c,d):f.css(a,c)})},f.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bz(a,"opacity","opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":f.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!!a&&a.nodeType!==3&&a.nodeType!==8&&!!a.style){var g,h,i=f.camelCase(c),j=a.style,k=f.cssHooks[i];c=f.cssProps[i]||i;if(d===b){if(k&&"get"in k&&(g=k.get(a,!1,e))!==b)return g;return j[c]}h=typeof d,h==="string"&&(g=bv.exec(d))&&(d=+(g[1]+1)*+g[2]+parseFloat(f.css(a,c)),h="number");if(d==null||h==="number"&&isNaN(d))return;h==="number"&&!f.cssNumber[i]&&(d+="px");if(!k||!("set"in k)||(d=k.set(a,d))!==b)try{j[c]=d}catch(l){}}},css:function(a,c,d){var e,g;c=f.camelCase(c),g=f.cssHooks[c],c=f.cssProps[c]||c,c==="cssFloat"&&(c="float");if(g&&"get"in g&&(e=g.get(a,!0,d))!==b)return e;if(bz)return bz(a,c)},swap:function(a,b,c){var d={};for(var e in b)d[e]=a.style[e],a.style[e]=b[e];c.call(a);for(e in b)a.style[e]=d[e]}}),f.curCSS=f.css,f.each(["height","width"],function(a,b){f.cssHooks[b]={get:function(a,c,d){var e;if(c){if(a.offsetWidth!==0)return bC(a,b,d);f.swap(a,bw,function(){e=bC(a,b,d)});return e}},set:function(a,b){if(!bt.test(b))return b;b=parseFloat(b);if(b>=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return br.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bq,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bq.test(g)?g.replace(bq,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bz(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bA=function(a,b){var c,d,e;b=b.replace(bs,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!f.contains(a.ownerDocument.documentElement,a)&&(c=f.style(a,b)));return c}),c.documentElement.currentStyle&&(bB=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f===null&&g&&(e=g[b])&&(f=e),!bt.test(f)&&bu.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f||0,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f}),bz=bA||bB,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bD=/%20/g,bE=/\[\]$/,bF=/\r?\n/g,bG=/#.*$/,bH=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bI=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bJ=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bK=/^(?:GET|HEAD)$/,bL=/^\/\//,bM=/\?/,bN=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bO=/^(?:select|textarea)/i,bP=/\s+/,bQ=/([?&])_=[^&]*/,bR=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bS=f.fn.load,bT={},bU={},bV,bW,bX=["*/"]+["*"];try{bV=e.href}catch(bY){bV=c.createElement("a"),bV.href="",bV=bV.href}bW=bR.exec(bV.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bS)return bS.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("<div>").append(c.replace(bN,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bO.test(this.nodeName)||bI.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bF,"\r\n")}}):{name:b.name,value:c.replace(bF,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.on(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?b_(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),b_(a,b);return a},ajaxSettings:{url:bV,isLocal:bJ.test(bW[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bX},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bZ(bT),ajaxTransport:bZ(bU),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?cb(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=cc(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks("once memory"),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bH.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bG,"").replace(bL,bW[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bP),d.crossDomain==null&&(r=bR.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bW[1]&&r[2]==bW[2]&&(r[3]||(r[1]==="http:"?80:443))==(bW[3]||(bW[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),b$(bT,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bK.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bM.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bQ,"$1_="+x);d.url=y+(y===d.url?(bM.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bX+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=b$(bU,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){if(s<2)w(-1,z);else throw z}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)ca(g,a[g],c,e);return d.join("&").replace(bD,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cd=f.now(),ce=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cd++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(ce.test(b.url)||e&&ce.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(ce,l),b.url===j&&(e&&(k=k.replace(ce,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var cf=a.ActiveXObject?function(){for(var a in ch)ch[a](0,1)}:!1,cg=0,ch;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ci()||cj()}:ci,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,cf&&delete ch[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cg,cf&&(ch||(ch={},f(a).unload(cf)),ch[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var ck={},cl,cm,cn=/^(?:toggle|show|hide)$/,co=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cp,cq=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cr;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cu("show",3),a,b,c);for(var g=0,h=this.length;g<h;g++)d=this[g],d.style&&(e=d.style.display,!f._data(d,"olddisplay")&&e==="none"&&(e=d.style.display=""),e===""&&f.css(d,"display")==="none"&&f._data(d,"olddisplay",cv(d.nodeName)));for(g=0;g<h;g++){d=this[g];if(d.style){e=d.style.display;if(e===""||e==="none")d.style.display=f._data(d,"olddisplay")||""}}return this},hide:function(a,b,c){if(a||a===0)return this.animate(cu("hide",3),a,b,c);var d,e,g=0,h=this.length;for(;g<h;g++)d=this[g],d.style&&(e=f.css(d,"display"),e!=="none"&&!f._data(d,"olddisplay")&&f._data(d,"olddisplay",e));for(g=0;g<h;g++)this[g].style&&(this[g].style.display="none");return this},_toggle:f.fn.toggle,toggle:function(a,b,c){var d=typeof a=="boolean";f.isFunction(a)&&f.isFunction(b)?this._toggle.apply(this,arguments):a==null||d?this.each(function(){var b=d?a:f(this).is(":hidden");f(this)[b?"show":"hide"]()}):this.animate(cu("toggle",3),a,b,c);return this},fadeTo:function(a,b,c,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){function g(){e.queue===!1&&f._mark(this);var b=f.extend({},e),c=this.nodeType===1,d=c&&f(this).is(":hidden"),g,h,i,j,k,l,m,n,o;b.animatedProperties={};for(i in a){g=f.camelCase(i),i!==g&&(a[g]=a[i],delete a[i]),h=a[g],f.isArray(h)?(b.animatedProperties[g]=h[1],h=a[g]=h[0]):b.animatedProperties[g]=b.specialEasing&&b.specialEasing[g]||b.easing||"swing";if(h==="hide"&&d||h==="show"&&!d)return b.complete.call(this);c&&(g==="height"||g==="width")&&(b.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY],f.css(this,"display")==="inline"&&f.css(this,"float")==="none"&&(!f.support.inlineBlockNeedsLayout||cv(this.nodeName)==="inline"?this.style.display="inline-block":this.style.zoom=1))}b.overflow!=null&&(this.style.overflow="hidden");for(i in a)j=new f.fx(this,b,i),h=a[i],cn.test(h)?(o=f._data(this,"toggle"+i)||(h==="toggle"?d?"show":"hide":0),o?(f._data(this,"toggle"+i,o==="show"?"hide":"show"),j[o]()):j[h]()):(k=co.exec(h),l=j.cur(),k?(m=parseFloat(k[2]),n=k[3]||(f.cssNumber[i]?"":"px"),n!=="px"&&(f.style(this,i,(m||1)+n),l=(m||1)/j.cur()*l,f.style(this,i,l+n)),k[1]&&(m=(k[1]==="-="?-1:1)*m+l),j.custom(l,m,n)):j.custom(l,h,""));return!0}var e=f.speed(b,c,d);if(f.isEmptyObject(a))return this.each(e.complete,[!1]);a=f.extend({},a);return e.queue===!1?this.each(g):this.queue(e.queue,g)},stop:function(a,c,d){typeof a!="string"&&(d=c,c=a,a=b),c&&a!==!1&&this.queue(a||"fx",[]);return this.each(function(){function h(a,b,c){var e=b[c];f.removeData(a,c,!0),e.stop(d)}var b,c=!1,e=f.timers,g=f._data(this);d||f._unmark(!0,this);if(a==null)for(b in g)g[b]&&g[b].stop&&b.indexOf(".run")===b.length-4&&h(this,g,b);else g[b=a+".run"]&&g[b].stop&&h(this,g,b);for(b=e.length;b--;)e[b].elem===this&&(a==null||e[b].queue===a)&&(d?e[b](!0):e[b].saveState(),c=!0,e.splice(b,1));(!d||!c)&&f.dequeue(this,a)})}}),f.each({slideDown:cu("show",1),slideUp:cu("hide",1),slideToggle:cu("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){f.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),f.extend({speed:function(a,b,c){var d=a&&typeof a=="object"?f.extend({},a):{complete:c||!c&&b||f.isFunction(a)&&a,duration:a,easing:c&&b||b&&!f.isFunction(b)&&b};d.duration=f.fx.off?0:typeof d.duration=="number"?d.duration:d.duration in f.fx.speeds?f.fx.speeds[d.duration]:f.fx.speeds._default;if(d.queue==null||d.queue===!0)d.queue="fx";d.old=d.complete,d.complete=function(a){f.isFunction(d.old)&&d.old.call(this),d.queue?f.dequeue(this,d.queue):a!==!1&&f._unmark(this)};return d},easing:{linear:function(a,b,c,d){return c+d*a},swing:function(a,b,c,d){return(-Math.cos(a*Math.PI)/2+.5)*d+c}},timers:[],fx:function(a,b,c){this.options=b,this.elem=a,this.prop=c,b.orig=b.orig||{}}}),f.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(f.fx.step[this.prop]||f.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a,b=f.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b==="auto"?0:b:a},custom:function(a,c,d){function h(a){return e.step(a)}var e=this,g=f.fx;this.startTime=cr||cs(),this.end=c,this.now=this.start=a,this.pos=this.state=0,this.unit=d||this.unit||(f.cssNumber[this.prop]?"":"px"),h.queue=this.options.queue,h.elem=this.elem,h.saveState=function(){e.options.hide&&f._data(e.elem,"fxshow"+e.prop)===b&&f._data(e.elem,"fxshow"+e.prop,e.start)},h()&&f.timers.push(h)&&!cp&&(cp=setInterval(g.tick,g.interval))},show:function(){var a=f._data(this.elem,"fxshow"+this.prop);this.options.orig[this.prop]=a||f.style(this.elem,this.prop),this.options.show=!0,a!==b?this.custom(this.cur(),a):this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur()),f(this.elem).show()},hide:function(){this.options.orig[this.prop]=f._data(this.elem,"fxshow"+this.prop)||f.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(a){var b,c,d,e=cr||cs(),g=!0,h=this.elem,i=this.options;if(a||e>=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(g=!1);if(g){i.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a]}),i.hide&&f(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)f.style(h,b,i.orig[b]),f.removeData(h,"fxshow"+b,!0),f.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=f.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a,b=f.timers,c=0;for(;c<b.length;c++)a=b[c],!a()&&b[c]===a&&b.splice(c--,1);b.length||f.fx.stop()},interval:13,stop:function(){clearInterval(cp),cp=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){f.style(a.elem,"opacity",a.now)},_default:function(a){a.elem.style&&a.elem.style[a.prop]!=null?a.elem.style[a.prop]=a.now+a.unit:a.elem[a.prop]=a.now}}}),f.each(["width","height"],function(a,b){f.fx.step[b]=function(a){f.style(a.elem,b,Math.max(0,a.now)+a.unit)}}),f.expr&&f.expr.filters&&(f.expr.filters.animated=function(a){return f.grep(f.timers,function(b){return a===b.elem}).length});var cw=/^t(?:able|d|h)$/i,cx=/^(?:body|html)$/i;"getBoundingClientRect"in c.documentElement?f.fn.offset=function(a){var b=this[0],c;if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);try{c=b.getBoundingClientRect()}catch(d){}var e=b.ownerDocument,g=e.documentElement;if(!c||!f.contains(g,b))return c?{top:c.top,left:c.left}:{top:0,left:0};var h=e.body,i=cy(e),j=g.clientTop||h.clientTop||0,k=g.clientLeft||h.clientLeft||0,l=i.pageYOffset||f.support.boxModel&&g.scrollTop||h.scrollTop,m=i.pageXOffset||f.support.boxModel&&g.scrollLeft||h.scrollLeft,n=c.top+l-j,o=c.left+m-k;return{top:n,left:o}}:f.fn.offset=function(a){var b=this[0];if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);var c,d=b.offsetParent,e=b,g=b.ownerDocument,h=g.documentElement,i=g.body,j=g.defaultView,k=j?j.getComputedStyle(b,null):b.currentStyle,l=b.offsetTop,m=b.offsetLeft;while((b=b.parentNode)&&b!==i&&b!==h){if(f.support.fixedPosition&&k.position==="fixed")break;c=j?j.getComputedStyle(b,null):b.currentStyle,l-=b.scrollTop,m-=b.scrollLeft,b===d&&(l+=b.offsetTop,m+=b.offsetLeft,f.support.doesNotAddBorder&&(!f.support.doesAddBorderForTableAndCells||!cw.test(b.nodeName))&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),e=d,d=b.offsetParent),f.support.subtractsBorderForOverflowNotVisible&&c.overflow!=="visible"&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),k=c}if(k.position==="relative"||k.position==="static")l+=i.offsetTop,m+=i.offsetLeft;f.support.fixedPosition&&k.position==="fixed"&&(l+=Math.max(h.scrollTop,i.scrollTop),m+=Math.max(h.scrollLeft,i.scrollLeft));return{top:l,left:m}},f.offset={bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;f.support.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(f.css(a,"marginTop"))||0,c+=parseFloat(f.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var d=f.css(a,"position");d==="static"&&(a.style.position="relative");var e=f(a),g=e.offset(),h=f.css(a,"top"),i=f.css(a,"left"),j=(d==="absolute"||d==="fixed")&&f.inArray("auto",[h,i])>-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cy(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cy(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){var a=this[0];return a?a.style?parseFloat(f.css(a,d,"padding")):this[d]():null},f.fn["outer"+c]=function(a){var b=this[0];return b?b.style?parseFloat(f.css(b,d,a?"margin":"border")):this[d]():null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c],h=e.document.body;return e.document.compatMode==="CSS1Compat"&&g||h&&h["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var i=f.css(e,d),j=parseFloat(i);return f.isNumeric(j)?j:i}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return f})})(window);

/*!
 * jQuery UI 1.8.16
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI
 */
(function(c,j){function k(a,b){var d=a.nodeName.toLowerCase();if("area"===d){b=a.parentNode;d=b.name;if(!a.href||!d||b.nodeName.toLowerCase()!=="map")return false;a=c("img[usemap=#"+d+"]")[0];return!!a&&l(a)}return(/input|select|textarea|button|object/.test(d)?!a.disabled:"a"==d?a.href||b:b)&&l(a)}function l(a){return!c(a).parents().andSelf().filter(function(){return c.curCSS(this,"visibility")==="hidden"||c.expr.filters.hidden(this)}).length}c.ui=c.ui||{};if(!c.ui.version){c.extend(c.ui,{version:"1.8.16",
keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}});c.fn.extend({propAttr:c.fn.prop||c.fn.attr,_focus:c.fn.focus,focus:function(a,b){return typeof a==="number"?this.each(function(){var d=
this;setTimeout(function(){c(d).focus();b&&b.call(d)},a)}):this._focus.apply(this,arguments)},scrollParent:function(){var a;a=c.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(c.curCSS(this,"position",1))&&/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(c.curCSS(this,
"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!a.length?c(document):a},zIndex:function(a){if(a!==j)return this.css("zIndex",a);if(this.length){a=c(this[0]);for(var b;a.length&&a[0]!==document;){b=a.css("position");if(b==="absolute"||b==="relative"||b==="fixed"){b=parseInt(a.css("zIndex"),10);if(!isNaN(b)&&b!==0)return b}a=a.parent()}}return 0},disableSelection:function(){return this.bind((c.support.selectstart?"selectstart":
"mousedown")+".ui-disableSelection",function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}});c.each(["Width","Height"],function(a,b){function d(f,g,m,n){c.each(e,function(){g-=parseFloat(c.curCSS(f,"padding"+this,true))||0;if(m)g-=parseFloat(c.curCSS(f,"border"+this+"Width",true))||0;if(n)g-=parseFloat(c.curCSS(f,"margin"+this,true))||0});return g}var e=b==="Width"?["Left","Right"]:["Top","Bottom"],h=b.toLowerCase(),i={innerWidth:c.fn.innerWidth,innerHeight:c.fn.innerHeight,
outerWidth:c.fn.outerWidth,outerHeight:c.fn.outerHeight};c.fn["inner"+b]=function(f){if(f===j)return i["inner"+b].call(this);return this.each(function(){c(this).css(h,d(this,f)+"px")})};c.fn["outer"+b]=function(f,g){if(typeof f!=="number")return i["outer"+b].call(this,f);return this.each(function(){c(this).css(h,d(this,f,true,g)+"px")})}});c.extend(c.expr[":"],{data:function(a,b,d){return!!c.data(a,d[3])},focusable:function(a){return k(a,!isNaN(c.attr(a,"tabindex")))},tabbable:function(a){var b=c.attr(a,
"tabindex"),d=isNaN(b);return(d||b>=0)&&k(a,!d)}});c(function(){var a=document.body,b=a.appendChild(b=document.createElement("div"));c.extend(b.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});c.support.minHeight=b.offsetHeight===100;c.support.selectstart="onselectstart"in b;a.removeChild(b).style.display="none"});c.extend(c.ui,{plugin:{add:function(a,b,d){a=c.ui[a].prototype;for(var e in d){a.plugins[e]=a.plugins[e]||[];a.plugins[e].push([b,d[e]])}},call:function(a,b,d){if((b=a.plugins[b])&&
a.element[0].parentNode)for(var e=0;e<b.length;e++)a.options[b[e][0]]&&b[e][1].apply(a.element,d)}},contains:function(a,b){return document.compareDocumentPosition?a.compareDocumentPosition(b)&16:a!==b&&a.contains(b)},hasScroll:function(a,b){if(c(a).css("overflow")==="hidden")return false;b=b&&b==="left"?"scrollLeft":"scrollTop";var d=false;if(a[b]>0)return true;a[b]=1;d=a[b]>0;a[b]=0;return d},isOverAxis:function(a,b,d){return a>b&&a<b+d},isOver:function(a,b,d,e,h,i){return c.ui.isOverAxis(a,d,h)&&
c.ui.isOverAxis(b,e,i)}})}})(jQuery);

;/*!
 * jQuery UI Widget 1.8.16
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Widget
 */
(function(b,j){if(b.cleanData){var k=b.cleanData;b.cleanData=function(a){for(var c=0,d;(d=a[c])!=null;c++)try{b(d).triggerHandler("remove")}catch(e){}k(a)}}else{var l=b.fn.remove;b.fn.remove=function(a,c){return this.each(function(){if(!c)if(!a||b.filter(a,[this]).length)b("*",this).add([this]).each(function(){try{b(this).triggerHandler("remove")}catch(d){}});return l.call(b(this),a,c)})}}b.widget=function(a,c,d){var e=a.split(".")[0],f;a=a.split(".")[1];f=e+"-"+a;if(!d){d=c;c=b.Widget}b.expr[":"][f]=
function(h){return!!b.data(h,a)};b[e]=b[e]||{};b[e][a]=function(h,g){arguments.length&&this._createWidget(h,g)};c=new c;c.options=b.extend(true,{},c.options);b[e][a].prototype=b.extend(true,c,{namespace:e,widgetName:a,widgetEventPrefix:b[e][a].prototype.widgetEventPrefix||a,widgetBaseClass:f},d);b.widget.bridge(a,b[e][a])};b.widget.bridge=function(a,c){b.fn[a]=function(d){var e=typeof d==="string",f=Array.prototype.slice.call(arguments,1),h=this;d=!e&&f.length?b.extend.apply(null,[true,d].concat(f)):
d;if(e&&d.charAt(0)==="_")return h;e?this.each(function(){var g=b.data(this,a),i=g&&b.isFunction(g[d])?g[d].apply(g,f):g;if(i!==g&&i!==j){h=i;return false}}):this.each(function(){var g=b.data(this,a);g?g.option(d||{})._init():b.data(this,a,new c(d,this))});return h}};b.Widget=function(a,c){arguments.length&&this._createWidget(a,c)};b.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:false},_createWidget:function(a,c){b.data(c,this.widgetName,this);this.element=b(c);this.options=
b.extend(true,{},this.options,this._getCreateOptions(),a);var d=this;this.element.bind("remove."+this.widgetName,function(){d.destroy()});this._create();this._trigger("create");this._init()},_getCreateOptions:function(){return b.metadata&&b.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+
"-disabled ui-state-disabled")},widget:function(){return this.element},option:function(a,c){var d=a;if(arguments.length===0)return b.extend({},this.options);if(typeof a==="string"){if(c===j)return this.options[a];d={};d[a]=c}this._setOptions(d);return this},_setOptions:function(a){var c=this;b.each(a,function(d,e){c._setOption(d,e)});return this},_setOption:function(a,c){this.options[a]=c;if(a==="disabled")this.widget()[c?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",
c);return this},enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_trigger:function(a,c,d){var e=this.options[a];c=b.Event(c);c.type=(a===this.widgetEventPrefix?a:this.widgetEventPrefix+a).toLowerCase();d=d||{};if(c.originalEvent){a=b.event.props.length;for(var f;a;){f=b.event.props[--a];c[f]=c.originalEvent[f]}}this.element.trigger(c,d);return!(b.isFunction(e)&&e.call(this.element[0],c,d)===false||c.isDefaultPrevented())}}})(jQuery);

;/*!
 * jQuery UI Mouse 1.8.16
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Mouse
 *
 * Depends:
 *	jquery.ui.widget.js
 */
(function(b){var d=false;b(document).mouseup(function(){d=false});b.widget("ui.mouse",{options:{cancel:":input,option",distance:1,delay:0},_mouseInit:function(){var a=this;this.element.bind("mousedown."+this.widgetName,function(c){return a._mouseDown(c)}).bind("click."+this.widgetName,function(c){if(true===b.data(c.target,a.widgetName+".preventClickEvent")){b.removeData(c.target,a.widgetName+".preventClickEvent");c.stopImmediatePropagation();return false}});this.started=false},_mouseDestroy:function(){this.element.unbind("."+
this.widgetName)},_mouseDown:function(a){if(!d){this._mouseStarted&&this._mouseUp(a);this._mouseDownEvent=a;var c=this,f=a.which==1,g=typeof this.options.cancel=="string"&&a.target.nodeName?b(a.target).closest(this.options.cancel).length:false;if(!f||g||!this._mouseCapture(a))return true;this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet)this._mouseDelayTimer=setTimeout(function(){c.mouseDelayMet=true},this.options.delay);if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a)){this._mouseStarted=
this._mouseStart(a)!==false;if(!this._mouseStarted){a.preventDefault();return true}}true===b.data(a.target,this.widgetName+".preventClickEvent")&&b.removeData(a.target,this.widgetName+".preventClickEvent");this._mouseMoveDelegate=function(e){return c._mouseMove(e)};this._mouseUpDelegate=function(e){return c._mouseUp(e)};b(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);a.preventDefault();return d=true}},_mouseMove:function(a){if(b.browser.msie&&
!(document.documentMode>=9)&&!a.button)return this._mouseUp(a);if(this._mouseStarted){this._mouseDrag(a);return a.preventDefault()}if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a))(this._mouseStarted=this._mouseStart(this._mouseDownEvent,a)!==false)?this._mouseDrag(a):this._mouseUp(a);return!this._mouseStarted},_mouseUp:function(a){b(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=
false;a.target==this._mouseDownEvent.target&&b.data(a.target,this.widgetName+".preventClickEvent",true);this._mouseStop(a)}return false},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX-a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return true}})})(jQuery);

;/*
 * jQuery UI Position 1.8.16
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Position
 */
(function(c){c.ui=c.ui||{};var n=/left|center|right/,o=/top|center|bottom/,t=c.fn.position,u=c.fn.offset;c.fn.position=function(b){if(!b||!b.of)return t.apply(this,arguments);b=c.extend({},b);var a=c(b.of),d=a[0],g=(b.collision||"flip").split(" "),e=b.offset?b.offset.split(" "):[0,0],h,k,j;if(d.nodeType===9){h=a.width();k=a.height();j={top:0,left:0}}else if(d.setTimeout){h=a.width();k=a.height();j={top:a.scrollTop(),left:a.scrollLeft()}}else if(d.preventDefault){b.at="left top";h=k=0;j={top:b.of.pageY,
left:b.of.pageX}}else{h=a.outerWidth();k=a.outerHeight();j=a.offset()}c.each(["my","at"],function(){var f=(b[this]||"").split(" ");if(f.length===1)f=n.test(f[0])?f.concat(["center"]):o.test(f[0])?["center"].concat(f):["center","center"];f[0]=n.test(f[0])?f[0]:"center";f[1]=o.test(f[1])?f[1]:"center";b[this]=f});if(g.length===1)g[1]=g[0];e[0]=parseInt(e[0],10)||0;if(e.length===1)e[1]=e[0];e[1]=parseInt(e[1],10)||0;if(b.at[0]==="right")j.left+=h;else if(b.at[0]==="center")j.left+=h/2;if(b.at[1]==="bottom")j.top+=
k;else if(b.at[1]==="center")j.top+=k/2;j.left+=e[0];j.top+=e[1];return this.each(function(){var f=c(this),l=f.outerWidth(),m=f.outerHeight(),p=parseInt(c.curCSS(this,"marginLeft",true))||0,q=parseInt(c.curCSS(this,"marginTop",true))||0,v=l+p+(parseInt(c.curCSS(this,"marginRight",true))||0),w=m+q+(parseInt(c.curCSS(this,"marginBottom",true))||0),i=c.extend({},j),r;if(b.my[0]==="right")i.left-=l;else if(b.my[0]==="center")i.left-=l/2;if(b.my[1]==="bottom")i.top-=m;else if(b.my[1]==="center")i.top-=
m/2;i.left=Math.round(i.left);i.top=Math.round(i.top);r={left:i.left-p,top:i.top-q};c.each(["left","top"],function(s,x){c.ui.position[g[s]]&&c.ui.position[g[s]][x](i,{targetWidth:h,targetHeight:k,elemWidth:l,elemHeight:m,collisionPosition:r,collisionWidth:v,collisionHeight:w,offset:e,my:b.my,at:b.at})});c.fn.bgiframe&&f.bgiframe();f.offset(c.extend(i,{using:b.using}))})};c.ui.position={fit:{left:function(b,a){var d=c(window);d=a.collisionPosition.left+a.collisionWidth-d.width()-d.scrollLeft();b.left=
d>0?b.left-d:Math.max(b.left-a.collisionPosition.left,b.left)},top:function(b,a){var d=c(window);d=a.collisionPosition.top+a.collisionHeight-d.height()-d.scrollTop();b.top=d>0?b.top-d:Math.max(b.top-a.collisionPosition.top,b.top)}},flip:{left:function(b,a){if(a.at[0]!=="center"){var d=c(window);d=a.collisionPosition.left+a.collisionWidth-d.width()-d.scrollLeft();var g=a.my[0]==="left"?-a.elemWidth:a.my[0]==="right"?a.elemWidth:0,e=a.at[0]==="left"?a.targetWidth:-a.targetWidth,h=-2*a.offset[0];b.left+=
a.collisionPosition.left<0?g+e+h:d>0?g+e+h:0}},top:function(b,a){if(a.at[1]!=="center"){var d=c(window);d=a.collisionPosition.top+a.collisionHeight-d.height()-d.scrollTop();var g=a.my[1]==="top"?-a.elemHeight:a.my[1]==="bottom"?a.elemHeight:0,e=a.at[1]==="top"?a.targetHeight:-a.targetHeight,h=-2*a.offset[1];b.top+=a.collisionPosition.top<0?g+e+h:d>0?g+e+h:0}}}};if(!c.offset.setOffset){c.offset.setOffset=function(b,a){if(/static/.test(c.curCSS(b,"position")))b.style.position="relative";var d=c(b),
g=d.offset(),e=parseInt(c.curCSS(b,"top",true),10)||0,h=parseInt(c.curCSS(b,"left",true),10)||0;g={top:a.top-g.top+e,left:a.left-g.left+h};"using"in a?a.using.call(b,g):d.css(g)};c.fn.offset=function(b){var a=this[0];if(!a||!a.ownerDocument)return null;if(b)return this.each(function(){c.offset.setOffset(this,b)});return u.call(this)}}})(jQuery);

;/*
 * jQuery UI Draggable 1.8.16
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Draggables
 *
 * Depends:
 *	jquery.ui.core.js
 *	jquery.ui.mouse.js
 *	jquery.ui.widget.js
 */
(function(d){d.widget("ui.draggable",d.ui.mouse,{widgetEventPrefix:"drag",options:{addClasses:true,appendTo:"parent",axis:false,connectToSortable:false,containment:false,cursor:"auto",cursorAt:false,grid:false,handle:false,helper:"original",iframeFix:false,opacity:false,refreshPositions:false,revert:false,revertDuration:500,scope:"default",scroll:true,scrollSensitivity:20,scrollSpeed:20,snap:false,snapMode:"both",snapTolerance:20,stack:false,zIndex:false},_create:function(){if(this.options.helper==
"original"&&!/^(?:r|a|f)/.test(this.element.css("position")))this.element[0].style.position="relative";this.options.addClasses&&this.element.addClass("ui-draggable");this.options.disabled&&this.element.addClass("ui-draggable-disabled");this._mouseInit()},destroy:function(){if(this.element.data("draggable")){this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled");this._mouseDestroy();return this}},_mouseCapture:function(a){var b=
this.options;if(this.helper||b.disabled||d(a.target).is(".ui-resizable-handle"))return false;this.handle=this._getHandle(a);if(!this.handle)return false;if(b.iframeFix)d(b.iframeFix===true?"iframe":b.iframeFix).each(function(){d('<div class="ui-draggable-iframeFix" style="background: #fff;"></div>').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1E3}).css(d(this).offset()).appendTo("body")});return true},_mouseStart:function(a){var b=this.options;
this.helper=this._createHelper(a);this._cacheHelperProportions();if(d.ui.ddmanager)d.ui.ddmanager.current=this;this._cacheMargins();this.cssPosition=this.helper.css("position");this.scrollParent=this.helper.scrollParent();this.offset=this.positionAbs=this.element.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};d.extend(this.offset,{click:{left:a.pageX-this.offset.left,top:a.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});
this.originalPosition=this.position=this._generatePosition(a);this.originalPageX=a.pageX;this.originalPageY=a.pageY;b.cursorAt&&this._adjustOffsetFromHelper(b.cursorAt);b.containment&&this._setContainment();if(this._trigger("start",a)===false){this._clear();return false}this._cacheHelperProportions();d.ui.ddmanager&&!b.dropBehaviour&&d.ui.ddmanager.prepareOffsets(this,a);this.helper.addClass("ui-draggable-dragging");this._mouseDrag(a,true);d.ui.ddmanager&&d.ui.ddmanager.dragStart(this,a);return true},
_mouseDrag:function(a,b){this.position=this._generatePosition(a);this.positionAbs=this._convertPositionTo("absolute");if(!b){b=this._uiHash();if(this._trigger("drag",a,b)===false){this._mouseUp({});return false}this.position=b.position}if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+"px";if(!this.options.axis||this.options.axis!="x")this.helper[0].style.top=this.position.top+"px";d.ui.ddmanager&&d.ui.ddmanager.drag(this,a);return false},_mouseStop:function(a){var b=
false;if(d.ui.ddmanager&&!this.options.dropBehaviour)b=d.ui.ddmanager.drop(this,a);if(this.dropped){b=this.dropped;this.dropped=false}if((!this.element[0]||!this.element[0].parentNode)&&this.options.helper=="original")return false;if(this.options.revert=="invalid"&&!b||this.options.revert=="valid"&&b||this.options.revert===true||d.isFunction(this.options.revert)&&this.options.revert.call(this.element,b)){var c=this;d(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,
10),function(){c._trigger("stop",a)!==false&&c._clear()})}else this._trigger("stop",a)!==false&&this._clear();return false},_mouseUp:function(a){this.options.iframeFix===true&&d("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)});d.ui.ddmanager&&d.ui.ddmanager.dragStop(this,a);return d.ui.mouse.prototype._mouseUp.call(this,a)},cancel:function(){this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear();return this},_getHandle:function(a){var b=!this.options.handle||
!d(this.options.handle,this.element).length?true:false;d(this.options.handle,this.element).find("*").andSelf().each(function(){if(this==a.target)b=true});return b},_createHelper:function(a){var b=this.options;a=d.isFunction(b.helper)?d(b.helper.apply(this.element[0],[a])):b.helper=="clone"?this.element.clone().removeAttr("id"):this.element;a.parents("body").length||a.appendTo(b.appendTo=="parent"?this.element[0].parentNode:b.appendTo);a[0]!=this.element[0]&&!/(fixed|absolute)/.test(a.css("position"))&&
a.css("position","absolute");return a},_adjustOffsetFromHelper:function(a){if(typeof a=="string")a=a.split(" ");if(d.isArray(a))a={left:+a[0],top:+a[1]||0};if("left"in a)this.offset.click.left=a.left+this.margins.left;if("right"in a)this.offset.click.left=this.helperProportions.width-a.right+this.margins.left;if("top"in a)this.offset.click.top=a.top+this.margins.top;if("bottom"in a)this.offset.click.top=this.helperProportions.height-a.bottom+this.margins.top},_getParentOffset:function(){this.offsetParent=
this.helper.offsetParent();var a=this.offsetParent.offset();if(this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],this.offsetParent[0])){a.left+=this.scrollParent.scrollLeft();a.top+=this.scrollParent.scrollTop()}if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&d.browser.msie)a={top:0,left:0};return{top:a.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:a.left+(parseInt(this.offsetParent.css("borderLeftWidth"),
10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var a=this.element.position();return{top:a.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:a.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),
10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var a=this.options;if(a.containment=="parent")a.containment=this.helper[0].parentNode;if(a.containment=="document"||a.containment=="window")this.containment=[a.containment=="document"?0:d(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,a.containment=="document"?0:d(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,
(a.containment=="document"?0:d(window).scrollLeft())+d(a.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(a.containment=="document"?0:d(window).scrollTop())+(d(a.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(a.containment)&&a.containment.constructor!=Array){a=d(a.containment);var b=a[0];if(b){a.offset();var c=d(b).css("overflow")!=
"hidden";this.containment=[(parseInt(d(b).css("borderLeftWidth"),10)||0)+(parseInt(d(b).css("paddingLeft"),10)||0),(parseInt(d(b).css("borderTopWidth"),10)||0)+(parseInt(d(b).css("paddingTop"),10)||0),(c?Math.max(b.scrollWidth,b.offsetWidth):b.offsetWidth)-(parseInt(d(b).css("borderLeftWidth"),10)||0)-(parseInt(d(b).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(c?Math.max(b.scrollHeight,b.offsetHeight):b.offsetHeight)-(parseInt(d(b).css("borderTopWidth"),
10)||0)-(parseInt(d(b).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom];this.relative_container=a}}else if(a.containment.constructor==Array)this.containment=a.containment},_convertPositionTo:function(a,b){if(!b)b=this.position;a=a=="absolute"?1:-1;var c=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,f=/(html|body)/i.test(c[0].tagName);return{top:b.top+
this.offset.relative.top*a+this.offset.parent.top*a-(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():f?0:c.scrollTop())*a),left:b.left+this.offset.relative.left*a+this.offset.parent.left*a-(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():f?0:c.scrollLeft())*a)}},_generatePosition:function(a){var b=this.options,c=this.cssPosition=="absolute"&&
!(this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,f=/(html|body)/i.test(c[0].tagName),e=a.pageX,h=a.pageY;if(this.originalPosition){var g;if(this.containment){if(this.relative_container){g=this.relative_container.offset();g=[this.containment[0]+g.left,this.containment[1]+g.top,this.containment[2]+g.left,this.containment[3]+g.top]}else g=this.containment;if(a.pageX-this.offset.click.left<g[0])e=g[0]+this.offset.click.left;
if(a.pageY-this.offset.click.top<g[1])h=g[1]+this.offset.click.top;if(a.pageX-this.offset.click.left>g[2])e=g[2]+this.offset.click.left;if(a.pageY-this.offset.click.top>g[3])h=g[3]+this.offset.click.top}if(b.grid){h=b.grid[1]?this.originalPageY+Math.round((h-this.originalPageY)/b.grid[1])*b.grid[1]:this.originalPageY;h=g?!(h-this.offset.click.top<g[1]||h-this.offset.click.top>g[3])?h:!(h-this.offset.click.top<g[1])?h-b.grid[1]:h+b.grid[1]:h;e=b.grid[0]?this.originalPageX+Math.round((e-this.originalPageX)/
b.grid[0])*b.grid[0]:this.originalPageX;e=g?!(e-this.offset.click.left<g[0]||e-this.offset.click.left>g[2])?e:!(e-this.offset.click.left<g[0])?e-b.grid[0]:e+b.grid[0]:e}}return{top:h-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollTop():f?0:c.scrollTop()),left:e-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+(d.browser.safari&&d.browser.version<
526&&this.cssPosition=="fixed"?0:this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():f?0:c.scrollLeft())}},_clear:function(){this.helper.removeClass("ui-draggable-dragging");this.helper[0]!=this.element[0]&&!this.cancelHelperRemoval&&this.helper.remove();this.helper=null;this.cancelHelperRemoval=false},_trigger:function(a,b,c){c=c||this._uiHash();d.ui.plugin.call(this,a,[b,c]);if(a=="drag")this.positionAbs=this._convertPositionTo("absolute");return d.Widget.prototype._trigger.call(this,a,b,
c)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}});d.extend(d.ui.draggable,{version:"1.8.16"});d.ui.plugin.add("draggable","connectToSortable",{start:function(a,b){var c=d(this).data("draggable"),f=c.options,e=d.extend({},b,{item:c.element});c.sortables=[];d(f.connectToSortable).each(function(){var h=d.data(this,"sortable");if(h&&!h.options.disabled){c.sortables.push({instance:h,shouldRevert:h.options.revert});
h.refreshPositions();h._trigger("activate",a,e)}})},stop:function(a,b){var c=d(this).data("draggable"),f=d.extend({},b,{item:c.element});d.each(c.sortables,function(){if(this.instance.isOver){this.instance.isOver=0;c.cancelHelperRemoval=true;this.instance.cancelHelperRemoval=false;if(this.shouldRevert)this.instance.options.revert=true;this.instance._mouseStop(a);this.instance.options.helper=this.instance.options._helper;c.options.helper=="original"&&this.instance.currentItem.css({top:"auto",left:"auto"})}else{this.instance.cancelHelperRemoval=
false;this.instance._trigger("deactivate",a,f)}})},drag:function(a,b){var c=d(this).data("draggable"),f=this;d.each(c.sortables,function(){this.instance.positionAbs=c.positionAbs;this.instance.helperProportions=c.helperProportions;this.instance.offset.click=c.offset.click;if(this.instance._intersectsWith(this.instance.containerCache)){if(!this.instance.isOver){this.instance.isOver=1;this.instance.currentItem=d(f).clone().removeAttr("id").appendTo(this.instance.element).data("sortable-item",true);
this.instance.options._helper=this.instance.options.helper;this.instance.options.helper=function(){return b.helper[0]};a.target=this.instance.currentItem[0];this.instance._mouseCapture(a,true);this.instance._mouseStart(a,true,true);this.instance.offset.click.top=c.offset.click.top;this.instance.offset.click.left=c.offset.click.left;this.instance.offset.parent.left-=c.offset.parent.left-this.instance.offset.parent.left;this.instance.offset.parent.top-=c.offset.parent.top-this.instance.offset.parent.top;
c._trigger("toSortable",a);c.dropped=this.instance.element;c.currentItem=c.element;this.instance.fromOutside=c}this.instance.currentItem&&this.instance._mouseDrag(a)}else if(this.instance.isOver){this.instance.isOver=0;this.instance.cancelHelperRemoval=true;this.instance.options.revert=false;this.instance._trigger("out",a,this.instance._uiHash(this.instance));this.instance._mouseStop(a,true);this.instance.options.helper=this.instance.options._helper;this.instance.currentItem.remove();this.instance.placeholder&&
this.instance.placeholder.remove();c._trigger("fromSortable",a);c.dropped=false}})}});d.ui.plugin.add("draggable","cursor",{start:function(){var a=d("body"),b=d(this).data("draggable").options;if(a.css("cursor"))b._cursor=a.css("cursor");a.css("cursor",b.cursor)},stop:function(){var a=d(this).data("draggable").options;a._cursor&&d("body").css("cursor",a._cursor)}});d.ui.plugin.add("draggable","opacity",{start:function(a,b){a=d(b.helper);b=d(this).data("draggable").options;if(a.css("opacity"))b._opacity=
a.css("opacity");a.css("opacity",b.opacity)},stop:function(a,b){a=d(this).data("draggable").options;a._opacity&&d(b.helper).css("opacity",a._opacity)}});d.ui.plugin.add("draggable","scroll",{start:function(){var a=d(this).data("draggable");if(a.scrollParent[0]!=document&&a.scrollParent[0].tagName!="HTML")a.overflowOffset=a.scrollParent.offset()},drag:function(a){var b=d(this).data("draggable"),c=b.options,f=false;if(b.scrollParent[0]!=document&&b.scrollParent[0].tagName!="HTML"){if(!c.axis||c.axis!=
"x")if(b.overflowOffset.top+b.scrollParent[0].offsetHeight-a.pageY<c.scrollSensitivity)b.scrollParent[0].scrollTop=f=b.scrollParent[0].scrollTop+c.scrollSpeed;else if(a.pageY-b.overflowOffset.top<c.scrollSensitivity)b.scrollParent[0].scrollTop=f=b.scrollParent[0].scrollTop-c.scrollSpeed;if(!c.axis||c.axis!="y")if(b.overflowOffset.left+b.scrollParent[0].offsetWidth-a.pageX<c.scrollSensitivity)b.scrollParent[0].scrollLeft=f=b.scrollParent[0].scrollLeft+c.scrollSpeed;else if(a.pageX-b.overflowOffset.left<
c.scrollSensitivity)b.scrollParent[0].scrollLeft=f=b.scrollParent[0].scrollLeft-c.scrollSpeed}else{if(!c.axis||c.axis!="x")if(a.pageY-d(document).scrollTop()<c.scrollSensitivity)f=d(document).scrollTop(d(document).scrollTop()-c.scrollSpeed);else if(d(window).height()-(a.pageY-d(document).scrollTop())<c.scrollSensitivity)f=d(document).scrollTop(d(document).scrollTop()+c.scrollSpeed);if(!c.axis||c.axis!="y")if(a.pageX-d(document).scrollLeft()<c.scrollSensitivity)f=d(document).scrollLeft(d(document).scrollLeft()-
c.scrollSpeed);else if(d(window).width()-(a.pageX-d(document).scrollLeft())<c.scrollSensitivity)f=d(document).scrollLeft(d(document).scrollLeft()+c.scrollSpeed)}f!==false&&d.ui.ddmanager&&!c.dropBehaviour&&d.ui.ddmanager.prepareOffsets(b,a)}});d.ui.plugin.add("draggable","snap",{start:function(){var a=d(this).data("draggable"),b=a.options;a.snapElements=[];d(b.snap.constructor!=String?b.snap.items||":data(draggable)":b.snap).each(function(){var c=d(this),f=c.offset();this!=a.element[0]&&a.snapElements.push({item:this,
width:c.outerWidth(),height:c.outerHeight(),top:f.top,left:f.left})})},drag:function(a,b){for(var c=d(this).data("draggable"),f=c.options,e=f.snapTolerance,h=b.offset.left,g=h+c.helperProportions.width,n=b.offset.top,o=n+c.helperProportions.height,i=c.snapElements.length-1;i>=0;i--){var j=c.snapElements[i].left,l=j+c.snapElements[i].width,k=c.snapElements[i].top,m=k+c.snapElements[i].height;if(j-e<h&&h<l+e&&k-e<n&&n<m+e||j-e<h&&h<l+e&&k-e<o&&o<m+e||j-e<g&&g<l+e&&k-e<n&&n<m+e||j-e<g&&g<l+e&&k-e<o&&
o<m+e){if(f.snapMode!="inner"){var p=Math.abs(k-o)<=e,q=Math.abs(m-n)<=e,r=Math.abs(j-g)<=e,s=Math.abs(l-h)<=e;if(p)b.position.top=c._convertPositionTo("relative",{top:k-c.helperProportions.height,left:0}).top-c.margins.top;if(q)b.position.top=c._convertPositionTo("relative",{top:m,left:0}).top-c.margins.top;if(r)b.position.left=c._convertPositionTo("relative",{top:0,left:j-c.helperProportions.width}).left-c.margins.left;if(s)b.position.left=c._convertPositionTo("relative",{top:0,left:l}).left-c.margins.left}var t=
p||q||r||s;if(f.snapMode!="outer"){p=Math.abs(k-n)<=e;q=Math.abs(m-o)<=e;r=Math.abs(j-h)<=e;s=Math.abs(l-g)<=e;if(p)b.position.top=c._convertPositionTo("relative",{top:k,left:0}).top-c.margins.top;if(q)b.position.top=c._convertPositionTo("relative",{top:m-c.helperProportions.height,left:0}).top-c.margins.top;if(r)b.position.left=c._convertPositionTo("relative",{top:0,left:j}).left-c.margins.left;if(s)b.position.left=c._convertPositionTo("relative",{top:0,left:l-c.helperProportions.width}).left-c.margins.left}if(!c.snapElements[i].snapping&&
(p||q||r||s||t))c.options.snap.snap&&c.options.snap.snap.call(c.element,a,d.extend(c._uiHash(),{snapItem:c.snapElements[i].item}));c.snapElements[i].snapping=p||q||r||s||t}else{c.snapElements[i].snapping&&c.options.snap.release&&c.options.snap.release.call(c.element,a,d.extend(c._uiHash(),{snapItem:c.snapElements[i].item}));c.snapElements[i].snapping=false}}}});d.ui.plugin.add("draggable","stack",{start:function(){var a=d(this).data("draggable").options;a=d.makeArray(d(a.stack)).sort(function(c,f){return(parseInt(d(c).css("zIndex"),
10)||0)-(parseInt(d(f).css("zIndex"),10)||0)});if(a.length){var b=parseInt(a[0].style.zIndex)||0;d(a).each(function(c){this.style.zIndex=b+c});this[0].style.zIndex=b+a.length}}});d.ui.plugin.add("draggable","zIndex",{start:function(a,b){a=d(b.helper);b=d(this).data("draggable").options;if(a.css("zIndex"))b._zIndex=a.css("zIndex");a.css("zIndex",b.zIndex)},stop:function(a,b){a=d(this).data("draggable").options;a._zIndex&&d(b.helper).css("zIndex",a._zIndex)}})})(jQuery);

;/*
 * jQuery UI Resizable 1.8.16
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Resizables
 *
 * Depends:
 *	jquery.ui.core.js
 *	jquery.ui.mouse.js
 *	jquery.ui.widget.js
 */
(function(e){e.widget("ui.resizable",e.ui.mouse,{widgetEventPrefix:"resize",options:{alsoResize:false,animate:false,animateDuration:"slow",animateEasing:"swing",aspectRatio:false,autoHide:false,containment:false,ghost:false,grid:false,handles:"e,s,se",helper:false,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:1E3},_create:function(){var b=this,a=this.options;this.element.addClass("ui-resizable");e.extend(this,{_aspectRatio:!!a.aspectRatio,aspectRatio:a.aspectRatio,originalElement:this.element,
_proportionallyResizeElements:[],_helper:a.helper||a.ghost||a.animate?a.helper||"ui-resizable-helper":null});if(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)){/relative/.test(this.element.css("position"))&&e.browser.opera&&this.element.css({position:"relative",top:"auto",left:"auto"});this.element.wrap(e('<div class="ui-wrapper" style="overflow: hidden;"></div>').css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),
top:this.element.css("top"),left:this.element.css("left")}));this.element=this.element.parent().data("resizable",this.element.data("resizable"));this.elementIsWrapper=true;this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")});this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});this.originalResizeStyle=
this.originalElement.css("resize");this.originalElement.css("resize","none");this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"}));this.originalElement.css({margin:this.originalElement.css("margin")});this._proportionallyResize()}this.handles=a.handles||(!e(".ui-resizable-handle",this.element).length?"e,s,se":{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",
nw:".ui-resizable-nw"});if(this.handles.constructor==String){if(this.handles=="all")this.handles="n,e,s,w,se,sw,ne,nw";var c=this.handles.split(",");this.handles={};for(var d=0;d<c.length;d++){var f=e.trim(c[d]),g=e('<div class="ui-resizable-handle '+("ui-resizable-"+f)+'"></div>');/sw|se|ne|nw/.test(f)&&g.css({zIndex:++a.zIndex});"se"==f&&g.addClass("ui-icon ui-icon-gripsmall-diagonal-se");this.handles[f]=".ui-resizable-"+f;this.element.append(g)}}this._renderAxis=function(h){h=h||this.element;for(var i in this.handles){if(this.handles[i].constructor==
String)this.handles[i]=e(this.handles[i],this.element).show();if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var j=e(this.handles[i],this.element),l=0;l=/sw|ne|nw|se|n|s/.test(i)?j.outerHeight():j.outerWidth();j=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join("");h.css(j,l);this._proportionallyResize()}e(this.handles[i])}};this._renderAxis(this.element);this._handles=e(".ui-resizable-handle",this.element).disableSelection();
this._handles.mouseover(function(){if(!b.resizing){if(this.className)var h=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);b.axis=h&&h[1]?h[1]:"se"}});if(a.autoHide){this._handles.hide();e(this.element).addClass("ui-resizable-autohide").hover(function(){if(!a.disabled){e(this).removeClass("ui-resizable-autohide");b._handles.show()}},function(){if(!a.disabled)if(!b.resizing){e(this).addClass("ui-resizable-autohide");b._handles.hide()}})}this._mouseInit()},destroy:function(){this._mouseDestroy();
var b=function(c){e(c).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};if(this.elementIsWrapper){b(this.element);var a=this.element;a.after(this.originalElement.css({position:a.css("position"),width:a.outerWidth(),height:a.outerHeight(),top:a.css("top"),left:a.css("left")})).remove()}this.originalElement.css("resize",this.originalResizeStyle);b(this.originalElement);return this},_mouseCapture:function(b){var a=
false;for(var c in this.handles)if(e(this.handles[c])[0]==b.target)a=true;return!this.options.disabled&&a},_mouseStart:function(b){var a=this.options,c=this.element.position(),d=this.element;this.resizing=true;this.documentScroll={top:e(document).scrollTop(),left:e(document).scrollLeft()};if(d.is(".ui-draggable")||/absolute/.test(d.css("position")))d.css({position:"absolute",top:c.top,left:c.left});e.browser.opera&&/relative/.test(d.css("position"))&&d.css({position:"relative",top:"auto",left:"auto"});
this._renderProxy();c=m(this.helper.css("left"));var f=m(this.helper.css("top"));if(a.containment){c+=e(a.containment).scrollLeft()||0;f+=e(a.containment).scrollTop()||0}this.offset=this.helper.offset();this.position={left:c,top:f};this.size=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalSize=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalPosition={left:c,top:f};this.sizeDiff=
{width:d.outerWidth()-d.width(),height:d.outerHeight()-d.height()};this.originalMousePosition={left:b.pageX,top:b.pageY};this.aspectRatio=typeof a.aspectRatio=="number"?a.aspectRatio:this.originalSize.width/this.originalSize.height||1;a=e(".ui-resizable-"+this.axis).css("cursor");e("body").css("cursor",a=="auto"?this.axis+"-resize":a);d.addClass("ui-resizable-resizing");this._propagate("start",b);return true},_mouseDrag:function(b){var a=this.helper,c=this.originalMousePosition,d=this._change[this.axis];
if(!d)return false;c=d.apply(this,[b,b.pageX-c.left||0,b.pageY-c.top||0]);this._updateVirtualBoundaries(b.shiftKey);if(this._aspectRatio||b.shiftKey)c=this._updateRatio(c,b);c=this._respectSize(c,b);this._propagate("resize",b);a.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize();this._updateCache(c);this._trigger("resize",b,this.ui());return false},
_mouseStop:function(b){this.resizing=false;var a=this.options,c=this;if(this._helper){var d=this._proportionallyResizeElements,f=d.length&&/textarea/i.test(d[0].nodeName);d=f&&e.ui.hasScroll(d[0],"left")?0:c.sizeDiff.height;f=f?0:c.sizeDiff.width;f={width:c.helper.width()-f,height:c.helper.height()-d};d=parseInt(c.element.css("left"),10)+(c.position.left-c.originalPosition.left)||null;var g=parseInt(c.element.css("top"),10)+(c.position.top-c.originalPosition.top)||null;a.animate||this.element.css(e.extend(f,
{top:g,left:d}));c.helper.height(c.size.height);c.helper.width(c.size.width);this._helper&&!a.animate&&this._proportionallyResize()}e("body").css("cursor","auto");this.element.removeClass("ui-resizable-resizing");this._propagate("stop",b);this._helper&&this.helper.remove();return false},_updateVirtualBoundaries:function(b){var a=this.options,c,d,f;a={minWidth:k(a.minWidth)?a.minWidth:0,maxWidth:k(a.maxWidth)?a.maxWidth:Infinity,minHeight:k(a.minHeight)?a.minHeight:0,maxHeight:k(a.maxHeight)?a.maxHeight:
Infinity};if(this._aspectRatio||b){b=a.minHeight*this.aspectRatio;d=a.minWidth/this.aspectRatio;c=a.maxHeight*this.aspectRatio;f=a.maxWidth/this.aspectRatio;if(b>a.minWidth)a.minWidth=b;if(d>a.minHeight)a.minHeight=d;if(c<a.maxWidth)a.maxWidth=c;if(f<a.maxHeight)a.maxHeight=f}this._vBoundaries=a},_updateCache:function(b){this.offset=this.helper.offset();if(k(b.left))this.position.left=b.left;if(k(b.top))this.position.top=b.top;if(k(b.height))this.size.height=b.height;if(k(b.width))this.size.width=
b.width},_updateRatio:function(b){var a=this.position,c=this.size,d=this.axis;if(k(b.height))b.width=b.height*this.aspectRatio;else if(k(b.width))b.height=b.width/this.aspectRatio;if(d=="sw"){b.left=a.left+(c.width-b.width);b.top=null}if(d=="nw"){b.top=a.top+(c.height-b.height);b.left=a.left+(c.width-b.width)}return b},_respectSize:function(b){var a=this._vBoundaries,c=this.axis,d=k(b.width)&&a.maxWidth&&a.maxWidth<b.width,f=k(b.height)&&a.maxHeight&&a.maxHeight<b.height,g=k(b.width)&&a.minWidth&&
a.minWidth>b.width,h=k(b.height)&&a.minHeight&&a.minHeight>b.height;if(g)b.width=a.minWidth;if(h)b.height=a.minHeight;if(d)b.width=a.maxWidth;if(f)b.height=a.maxHeight;var i=this.originalPosition.left+this.originalSize.width,j=this.position.top+this.size.height,l=/sw|nw|w/.test(c);c=/nw|ne|n/.test(c);if(g&&l)b.left=i-a.minWidth;if(d&&l)b.left=i-a.maxWidth;if(h&&c)b.top=j-a.minHeight;if(f&&c)b.top=j-a.maxHeight;if((a=!b.width&&!b.height)&&!b.left&&b.top)b.top=null;else if(a&&!b.top&&b.left)b.left=
null;return b},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var b=this.helper||this.element,a=0;a<this._proportionallyResizeElements.length;a++){var c=this._proportionallyResizeElements[a];if(!this.borderDif){var d=[c.css("borderTopWidth"),c.css("borderRightWidth"),c.css("borderBottomWidth"),c.css("borderLeftWidth")],f=[c.css("paddingTop"),c.css("paddingRight"),c.css("paddingBottom"),c.css("paddingLeft")];this.borderDif=e.map(d,function(g,h){g=parseInt(g,10)||
0;h=parseInt(f[h],10)||0;return g+h})}e.browser.msie&&(e(b).is(":hidden")||e(b).parents(":hidden").length)||c.css({height:b.height()-this.borderDif[0]-this.borderDif[2]||0,width:b.width()-this.borderDif[1]-this.borderDif[3]||0})}},_renderProxy:function(){var b=this.options;this.elementOffset=this.element.offset();if(this._helper){this.helper=this.helper||e('<div style="overflow:hidden;"></div>');var a=e.browser.msie&&e.browser.version<7,c=a?1:0;a=a?2:-1;this.helper.addClass(this._helper).css({width:this.element.outerWidth()+
a,height:this.element.outerHeight()+a,position:"absolute",left:this.elementOffset.left-c+"px",top:this.elementOffset.top-c+"px",zIndex:++b.zIndex});this.helper.appendTo("body").disableSelection()}else this.helper=this.element},_change:{e:function(b,a){return{width:this.originalSize.width+a}},w:function(b,a){return{left:this.originalPosition.left+a,width:this.originalSize.width-a}},n:function(b,a,c){return{top:this.originalPosition.top+c,height:this.originalSize.height-c}},s:function(b,a,c){return{height:this.originalSize.height+
c}},se:function(b,a,c){return e.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[b,a,c]))},sw:function(b,a,c){return e.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[b,a,c]))},ne:function(b,a,c){return e.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[b,a,c]))},nw:function(b,a,c){return e.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[b,a,c]))}},_propagate:function(b,a){e.ui.plugin.call(this,b,[a,this.ui()]);
b!="resize"&&this._trigger(b,a,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}});e.extend(e.ui.resizable,{version:"1.8.16"});e.ui.plugin.add("resizable","alsoResize",{start:function(){var b=e(this).data("resizable").options,a=function(c){e(c).each(function(){var d=e(this);d.data("resizable-alsoresize",{width:parseInt(d.width(),
10),height:parseInt(d.height(),10),left:parseInt(d.css("left"),10),top:parseInt(d.css("top"),10),position:d.css("position")})})};if(typeof b.alsoResize=="object"&&!b.alsoResize.parentNode)if(b.alsoResize.length){b.alsoResize=b.alsoResize[0];a(b.alsoResize)}else e.each(b.alsoResize,function(c){a(c)});else a(b.alsoResize)},resize:function(b,a){var c=e(this).data("resizable");b=c.options;var d=c.originalSize,f=c.originalPosition,g={height:c.size.height-d.height||0,width:c.size.width-d.width||0,top:c.position.top-
f.top||0,left:c.position.left-f.left||0},h=function(i,j){e(i).each(function(){var l=e(this),q=e(this).data("resizable-alsoresize"),p={},r=j&&j.length?j:l.parents(a.originalElement[0]).length?["width","height"]:["width","height","top","left"];e.each(r,function(n,o){if((n=(q[o]||0)+(g[o]||0))&&n>=0)p[o]=n||null});if(e.browser.opera&&/relative/.test(l.css("position"))){c._revertToRelativePosition=true;l.css({position:"absolute",top:"auto",left:"auto"})}l.css(p)})};typeof b.alsoResize=="object"&&!b.alsoResize.nodeType?
e.each(b.alsoResize,function(i,j){h(i,j)}):h(b.alsoResize)},stop:function(){var b=e(this).data("resizable"),a=b.options,c=function(d){e(d).each(function(){var f=e(this);f.css({position:f.data("resizable-alsoresize").position})})};if(b._revertToRelativePosition){b._revertToRelativePosition=false;typeof a.alsoResize=="object"&&!a.alsoResize.nodeType?e.each(a.alsoResize,function(d){c(d)}):c(a.alsoResize)}e(this).removeData("resizable-alsoresize")}});e.ui.plugin.add("resizable","animate",{stop:function(b){var a=
e(this).data("resizable"),c=a.options,d=a._proportionallyResizeElements,f=d.length&&/textarea/i.test(d[0].nodeName),g=f&&e.ui.hasScroll(d[0],"left")?0:a.sizeDiff.height;f={width:a.size.width-(f?0:a.sizeDiff.width),height:a.size.height-g};g=parseInt(a.element.css("left"),10)+(a.position.left-a.originalPosition.left)||null;var h=parseInt(a.element.css("top"),10)+(a.position.top-a.originalPosition.top)||null;a.element.animate(e.extend(f,h&&g?{top:h,left:g}:{}),{duration:c.animateDuration,easing:c.animateEasing,
step:function(){var i={width:parseInt(a.element.css("width"),10),height:parseInt(a.element.css("height"),10),top:parseInt(a.element.css("top"),10),left:parseInt(a.element.css("left"),10)};d&&d.length&&e(d[0]).css({width:i.width,height:i.height});a._updateCache(i);a._propagate("resize",b)}})}});e.ui.plugin.add("resizable","containment",{start:function(){var b=e(this).data("resizable"),a=b.element,c=b.options.containment;if(a=c instanceof e?c.get(0):/parent/.test(c)?a.parent().get(0):c){b.containerElement=
e(a);if(/document/.test(c)||c==document){b.containerOffset={left:0,top:0};b.containerPosition={left:0,top:0};b.parentData={element:e(document),left:0,top:0,width:e(document).width(),height:e(document).height()||document.body.parentNode.scrollHeight}}else{var d=e(a),f=[];e(["Top","Right","Left","Bottom"]).each(function(i,j){f[i]=m(d.css("padding"+j))});b.containerOffset=d.offset();b.containerPosition=d.position();b.containerSize={height:d.innerHeight()-f[3],width:d.innerWidth()-f[1]};c=b.containerOffset;
var g=b.containerSize.height,h=b.containerSize.width;h=e.ui.hasScroll(a,"left")?a.scrollWidth:h;g=e.ui.hasScroll(a)?a.scrollHeight:g;b.parentData={element:a,left:c.left,top:c.top,width:h,height:g}}}},resize:function(b){var a=e(this).data("resizable"),c=a.options,d=a.containerOffset,f=a.position;b=a._aspectRatio||b.shiftKey;var g={top:0,left:0},h=a.containerElement;if(h[0]!=document&&/static/.test(h.css("position")))g=d;if(f.left<(a._helper?d.left:0)){a.size.width+=a._helper?a.position.left-d.left:
a.position.left-g.left;if(b)a.size.height=a.size.width/c.aspectRatio;a.position.left=c.helper?d.left:0}if(f.top<(a._helper?d.top:0)){a.size.height+=a._helper?a.position.top-d.top:a.position.top;if(b)a.size.width=a.size.height*c.aspectRatio;a.position.top=a._helper?d.top:0}a.offset.left=a.parentData.left+a.position.left;a.offset.top=a.parentData.top+a.position.top;c=Math.abs((a._helper?a.offset.left-g.left:a.offset.left-g.left)+a.sizeDiff.width);d=Math.abs((a._helper?a.offset.top-g.top:a.offset.top-
d.top)+a.sizeDiff.height);f=a.containerElement.get(0)==a.element.parent().get(0);g=/relative|absolute/.test(a.containerElement.css("position"));if(f&&g)c-=a.parentData.left;if(c+a.size.width>=a.parentData.width){a.size.width=a.parentData.width-c;if(b)a.size.height=a.size.width/a.aspectRatio}if(d+a.size.height>=a.parentData.height){a.size.height=a.parentData.height-d;if(b)a.size.width=a.size.height*a.aspectRatio}},stop:function(){var b=e(this).data("resizable"),a=b.options,c=b.containerOffset,d=b.containerPosition,
f=b.containerElement,g=e(b.helper),h=g.offset(),i=g.outerWidth()-b.sizeDiff.width;g=g.outerHeight()-b.sizeDiff.height;b._helper&&!a.animate&&/relative/.test(f.css("position"))&&e(this).css({left:h.left-d.left-c.left,width:i,height:g});b._helper&&!a.animate&&/static/.test(f.css("position"))&&e(this).css({left:h.left-d.left-c.left,width:i,height:g})}});e.ui.plugin.add("resizable","ghost",{start:function(){var b=e(this).data("resizable"),a=b.options,c=b.size;b.ghost=b.originalElement.clone();b.ghost.css({opacity:0.25,
display:"block",position:"relative",height:c.height,width:c.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof a.ghost=="string"?a.ghost:"");b.ghost.appendTo(b.helper)},resize:function(){var b=e(this).data("resizable");b.ghost&&b.ghost.css({position:"relative",height:b.size.height,width:b.size.width})},stop:function(){var b=e(this).data("resizable");b.ghost&&b.helper&&b.helper.get(0).removeChild(b.ghost.get(0))}});e.ui.plugin.add("resizable","grid",{resize:function(){var b=
e(this).data("resizable"),a=b.options,c=b.size,d=b.originalSize,f=b.originalPosition,g=b.axis;a.grid=typeof a.grid=="number"?[a.grid,a.grid]:a.grid;var h=Math.round((c.width-d.width)/(a.grid[0]||1))*(a.grid[0]||1);a=Math.round((c.height-d.height)/(a.grid[1]||1))*(a.grid[1]||1);if(/^(se|s|e)$/.test(g)){b.size.width=d.width+h;b.size.height=d.height+a}else if(/^(ne)$/.test(g)){b.size.width=d.width+h;b.size.height=d.height+a;b.position.top=f.top-a}else{if(/^(sw)$/.test(g)){b.size.width=d.width+h;b.size.height=
d.height+a}else{b.size.width=d.width+h;b.size.height=d.height+a;b.position.top=f.top-a}b.position.left=f.left-h}}});var m=function(b){return parseInt(b,10)||0},k=function(b){return!isNaN(parseInt(b,10))}})(jQuery);

;/*
 * jQuery UI Button 1.8.16
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Button
 *
 * Depends:
 *	jquery.ui.core.js
 *	jquery.ui.widget.js
 */
(function(b){var h,i,j,g,l=function(){var a=b(this).find(":ui-button");setTimeout(function(){a.button("refresh")},1)},k=function(a){var c=a.name,e=a.form,f=b([]);if(c)f=e?b(e).find("[name='"+c+"']"):b("[name='"+c+"']",a.ownerDocument).filter(function(){return!this.form});return f};b.widget("ui.button",{options:{disabled:null,text:true,label:null,icons:{primary:null,secondary:null}},_create:function(){this.element.closest("form").unbind("reset.button").bind("reset.button",l);if(typeof this.options.disabled!==
"boolean")this.options.disabled=this.element.propAttr("disabled");this._determineButtonType();this.hasTitle=!!this.buttonElement.attr("title");var a=this,c=this.options,e=this.type==="checkbox"||this.type==="radio",f="ui-state-hover"+(!e?" ui-state-active":"");if(c.label===null)c.label=this.buttonElement.html();if(this.element.is(":disabled"))c.disabled=true;this.buttonElement.addClass("ui-button ui-widget ui-state-default ui-corner-all").attr("role","button").bind("mouseenter.button",function(){if(!c.disabled){b(this).addClass("ui-state-hover");
this===h&&b(this).addClass("ui-state-active")}}).bind("mouseleave.button",function(){c.disabled||b(this).removeClass(f)}).bind("click.button",function(d){if(c.disabled){d.preventDefault();d.stopImmediatePropagation()}});this.element.bind("focus.button",function(){a.buttonElement.addClass("ui-state-focus")}).bind("blur.button",function(){a.buttonElement.removeClass("ui-state-focus")});if(e){this.element.bind("change.button",function(){g||a.refresh()});this.buttonElement.bind("mousedown.button",function(d){if(!c.disabled){g=
false;i=d.pageX;j=d.pageY}}).bind("mouseup.button",function(d){if(!c.disabled)if(i!==d.pageX||j!==d.pageY)g=true})}if(this.type==="checkbox")this.buttonElement.bind("click.button",function(){if(c.disabled||g)return false;b(this).toggleClass("ui-state-active");a.buttonElement.attr("aria-pressed",a.element[0].checked)});else if(this.type==="radio")this.buttonElement.bind("click.button",function(){if(c.disabled||g)return false;b(this).addClass("ui-state-active");a.buttonElement.attr("aria-pressed","true");
var d=a.element[0];k(d).not(d).map(function(){return b(this).button("widget")[0]}).removeClass("ui-state-active").attr("aria-pressed","false")});else{this.buttonElement.bind("mousedown.button",function(){if(c.disabled)return false;b(this).addClass("ui-state-active");h=this;b(document).one("mouseup",function(){h=null})}).bind("mouseup.button",function(){if(c.disabled)return false;b(this).removeClass("ui-state-active")}).bind("keydown.button",function(d){if(c.disabled)return false;if(d.keyCode==b.ui.keyCode.SPACE||
d.keyCode==b.ui.keyCode.ENTER)b(this).addClass("ui-state-active")}).bind("keyup.button",function(){b(this).removeClass("ui-state-active")});this.buttonElement.is("a")&&this.buttonElement.keyup(function(d){d.keyCode===b.ui.keyCode.SPACE&&b(this).click()})}this._setOption("disabled",c.disabled);this._resetButton()},_determineButtonType:function(){this.type=this.element.is(":checkbox")?"checkbox":this.element.is(":radio")?"radio":this.element.is("input")?"input":"button";if(this.type==="checkbox"||this.type===
"radio"){var a=this.element.parents().filter(":last"),c="label[for='"+this.element.attr("id")+"']";this.buttonElement=a.find(c);if(!this.buttonElement.length){a=a.length?a.siblings():this.element.siblings();this.buttonElement=a.filter(c);if(!this.buttonElement.length)this.buttonElement=a.find(c)}this.element.addClass("ui-helper-hidden-accessible");(a=this.element.is(":checked"))&&this.buttonElement.addClass("ui-state-active");this.buttonElement.attr("aria-pressed",a)}else this.buttonElement=this.element},
widget:function(){return this.buttonElement},destroy:function(){this.element.removeClass("ui-helper-hidden-accessible");this.buttonElement.removeClass("ui-button ui-widget ui-state-default ui-corner-all ui-state-hover ui-state-active  ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only").removeAttr("role").removeAttr("aria-pressed").html(this.buttonElement.find(".ui-button-text").html());this.hasTitle||this.buttonElement.removeAttr("title");
b.Widget.prototype.destroy.call(this)},_setOption:function(a,c){b.Widget.prototype._setOption.apply(this,arguments);if(a==="disabled")c?this.element.propAttr("disabled",true):this.element.propAttr("disabled",false);else this._resetButton()},refresh:function(){var a=this.element.is(":disabled");a!==this.options.disabled&&this._setOption("disabled",a);if(this.type==="radio")k(this.element[0]).each(function(){b(this).is(":checked")?b(this).button("widget").addClass("ui-state-active").attr("aria-pressed",
"true"):b(this).button("widget").removeClass("ui-state-active").attr("aria-pressed","false")});else if(this.type==="checkbox")this.element.is(":checked")?this.buttonElement.addClass("ui-state-active").attr("aria-pressed","true"):this.buttonElement.removeClass("ui-state-active").attr("aria-pressed","false")},_resetButton:function(){if(this.type==="input")this.options.label&&this.element.val(this.options.label);else{var a=this.buttonElement.removeClass("ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only"),
c=b("<span></span>").addClass("ui-button-text").html(this.options.label).appendTo(a.empty()).text(),e=this.options.icons,f=e.primary&&e.secondary,d=[];if(e.primary||e.secondary){if(this.options.text)d.push("ui-button-text-icon"+(f?"s":e.primary?"-primary":"-secondary"));e.primary&&a.prepend("<span class='ui-button-icon-primary ui-icon "+e.primary+"'></span>");e.secondary&&a.append("<span class='ui-button-icon-secondary ui-icon "+e.secondary+"'></span>");if(!this.options.text){d.push(f?"ui-button-icons-only":
"ui-button-icon-only");this.hasTitle||a.attr("title",c)}}else d.push("ui-button-text-only");a.addClass(d.join(" "))}}});b.widget("ui.buttonset",{options:{items:":button, :submit, :reset, :checkbox, :radio, a, :data(button)"},_create:function(){this.element.addClass("ui-buttonset")},_init:function(){this.refresh()},_setOption:function(a,c){a==="disabled"&&this.buttons.button("option",a,c);b.Widget.prototype._setOption.apply(this,arguments)},refresh:function(){var a=this.element.css("direction")===
"ltr";this.buttons=this.element.find(this.options.items).filter(":ui-button").button("refresh").end().not(":ui-button").button().end().map(function(){return b(this).button("widget")[0]}).removeClass("ui-corner-all ui-corner-left ui-corner-right").filter(":first").addClass(a?"ui-corner-left":"ui-corner-right").end().filter(":last").addClass(a?"ui-corner-right":"ui-corner-left").end().end()},destroy:function(){this.element.removeClass("ui-buttonset");this.buttons.map(function(){return b(this).button("widget")[0]}).removeClass("ui-corner-left ui-corner-right").end().button("destroy");
b.Widget.prototype.destroy.call(this)}})})(jQuery);

;/*
 * jQuery UI Dialog 1.8.16
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Dialog
 *
 * Depends:
 *	jquery.ui.core.js
 *	jquery.ui.widget.js
 *  jquery.ui.button.js
 *	jquery.ui.draggable.js
 *	jquery.ui.mouse.js
 *	jquery.ui.position.js
 *	jquery.ui.resizable.js
 */
(function(c,l){var m={buttons:true,height:true,maxHeight:true,maxWidth:true,minHeight:true,minWidth:true,width:true},n={maxHeight:true,maxWidth:true,minHeight:true,minWidth:true},o=c.attrFn||{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true,click:true};c.widget("ui.dialog",{options:{autoOpen:true,buttons:{},closeOnEscape:true,closeText:"close",dialogClass:"",draggable:true,hide:null,height:"auto",maxHeight:false,maxWidth:false,minHeight:150,minWidth:150,modal:false,
position:{my:"center",at:"center",collision:"fit",using:function(a){var b=c(this).css(a).offset().top;b<0&&c(this).css("top",a.top-b)}},resizable:true,show:null,stack:true,title:"",width:300,zIndex:1E3},_create:function(){this.originalTitle=this.element.attr("title");if(typeof this.originalTitle!=="string")this.originalTitle="";this.options.title=this.options.title||this.originalTitle;var a=this,b=a.options,d=b.title||"&#160;",e=c.ui.dialog.getTitleId(a.element),g=(a.uiDialog=c("<div></div>")).appendTo(document.body).hide().addClass("ui-dialog ui-widget ui-widget-content ui-corner-all "+
b.dialogClass).css({zIndex:b.zIndex}).attr("tabIndex",-1).css("outline",0).keydown(function(i){if(b.closeOnEscape&&!i.isDefaultPrevented()&&i.keyCode&&i.keyCode===c.ui.keyCode.ESCAPE){a.close(i);i.preventDefault()}}).attr({role:"dialog","aria-labelledby":e}).mousedown(function(i){a.moveToTop(false,i)});a.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(g);var f=(a.uiDialogTitlebar=c("<div></div>")).addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(g),
h=c('<a href="#"></a>').addClass("ui-dialog-titlebar-close ui-corner-all").attr("role","button").hover(function(){h.addClass("ui-state-hover")},function(){h.removeClass("ui-state-hover")}).focus(function(){h.addClass("ui-state-focus")}).blur(function(){h.removeClass("ui-state-focus")}).click(function(i){a.close(i);return false}).appendTo(f);(a.uiDialogTitlebarCloseText=c("<span></span>")).addClass("ui-icon ui-icon-closethick").text(b.closeText).appendTo(h);c("<span></span>").addClass("ui-dialog-title").attr("id",
e).html(d).prependTo(f);if(c.isFunction(b.beforeclose)&&!c.isFunction(b.beforeClose))b.beforeClose=b.beforeclose;f.find("*").add(f).disableSelection();b.draggable&&c.fn.draggable&&a._makeDraggable();b.resizable&&c.fn.resizable&&a._makeResizable();a._createButtons(b.buttons);a._isOpen=false;c.fn.bgiframe&&g.bgiframe()},_init:function(){this.options.autoOpen&&this.open()},destroy:function(){var a=this;a.overlay&&a.overlay.destroy();a.uiDialog.hide();a.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content ui-widget-content").hide().appendTo("body");
a.uiDialog.remove();a.originalTitle&&a.element.attr("title",a.originalTitle);return a},widget:function(){return this.uiDialog},close:function(a){var b=this,d,e;if(false!==b._trigger("beforeClose",a)){b.overlay&&b.overlay.destroy();b.uiDialog.unbind("keypress.ui-dialog");b._isOpen=false;if(b.options.hide)b.uiDialog.hide(b.options.hide,function(){b._trigger("close",a)});else{b.uiDialog.hide();b._trigger("close",a)}c.ui.dialog.overlay.resize();if(b.options.modal){d=0;c(".ui-dialog").each(function(){if(this!==
b.uiDialog[0]){e=c(this).css("z-index");isNaN(e)||(d=Math.max(d,e))}});c.ui.dialog.maxZ=d}return b}},isOpen:function(){return this._isOpen},moveToTop:function(a,b){var d=this,e=d.options;if(e.modal&&!a||!e.stack&&!e.modal)return d._trigger("focus",b);if(e.zIndex>c.ui.dialog.maxZ)c.ui.dialog.maxZ=e.zIndex;if(d.overlay){c.ui.dialog.maxZ+=1;d.overlay.$el.css("z-index",c.ui.dialog.overlay.maxZ=c.ui.dialog.maxZ)}a={scrollTop:d.element.scrollTop(),scrollLeft:d.element.scrollLeft()};c.ui.dialog.maxZ+=1;
d.uiDialog.css("z-index",c.ui.dialog.maxZ);d.element.attr(a);d._trigger("focus",b);return d},open:function(){if(!this._isOpen){var a=this,b=a.options,d=a.uiDialog;a.overlay=b.modal?new c.ui.dialog.overlay(a):null;a._size();a._position(b.position);d.show(b.show);a.moveToTop(true);b.modal&&d.bind("keypress.ui-dialog",function(e){if(e.keyCode===c.ui.keyCode.TAB){var g=c(":tabbable",this),f=g.filter(":first");g=g.filter(":last");if(e.target===g[0]&&!e.shiftKey){f.focus(1);return false}else if(e.target===
f[0]&&e.shiftKey){g.focus(1);return false}}});c(a.element.find(":tabbable").get().concat(d.find(".ui-dialog-buttonpane :tabbable").get().concat(d.get()))).eq(0).focus();a._isOpen=true;a._trigger("open");return a}},_createButtons:function(a){var b=this,d=false,e=c("<div></div>").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"),g=c("<div></div>").addClass("ui-dialog-buttonset").appendTo(e);b.uiDialog.find(".ui-dialog-buttonpane").remove();typeof a==="object"&&a!==null&&c.each(a,
function(){return!(d=true)});if(d){c.each(a,function(f,h){h=c.isFunction(h)?{click:h,text:f}:h;var i=c('<button type="button"></button>').click(function(){h.click.apply(b.element[0],arguments)}).appendTo(g);c.each(h,function(j,k){if(j!=="click")j in o?i[j](k):i.attr(j,k)});c.fn.button&&i.button()});e.appendTo(b.uiDialog)}},_makeDraggable:function(){function a(f){return{position:f.position,offset:f.offset}}var b=this,d=b.options,e=c(document),g;b.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",
handle:".ui-dialog-titlebar",containment:"document",start:function(f,h){g=d.height==="auto"?"auto":c(this).height();c(this).height(c(this).height()).addClass("ui-dialog-dragging");b._trigger("dragStart",f,a(h))},drag:function(f,h){b._trigger("drag",f,a(h))},stop:function(f,h){d.position=[h.position.left-e.scrollLeft(),h.position.top-e.scrollTop()];c(this).removeClass("ui-dialog-dragging").height(g);b._trigger("dragStop",f,a(h));c.ui.dialog.overlay.resize()}})},_makeResizable:function(a){function b(f){return{originalPosition:f.originalPosition,
originalSize:f.originalSize,position:f.position,size:f.size}}a=a===l?this.options.resizable:a;var d=this,e=d.options,g=d.uiDialog.css("position");a=typeof a==="string"?a:"n,e,s,w,se,sw,ne,nw";d.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:d.element,maxWidth:e.maxWidth,maxHeight:e.maxHeight,minWidth:e.minWidth,minHeight:d._minHeight(),handles:a,start:function(f,h){c(this).addClass("ui-dialog-resizing");d._trigger("resizeStart",f,b(h))},resize:function(f,h){d._trigger("resize",
f,b(h))},stop:function(f,h){c(this).removeClass("ui-dialog-resizing");e.height=c(this).height();e.width=c(this).width();d._trigger("resizeStop",f,b(h));c.ui.dialog.overlay.resize()}}).css("position",g).find(".ui-resizable-se").addClass("ui-icon ui-icon-grip-diagonal-se")},_minHeight:function(){var a=this.options;return a.height==="auto"?a.minHeight:Math.min(a.minHeight,a.height)},_position:function(a){var b=[],d=[0,0],e;if(a){if(typeof a==="string"||typeof a==="object"&&"0"in a){b=a.split?a.split(" "):
[a[0],a[1]];if(b.length===1)b[1]=b[0];c.each(["left","top"],function(g,f){if(+b[g]===b[g]){d[g]=b[g];b[g]=f}});a={my:b.join(" "),at:b.join(" "),offset:d.join(" ")}}a=c.extend({},c.ui.dialog.prototype.options.position,a)}else a=c.ui.dialog.prototype.options.position;(e=this.uiDialog.is(":visible"))||this.uiDialog.show();this.uiDialog.css({top:0,left:0}).position(c.extend({of:window},a));e||this.uiDialog.hide()},_setOptions:function(a){var b=this,d={},e=false;c.each(a,function(g,f){b._setOption(g,f);
if(g in m)e=true;if(g in n)d[g]=f});e&&this._size();this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option",d)},_setOption:function(a,b){var d=this,e=d.uiDialog;switch(a){case "beforeclose":a="beforeClose";break;case "buttons":d._createButtons(b);break;case "closeText":d.uiDialogTitlebarCloseText.text(""+b);break;case "dialogClass":e.removeClass(d.options.dialogClass).addClass("ui-dialog ui-widget ui-widget-content ui-corner-all "+b);break;case "disabled":b?e.addClass("ui-dialog-disabled"):
e.removeClass("ui-dialog-disabled");break;case "draggable":var g=e.is(":data(draggable)");g&&!b&&e.draggable("destroy");!g&&b&&d._makeDraggable();break;case "position":d._position(b);break;case "resizable":(g=e.is(":data(resizable)"))&&!b&&e.resizable("destroy");g&&typeof b==="string"&&e.resizable("option","handles",b);!g&&b!==false&&d._makeResizable(b);break;case "title":c(".ui-dialog-title",d.uiDialogTitlebar).html(""+(b||"&#160;"));break}c.Widget.prototype._setOption.apply(d,arguments)},_size:function(){var a=
this.options,b,d,e=this.uiDialog.is(":visible");this.element.show().css({width:"auto",minHeight:0,height:0});if(a.minWidth>a.width)a.width=a.minWidth;b=this.uiDialog.css({height:"auto",width:a.width}).height();d=Math.max(0,a.minHeight-b);if(a.height==="auto")if(c.support.minHeight)this.element.css({minHeight:d,height:"auto"});else{this.uiDialog.show();a=this.element.css("height","auto").height();e||this.uiDialog.hide();this.element.height(Math.max(a,d))}else this.element.height(Math.max(a.height-
b,0));this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())}});c.extend(c.ui.dialog,{version:"1.8.16",uuid:0,maxZ:0,getTitleId:function(a){a=a.attr("id");if(!a){this.uuid+=1;a=this.uuid}return"ui-dialog-title-"+a},overlay:function(a){this.$el=c.ui.dialog.overlay.create(a)}});c.extend(c.ui.dialog.overlay,{instances:[],oldInstances:[],maxZ:0,events:c.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(a){return a+".dialog-overlay"}).join(" "),
create:function(a){if(this.instances.length===0){setTimeout(function(){c.ui.dialog.overlay.instances.length&&c(document).bind(c.ui.dialog.overlay.events,function(d){if(c(d.target).zIndex()<c.ui.dialog.overlay.maxZ)return false})},1);c(document).bind("keydown.dialog-overlay",function(d){if(a.options.closeOnEscape&&!d.isDefaultPrevented()&&d.keyCode&&d.keyCode===c.ui.keyCode.ESCAPE){a.close(d);d.preventDefault()}});c(window).bind("resize.dialog-overlay",c.ui.dialog.overlay.resize)}var b=(this.oldInstances.pop()||
c("<div></div>").addClass("ui-widget-overlay")).appendTo(document.body).css({width:this.width(),height:this.height()});c.fn.bgiframe&&b.bgiframe();this.instances.push(b);return b},destroy:function(a){var b=c.inArray(a,this.instances);b!=-1&&this.oldInstances.push(this.instances.splice(b,1)[0]);this.instances.length===0&&c([document,window]).unbind(".dialog-overlay");a.remove();var d=0;c.each(this.instances,function(){d=Math.max(d,this.css("z-index"))});this.maxZ=d},height:function(){var a,b;if(c.browser.msie&&
c.browser.version<7){a=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);b=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight);return a<b?c(window).height()+"px":a+"px"}else return c(document).height()+"px"},width:function(){var a,b;if(c.browser.msie){a=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth);b=Math.max(document.documentElement.offsetWidth,document.body.offsetWidth);return a<b?c(window).width()+"px":a+"px"}else return c(document).width()+
"px"},resize:function(){var a=c([]);c.each(c.ui.dialog.overlay.instances,function(){a=a.add(this)});a.css({width:0,height:0}).css({width:c.ui.dialog.overlay.width(),height:c.ui.dialog.overlay.height()})}});c.extend(c.ui.dialog.overlay.prototype,{destroy:function(){c.ui.dialog.overlay.destroy(this.$el)}})})(jQuery);

;/*
 * jQuery UI Tabs 1.8.16
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Tabs
 *
 * Depends:
 *	jquery.ui.core.js
 *	jquery.ui.widget.js
 */
(function(d,p){function u(){return++v}function w(){return++x}var v=0,x=0;d.widget("ui.tabs",{options:{add:null,ajaxOptions:null,cache:false,cookie:null,collapsible:false,disable:null,disabled:[],enable:null,event:"click",fx:null,idPrefix:"ui-tabs-",load:null,panelTemplate:"<div></div>",remove:null,select:null,show:null,spinner:"<em>Loading&#8230;</em>",tabTemplate:"<li><a href='#{href}'><span>#{label}</span></a></li>"},_create:function(){this._tabify(true)},_setOption:function(b,e){if(b=="selected")this.options.collapsible&&
e==this.options.selected||this.select(e);else{this.options[b]=e;this._tabify()}},_tabId:function(b){return b.title&&b.title.replace(/\s/g,"_").replace(/[^\w\u00c0-\uFFFF-]/g,"")||this.options.idPrefix+u()},_sanitizeSelector:function(b){return b.replace(/:/g,"\\:")},_cookie:function(){var b=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+w());return d.cookie.apply(null,[b].concat(d.makeArray(arguments)))},_ui:function(b,e){return{tab:b,panel:e,index:this.anchors.index(b)}},_cleanup:function(){this.lis.filter(".ui-state-processing").removeClass("ui-state-processing").find("span:data(label.tabs)").each(function(){var b=
d(this);b.html(b.data("label.tabs")).removeData("label.tabs")})},_tabify:function(b){function e(g,f){g.css("display","");!d.support.opacity&&f.opacity&&g[0].style.removeAttribute("filter")}var a=this,c=this.options,h=/^#.+/;this.list=this.element.find("ol,ul").eq(0);this.lis=d(" > li:has(a[href])",this.list);this.anchors=this.lis.map(function(){return d("a",this)[0]});this.panels=d([]);this.anchors.each(function(g,f){var i=d(f).attr("href"),l=i.split("#")[0],q;if(l&&(l===location.toString().split("#")[0]||
(q=d("base")[0])&&l===q.href)){i=f.hash;f.href=i}if(h.test(i))a.panels=a.panels.add(a.element.find(a._sanitizeSelector(i)));else if(i&&i!=="#"){d.data(f,"href.tabs",i);d.data(f,"load.tabs",i.replace(/#.*$/,""));i=a._tabId(f);f.href="#"+i;f=a.element.find("#"+i);if(!f.length){f=d(c.panelTemplate).attr("id",i).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").insertAfter(a.panels[g-1]||a.list);f.data("destroy.tabs",true)}a.panels=a.panels.add(f)}else c.disabled.push(g)});if(b){this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all");
this.list.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.lis.addClass("ui-state-default ui-corner-top");this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom");if(c.selected===p){location.hash&&this.anchors.each(function(g,f){if(f.hash==location.hash){c.selected=g;return false}});if(typeof c.selected!=="number"&&c.cookie)c.selected=parseInt(a._cookie(),10);if(typeof c.selected!=="number"&&this.lis.filter(".ui-tabs-selected").length)c.selected=
this.lis.index(this.lis.filter(".ui-tabs-selected"));c.selected=c.selected||(this.lis.length?0:-1)}else if(c.selected===null)c.selected=-1;c.selected=c.selected>=0&&this.anchors[c.selected]||c.selected<0?c.selected:0;c.disabled=d.unique(c.disabled.concat(d.map(this.lis.filter(".ui-state-disabled"),function(g){return a.lis.index(g)}))).sort();d.inArray(c.selected,c.disabled)!=-1&&c.disabled.splice(d.inArray(c.selected,c.disabled),1);this.panels.addClass("ui-tabs-hide");this.lis.removeClass("ui-tabs-selected ui-state-active");
if(c.selected>=0&&this.anchors.length){a.element.find(a._sanitizeSelector(a.anchors[c.selected].hash)).removeClass("ui-tabs-hide");this.lis.eq(c.selected).addClass("ui-tabs-selected ui-state-active");a.element.queue("tabs",function(){a._trigger("show",null,a._ui(a.anchors[c.selected],a.element.find(a._sanitizeSelector(a.anchors[c.selected].hash))[0]))});this.load(c.selected)}d(window).bind("unload",function(){a.lis.add(a.anchors).unbind(".tabs");a.lis=a.anchors=a.panels=null})}else c.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"));
this.element[c.collapsible?"addClass":"removeClass"]("ui-tabs-collapsible");c.cookie&&this._cookie(c.selected,c.cookie);b=0;for(var j;j=this.lis[b];b++)d(j)[d.inArray(b,c.disabled)!=-1&&!d(j).hasClass("ui-tabs-selected")?"addClass":"removeClass"]("ui-state-disabled");c.cache===false&&this.anchors.removeData("cache.tabs");this.lis.add(this.anchors).unbind(".tabs");if(c.event!=="mouseover"){var k=function(g,f){f.is(":not(.ui-state-disabled)")&&f.addClass("ui-state-"+g)},n=function(g,f){f.removeClass("ui-state-"+
g)};this.lis.bind("mouseover.tabs",function(){k("hover",d(this))});this.lis.bind("mouseout.tabs",function(){n("hover",d(this))});this.anchors.bind("focus.tabs",function(){k("focus",d(this).closest("li"))});this.anchors.bind("blur.tabs",function(){n("focus",d(this).closest("li"))})}var m,o;if(c.fx)if(d.isArray(c.fx)){m=c.fx[0];o=c.fx[1]}else m=o=c.fx;var r=o?function(g,f){d(g).closest("li").addClass("ui-tabs-selected ui-state-active");f.hide().removeClass("ui-tabs-hide").animate(o,o.duration||"normal",
function(){e(f,o);a._trigger("show",null,a._ui(g,f[0]))})}:function(g,f){d(g).closest("li").addClass("ui-tabs-selected ui-state-active");f.removeClass("ui-tabs-hide");a._trigger("show",null,a._ui(g,f[0]))},s=m?function(g,f){f.animate(m,m.duration||"normal",function(){a.lis.removeClass("ui-tabs-selected ui-state-active");f.addClass("ui-tabs-hide");e(f,m);a.element.dequeue("tabs")})}:function(g,f){a.lis.removeClass("ui-tabs-selected ui-state-active");f.addClass("ui-tabs-hide");a.element.dequeue("tabs")};
this.anchors.bind(c.event+".tabs",function(){var g=this,f=d(g).closest("li"),i=a.panels.filter(":not(.ui-tabs-hide)"),l=a.element.find(a._sanitizeSelector(g.hash));if(f.hasClass("ui-tabs-selected")&&!c.collapsible||f.hasClass("ui-state-disabled")||f.hasClass("ui-state-processing")||a.panels.filter(":animated").length||a._trigger("select",null,a._ui(this,l[0]))===false){this.blur();return false}c.selected=a.anchors.index(this);a.abort();if(c.collapsible)if(f.hasClass("ui-tabs-selected")){c.selected=
-1;c.cookie&&a._cookie(c.selected,c.cookie);a.element.queue("tabs",function(){s(g,i)}).dequeue("tabs");this.blur();return false}else if(!i.length){c.cookie&&a._cookie(c.selected,c.cookie);a.element.queue("tabs",function(){r(g,l)});a.load(a.anchors.index(this));this.blur();return false}c.cookie&&a._cookie(c.selected,c.cookie);if(l.length){i.length&&a.element.queue("tabs",function(){s(g,i)});a.element.queue("tabs",function(){r(g,l)});a.load(a.anchors.index(this))}else throw"jQuery UI Tabs: Mismatching fragment identifier.";
d.browser.msie&&this.blur()});this.anchors.bind("click.tabs",function(){return false})},_getIndex:function(b){if(typeof b=="string")b=this.anchors.index(this.anchors.filter("[href$="+b+"]"));return b},destroy:function(){var b=this.options;this.abort();this.element.unbind(".tabs").removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible").removeData("tabs");this.list.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.anchors.each(function(){var e=
d.data(this,"href.tabs");if(e)this.href=e;var a=d(this).unbind(".tabs");d.each(["href","load","cache"],function(c,h){a.removeData(h+".tabs")})});this.lis.unbind(".tabs").add(this.panels).each(function(){d.data(this,"destroy.tabs")?d(this).remove():d(this).removeClass("ui-state-default ui-corner-top ui-tabs-selected ui-state-active ui-state-hover ui-state-focus ui-state-disabled ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide")});b.cookie&&this._cookie(null,b.cookie);return this},add:function(b,
e,a){if(a===p)a=this.anchors.length;var c=this,h=this.options;e=d(h.tabTemplate.replace(/#\{href\}/g,b).replace(/#\{label\}/g,e));b=!b.indexOf("#")?b.replace("#",""):this._tabId(d("a",e)[0]);e.addClass("ui-state-default ui-corner-top").data("destroy.tabs",true);var j=c.element.find("#"+b);j.length||(j=d(h.panelTemplate).attr("id",b).data("destroy.tabs",true));j.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide");if(a>=this.lis.length){e.appendTo(this.list);j.appendTo(this.list[0].parentNode)}else{e.insertBefore(this.lis[a]);
j.insertBefore(this.panels[a])}h.disabled=d.map(h.disabled,function(k){return k>=a?++k:k});this._tabify();if(this.anchors.length==1){h.selected=0;e.addClass("ui-tabs-selected ui-state-active");j.removeClass("ui-tabs-hide");this.element.queue("tabs",function(){c._trigger("show",null,c._ui(c.anchors[0],c.panels[0]))});this.load(0)}this._trigger("add",null,this._ui(this.anchors[a],this.panels[a]));return this},remove:function(b){b=this._getIndex(b);var e=this.options,a=this.lis.eq(b).remove(),c=this.panels.eq(b).remove();
if(a.hasClass("ui-tabs-selected")&&this.anchors.length>1)this.select(b+(b+1<this.anchors.length?1:-1));e.disabled=d.map(d.grep(e.disabled,function(h){return h!=b}),function(h){return h>=b?--h:h});this._tabify();this._trigger("remove",null,this._ui(a.find("a")[0],c[0]));return this},enable:function(b){b=this._getIndex(b);var e=this.options;if(d.inArray(b,e.disabled)!=-1){this.lis.eq(b).removeClass("ui-state-disabled");e.disabled=d.grep(e.disabled,function(a){return a!=b});this._trigger("enable",null,
this._ui(this.anchors[b],this.panels[b]));return this}},disable:function(b){b=this._getIndex(b);var e=this.options;if(b!=e.selected){this.lis.eq(b).addClass("ui-state-disabled");e.disabled.push(b);e.disabled.sort();this._trigger("disable",null,this._ui(this.anchors[b],this.panels[b]))}return this},select:function(b){b=this._getIndex(b);if(b==-1)if(this.options.collapsible&&this.options.selected!=-1)b=this.options.selected;else return this;this.anchors.eq(b).trigger(this.options.event+".tabs");return this},
load:function(b){b=this._getIndex(b);var e=this,a=this.options,c=this.anchors.eq(b)[0],h=d.data(c,"load.tabs");this.abort();if(!h||this.element.queue("tabs").length!==0&&d.data(c,"cache.tabs"))this.element.dequeue("tabs");else{this.lis.eq(b).addClass("ui-state-processing");if(a.spinner){var j=d("span",c);j.data("label.tabs",j.html()).html(a.spinner)}this.xhr=d.ajax(d.extend({},a.ajaxOptions,{url:h,success:function(k,n){e.element.find(e._sanitizeSelector(c.hash)).html(k);e._cleanup();a.cache&&d.data(c,
"cache.tabs",true);e._trigger("load",null,e._ui(e.anchors[b],e.panels[b]));try{a.ajaxOptions.success(k,n)}catch(m){}},error:function(k,n){e._cleanup();e._trigger("load",null,e._ui(e.anchors[b],e.panels[b]));try{a.ajaxOptions.error(k,n,b,c)}catch(m){}}}));e.element.dequeue("tabs");return this}},abort:function(){this.element.queue([]);this.panels.stop(false,true);this.element.queue("tabs",this.element.queue("tabs").splice(-2,2));if(this.xhr){this.xhr.abort();delete this.xhr}this._cleanup();return this},
url:function(b,e){this.anchors.eq(b).removeData("cache.tabs").data("load.tabs",e);return this},length:function(){return this.anchors.length}});d.extend(d.ui.tabs,{version:"1.8.16"});d.extend(d.ui.tabs.prototype,{rotation:null,rotate:function(b,e){var a=this,c=this.options,h=a._rotate||(a._rotate=function(j){clearTimeout(a.rotation);a.rotation=setTimeout(function(){var k=c.selected;a.select(++k<a.anchors.length?k:0)},b);j&&j.stopPropagation()});e=a._unrotate||(a._unrotate=!e?function(j){j.clientX&&
a.rotate(null)}:function(){t=c.selected;h()});if(b){this.element.bind("tabsshow",h);this.anchors.bind(c.event+".tabs",e);h()}else{clearTimeout(a.rotation);this.element.unbind("tabsshow",h);this.anchors.unbind(c.event+".tabs",e);delete this._rotate;delete this._unrotate}return this}})})(jQuery);

;/*
 * jQuery UI Datepicker 1.8.16
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Datepicker
 *
 * Depends:
 *	jquery.ui.core.js
 */
(function(d,C){function M(){this.debug=false;this._curInst=null;this._keyEvent=false;this._disabledInputs=[];this._inDialog=this._datepickerShowing=false;this._mainDivId="ui-datepicker-div";this._inlineClass="ui-datepicker-inline";this._appendClass="ui-datepicker-append";this._triggerClass="ui-datepicker-trigger";this._dialogClass="ui-datepicker-dialog";this._disableClass="ui-datepicker-disabled";this._unselectableClass="ui-datepicker-unselectable";this._currentClass="ui-datepicker-current-day";this._dayOverClass=
"ui-datepicker-days-cell-over";this.regional=[];this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su",
"Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:false,showMonthAfterYear:false,yearSuffix:""};this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:false,hideIfNoPrevNext:false,navigationAsDateFormat:false,gotoCurrent:false,changeMonth:false,changeYear:false,yearRange:"c-10:c+10",showOtherMonths:false,selectOtherMonths:false,showWeek:false,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",
minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:true,showButtonPanel:false,autoSize:false,disabled:false};d.extend(this._defaults,this.regional[""]);this.dpDiv=N(d('<div id="'+this._mainDivId+'" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'))}function N(a){return a.bind("mouseout",
function(b){b=d(b.target).closest("button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a");b.length&&b.removeClass("ui-state-hover ui-datepicker-prev-hover ui-datepicker-next-hover")}).bind("mouseover",function(b){b=d(b.target).closest("button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a");if(!(d.datepicker._isDisabledDatepicker(J.inline?a.parent()[0]:J.input[0])||!b.length)){b.parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover");
b.addClass("ui-state-hover");b.hasClass("ui-datepicker-prev")&&b.addClass("ui-datepicker-prev-hover");b.hasClass("ui-datepicker-next")&&b.addClass("ui-datepicker-next-hover")}})}function H(a,b){d.extend(a,b);for(var c in b)if(b[c]==null||b[c]==C)a[c]=b[c];return a}d.extend(d.ui,{datepicker:{version:"1.8.16"}});var B=(new Date).getTime(),J;d.extend(M.prototype,{markerClassName:"hasDatepicker",maxRows:4,log:function(){this.debug&&console.log.apply("",arguments)},_widgetDatepicker:function(){return this.dpDiv},
setDefaults:function(a){H(this._defaults,a||{});return this},_attachDatepicker:function(a,b){var c=null;for(var e in this._defaults){var f=a.getAttribute("date:"+e);if(f){c=c||{};try{c[e]=eval(f)}catch(h){c[e]=f}}}e=a.nodeName.toLowerCase();f=e=="div"||e=="span";if(!a.id){this.uuid+=1;a.id="dp"+this.uuid}var i=this._newInst(d(a),f);i.settings=d.extend({},b||{},c||{});if(e=="input")this._connectDatepicker(a,i);else f&&this._inlineDatepicker(a,i)},_newInst:function(a,b){return{id:a[0].id.replace(/([^A-Za-z0-9_-])/g,
"\\\\$1"),input:a,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:b,dpDiv:!b?this.dpDiv:N(d('<div class="'+this._inlineClass+' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'))}},_connectDatepicker:function(a,b){var c=d(a);b.append=d([]);b.trigger=d([]);if(!c.hasClass(this.markerClassName)){this._attachments(c,b);c.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp).bind("setData.datepicker",
function(e,f,h){b.settings[f]=h}).bind("getData.datepicker",function(e,f){return this._get(b,f)});this._autoSize(b);d.data(a,"datepicker",b);b.settings.disabled&&this._disableDatepicker(a)}},_attachments:function(a,b){var c=this._get(b,"appendText"),e=this._get(b,"isRTL");b.append&&b.append.remove();if(c){b.append=d('<span class="'+this._appendClass+'">'+c+"</span>");a[e?"before":"after"](b.append)}a.unbind("focus",this._showDatepicker);b.trigger&&b.trigger.remove();c=this._get(b,"showOn");if(c==
"focus"||c=="both")a.focus(this._showDatepicker);if(c=="button"||c=="both"){c=this._get(b,"buttonText");var f=this._get(b,"buttonImage");b.trigger=d(this._get(b,"buttonImageOnly")?d("<img/>").addClass(this._triggerClass).attr({src:f,alt:c,title:c}):d('<button type="button"></button>').addClass(this._triggerClass).html(f==""?c:d("<img/>").attr({src:f,alt:c,title:c})));a[e?"before":"after"](b.trigger);b.trigger.click(function(){d.datepicker._datepickerShowing&&d.datepicker._lastInput==a[0]?d.datepicker._hideDatepicker():
d.datepicker._showDatepicker(a[0]);return false})}},_autoSize:function(a){if(this._get(a,"autoSize")&&!a.inline){var b=new Date(2009,11,20),c=this._get(a,"dateFormat");if(c.match(/[DM]/)){var e=function(f){for(var h=0,i=0,g=0;g<f.length;g++)if(f[g].length>h){h=f[g].length;i=g}return i};b.setMonth(e(this._get(a,c.match(/MM/)?"monthNames":"monthNamesShort")));b.setDate(e(this._get(a,c.match(/DD/)?"dayNames":"dayNamesShort"))+20-b.getDay())}a.input.attr("size",this._formatDate(a,b).length)}},_inlineDatepicker:function(a,
b){var c=d(a);if(!c.hasClass(this.markerClassName)){c.addClass(this.markerClassName).append(b.dpDiv).bind("setData.datepicker",function(e,f,h){b.settings[f]=h}).bind("getData.datepicker",function(e,f){return this._get(b,f)});d.data(a,"datepicker",b);this._setDate(b,this._getDefaultDate(b),true);this._updateDatepicker(b);this._updateAlternate(b);b.settings.disabled&&this._disableDatepicker(a);b.dpDiv.css("display","block")}},_dialogDatepicker:function(a,b,c,e,f){a=this._dialogInst;if(!a){this.uuid+=
1;this._dialogInput=d('<input type="text" id="'+("dp"+this.uuid)+'" style="position: absolute; top: -100px; width: 0px; z-index: -10;"/>');this._dialogInput.keydown(this._doKeyDown);d("body").append(this._dialogInput);a=this._dialogInst=this._newInst(this._dialogInput,false);a.settings={};d.data(this._dialogInput[0],"datepicker",a)}H(a.settings,e||{});b=b&&b.constructor==Date?this._formatDate(a,b):b;this._dialogInput.val(b);this._pos=f?f.length?f:[f.pageX,f.pageY]:null;if(!this._pos)this._pos=[document.documentElement.clientWidth/
2-100+(document.documentElement.scrollLeft||document.body.scrollLeft),document.documentElement.clientHeight/2-150+(document.documentElement.scrollTop||document.body.scrollTop)];this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px");a.settings.onSelect=c;this._inDialog=true;this.dpDiv.addClass(this._dialogClass);this._showDatepicker(this._dialogInput[0]);d.blockUI&&d.blockUI(this.dpDiv);d.data(this._dialogInput[0],"datepicker",a);return this},_destroyDatepicker:function(a){var b=
d(a),c=d.data(a,"datepicker");if(b.hasClass(this.markerClassName)){var e=a.nodeName.toLowerCase();d.removeData(a,"datepicker");if(e=="input"){c.append.remove();c.trigger.remove();b.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)}else if(e=="div"||e=="span")b.removeClass(this.markerClassName).empty()}},_enableDatepicker:function(a){var b=d(a),c=d.data(a,"datepicker");if(b.hasClass(this.markerClassName)){var e=
a.nodeName.toLowerCase();if(e=="input"){a.disabled=false;c.trigger.filter("button").each(function(){this.disabled=false}).end().filter("img").css({opacity:"1.0",cursor:""})}else if(e=="div"||e=="span"){b=b.children("."+this._inlineClass);b.children().removeClass("ui-state-disabled");b.find("select.ui-datepicker-month, select.ui-datepicker-year").removeAttr("disabled")}this._disabledInputs=d.map(this._disabledInputs,function(f){return f==a?null:f})}},_disableDatepicker:function(a){var b=d(a),c=d.data(a,
"datepicker");if(b.hasClass(this.markerClassName)){var e=a.nodeName.toLowerCase();if(e=="input"){a.disabled=true;c.trigger.filter("button").each(function(){this.disabled=true}).end().filter("img").css({opacity:"0.5",cursor:"default"})}else if(e=="div"||e=="span"){b=b.children("."+this._inlineClass);b.children().addClass("ui-state-disabled");b.find("select.ui-datepicker-month, select.ui-datepicker-year").attr("disabled","disabled")}this._disabledInputs=d.map(this._disabledInputs,function(f){return f==
a?null:f});this._disabledInputs[this._disabledInputs.length]=a}},_isDisabledDatepicker:function(a){if(!a)return false;for(var b=0;b<this._disabledInputs.length;b++)if(this._disabledInputs[b]==a)return true;return false},_getInst:function(a){try{return d.data(a,"datepicker")}catch(b){throw"Missing instance data for this datepicker";}},_optionDatepicker:function(a,b,c){var e=this._getInst(a);if(arguments.length==2&&typeof b=="string")return b=="defaults"?d.extend({},d.datepicker._defaults):e?b=="all"?
d.extend({},e.settings):this._get(e,b):null;var f=b||{};if(typeof b=="string"){f={};f[b]=c}if(e){this._curInst==e&&this._hideDatepicker();var h=this._getDateDatepicker(a,true),i=this._getMinMaxDate(e,"min"),g=this._getMinMaxDate(e,"max");H(e.settings,f);if(i!==null&&f.dateFormat!==C&&f.minDate===C)e.settings.minDate=this._formatDate(e,i);if(g!==null&&f.dateFormat!==C&&f.maxDate===C)e.settings.maxDate=this._formatDate(e,g);this._attachments(d(a),e);this._autoSize(e);this._setDate(e,h);this._updateAlternate(e);
this._updateDatepicker(e)}},_changeDatepicker:function(a,b,c){this._optionDatepicker(a,b,c)},_refreshDatepicker:function(a){(a=this._getInst(a))&&this._updateDatepicker(a)},_setDateDatepicker:function(a,b){if(a=this._getInst(a)){this._setDate(a,b);this._updateDatepicker(a);this._updateAlternate(a)}},_getDateDatepicker:function(a,b){(a=this._getInst(a))&&!a.inline&&this._setDateFromField(a,b);return a?this._getDate(a):null},_doKeyDown:function(a){var b=d.datepicker._getInst(a.target),c=true,e=b.dpDiv.is(".ui-datepicker-rtl");
b._keyEvent=true;if(d.datepicker._datepickerShowing)switch(a.keyCode){case 9:d.datepicker._hideDatepicker();c=false;break;case 13:c=d("td."+d.datepicker._dayOverClass+":not(."+d.datepicker._currentClass+")",b.dpDiv);c[0]&&d.datepicker._selectDay(a.target,b.selectedMonth,b.selectedYear,c[0]);if(a=d.datepicker._get(b,"onSelect")){c=d.datepicker._formatDate(b);a.apply(b.input?b.input[0]:null,[c,b])}else d.datepicker._hideDatepicker();return false;case 27:d.datepicker._hideDatepicker();break;case 33:d.datepicker._adjustDate(a.target,
a.ctrlKey?-d.datepicker._get(b,"stepBigMonths"):-d.datepicker._get(b,"stepMonths"),"M");break;case 34:d.datepicker._adjustDate(a.target,a.ctrlKey?+d.datepicker._get(b,"stepBigMonths"):+d.datepicker._get(b,"stepMonths"),"M");break;case 35:if(a.ctrlKey||a.metaKey)d.datepicker._clearDate(a.target);c=a.ctrlKey||a.metaKey;break;case 36:if(a.ctrlKey||a.metaKey)d.datepicker._gotoToday(a.target);c=a.ctrlKey||a.metaKey;break;case 37:if(a.ctrlKey||a.metaKey)d.datepicker._adjustDate(a.target,e?+1:-1,"D");c=
a.ctrlKey||a.metaKey;if(a.originalEvent.altKey)d.datepicker._adjustDate(a.target,a.ctrlKey?-d.datepicker._get(b,"stepBigMonths"):-d.datepicker._get(b,"stepMonths"),"M");break;case 38:if(a.ctrlKey||a.metaKey)d.datepicker._adjustDate(a.target,-7,"D");c=a.ctrlKey||a.metaKey;break;case 39:if(a.ctrlKey||a.metaKey)d.datepicker._adjustDate(a.target,e?-1:+1,"D");c=a.ctrlKey||a.metaKey;if(a.originalEvent.altKey)d.datepicker._adjustDate(a.target,a.ctrlKey?+d.datepicker._get(b,"stepBigMonths"):+d.datepicker._get(b,
"stepMonths"),"M");break;case 40:if(a.ctrlKey||a.metaKey)d.datepicker._adjustDate(a.target,+7,"D");c=a.ctrlKey||a.metaKey;break;default:c=false}else if(a.keyCode==36&&a.ctrlKey)d.datepicker._showDatepicker(this);else c=false;if(c){a.preventDefault();a.stopPropagation()}},_doKeyPress:function(a){var b=d.datepicker._getInst(a.target);if(d.datepicker._get(b,"constrainInput")){b=d.datepicker._possibleChars(d.datepicker._get(b,"dateFormat"));var c=String.fromCharCode(a.charCode==C?a.keyCode:a.charCode);
return a.ctrlKey||a.metaKey||c<" "||!b||b.indexOf(c)>-1}},_doKeyUp:function(a){a=d.datepicker._getInst(a.target);if(a.input.val()!=a.lastVal)try{if(d.datepicker.parseDate(d.datepicker._get(a,"dateFormat"),a.input?a.input.val():null,d.datepicker._getFormatConfig(a))){d.datepicker._setDateFromField(a);d.datepicker._updateAlternate(a);d.datepicker._updateDatepicker(a)}}catch(b){d.datepicker.log(b)}return true},_showDatepicker:function(a){a=a.target||a;if(a.nodeName.toLowerCase()!="input")a=d("input",
a.parentNode)[0];if(!(d.datepicker._isDisabledDatepicker(a)||d.datepicker._lastInput==a)){var b=d.datepicker._getInst(a);if(d.datepicker._curInst&&d.datepicker._curInst!=b){d.datepicker._datepickerShowing&&d.datepicker._triggerOnClose(d.datepicker._curInst);d.datepicker._curInst.dpDiv.stop(true,true)}var c=d.datepicker._get(b,"beforeShow");c=c?c.apply(a,[a,b]):{};if(c!==false){H(b.settings,c);b.lastVal=null;d.datepicker._lastInput=a;d.datepicker._setDateFromField(b);if(d.datepicker._inDialog)a.value=
"";if(!d.datepicker._pos){d.datepicker._pos=d.datepicker._findPos(a);d.datepicker._pos[1]+=a.offsetHeight}var e=false;d(a).parents().each(function(){e|=d(this).css("position")=="fixed";return!e});if(e&&d.browser.opera){d.datepicker._pos[0]-=document.documentElement.scrollLeft;d.datepicker._pos[1]-=document.documentElement.scrollTop}c={left:d.datepicker._pos[0],top:d.datepicker._pos[1]};d.datepicker._pos=null;b.dpDiv.empty();b.dpDiv.css({position:"absolute",display:"block",top:"-1000px"});d.datepicker._updateDatepicker(b);
c=d.datepicker._checkOffset(b,c,e);b.dpDiv.css({position:d.datepicker._inDialog&&d.blockUI?"static":e?"fixed":"absolute",display:"none",left:c.left+"px",top:c.top+"px"});if(!b.inline){c=d.datepicker._get(b,"showAnim");var f=d.datepicker._get(b,"duration"),h=function(){var i=b.dpDiv.find("iframe.ui-datepicker-cover");if(i.length){var g=d.datepicker._getBorders(b.dpDiv);i.css({left:-g[0],top:-g[1],width:b.dpDiv.outerWidth(),height:b.dpDiv.outerHeight()})}};b.dpDiv.zIndex(d(a).zIndex()+1);d.datepicker._datepickerShowing=
true;d.effects&&d.effects[c]?b.dpDiv.show(c,d.datepicker._get(b,"showOptions"),f,h):b.dpDiv[c||"show"](c?f:null,h);if(!c||!f)h();b.input.is(":visible")&&!b.input.is(":disabled")&&b.input.focus();d.datepicker._curInst=b}}}},_updateDatepicker:function(a){this.maxRows=4;var b=d.datepicker._getBorders(a.dpDiv);J=a;a.dpDiv.empty().append(this._generateHTML(a));var c=a.dpDiv.find("iframe.ui-datepicker-cover");c.length&&c.css({left:-b[0],top:-b[1],width:a.dpDiv.outerWidth(),height:a.dpDiv.outerHeight()});
a.dpDiv.find("."+this._dayOverClass+" a").mouseover();b=this._getNumberOfMonths(a);c=b[1];a.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("");c>1&&a.dpDiv.addClass("ui-datepicker-multi-"+c).css("width",17*c+"em");a.dpDiv[(b[0]!=1||b[1]!=1?"add":"remove")+"Class"]("ui-datepicker-multi");a.dpDiv[(this._get(a,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl");a==d.datepicker._curInst&&d.datepicker._datepickerShowing&&a.input&&a.input.is(":visible")&&
!a.input.is(":disabled")&&a.input[0]!=document.activeElement&&a.input.focus();if(a.yearshtml){var e=a.yearshtml;setTimeout(function(){e===a.yearshtml&&a.yearshtml&&a.dpDiv.find("select.ui-datepicker-year:first").replaceWith(a.yearshtml);e=a.yearshtml=null},0)}},_getBorders:function(a){var b=function(c){return{thin:1,medium:2,thick:3}[c]||c};return[parseFloat(b(a.css("border-left-width"))),parseFloat(b(a.css("border-top-width")))]},_checkOffset:function(a,b,c){var e=a.dpDiv.outerWidth(),f=a.dpDiv.outerHeight(),
h=a.input?a.input.outerWidth():0,i=a.input?a.input.outerHeight():0,g=document.documentElement.clientWidth+d(document).scrollLeft(),j=document.documentElement.clientHeight+d(document).scrollTop();b.left-=this._get(a,"isRTL")?e-h:0;b.left-=c&&b.left==a.input.offset().left?d(document).scrollLeft():0;b.top-=c&&b.top==a.input.offset().top+i?d(document).scrollTop():0;b.left-=Math.min(b.left,b.left+e>g&&g>e?Math.abs(b.left+e-g):0);b.top-=Math.min(b.top,b.top+f>j&&j>f?Math.abs(f+i):0);return b},_findPos:function(a){for(var b=
this._get(this._getInst(a),"isRTL");a&&(a.type=="hidden"||a.nodeType!=1||d.expr.filters.hidden(a));)a=a[b?"previousSibling":"nextSibling"];a=d(a).offset();return[a.left,a.top]},_triggerOnClose:function(a){var b=this._get(a,"onClose");if(b)b.apply(a.input?a.input[0]:null,[a.input?a.input.val():"",a])},_hideDatepicker:function(a){var b=this._curInst;if(!(!b||a&&b!=d.data(a,"datepicker")))if(this._datepickerShowing){a=this._get(b,"showAnim");var c=this._get(b,"duration"),e=function(){d.datepicker._tidyDialog(b);
this._curInst=null};d.effects&&d.effects[a]?b.dpDiv.hide(a,d.datepicker._get(b,"showOptions"),c,e):b.dpDiv[a=="slideDown"?"slideUp":a=="fadeIn"?"fadeOut":"hide"](a?c:null,e);a||e();d.datepicker._triggerOnClose(b);this._datepickerShowing=false;this._lastInput=null;if(this._inDialog){this._dialogInput.css({position:"absolute",left:"0",top:"-100px"});if(d.blockUI){d.unblockUI();d("body").append(this.dpDiv)}}this._inDialog=false}},_tidyDialog:function(a){a.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},
_checkExternalClick:function(a){if(d.datepicker._curInst){a=d(a.target);a[0].id!=d.datepicker._mainDivId&&a.parents("#"+d.datepicker._mainDivId).length==0&&!a.hasClass(d.datepicker.markerClassName)&&!a.hasClass(d.datepicker._triggerClass)&&d.datepicker._datepickerShowing&&!(d.datepicker._inDialog&&d.blockUI)&&d.datepicker._hideDatepicker()}},_adjustDate:function(a,b,c){a=d(a);var e=this._getInst(a[0]);if(!this._isDisabledDatepicker(a[0])){this._adjustInstDate(e,b+(c=="M"?this._get(e,"showCurrentAtPos"):
0),c);this._updateDatepicker(e)}},_gotoToday:function(a){a=d(a);var b=this._getInst(a[0]);if(this._get(b,"gotoCurrent")&&b.currentDay){b.selectedDay=b.currentDay;b.drawMonth=b.selectedMonth=b.currentMonth;b.drawYear=b.selectedYear=b.currentYear}else{var c=new Date;b.selectedDay=c.getDate();b.drawMonth=b.selectedMonth=c.getMonth();b.drawYear=b.selectedYear=c.getFullYear()}this._notifyChange(b);this._adjustDate(a)},_selectMonthYear:function(a,b,c){a=d(a);var e=this._getInst(a[0]);e["selected"+(c=="M"?
"Month":"Year")]=e["draw"+(c=="M"?"Month":"Year")]=parseInt(b.options[b.selectedIndex].value,10);this._notifyChange(e);this._adjustDate(a)},_selectDay:function(a,b,c,e){var f=d(a);if(!(d(e).hasClass(this._unselectableClass)||this._isDisabledDatepicker(f[0]))){f=this._getInst(f[0]);f.selectedDay=f.currentDay=d("a",e).html();f.selectedMonth=f.currentMonth=b;f.selectedYear=f.currentYear=c;this._selectDate(a,this._formatDate(f,f.currentDay,f.currentMonth,f.currentYear))}},_clearDate:function(a){a=d(a);
this._getInst(a[0]);this._selectDate(a,"")},_selectDate:function(a,b){a=this._getInst(d(a)[0]);b=b!=null?b:this._formatDate(a);a.input&&a.input.val(b);this._updateAlternate(a);var c=this._get(a,"onSelect");if(c)c.apply(a.input?a.input[0]:null,[b,a]);else a.input&&a.input.trigger("change");if(a.inline)this._updateDatepicker(a);else{this._hideDatepicker();this._lastInput=a.input[0];typeof a.input[0]!="object"&&a.input.focus();this._lastInput=null}},_updateAlternate:function(a){var b=this._get(a,"altField");
if(b){var c=this._get(a,"altFormat")||this._get(a,"dateFormat"),e=this._getDate(a),f=this.formatDate(c,e,this._getFormatConfig(a));d(b).each(function(){d(this).val(f)})}},noWeekends:function(a){a=a.getDay();return[a>0&&a<6,""]},iso8601Week:function(a){a=new Date(a.getTime());a.setDate(a.getDate()+4-(a.getDay()||7));var b=a.getTime();a.setMonth(0);a.setDate(1);return Math.floor(Math.round((b-a)/864E5)/7)+1},parseDate:function(a,b,c){if(a==null||b==null)throw"Invalid arguments";b=typeof b=="object"?
b.toString():b+"";if(b=="")return null;var e=(c?c.shortYearCutoff:null)||this._defaults.shortYearCutoff;e=typeof e!="string"?e:(new Date).getFullYear()%100+parseInt(e,10);for(var f=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,h=(c?c.dayNames:null)||this._defaults.dayNames,i=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort,g=(c?c.monthNames:null)||this._defaults.monthNames,j=c=-1,l=-1,u=-1,k=false,o=function(p){(p=A+1<a.length&&a.charAt(A+1)==p)&&A++;return p},m=function(p){var D=
o(p);p=new RegExp("^\\d{1,"+(p=="@"?14:p=="!"?20:p=="y"&&D?4:p=="o"?3:2)+"}");p=b.substring(q).match(p);if(!p)throw"Missing number at position "+q;q+=p[0].length;return parseInt(p[0],10)},n=function(p,D,K){p=d.map(o(p)?K:D,function(w,x){return[[x,w]]}).sort(function(w,x){return-(w[1].length-x[1].length)});var E=-1;d.each(p,function(w,x){w=x[1];if(b.substr(q,w.length).toLowerCase()==w.toLowerCase()){E=x[0];q+=w.length;return false}});if(E!=-1)return E+1;else throw"Unknown name at position "+q;},s=
function(){if(b.charAt(q)!=a.charAt(A))throw"Unexpected literal at position "+q;q++},q=0,A=0;A<a.length;A++)if(k)if(a.charAt(A)=="'"&&!o("'"))k=false;else s();else switch(a.charAt(A)){case "d":l=m("d");break;case "D":n("D",f,h);break;case "o":u=m("o");break;case "m":j=m("m");break;case "M":j=n("M",i,g);break;case "y":c=m("y");break;case "@":var v=new Date(m("@"));c=v.getFullYear();j=v.getMonth()+1;l=v.getDate();break;case "!":v=new Date((m("!")-this._ticksTo1970)/1E4);c=v.getFullYear();j=v.getMonth()+
1;l=v.getDate();break;case "'":if(o("'"))s();else k=true;break;default:s()}if(q<b.length)throw"Extra/unparsed characters found in date: "+b.substring(q);if(c==-1)c=(new Date).getFullYear();else if(c<100)c+=(new Date).getFullYear()-(new Date).getFullYear()%100+(c<=e?0:-100);if(u>-1){j=1;l=u;do{e=this._getDaysInMonth(c,j-1);if(l<=e)break;j++;l-=e}while(1)}v=this._daylightSavingAdjust(new Date(c,j-1,l));if(v.getFullYear()!=c||v.getMonth()+1!=j||v.getDate()!=l)throw"Invalid date";return v},ATOM:"yy-mm-dd",
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",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925))*24*60*60*1E7,formatDate:function(a,b,c){if(!b)return"";var e=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,f=(c?c.dayNames:null)||this._defaults.dayNames,h=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort;c=(c?c.monthNames:
null)||this._defaults.monthNames;var i=function(o){(o=k+1<a.length&&a.charAt(k+1)==o)&&k++;return o},g=function(o,m,n){m=""+m;if(i(o))for(;m.length<n;)m="0"+m;return m},j=function(o,m,n,s){return i(o)?s[m]:n[m]},l="",u=false;if(b)for(var k=0;k<a.length;k++)if(u)if(a.charAt(k)=="'"&&!i("'"))u=false;else l+=a.charAt(k);else switch(a.charAt(k)){case "d":l+=g("d",b.getDate(),2);break;case "D":l+=j("D",b.getDay(),e,f);break;case "o":l+=g("o",Math.round(((new Date(b.getFullYear(),b.getMonth(),b.getDate())).getTime()-
(new Date(b.getFullYear(),0,0)).getTime())/864E5),3);break;case "m":l+=g("m",b.getMonth()+1,2);break;case "M":l+=j("M",b.getMonth(),h,c);break;case "y":l+=i("y")?b.getFullYear():(b.getYear()%100<10?"0":"")+b.getYear()%100;break;case "@":l+=b.getTime();break;case "!":l+=b.getTime()*1E4+this._ticksTo1970;break;case "'":if(i("'"))l+="'";else u=true;break;default:l+=a.charAt(k)}return l},_possibleChars:function(a){for(var b="",c=false,e=function(h){(h=f+1<a.length&&a.charAt(f+1)==h)&&f++;return h},f=
0;f<a.length;f++)if(c)if(a.charAt(f)=="'"&&!e("'"))c=false;else b+=a.charAt(f);else switch(a.charAt(f)){case "d":case "m":case "y":case "@":b+="0123456789";break;case "D":case "M":return null;case "'":if(e("'"))b+="'";else c=true;break;default:b+=a.charAt(f)}return b},_get:function(a,b){return a.settings[b]!==C?a.settings[b]:this._defaults[b]},_setDateFromField:function(a,b){if(a.input.val()!=a.lastVal){var c=this._get(a,"dateFormat"),e=a.lastVal=a.input?a.input.val():null,f,h;f=h=this._getDefaultDate(a);
var i=this._getFormatConfig(a);try{f=this.parseDate(c,e,i)||h}catch(g){this.log(g);e=b?"":e}a.selectedDay=f.getDate();a.drawMonth=a.selectedMonth=f.getMonth();a.drawYear=a.selectedYear=f.getFullYear();a.currentDay=e?f.getDate():0;a.currentMonth=e?f.getMonth():0;a.currentYear=e?f.getFullYear():0;this._adjustInstDate(a)}},_getDefaultDate:function(a){return this._restrictMinMax(a,this._determineDate(a,this._get(a,"defaultDate"),new Date))},_determineDate:function(a,b,c){var e=function(h){var i=new Date;
i.setDate(i.getDate()+h);return i},f=function(h){try{return d.datepicker.parseDate(d.datepicker._get(a,"dateFormat"),h,d.datepicker._getFormatConfig(a))}catch(i){}var g=(h.toLowerCase().match(/^c/)?d.datepicker._getDate(a):null)||new Date,j=g.getFullYear(),l=g.getMonth();g=g.getDate();for(var u=/([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,k=u.exec(h);k;){switch(k[2]||"d"){case "d":case "D":g+=parseInt(k[1],10);break;case "w":case "W":g+=parseInt(k[1],10)*7;break;case "m":case "M":l+=parseInt(k[1],10);g=
Math.min(g,d.datepicker._getDaysInMonth(j,l));break;case "y":case "Y":j+=parseInt(k[1],10);g=Math.min(g,d.datepicker._getDaysInMonth(j,l));break}k=u.exec(h)}return new Date(j,l,g)};if(b=(b=b==null||b===""?c:typeof b=="string"?f(b):typeof b=="number"?isNaN(b)?c:e(b):new Date(b.getTime()))&&b.toString()=="Invalid Date"?c:b){b.setHours(0);b.setMinutes(0);b.setSeconds(0);b.setMilliseconds(0)}return this._daylightSavingAdjust(b)},_daylightSavingAdjust:function(a){if(!a)return null;a.setHours(a.getHours()>
12?a.getHours()+2:0);return a},_setDate:function(a,b,c){var e=!b,f=a.selectedMonth,h=a.selectedYear;b=this._restrictMinMax(a,this._determineDate(a,b,new Date));a.selectedDay=a.currentDay=b.getDate();a.drawMonth=a.selectedMonth=a.currentMonth=b.getMonth();a.drawYear=a.selectedYear=a.currentYear=b.getFullYear();if((f!=a.selectedMonth||h!=a.selectedYear)&&!c)this._notifyChange(a);this._adjustInstDate(a);if(a.input)a.input.val(e?"":this._formatDate(a))},_getDate:function(a){return!a.currentYear||a.input&&
a.input.val()==""?null:this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay))},_generateHTML:function(a){var b=new Date;b=this._daylightSavingAdjust(new Date(b.getFullYear(),b.getMonth(),b.getDate()));var c=this._get(a,"isRTL"),e=this._get(a,"showButtonPanel"),f=this._get(a,"hideIfNoPrevNext"),h=this._get(a,"navigationAsDateFormat"),i=this._getNumberOfMonths(a),g=this._get(a,"showCurrentAtPos"),j=this._get(a,"stepMonths"),l=i[0]!=1||i[1]!=1,u=this._daylightSavingAdjust(!a.currentDay?
new Date(9999,9,9):new Date(a.currentYear,a.currentMonth,a.currentDay)),k=this._getMinMaxDate(a,"min"),o=this._getMinMaxDate(a,"max");g=a.drawMonth-g;var m=a.drawYear;if(g<0){g+=12;m--}if(o){var n=this._daylightSavingAdjust(new Date(o.getFullYear(),o.getMonth()-i[0]*i[1]+1,o.getDate()));for(n=k&&n<k?k:n;this._daylightSavingAdjust(new Date(m,g,1))>n;){g--;if(g<0){g=11;m--}}}a.drawMonth=g;a.drawYear=m;n=this._get(a,"prevText");n=!h?n:this.formatDate(n,this._daylightSavingAdjust(new Date(m,g-j,1)),this._getFormatConfig(a));
n=this._canAdjustMonth(a,-1,m,g)?'<a class="ui-datepicker-prev ui-corner-all" onclick="DP_jQuery_'+B+".datepicker._adjustDate('#"+a.id+"', -"+j+", 'M');\" title=\""+n+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"e":"w")+'">'+n+"</span></a>":f?"":'<a class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="'+n+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"e":"w")+'">'+n+"</span></a>";var s=this._get(a,"nextText");s=!h?s:this.formatDate(s,this._daylightSavingAdjust(new Date(m,
g+j,1)),this._getFormatConfig(a));f=this._canAdjustMonth(a,+1,m,g)?'<a class="ui-datepicker-next ui-corner-all" onclick="DP_jQuery_'+B+".datepicker._adjustDate('#"+a.id+"', +"+j+", 'M');\" title=\""+s+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"w":"e")+'">'+s+"</span></a>":f?"":'<a class="ui-datepicker-next ui-corner-all ui-state-disabled" title="'+s+'"><span class="ui-icon ui-icon-circle-triangle-'+(c?"w":"e")+'">'+s+"</span></a>";j=this._get(a,"currentText");s=this._get(a,"gotoCurrent")&&
a.currentDay?u:b;j=!h?j:this.formatDate(j,s,this._getFormatConfig(a));h=!a.inline?'<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" onclick="DP_jQuery_'+B+'.datepicker._hideDatepicker();">'+this._get(a,"closeText")+"</button>":"";e=e?'<div class="ui-datepicker-buttonpane ui-widget-content">'+(c?h:"")+(this._isInRange(a,s)?'<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" onclick="DP_jQuery_'+
B+".datepicker._gotoToday('#"+a.id+"');\">"+j+"</button>":"")+(c?"":h)+"</div>":"";h=parseInt(this._get(a,"firstDay"),10);h=isNaN(h)?0:h;j=this._get(a,"showWeek");s=this._get(a,"dayNames");this._get(a,"dayNamesShort");var q=this._get(a,"dayNamesMin"),A=this._get(a,"monthNames"),v=this._get(a,"monthNamesShort"),p=this._get(a,"beforeShowDay"),D=this._get(a,"showOtherMonths"),K=this._get(a,"selectOtherMonths");this._get(a,"calculateWeek");for(var E=this._getDefaultDate(a),w="",x=0;x<i[0];x++){var O=
"";this.maxRows=4;for(var G=0;G<i[1];G++){var P=this._daylightSavingAdjust(new Date(m,g,a.selectedDay)),t=" ui-corner-all",y="";if(l){y+='<div class="ui-datepicker-group';if(i[1]>1)switch(G){case 0:y+=" ui-datepicker-group-first";t=" ui-corner-"+(c?"right":"left");break;case i[1]-1:y+=" ui-datepicker-group-last";t=" ui-corner-"+(c?"left":"right");break;default:y+=" ui-datepicker-group-middle";t="";break}y+='">'}y+='<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix'+t+'">'+(/all|left/.test(t)&&
x==0?c?f:n:"")+(/all|right/.test(t)&&x==0?c?n:f:"")+this._generateMonthYearHeader(a,g,m,k,o,x>0||G>0,A,v)+'</div><table class="ui-datepicker-calendar"><thead><tr>';var z=j?'<th class="ui-datepicker-week-col">'+this._get(a,"weekHeader")+"</th>":"";for(t=0;t<7;t++){var r=(t+h)%7;z+="<th"+((t+h+6)%7>=5?' class="ui-datepicker-week-end"':"")+'><span title="'+s[r]+'">'+q[r]+"</span></th>"}y+=z+"</tr></thead><tbody>";z=this._getDaysInMonth(m,g);if(m==a.selectedYear&&g==a.selectedMonth)a.selectedDay=Math.min(a.selectedDay,
z);t=(this._getFirstDayOfMonth(m,g)-h+7)%7;z=Math.ceil((t+z)/7);this.maxRows=z=l?this.maxRows>z?this.maxRows:z:z;r=this._daylightSavingAdjust(new Date(m,g,1-t));for(var Q=0;Q<z;Q++){y+="<tr>";var R=!j?"":'<td class="ui-datepicker-week-col">'+this._get(a,"calculateWeek")(r)+"</td>";for(t=0;t<7;t++){var I=p?p.apply(a.input?a.input[0]:null,[r]):[true,""],F=r.getMonth()!=g,L=F&&!K||!I[0]||k&&r<k||o&&r>o;R+='<td class="'+((t+h+6)%7>=5?" ui-datepicker-week-end":"")+(F?" ui-datepicker-other-month":"")+(r.getTime()==
P.getTime()&&g==a.selectedMonth&&a._keyEvent||E.getTime()==r.getTime()&&E.getTime()==P.getTime()?" "+this._dayOverClass:"")+(L?" "+this._unselectableClass+" ui-state-disabled":"")+(F&&!D?"":" "+I[1]+(r.getTime()==u.getTime()?" "+this._currentClass:"")+(r.getTime()==b.getTime()?" ui-datepicker-today":""))+'"'+((!F||D)&&I[2]?' title="'+I[2]+'"':"")+(L?"":' onclick="DP_jQuery_'+B+".datepicker._selectDay('#"+a.id+"',"+r.getMonth()+","+r.getFullYear()+', this);return false;"')+">"+(F&&!D?"&#xa0;":L?'<span class="ui-state-default">'+
r.getDate()+"</span>":'<a class="ui-state-default'+(r.getTime()==b.getTime()?" ui-state-highlight":"")+(r.getTime()==u.getTime()?" ui-state-active":"")+(F?" ui-priority-secondary":"")+'" href="#">'+r.getDate()+"</a>")+"</td>";r.setDate(r.getDate()+1);r=this._daylightSavingAdjust(r)}y+=R+"</tr>"}g++;if(g>11){g=0;m++}y+="</tbody></table>"+(l?"</div>"+(i[0]>0&&G==i[1]-1?'<div class="ui-datepicker-row-break"></div>':""):"");O+=y}w+=O}w+=e+(d.browser.msie&&parseInt(d.browser.version,10)<7&&!a.inline?'<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>':
"");a._keyEvent=false;return w},_generateMonthYearHeader:function(a,b,c,e,f,h,i,g){var j=this._get(a,"changeMonth"),l=this._get(a,"changeYear"),u=this._get(a,"showMonthAfterYear"),k='<div class="ui-datepicker-title">',o="";if(h||!j)o+='<span class="ui-datepicker-month">'+i[b]+"</span>";else{i=e&&e.getFullYear()==c;var m=f&&f.getFullYear()==c;o+='<select class="ui-datepicker-month" onchange="DP_jQuery_'+B+".datepicker._selectMonthYear('#"+a.id+"', this, 'M');\" >";for(var n=0;n<12;n++)if((!i||n>=e.getMonth())&&
(!m||n<=f.getMonth()))o+='<option value="'+n+'"'+(n==b?' selected="selected"':"")+">"+g[n]+"</option>";o+="</select>"}u||(k+=o+(h||!(j&&l)?"&#xa0;":""));if(!a.yearshtml){a.yearshtml="";if(h||!l)k+='<span class="ui-datepicker-year">'+c+"</span>";else{g=this._get(a,"yearRange").split(":");var s=(new Date).getFullYear();i=function(q){q=q.match(/c[+-].*/)?c+parseInt(q.substring(1),10):q.match(/[+-].*/)?s+parseInt(q,10):parseInt(q,10);return isNaN(q)?s:q};b=i(g[0]);g=Math.max(b,i(g[1]||""));b=e?Math.max(b,
e.getFullYear()):b;g=f?Math.min(g,f.getFullYear()):g;for(a.yearshtml+='<select class="ui-datepicker-year" onchange="DP_jQuery_'+B+".datepicker._selectMonthYear('#"+a.id+"', this, 'Y');\" >";b<=g;b++)a.yearshtml+='<option value="'+b+'"'+(b==c?' selected="selected"':"")+">"+b+"</option>";a.yearshtml+="</select>";k+=a.yearshtml;a.yearshtml=null}}k+=this._get(a,"yearSuffix");if(u)k+=(h||!(j&&l)?"&#xa0;":"")+o;k+="</div>";return k},_adjustInstDate:function(a,b,c){var e=a.drawYear+(c=="Y"?b:0),f=a.drawMonth+
(c=="M"?b:0);b=Math.min(a.selectedDay,this._getDaysInMonth(e,f))+(c=="D"?b:0);e=this._restrictMinMax(a,this._daylightSavingAdjust(new Date(e,f,b)));a.selectedDay=e.getDate();a.drawMonth=a.selectedMonth=e.getMonth();a.drawYear=a.selectedYear=e.getFullYear();if(c=="M"||c=="Y")this._notifyChange(a)},_restrictMinMax:function(a,b){var c=this._getMinMaxDate(a,"min");a=this._getMinMaxDate(a,"max");b=c&&b<c?c:b;return b=a&&b>a?a:b},_notifyChange:function(a){var b=this._get(a,"onChangeMonthYear");if(b)b.apply(a.input?
a.input[0]:null,[a.selectedYear,a.selectedMonth+1,a])},_getNumberOfMonths:function(a){a=this._get(a,"numberOfMonths");return a==null?[1,1]:typeof a=="number"?[1,a]:a},_getMinMaxDate:function(a,b){return this._determineDate(a,this._get(a,b+"Date"),null)},_getDaysInMonth:function(a,b){return 32-this._daylightSavingAdjust(new Date(a,b,32)).getDate()},_getFirstDayOfMonth:function(a,b){return(new Date(a,b,1)).getDay()},_canAdjustMonth:function(a,b,c,e){var f=this._getNumberOfMonths(a);c=this._daylightSavingAdjust(new Date(c,
e+(b<0?b:f[0]*f[1]),1));b<0&&c.setDate(this._getDaysInMonth(c.getFullYear(),c.getMonth()));return this._isInRange(a,c)},_isInRange:function(a,b){var c=this._getMinMaxDate(a,"min");a=this._getMinMaxDate(a,"max");return(!c||b.getTime()>=c.getTime())&&(!a||b.getTime()<=a.getTime())},_getFormatConfig:function(a){var b=this._get(a,"shortYearCutoff");b=typeof b!="string"?b:(new Date).getFullYear()%100+parseInt(b,10);return{shortYearCutoff:b,dayNamesShort:this._get(a,"dayNamesShort"),dayNames:this._get(a,
"dayNames"),monthNamesShort:this._get(a,"monthNamesShort"),monthNames:this._get(a,"monthNames")}},_formatDate:function(a,b,c,e){if(!b){a.currentDay=a.selectedDay;a.currentMonth=a.selectedMonth;a.currentYear=a.selectedYear}b=b?typeof b=="object"?b:this._daylightSavingAdjust(new Date(e,c,b)):this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay));return this.formatDate(this._get(a,"dateFormat"),b,this._getFormatConfig(a))}});d.fn.datepicker=function(a){if(!this.length)return this;
if(!d.datepicker.initialized){d(document).mousedown(d.datepicker._checkExternalClick).find("body").append(d.datepicker.dpDiv);d.datepicker.initialized=true}var b=Array.prototype.slice.call(arguments,1);if(typeof a=="string"&&(a=="isDisabled"||a=="getDate"||a=="widget"))return d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this[0]].concat(b));if(a=="option"&&arguments.length==2&&typeof arguments[1]=="string")return d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this[0]].concat(b));return this.each(function(){typeof a==
"string"?d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this].concat(b)):d.datepicker._attachDatepicker(this,a)})};d.datepicker=new M;d.datepicker.initialized=false;d.datepicker.uuid=(new Date).getTime();d.datepicker.version="1.8.16";window["DP_jQuery_"+B]=d})(jQuery);

/* Russian (UTF-8) initialisation for the jQuery UI date picker plugin. */
/* Written by Andrew Stromnov (stromnov@gmail.com). */
(function($){
	$.datepicker.regional['ru'] = {
		closeText: 'Закрыть',
		prevText: '&#x3c;Пред',
		nextText: 'След&#x3e;',
		currentText: 'Сегодня',
		monthNames: ['Январь','Февраль','Март','Апрель','Май','Июнь',
		'Июль','Август','Сентябрь','Октябрь','Ноябрь','Декабрь'],
		monthNamesShort: ['Янв','Фев','Мар','Апр','Май','Июн',
		'Июл','Авг','Сен','Окт','Ноя','Дек'],
		dayNames: ['воскресенье','понедельник','вторник','среда','четверг','пятница','суббота'],
		dayNamesShort: ['вск','пнд','втр','срд','чтв','птн','сбт'],
		dayNamesMin: ['Вс','Пн','Вт','Ср','Чт','Пт','Сб'],
		weekHeader: 'Нед',
		dateFormat: 'dd.mm.yy',
		firstDay: 1,
		isRTL: false,
		showMonthAfterYear: false,
		yearSuffix: ''};
	$.datepicker.setDefaults($.datepicker.regional['ru']);
})(jQuery);
;/*
 * jQuery UI Effects 1.8.16
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Effects/
 */
jQuery.effects||function(f,j){function m(c){var a;if(c&&c.constructor==Array&&c.length==3)return c;if(a=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(c))return[parseInt(a[1],10),parseInt(a[2],10),parseInt(a[3],10)];if(a=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(c))return[parseFloat(a[1])*2.55,parseFloat(a[2])*2.55,parseFloat(a[3])*2.55];if(a=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(c))return[parseInt(a[1],
16),parseInt(a[2],16),parseInt(a[3],16)];if(a=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(c))return[parseInt(a[1]+a[1],16),parseInt(a[2]+a[2],16),parseInt(a[3]+a[3],16)];if(/rgba\(0, 0, 0, 0\)/.exec(c))return n.transparent;return n[f.trim(c).toLowerCase()]}function s(c,a){var b;do{b=f.curCSS(c,a);if(b!=""&&b!="transparent"||f.nodeName(c,"body"))break;a="backgroundColor"}while(c=c.parentNode);return m(b)}function o(){var c=document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle,
a={},b,d;if(c&&c.length&&c[0]&&c[c[0]])for(var e=c.length;e--;){b=c[e];if(typeof c[b]=="string"){d=b.replace(/\-(\w)/g,function(g,h){return h.toUpperCase()});a[d]=c[b]}}else for(b in c)if(typeof c[b]==="string")a[b]=c[b];return a}function p(c){var a,b;for(a in c){b=c[a];if(b==null||f.isFunction(b)||a in t||/scrollbar/.test(a)||!/color/i.test(a)&&isNaN(parseFloat(b)))delete c[a]}return c}function u(c,a){var b={_:0},d;for(d in a)if(c[d]!=a[d])b[d]=a[d];return b}function k(c,a,b,d){if(typeof c=="object"){d=
a;b=null;a=c;c=a.effect}if(f.isFunction(a)){d=a;b=null;a={}}if(typeof a=="number"||f.fx.speeds[a]){d=b;b=a;a={}}if(f.isFunction(b)){d=b;b=null}a=a||{};b=b||a.duration;b=f.fx.off?0:typeof b=="number"?b:b in f.fx.speeds?f.fx.speeds[b]:f.fx.speeds._default;d=d||a.complete;return[c,a,b,d]}function l(c){if(!c||typeof c==="number"||f.fx.speeds[c])return true;if(typeof c==="string"&&!f.effects[c])return true;return false}f.effects={};f.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor",
"borderTopColor","borderColor","color","outlineColor"],function(c,a){f.fx.step[a]=function(b){if(!b.colorInit){b.start=s(b.elem,a);b.end=m(b.end);b.colorInit=true}b.elem.style[a]="rgb("+Math.max(Math.min(parseInt(b.pos*(b.end[0]-b.start[0])+b.start[0],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[1]-b.start[1])+b.start[1],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[2]-b.start[2])+b.start[2],10),255),0)+")"}});var n={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,
0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,
211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]},q=["add","remove","toggle"],t={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};f.effects.animateClass=function(c,a,b,
d){if(f.isFunction(b)){d=b;b=null}return this.queue(function(){var e=f(this),g=e.attr("style")||" ",h=p(o.call(this)),r,v=e.attr("class");f.each(q,function(w,i){c[i]&&e[i+"Class"](c[i])});r=p(o.call(this));e.attr("class",v);e.animate(u(h,r),{queue:false,duration:a,easing:b,complete:function(){f.each(q,function(w,i){c[i]&&e[i+"Class"](c[i])});if(typeof e.attr("style")=="object"){e.attr("style").cssText="";e.attr("style").cssText=g}else e.attr("style",g);d&&d.apply(this,arguments);f.dequeue(this)}})})};
f.fn.extend({_addClass:f.fn.addClass,addClass:function(c,a,b,d){return a?f.effects.animateClass.apply(this,[{add:c},a,b,d]):this._addClass(c)},_removeClass:f.fn.removeClass,removeClass:function(c,a,b,d){return a?f.effects.animateClass.apply(this,[{remove:c},a,b,d]):this._removeClass(c)},_toggleClass:f.fn.toggleClass,toggleClass:function(c,a,b,d,e){return typeof a=="boolean"||a===j?b?f.effects.animateClass.apply(this,[a?{add:c}:{remove:c},b,d,e]):this._toggleClass(c,a):f.effects.animateClass.apply(this,
[{toggle:c},a,b,d])},switchClass:function(c,a,b,d,e){return f.effects.animateClass.apply(this,[{add:a,remove:c},b,d,e])}});f.extend(f.effects,{version:"1.8.16",save:function(c,a){for(var b=0;b<a.length;b++)a[b]!==null&&c.data("ec.storage."+a[b],c[0].style[a[b]])},restore:function(c,a){for(var b=0;b<a.length;b++)a[b]!==null&&c.css(a[b],c.data("ec.storage."+a[b]))},setMode:function(c,a){if(a=="toggle")a=c.is(":hidden")?"show":"hide";return a},getBaseline:function(c,a){var b;switch(c[0]){case "top":b=
0;break;case "middle":b=0.5;break;case "bottom":b=1;break;default:b=c[0]/a.height}switch(c[1]){case "left":c=0;break;case "center":c=0.5;break;case "right":c=1;break;default:c=c[1]/a.width}return{x:c,y:b}},createWrapper:function(c){if(c.parent().is(".ui-effects-wrapper"))return c.parent();var a={width:c.outerWidth(true),height:c.outerHeight(true),"float":c.css("float")},b=f("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),
d=document.activeElement;c.wrap(b);if(c[0]===d||f.contains(c[0],d))f(d).focus();b=c.parent();if(c.css("position")=="static"){b.css({position:"relative"});c.css({position:"relative"})}else{f.extend(a,{position:c.css("position"),zIndex:c.css("z-index")});f.each(["top","left","bottom","right"],function(e,g){a[g]=c.css(g);if(isNaN(parseInt(a[g],10)))a[g]="auto"});c.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})}return b.css(a).show()},removeWrapper:function(c){var a,b=document.activeElement;
if(c.parent().is(".ui-effects-wrapper")){a=c.parent().replaceWith(c);if(c[0]===b||f.contains(c[0],b))f(b).focus();return a}return c},setTransition:function(c,a,b,d){d=d||{};f.each(a,function(e,g){unit=c.cssUnit(g);if(unit[0]>0)d[g]=unit[0]*b+unit[1]});return d}});f.fn.extend({effect:function(c){var a=k.apply(this,arguments),b={options:a[1],duration:a[2],callback:a[3]};a=b.options.mode;var d=f.effects[c];if(f.fx.off||!d)return a?this[a](b.duration,b.callback):this.each(function(){b.callback&&b.callback.call(this)});
return d.call(this,b)},_show:f.fn.show,show:function(c){if(l(c))return this._show.apply(this,arguments);else{var a=k.apply(this,arguments);a[1].mode="show";return this.effect.apply(this,a)}},_hide:f.fn.hide,hide:function(c){if(l(c))return this._hide.apply(this,arguments);else{var a=k.apply(this,arguments);a[1].mode="hide";return this.effect.apply(this,a)}},__toggle:f.fn.toggle,toggle:function(c){if(l(c)||typeof c==="boolean"||f.isFunction(c))return this.__toggle.apply(this,arguments);else{var a=k.apply(this,
arguments);a[1].mode="toggle";return this.effect.apply(this,a)}},cssUnit:function(c){var a=this.css(c),b=[];f.each(["em","px","%","pt"],function(d,e){if(a.indexOf(e)>0)b=[parseFloat(a),e]});return b}});f.easing.jswing=f.easing.swing;f.extend(f.easing,{def:"easeOutQuad",swing:function(c,a,b,d,e){return f.easing[f.easing.def](c,a,b,d,e)},easeInQuad:function(c,a,b,d,e){return d*(a/=e)*a+b},easeOutQuad:function(c,a,b,d,e){return-d*(a/=e)*(a-2)+b},easeInOutQuad:function(c,a,b,d,e){if((a/=e/2)<1)return d/
2*a*a+b;return-d/2*(--a*(a-2)-1)+b},easeInCubic:function(c,a,b,d,e){return d*(a/=e)*a*a+b},easeOutCubic:function(c,a,b,d,e){return d*((a=a/e-1)*a*a+1)+b},easeInOutCubic:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a+b;return d/2*((a-=2)*a*a+2)+b},easeInQuart:function(c,a,b,d,e){return d*(a/=e)*a*a*a+b},easeOutQuart:function(c,a,b,d,e){return-d*((a=a/e-1)*a*a*a-1)+b},easeInOutQuart:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a*a+b;return-d/2*((a-=2)*a*a*a-2)+b},easeInQuint:function(c,a,b,
d,e){return d*(a/=e)*a*a*a*a+b},easeOutQuint:function(c,a,b,d,e){return d*((a=a/e-1)*a*a*a*a+1)+b},easeInOutQuint:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a*a*a+b;return d/2*((a-=2)*a*a*a*a+2)+b},easeInSine:function(c,a,b,d,e){return-d*Math.cos(a/e*(Math.PI/2))+d+b},easeOutSine:function(c,a,b,d,e){return d*Math.sin(a/e*(Math.PI/2))+b},easeInOutSine:function(c,a,b,d,e){return-d/2*(Math.cos(Math.PI*a/e)-1)+b},easeInExpo:function(c,a,b,d,e){return a==0?b:d*Math.pow(2,10*(a/e-1))+b},easeOutExpo:function(c,
a,b,d,e){return a==e?b+d:d*(-Math.pow(2,-10*a/e)+1)+b},easeInOutExpo:function(c,a,b,d,e){if(a==0)return b;if(a==e)return b+d;if((a/=e/2)<1)return d/2*Math.pow(2,10*(a-1))+b;return d/2*(-Math.pow(2,-10*--a)+2)+b},easeInCirc:function(c,a,b,d,e){return-d*(Math.sqrt(1-(a/=e)*a)-1)+b},easeOutCirc:function(c,a,b,d,e){return d*Math.sqrt(1-(a=a/e-1)*a)+b},easeInOutCirc:function(c,a,b,d,e){if((a/=e/2)<1)return-d/2*(Math.sqrt(1-a*a)-1)+b;return d/2*(Math.sqrt(1-(a-=2)*a)+1)+b},easeInElastic:function(c,a,b,
d,e){c=1.70158;var g=0,h=d;if(a==0)return b;if((a/=e)==1)return b+d;g||(g=e*0.3);if(h<Math.abs(d)){h=d;c=g/4}else c=g/(2*Math.PI)*Math.asin(d/h);return-(h*Math.pow(2,10*(a-=1))*Math.sin((a*e-c)*2*Math.PI/g))+b},easeOutElastic:function(c,a,b,d,e){c=1.70158;var g=0,h=d;if(a==0)return b;if((a/=e)==1)return b+d;g||(g=e*0.3);if(h<Math.abs(d)){h=d;c=g/4}else c=g/(2*Math.PI)*Math.asin(d/h);return h*Math.pow(2,-10*a)*Math.sin((a*e-c)*2*Math.PI/g)+d+b},easeInOutElastic:function(c,a,b,d,e){c=1.70158;var g=
0,h=d;if(a==0)return b;if((a/=e/2)==2)return b+d;g||(g=e*0.3*1.5);if(h<Math.abs(d)){h=d;c=g/4}else c=g/(2*Math.PI)*Math.asin(d/h);if(a<1)return-0.5*h*Math.pow(2,10*(a-=1))*Math.sin((a*e-c)*2*Math.PI/g)+b;return h*Math.pow(2,-10*(a-=1))*Math.sin((a*e-c)*2*Math.PI/g)*0.5+d+b},easeInBack:function(c,a,b,d,e,g){if(g==j)g=1.70158;return d*(a/=e)*a*((g+1)*a-g)+b},easeOutBack:function(c,a,b,d,e,g){if(g==j)g=1.70158;return d*((a=a/e-1)*a*((g+1)*a+g)+1)+b},easeInOutBack:function(c,a,b,d,e,g){if(g==j)g=1.70158;
if((a/=e/2)<1)return d/2*a*a*(((g*=1.525)+1)*a-g)+b;return d/2*((a-=2)*a*(((g*=1.525)+1)*a+g)+2)+b},easeInBounce:function(c,a,b,d,e){return d-f.easing.easeOutBounce(c,e-a,0,d,e)+b},easeOutBounce:function(c,a,b,d,e){return(a/=e)<1/2.75?d*7.5625*a*a+b:a<2/2.75?d*(7.5625*(a-=1.5/2.75)*a+0.75)+b:a<2.5/2.75?d*(7.5625*(a-=2.25/2.75)*a+0.9375)+b:d*(7.5625*(a-=2.625/2.75)*a+0.984375)+b},easeInOutBounce:function(c,a,b,d,e){if(a<e/2)return f.easing.easeInBounce(c,a*2,0,d,e)*0.5+b;return f.easing.easeOutBounce(c,
a*2-e,0,d,e)*0.5+d*0.5+b}})}(jQuery);
;/*
 * jQuery UI Effects Bounce 1.8.16
 *
 * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * http://docs.jquery.com/UI/Effects/Bounce
 *
 * Depends:
 *	jquery.effects.core.js
 */
(function(e){e.effects.bounce=function(b){return this.queue(function(){var a=e(this),l=["position","top","bottom","left","right"],h=e.effects.setMode(a,b.options.mode||"effect"),d=b.options.direction||"up",c=b.options.distance||20,m=b.options.times||5,i=b.duration||250;/show|hide/.test(h)&&l.push("opacity");e.effects.save(a,l);a.show();e.effects.createWrapper(a);var f=d=="up"||d=="down"?"top":"left";d=d=="up"||d=="left"?"pos":"neg";c=b.options.distance||(f=="top"?a.outerHeight({margin:true})/3:a.outerWidth({margin:true})/
3);if(h=="show")a.css("opacity",0).css(f,d=="pos"?-c:c);if(h=="hide")c/=m*2;h!="hide"&&m--;if(h=="show"){var g={opacity:1};g[f]=(d=="pos"?"+=":"-=")+c;a.animate(g,i/2,b.options.easing);c/=2;m--}for(g=0;g<m;g++){var j={},k={};j[f]=(d=="pos"?"-=":"+=")+c;k[f]=(d=="pos"?"+=":"-=")+c;a.animate(j,i/2,b.options.easing).animate(k,i/2,b.options.easing);c=h=="hide"?c*2:c/2}if(h=="hide"){g={opacity:0};g[f]=(d=="pos"?"-=":"+=")+c;a.animate(g,i/2,b.options.easing,function(){a.hide();e.effects.restore(a,l);e.effects.removeWrapper(a);
b.callback&&b.callback.apply(this,arguments)})}else{j={};k={};j[f]=(d=="pos"?"-=":"+=")+c;k[f]=(d=="pos"?"+=":"-=")+c;a.animate(j,i/2,b.options.easing).animate(k,i/2,b.options.easing,function(){e.effects.restore(a,l);e.effects.removeWrapper(a);b.callback&&b.callback.apply(this,arguments)})}a.queue("fx",function(){a.dequeue()});a.dequeue()})}})(jQuery);

/*
 * File:        jquery.dataTables.min.js
 * Version:     1.8.2
 * Author:      Allan Jardine (www.sprymedia.co.uk)
 * Info:        www.datatables.net
 *
 * Copyright 2008-2011 Allan Jardine, all rights reserved.
 *
 * This source file is free software, under either the GPL v2 license or a
 * BSD style license, as supplied with this software.
 *
 * This source file is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details.
 */
(function(i,za,p){i.fn.dataTableSettings=[];var D=i.fn.dataTableSettings;i.fn.dataTableExt={};var n=i.fn.dataTableExt;n.sVersion="1.8.2";n.sErrMode="alert";n.iApiIndex=0;n.oApi={};n.afnFiltering=[];n.aoFeatures=[];n.ofnSearch={};n.afnSortData=[];n.oStdClasses={sPagePrevEnabled:"paginate_enabled_previous",sPagePrevDisabled:"paginate_disabled_previous",sPageNextEnabled:"paginate_enabled_next",sPageNextDisabled:"paginate_disabled_next",sPageJUINext:"",sPageJUIPrev:"",sPageButton:"paginate_button",sPageButtonActive:"paginate_active",
sPageButtonStaticDisabled:"paginate_button paginate_button_disabled",sPageFirst:"first",sPagePrevious:"previous",sPageNext:"next",sPageLast:"last",sStripeOdd:"odd",sStripeEven:"even",sRowEmpty:"dataTables_empty",sWrapper:"dataTables_wrapper",sFilter:"dataTables_filter",sInfo:"dataTables_info",sPaging:"dataTables_paginate paging_",sLength:"dataTables_length",sProcessing:"dataTables_processing",sSortAsc:"sorting_asc",sSortDesc:"sorting_desc",sSortable:"sorting",sSortableAsc:"sorting_asc_disabled",sSortableDesc:"sorting_desc_disabled",
sSortableNone:"sorting_disabled",sSortColumn:"sorting_",sSortJUIAsc:"",sSortJUIDesc:"",sSortJUI:"",sSortJUIAscAllowed:"",sSortJUIDescAllowed:"",sSortJUIWrapper:"",sSortIcon:"",sScrollWrapper:"dataTables_scroll",sScrollHead:"dataTables_scrollHead",sScrollHeadInner:"dataTables_scrollHeadInner",sScrollBody:"dataTables_scrollBody",sScrollFoot:"dataTables_scrollFoot",sScrollFootInner:"dataTables_scrollFootInner",sFooterTH:""};n.oJUIClasses={sPagePrevEnabled:"fg-button ui-button ui-state-default ui-corner-left",
sPagePrevDisabled:"fg-button ui-button ui-state-default ui-corner-left ui-state-disabled",sPageNextEnabled:"fg-button ui-button ui-state-default ui-corner-right",sPageNextDisabled:"fg-button ui-button ui-state-default ui-corner-right ui-state-disabled",sPageJUINext:"ui-icon ui-icon-circle-arrow-e",sPageJUIPrev:"ui-icon ui-icon-circle-arrow-w",sPageButton:"fg-button ui-button ui-state-default",sPageButtonActive:"fg-button ui-button ui-state-default ui-state-disabled",sPageButtonStaticDisabled:"fg-button ui-button ui-state-default ui-state-disabled",
sPageFirst:"first ui-corner-tl ui-corner-bl",sPagePrevious:"previous",sPageNext:"next",sPageLast:"last ui-corner-tr ui-corner-br",sStripeOdd:"odd",sStripeEven:"even",sRowEmpty:"dataTables_empty",sWrapper:"dataTables_wrapper",sFilter:"dataTables_filter",sInfo:"dataTables_info",sPaging:"dataTables_paginate fg-buttonset ui-buttonset fg-buttonset-multi ui-buttonset-multi paging_",sLength:"dataTables_length",sProcessing:"dataTables_processing",sSortAsc:"ui-state-default",sSortDesc:"ui-state-default",sSortable:"ui-state-default",
sSortableAsc:"ui-state-default",sSortableDesc:"ui-state-default",sSortableNone:"ui-state-default",sSortColumn:"sorting_",sSortJUIAsc:"css_right ui-icon ui-icon-triangle-1-n",sSortJUIDesc:"css_right ui-icon ui-icon-triangle-1-s",sSortJUI:"css_right ui-icon ui-icon-carat-2-n-s",sSortJUIAscAllowed:"css_right ui-icon ui-icon-carat-1-n",sSortJUIDescAllowed:"css_right ui-icon ui-icon-carat-1-s",sSortJUIWrapper:"DataTables_sort_wrapper",sSortIcon:"DataTables_sort_icon",sScrollWrapper:"dataTables_scroll",
sScrollHead:"dataTables_scrollHead ui-state-default",sScrollHeadInner:"dataTables_scrollHeadInner",sScrollBody:"dataTables_scrollBody",sScrollFoot:"dataTables_scrollFoot ui-state-default",sScrollFootInner:"dataTables_scrollFootInner",sFooterTH:"ui-state-default"};n.oPagination={two_button:{fnInit:function(g,l,s){var t,w,y;if(g.bJUI){t=p.createElement("a");w=p.createElement("a");y=p.createElement("span");y.className=g.oClasses.sPageJUINext;w.appendChild(y);y=p.createElement("span");y.className=g.oClasses.sPageJUIPrev;
t.appendChild(y)}else{t=p.createElement("div");w=p.createElement("div")}t.className=g.oClasses.sPagePrevDisabled;w.className=g.oClasses.sPageNextDisabled;t.title=g.oLanguage.oPaginate.sPrevious;w.title=g.oLanguage.oPaginate.sNext;l.appendChild(t);l.appendChild(w);i(t).bind("click.DT",function(){g.oApi._fnPageChange(g,"previous")&&s(g)});i(w).bind("click.DT",function(){g.oApi._fnPageChange(g,"next")&&s(g)});i(t).bind("selectstart.DT",function(){return false});i(w).bind("selectstart.DT",function(){return false});
if(g.sTableId!==""&&typeof g.aanFeatures.p=="undefined"){l.setAttribute("id",g.sTableId+"_paginate");t.setAttribute("id",g.sTableId+"_previous");w.setAttribute("id",g.sTableId+"_next")}},fnUpdate:function(g){if(g.aanFeatures.p)for(var l=g.aanFeatures.p,s=0,t=l.length;s<t;s++)if(l[s].childNodes.length!==0){l[s].childNodes[0].className=g._iDisplayStart===0?g.oClasses.sPagePrevDisabled:g.oClasses.sPagePrevEnabled;l[s].childNodes[1].className=g.fnDisplayEnd()==g.fnRecordsDisplay()?g.oClasses.sPageNextDisabled:
g.oClasses.sPageNextEnabled}}},iFullNumbersShowPages:5,full_numbers:{fnInit:function(g,l,s){var t=p.createElement("span"),w=p.createElement("span"),y=p.createElement("span"),F=p.createElement("span"),x=p.createElement("span");t.innerHTML=g.oLanguage.oPaginate.sFirst;w.innerHTML=g.oLanguage.oPaginate.sPrevious;F.innerHTML=g.oLanguage.oPaginate.sNext;x.innerHTML=g.oLanguage.oPaginate.sLast;var v=g.oClasses;t.className=v.sPageButton+" "+v.sPageFirst;w.className=v.sPageButton+" "+v.sPagePrevious;F.className=
v.sPageButton+" "+v.sPageNext;x.className=v.sPageButton+" "+v.sPageLast;l.appendChild(t);l.appendChild(w);l.appendChild(y);l.appendChild(F);l.appendChild(x);i(t).bind("click.DT",function(){g.oApi._fnPageChange(g,"first")&&s(g)});i(w).bind("click.DT",function(){g.oApi._fnPageChange(g,"previous")&&s(g)});i(F).bind("click.DT",function(){g.oApi._fnPageChange(g,"next")&&s(g)});i(x).bind("click.DT",function(){g.oApi._fnPageChange(g,"last")&&s(g)});i("span",l).bind("mousedown.DT",function(){return false}).bind("selectstart.DT",
function(){return false});if(g.sTableId!==""&&typeof g.aanFeatures.p=="undefined"){l.setAttribute("id",g.sTableId+"_paginate");t.setAttribute("id",g.sTableId+"_first");w.setAttribute("id",g.sTableId+"_previous");F.setAttribute("id",g.sTableId+"_next");x.setAttribute("id",g.sTableId+"_last")}},fnUpdate:function(g,l){if(g.aanFeatures.p){var s=n.oPagination.iFullNumbersShowPages,t=Math.floor(s/2),w=Math.ceil(g.fnRecordsDisplay()/g._iDisplayLength),y=Math.ceil(g._iDisplayStart/g._iDisplayLength)+1,F=
"",x,v=g.oClasses;if(w<s){t=1;x=w}else if(y<=t){t=1;x=s}else if(y>=w-t){t=w-s+1;x=w}else{t=y-Math.ceil(s/2)+1;x=t+s-1}for(s=t;s<=x;s++)F+=y!=s?'<span class="'+v.sPageButton+'">'+s+"</span>":'<span class="'+v.sPageButtonActive+'">'+s+"</span>";x=g.aanFeatures.p;var z,$=function(M){g._iDisplayStart=(this.innerHTML*1-1)*g._iDisplayLength;l(g);M.preventDefault()},X=function(){return false};s=0;for(t=x.length;s<t;s++)if(x[s].childNodes.length!==0){z=i("span:eq(2)",x[s]);z.html(F);i("span",z).bind("click.DT",
$).bind("mousedown.DT",X).bind("selectstart.DT",X);z=x[s].getElementsByTagName("span");z=[z[0],z[1],z[z.length-2],z[z.length-1]];i(z).removeClass(v.sPageButton+" "+v.sPageButtonActive+" "+v.sPageButtonStaticDisabled);if(y==1){z[0].className+=" "+v.sPageButtonStaticDisabled;z[1].className+=" "+v.sPageButtonStaticDisabled}else{z[0].className+=" "+v.sPageButton;z[1].className+=" "+v.sPageButton}if(w===0||y==w||g._iDisplayLength==-1){z[2].className+=" "+v.sPageButtonStaticDisabled;z[3].className+=" "+
v.sPageButtonStaticDisabled}else{z[2].className+=" "+v.sPageButton;z[3].className+=" "+v.sPageButton}}}}}};n.oSort={"string-asc":function(g,l){if(typeof g!="string")g="";if(typeof l!="string")l="";g=g.toLowerCase();l=l.toLowerCase();return g<l?-1:g>l?1:0},"string-desc":function(g,l){if(typeof g!="string")g="";if(typeof l!="string")l="";g=g.toLowerCase();l=l.toLowerCase();return g<l?1:g>l?-1:0},"html-asc":function(g,l){g=g.replace(/<.*?>/g,"").toLowerCase();l=l.replace(/<.*?>/g,"").toLowerCase();return g<
l?-1:g>l?1:0},"html-desc":function(g,l){g=g.replace(/<.*?>/g,"").toLowerCase();l=l.replace(/<.*?>/g,"").toLowerCase();return g<l?1:g>l?-1:0},"date-asc":function(g,l){g=Date.parse(g);l=Date.parse(l);if(isNaN(g)||g==="")g=Date.parse("01/01/1970 00:00:00");if(isNaN(l)||l==="")l=Date.parse("01/01/1970 00:00:00");return g-l},"date-desc":function(g,l){g=Date.parse(g);l=Date.parse(l);if(isNaN(g)||g==="")g=Date.parse("01/01/1970 00:00:00");if(isNaN(l)||l==="")l=Date.parse("01/01/1970 00:00:00");return l-
g},"numeric-asc":function(g,l){return(g=="-"||g===""?0:g*1)-(l=="-"||l===""?0:l*1)},"numeric-desc":function(g,l){return(l=="-"||l===""?0:l*1)-(g=="-"||g===""?0:g*1)}};n.aTypes=[function(g){if(typeof g=="number")return"numeric";else if(typeof g!="string")return null;var l,s=false;l=g.charAt(0);if("0123456789-".indexOf(l)==-1)return null;for(var t=1;t<g.length;t++){l=g.charAt(t);if("0123456789.".indexOf(l)==-1)return null;if(l=="."){if(s)return null;s=true}}return"numeric"},function(g){var l=Date.parse(g);
if(l!==null&&!isNaN(l)||typeof g=="string"&&g.length===0)return"date";return null},function(g){if(typeof g=="string"&&g.indexOf("<")!=-1&&g.indexOf(">")!=-1)return"html";return null}];n.fnVersionCheck=function(g){var l=function(x,v){for(;x.length<v;)x+="0";return x},s=n.sVersion.split(".");g=g.split(".");for(var t="",w="",y=0,F=g.length;y<F;y++){t+=l(s[y],3);w+=l(g[y],3)}return parseInt(t,10)>=parseInt(w,10)};n._oExternConfig={iNextUnique:0};i.fn.dataTable=function(g){function l(){this.fnRecordsTotal=
function(){return this.oFeatures.bServerSide?parseInt(this._iRecordsTotal,10):this.aiDisplayMaster.length};this.fnRecordsDisplay=function(){return this.oFeatures.bServerSide?parseInt(this._iRecordsDisplay,10):this.aiDisplay.length};this.fnDisplayEnd=function(){return this.oFeatures.bServerSide?this.oFeatures.bPaginate===false||this._iDisplayLength==-1?this._iDisplayStart+this.aiDisplay.length:Math.min(this._iDisplayStart+this._iDisplayLength,this._iRecordsDisplay):this._iDisplayEnd};this.sInstance=
this.oInstance=null;this.oFeatures={bPaginate:true,bLengthChange:true,bFilter:true,bSort:true,bInfo:true,bAutoWidth:true,bProcessing:false,bSortClasses:true,bStateSave:false,bServerSide:false,bDeferRender:false};this.oScroll={sX:"",sXInner:"",sY:"",bCollapse:false,bInfinite:false,iLoadGap:100,iBarWidth:0,bAutoCss:true};this.aanFeatures=[];this.oLanguage={sProcessing:"Processing...",sLengthMenu:"Show _MENU_ entries",sZeroRecords:"No matching records found",sEmptyTable:"No data available in table",
sLoadingRecords:"Loading...",sInfo:"Showing _START_ to _END_ of _TOTAL_ entries",sInfoEmpty:"Showing 0 to 0 of 0 entries",sInfoFiltered:"(filtered from _MAX_ total entries)",sInfoPostFix:"",sInfoThousands:",",sSearch:"Search:",sUrl:"",oPaginate:{sFirst:"First",sPrevious:"Previous",sNext:"Next",sLast:"Last"},fnInfoCallback:null};this.aoData=[];this.aiDisplay=[];this.aiDisplayMaster=[];this.aoColumns=[];this.aoHeader=[];this.aoFooter=[];this.iNextId=0;this.asDataSearch=[];this.oPreviousSearch={sSearch:"",
bRegex:false,bSmart:true};this.aoPreSearchCols=[];this.aaSorting=[[0,"asc",0]];this.aaSortingFixed=null;this.asStripeClasses=[];this.asDestroyStripes=[];this.sDestroyWidth=0;this.fnFooterCallback=this.fnHeaderCallback=this.fnRowCallback=null;this.aoDrawCallback=[];this.fnInitComplete=this.fnPreDrawCallback=null;this.sTableId="";this.nTableWrapper=this.nTBody=this.nTFoot=this.nTHead=this.nTable=null;this.bInitialised=this.bDeferLoading=false;this.aoOpenRows=[];this.sDom="lfrtip";this.sPaginationType=
"two_button";this.iCookieDuration=7200;this.sCookiePrefix="SpryMedia_DataTables_";this.fnCookieCallback=null;this.aoStateSave=[];this.aoStateLoad=[];this.sAjaxSource=this.oLoadedState=null;this.sAjaxDataProp="aaData";this.bAjaxDataGet=true;this.jqXHR=null;this.fnServerData=function(a,b,c,d){d.jqXHR=i.ajax({url:a,data:b,success:function(f){i(d.oInstance).trigger("xhr",d);c(f)},dataType:"json",cache:false,error:function(f,e){e=="parsererror"&&alert("DataTables warning: JSON data from server could not be parsed. This is caused by a JSON formatting error.")}})};
this.aoServerParams=[];this.fnFormatNumber=function(a){if(a<1E3)return a;else{var b=a+"";a=b.split("");var c="";b=b.length;for(var d=0;d<b;d++){if(d%3===0&&d!==0)c=this.oLanguage.sInfoThousands+c;c=a[b-d-1]+c}}return c};this.aLengthMenu=[10,25,50,100];this.bDrawing=this.iDraw=0;this.iDrawError=-1;this._iDisplayLength=10;this._iDisplayStart=0;this._iDisplayEnd=10;this._iRecordsDisplay=this._iRecordsTotal=0;this.bJUI=false;this.oClasses=n.oStdClasses;this.bSortCellsTop=this.bSorted=this.bFiltered=false;
this.oInit=null;this.aoDestroyCallback=[]}function s(a){return function(){var b=[A(this[n.iApiIndex])].concat(Array.prototype.slice.call(arguments));return n.oApi[a].apply(this,b)}}function t(a){var b,c,d=a.iInitDisplayStart;if(a.bInitialised===false)setTimeout(function(){t(a)},200);else{Aa(a);X(a);M(a,a.aoHeader);a.nTFoot&&M(a,a.aoFooter);K(a,true);a.oFeatures.bAutoWidth&&ga(a);b=0;for(c=a.aoColumns.length;b<c;b++)if(a.aoColumns[b].sWidth!==null)a.aoColumns[b].nTh.style.width=q(a.aoColumns[b].sWidth);
if(a.oFeatures.bSort)R(a);else if(a.oFeatures.bFilter)N(a,a.oPreviousSearch);else{a.aiDisplay=a.aiDisplayMaster.slice();E(a);C(a)}if(a.sAjaxSource!==null&&!a.oFeatures.bServerSide){c=[];ha(a,c);a.fnServerData.call(a.oInstance,a.sAjaxSource,c,function(f){var e=f;if(a.sAjaxDataProp!=="")e=aa(a.sAjaxDataProp)(f);for(b=0;b<e.length;b++)v(a,e[b]);a.iInitDisplayStart=d;if(a.oFeatures.bSort)R(a);else{a.aiDisplay=a.aiDisplayMaster.slice();E(a);C(a)}K(a,false);w(a,f)},a)}else if(!a.oFeatures.bServerSide){K(a,
false);w(a)}}}function w(a,b){a._bInitComplete=true;if(typeof a.fnInitComplete=="function")typeof b!="undefined"?a.fnInitComplete.call(a.oInstance,a,b):a.fnInitComplete.call(a.oInstance,a)}function y(a,b,c){a.oLanguage=i.extend(true,a.oLanguage,b);typeof b.sEmptyTable=="undefined"&&typeof b.sZeroRecords!="undefined"&&o(a.oLanguage,b,"sZeroRecords","sEmptyTable");typeof b.sLoadingRecords=="undefined"&&typeof b.sZeroRecords!="undefined"&&o(a.oLanguage,b,"sZeroRecords","sLoadingRecords");c&&t(a)}function F(a,
b){var c=a.aoColumns.length;b={sType:null,_bAutoType:true,bVisible:true,bSearchable:true,bSortable:true,asSorting:["asc","desc"],sSortingClass:a.oClasses.sSortable,sSortingClassJUI:a.oClasses.sSortJUI,sTitle:b?b.innerHTML:"",sName:"",sWidth:null,sWidthOrig:null,sClass:null,fnRender:null,bUseRendered:true,iDataSort:c,mDataProp:c,fnGetData:null,fnSetData:null,sSortDataType:"std",sDefaultContent:null,sContentPadding:"",nTh:b?b:p.createElement("th"),nTf:null};a.aoColumns.push(b);if(typeof a.aoPreSearchCols[c]==
"undefined"||a.aoPreSearchCols[c]===null)a.aoPreSearchCols[c]={sSearch:"",bRegex:false,bSmart:true};else{if(typeof a.aoPreSearchCols[c].bRegex=="undefined")a.aoPreSearchCols[c].bRegex=true;if(typeof a.aoPreSearchCols[c].bSmart=="undefined")a.aoPreSearchCols[c].bSmart=true}x(a,c,null)}function x(a,b,c){b=a.aoColumns[b];if(typeof c!="undefined"&&c!==null){if(typeof c.sType!="undefined"){b.sType=c.sType;b._bAutoType=false}o(b,c,"bVisible");o(b,c,"bSearchable");o(b,c,"bSortable");o(b,c,"sTitle");o(b,
c,"sName");o(b,c,"sWidth");o(b,c,"sWidth","sWidthOrig");o(b,c,"sClass");o(b,c,"fnRender");o(b,c,"bUseRendered");o(b,c,"iDataSort");o(b,c,"mDataProp");o(b,c,"asSorting");o(b,c,"sSortDataType");o(b,c,"sDefaultContent");o(b,c,"sContentPadding")}b.fnGetData=aa(b.mDataProp);b.fnSetData=Ba(b.mDataProp);if(!a.oFeatures.bSort)b.bSortable=false;if(!b.bSortable||i.inArray("asc",b.asSorting)==-1&&i.inArray("desc",b.asSorting)==-1){b.sSortingClass=a.oClasses.sSortableNone;b.sSortingClassJUI=""}else if(b.bSortable||
i.inArray("asc",b.asSorting)==-1&&i.inArray("desc",b.asSorting)==-1){b.sSortingClass=a.oClasses.sSortable;b.sSortingClassJUI=a.oClasses.sSortJUI}else if(i.inArray("asc",b.asSorting)!=-1&&i.inArray("desc",b.asSorting)==-1){b.sSortingClass=a.oClasses.sSortableAsc;b.sSortingClassJUI=a.oClasses.sSortJUIAscAllowed}else if(i.inArray("asc",b.asSorting)==-1&&i.inArray("desc",b.asSorting)!=-1){b.sSortingClass=a.oClasses.sSortableDesc;b.sSortingClassJUI=a.oClasses.sSortJUIDescAllowed}}function v(a,b){var c;
c=i.isArray(b)?b.slice():i.extend(true,{},b);b=a.aoData.length;var d={nTr:null,_iId:a.iNextId++,_aData:c,_anHidden:[],_sRowStripe:""};a.aoData.push(d);for(var f,e=0,h=a.aoColumns.length;e<h;e++){c=a.aoColumns[e];typeof c.fnRender=="function"&&c.bUseRendered&&c.mDataProp!==null&&O(a,b,e,c.fnRender({iDataRow:b,iDataColumn:e,aData:d._aData,oSettings:a}));if(c._bAutoType&&c.sType!="string"){f=G(a,b,e,"type");if(f!==null&&f!==""){f=ia(f);if(c.sType===null)c.sType=f;else if(c.sType!=f&&c.sType!="html")c.sType=
"string"}}}a.aiDisplayMaster.push(b);a.oFeatures.bDeferRender||z(a,b);return b}function z(a,b){var c=a.aoData[b],d;if(c.nTr===null){c.nTr=p.createElement("tr");typeof c._aData.DT_RowId!="undefined"&&c.nTr.setAttribute("id",c._aData.DT_RowId);typeof c._aData.DT_RowClass!="undefined"&&i(c.nTr).addClass(c._aData.DT_RowClass);for(var f=0,e=a.aoColumns.length;f<e;f++){var h=a.aoColumns[f];d=p.createElement("td");d.innerHTML=typeof h.fnRender=="function"&&(!h.bUseRendered||h.mDataProp===null)?h.fnRender({iDataRow:b,
iDataColumn:f,aData:c._aData,oSettings:a}):G(a,b,f,"display");if(h.sClass!==null)d.className=h.sClass;if(h.bVisible){c.nTr.appendChild(d);c._anHidden[f]=null}else c._anHidden[f]=d}}}function $(a){var b,c,d,f,e,h,j,k,m;if(a.bDeferLoading||a.sAjaxSource===null){j=a.nTBody.childNodes;b=0;for(c=j.length;b<c;b++)if(j[b].nodeName.toUpperCase()=="TR"){k=a.aoData.length;a.aoData.push({nTr:j[b],_iId:a.iNextId++,_aData:[],_anHidden:[],_sRowStripe:""});a.aiDisplayMaster.push(k);h=j[b].childNodes;d=e=0;for(f=
h.length;d<f;d++){m=h[d].nodeName.toUpperCase();if(m=="TD"||m=="TH"){O(a,k,e,i.trim(h[d].innerHTML));e++}}}}j=ba(a);h=[];b=0;for(c=j.length;b<c;b++){d=0;for(f=j[b].childNodes.length;d<f;d++){e=j[b].childNodes[d];m=e.nodeName.toUpperCase();if(m=="TD"||m=="TH")h.push(e)}}h.length!=j.length*a.aoColumns.length&&J(a,1,"Unexpected number of TD elements. Expected "+j.length*a.aoColumns.length+" and got "+h.length+". DataTables does not support rowspan / colspan in the table body, and there must be one cell for each row/column combination.");
d=0;for(f=a.aoColumns.length;d<f;d++){if(a.aoColumns[d].sTitle===null)a.aoColumns[d].sTitle=a.aoColumns[d].nTh.innerHTML;j=a.aoColumns[d]._bAutoType;m=typeof a.aoColumns[d].fnRender=="function";e=a.aoColumns[d].sClass!==null;k=a.aoColumns[d].bVisible;var u,r;if(j||m||e||!k){b=0;for(c=a.aoData.length;b<c;b++){u=h[b*f+d];if(j&&a.aoColumns[d].sType!="string"){r=G(a,b,d,"type");if(r!==""){r=ia(r);if(a.aoColumns[d].sType===null)a.aoColumns[d].sType=r;else if(a.aoColumns[d].sType!=r&&a.aoColumns[d].sType!=
"html")a.aoColumns[d].sType="string"}}if(m){r=a.aoColumns[d].fnRender({iDataRow:b,iDataColumn:d,aData:a.aoData[b]._aData,oSettings:a});u.innerHTML=r;a.aoColumns[d].bUseRendered&&O(a,b,d,r)}if(e)u.className+=" "+a.aoColumns[d].sClass;if(k)a.aoData[b]._anHidden[d]=null;else{a.aoData[b]._anHidden[d]=u;u.parentNode.removeChild(u)}}}}}function X(a){var b,c,d;a.nTHead.getElementsByTagName("tr");if(a.nTHead.getElementsByTagName("th").length!==0){b=0;for(d=a.aoColumns.length;b<d;b++){c=a.aoColumns[b].nTh;
a.aoColumns[b].sClass!==null&&i(c).addClass(a.aoColumns[b].sClass);if(a.aoColumns[b].sTitle!=c.innerHTML)c.innerHTML=a.aoColumns[b].sTitle}}else{var f=p.createElement("tr");b=0;for(d=a.aoColumns.length;b<d;b++){c=a.aoColumns[b].nTh;c.innerHTML=a.aoColumns[b].sTitle;a.aoColumns[b].sClass!==null&&i(c).addClass(a.aoColumns[b].sClass);f.appendChild(c)}i(a.nTHead).html("")[0].appendChild(f);Y(a.aoHeader,a.nTHead)}if(a.bJUI){b=0;for(d=a.aoColumns.length;b<d;b++){c=a.aoColumns[b].nTh;f=p.createElement("div");
f.className=a.oClasses.sSortJUIWrapper;i(c).contents().appendTo(f);var e=p.createElement("span");e.className=a.oClasses.sSortIcon;f.appendChild(e);c.appendChild(f)}}d=function(){this.onselectstart=function(){return false};return false};if(a.oFeatures.bSort)for(b=0;b<a.aoColumns.length;b++)if(a.aoColumns[b].bSortable!==false){ja(a,a.aoColumns[b].nTh,b);i(a.aoColumns[b].nTh).bind("mousedown.DT",d)}else i(a.aoColumns[b].nTh).addClass(a.oClasses.sSortableNone);a.oClasses.sFooterTH!==""&&i(a.nTFoot).children("tr").children("th").addClass(a.oClasses.sFooterTH);
if(a.nTFoot!==null){c=S(a,null,a.aoFooter);b=0;for(d=a.aoColumns.length;b<d;b++)if(typeof c[b]!="undefined")a.aoColumns[b].nTf=c[b]}}function M(a,b,c){var d,f,e,h=[],j=[],k=a.aoColumns.length;if(typeof c=="undefined")c=false;d=0;for(f=b.length;d<f;d++){h[d]=b[d].slice();h[d].nTr=b[d].nTr;for(e=k-1;e>=0;e--)!a.aoColumns[e].bVisible&&!c&&h[d].splice(e,1);j.push([])}d=0;for(f=h.length;d<f;d++){if(h[d].nTr){a=0;for(e=h[d].nTr.childNodes.length;a<e;a++)h[d].nTr.removeChild(h[d].nTr.childNodes[0])}e=0;
for(b=h[d].length;e<b;e++){k=c=1;if(typeof j[d][e]=="undefined"){h[d].nTr.appendChild(h[d][e].cell);for(j[d][e]=1;typeof h[d+c]!="undefined"&&h[d][e].cell==h[d+c][e].cell;){j[d+c][e]=1;c++}for(;typeof h[d][e+k]!="undefined"&&h[d][e].cell==h[d][e+k].cell;){for(a=0;a<c;a++)j[d+a][e+k]=1;k++}h[d][e].cell.rowSpan=c;h[d][e].cell.colSpan=k}}}}function C(a){var b,c,d=[],f=0,e=false;b=a.asStripeClasses.length;c=a.aoOpenRows.length;if(!(a.fnPreDrawCallback!==null&&a.fnPreDrawCallback.call(a.oInstance,a)===
false)){a.bDrawing=true;if(typeof a.iInitDisplayStart!="undefined"&&a.iInitDisplayStart!=-1){a._iDisplayStart=a.oFeatures.bServerSide?a.iInitDisplayStart:a.iInitDisplayStart>=a.fnRecordsDisplay()?0:a.iInitDisplayStart;a.iInitDisplayStart=-1;E(a)}if(a.bDeferLoading){a.bDeferLoading=false;a.iDraw++}else if(a.oFeatures.bServerSide){if(!a.bDestroying&&!Ca(a))return}else a.iDraw++;if(a.aiDisplay.length!==0){var h=a._iDisplayStart,j=a._iDisplayEnd;if(a.oFeatures.bServerSide){h=0;j=a.aoData.length}for(h=
h;h<j;h++){var k=a.aoData[a.aiDisplay[h]];k.nTr===null&&z(a,a.aiDisplay[h]);var m=k.nTr;if(b!==0){var u=a.asStripeClasses[f%b];if(k._sRowStripe!=u){i(m).removeClass(k._sRowStripe).addClass(u);k._sRowStripe=u}}if(typeof a.fnRowCallback=="function"){m=a.fnRowCallback.call(a.oInstance,m,a.aoData[a.aiDisplay[h]]._aData,f,h);if(!m&&!e){J(a,0,"A node was not returned by fnRowCallback");e=true}}d.push(m);f++;if(c!==0)for(k=0;k<c;k++)m==a.aoOpenRows[k].nParent&&d.push(a.aoOpenRows[k].nTr)}}else{d[0]=p.createElement("tr");
if(typeof a.asStripeClasses[0]!="undefined")d[0].className=a.asStripeClasses[0];e=a.oLanguage.sZeroRecords.replace("_MAX_",a.fnFormatNumber(a.fnRecordsTotal()));if(a.iDraw==1&&a.sAjaxSource!==null&&!a.oFeatures.bServerSide)e=a.oLanguage.sLoadingRecords;else if(typeof a.oLanguage.sEmptyTable!="undefined"&&a.fnRecordsTotal()===0)e=a.oLanguage.sEmptyTable;b=p.createElement("td");b.setAttribute("valign","top");b.colSpan=Z(a);b.className=a.oClasses.sRowEmpty;b.innerHTML=e;d[f].appendChild(b)}typeof a.fnHeaderCallback==
"function"&&a.fnHeaderCallback.call(a.oInstance,i(a.nTHead).children("tr")[0],ca(a),a._iDisplayStart,a.fnDisplayEnd(),a.aiDisplay);typeof a.fnFooterCallback=="function"&&a.fnFooterCallback.call(a.oInstance,i(a.nTFoot).children("tr")[0],ca(a),a._iDisplayStart,a.fnDisplayEnd(),a.aiDisplay);f=p.createDocumentFragment();b=p.createDocumentFragment();if(a.nTBody){e=a.nTBody.parentNode;b.appendChild(a.nTBody);if(!a.oScroll.bInfinite||!a._bInitComplete||a.bSorted||a.bFiltered){c=a.nTBody.childNodes;for(b=
c.length-1;b>=0;b--)c[b].parentNode.removeChild(c[b])}b=0;for(c=d.length;b<c;b++)f.appendChild(d[b]);a.nTBody.appendChild(f);e!==null&&e.appendChild(a.nTBody)}for(b=a.aoDrawCallback.length-1;b>=0;b--)a.aoDrawCallback[b].fn.call(a.oInstance,a);i(a.oInstance).trigger("draw",a);a.bSorted=false;a.bFiltered=false;a.bDrawing=false;if(a.oFeatures.bServerSide){K(a,false);typeof a._bInitComplete=="undefined"&&w(a)}}}function da(a){if(a.oFeatures.bSort)R(a,a.oPreviousSearch);else if(a.oFeatures.bFilter)N(a,
a.oPreviousSearch);else{E(a);C(a)}}function Ca(a){if(a.bAjaxDataGet){a.iDraw++;K(a,true);var b=Da(a);ha(a,b);a.fnServerData.call(a.oInstance,a.sAjaxSource,b,function(c){Ea(a,c)},a);return false}else return true}function Da(a){var b=a.aoColumns.length,c=[],d,f;c.push({name:"sEcho",value:a.iDraw});c.push({name:"iColumns",value:b});c.push({name:"sColumns",value:ka(a)});c.push({name:"iDisplayStart",value:a._iDisplayStart});c.push({name:"iDisplayLength",value:a.oFeatures.bPaginate!==false?a._iDisplayLength:
-1});for(f=0;f<b;f++){d=a.aoColumns[f].mDataProp;c.push({name:"mDataProp_"+f,value:typeof d=="function"?"function":d})}if(a.oFeatures.bFilter!==false){c.push({name:"sSearch",value:a.oPreviousSearch.sSearch});c.push({name:"bRegex",value:a.oPreviousSearch.bRegex});for(f=0;f<b;f++){c.push({name:"sSearch_"+f,value:a.aoPreSearchCols[f].sSearch});c.push({name:"bRegex_"+f,value:a.aoPreSearchCols[f].bRegex});c.push({name:"bSearchable_"+f,value:a.aoColumns[f].bSearchable})}}if(a.oFeatures.bSort!==false){d=
a.aaSortingFixed!==null?a.aaSortingFixed.length:0;var e=a.aaSorting.length;c.push({name:"iSortingCols",value:d+e});for(f=0;f<d;f++){c.push({name:"iSortCol_"+f,value:a.aaSortingFixed[f][0]});c.push({name:"sSortDir_"+f,value:a.aaSortingFixed[f][1]})}for(f=0;f<e;f++){c.push({name:"iSortCol_"+(f+d),value:a.aaSorting[f][0]});c.push({name:"sSortDir_"+(f+d),value:a.aaSorting[f][1]})}for(f=0;f<b;f++)c.push({name:"bSortable_"+f,value:a.aoColumns[f].bSortable})}return c}function ha(a,b){for(var c=0,d=a.aoServerParams.length;c<
d;c++)a.aoServerParams[c].fn.call(a.oInstance,b)}function Ea(a,b){if(typeof b.sEcho!="undefined")if(b.sEcho*1<a.iDraw)return;else a.iDraw=b.sEcho*1;if(!a.oScroll.bInfinite||a.oScroll.bInfinite&&(a.bSorted||a.bFiltered))la(a);a._iRecordsTotal=b.iTotalRecords;a._iRecordsDisplay=b.iTotalDisplayRecords;var c=ka(a);if(c=typeof b.sColumns!="undefined"&&c!==""&&b.sColumns!=c)var d=Fa(a,b.sColumns);b=aa(a.sAjaxDataProp)(b);for(var f=0,e=b.length;f<e;f++)if(c){for(var h=[],j=0,k=a.aoColumns.length;j<k;j++)h.push(b[f][d[j]]);
v(a,h)}else v(a,b[f]);a.aiDisplay=a.aiDisplayMaster.slice();a.bAjaxDataGet=false;C(a);a.bAjaxDataGet=true;K(a,false)}function Aa(a){var b=p.createElement("div");a.nTable.parentNode.insertBefore(b,a.nTable);a.nTableWrapper=p.createElement("div");a.nTableWrapper.className=a.oClasses.sWrapper;a.sTableId!==""&&a.nTableWrapper.setAttribute("id",a.sTableId+"_wrapper");a.nTableReinsertBefore=a.nTable.nextSibling;for(var c=a.nTableWrapper,d=a.sDom.split(""),f,e,h,j,k,m,u,r=0;r<d.length;r++){e=0;h=d[r];if(h==
"<"){j=p.createElement("div");k=d[r+1];if(k=="'"||k=='"'){m="";for(u=2;d[r+u]!=k;){m+=d[r+u];u++}if(m=="H")m="fg-toolbar ui-toolbar ui-widget-header ui-corner-tl ui-corner-tr ui-helper-clearfix";else if(m=="F")m="fg-toolbar ui-toolbar ui-widget-header ui-corner-bl ui-corner-br ui-helper-clearfix";if(m.indexOf(".")!=-1){k=m.split(".");j.setAttribute("id",k[0].substr(1,k[0].length-1));j.className=k[1]}else if(m.charAt(0)=="#")j.setAttribute("id",m.substr(1,m.length-1));else j.className=m;r+=u}c.appendChild(j);
c=j}else if(h==">")c=c.parentNode;else if(h=="l"&&a.oFeatures.bPaginate&&a.oFeatures.bLengthChange){f=Ga(a);e=1}else if(h=="f"&&a.oFeatures.bFilter){f=Ha(a);e=1}else if(h=="r"&&a.oFeatures.bProcessing){f=Ia(a);e=1}else if(h=="t"){f=Ja(a);e=1}else if(h=="i"&&a.oFeatures.bInfo){f=Ka(a);e=1}else if(h=="p"&&a.oFeatures.bPaginate){f=La(a);e=1}else if(n.aoFeatures.length!==0){j=n.aoFeatures;u=0;for(k=j.length;u<k;u++)if(h==j[u].cFeature){if(f=j[u].fnInit(a))e=1;break}}if(e==1&&f!==null){if(typeof a.aanFeatures[h]!=
"object")a.aanFeatures[h]=[];a.aanFeatures[h].push(f);c.appendChild(f)}}b.parentNode.replaceChild(a.nTableWrapper,b)}function Ja(a){if(a.oScroll.sX===""&&a.oScroll.sY==="")return a.nTable;var b=p.createElement("div"),c=p.createElement("div"),d=p.createElement("div"),f=p.createElement("div"),e=p.createElement("div"),h=p.createElement("div"),j=a.nTable.cloneNode(false),k=a.nTable.cloneNode(false),m=a.nTable.getElementsByTagName("thead")[0],u=a.nTable.getElementsByTagName("tfoot").length===0?null:a.nTable.getElementsByTagName("tfoot")[0],
r=typeof g.bJQueryUI!="undefined"&&g.bJQueryUI?n.oJUIClasses:n.oStdClasses;c.appendChild(d);e.appendChild(h);f.appendChild(a.nTable);b.appendChild(c);b.appendChild(f);d.appendChild(j);j.appendChild(m);if(u!==null){b.appendChild(e);h.appendChild(k);k.appendChild(u)}b.className=r.sScrollWrapper;c.className=r.sScrollHead;d.className=r.sScrollHeadInner;f.className=r.sScrollBody;e.className=r.sScrollFoot;h.className=r.sScrollFootInner;if(a.oScroll.bAutoCss){c.style.overflow="hidden";c.style.position="relative";
e.style.overflow="hidden";f.style.overflow="auto"}c.style.border="0";c.style.width="100%";e.style.border="0";d.style.width="150%";j.removeAttribute("id");j.style.marginLeft="0";a.nTable.style.marginLeft="0";if(u!==null){k.removeAttribute("id");k.style.marginLeft="0"}d=i(a.nTable).children("caption");h=0;for(k=d.length;h<k;h++)j.appendChild(d[h]);if(a.oScroll.sX!==""){c.style.width=q(a.oScroll.sX);f.style.width=q(a.oScroll.sX);if(u!==null)e.style.width=q(a.oScroll.sX);i(f).scroll(function(){c.scrollLeft=
this.scrollLeft;if(u!==null)e.scrollLeft=this.scrollLeft})}if(a.oScroll.sY!=="")f.style.height=q(a.oScroll.sY);a.aoDrawCallback.push({fn:Ma,sName:"scrolling"});a.oScroll.bInfinite&&i(f).scroll(function(){if(!a.bDrawing)if(i(this).scrollTop()+i(this).height()>i(a.nTable).height()-a.oScroll.iLoadGap)if(a.fnDisplayEnd()<a.fnRecordsDisplay()){ma(a,"next");E(a);C(a)}});a.nScrollHead=c;a.nScrollFoot=e;return b}function Ma(a){var b=a.nScrollHead.getElementsByTagName("div")[0],c=b.getElementsByTagName("table")[0],
d=a.nTable.parentNode,f,e,h,j,k,m,u,r,H=[],L=a.nTFoot!==null?a.nScrollFoot.getElementsByTagName("div")[0]:null,T=a.nTFoot!==null?L.getElementsByTagName("table")[0]:null,B=i.browser.msie&&i.browser.version<=7;h=a.nTable.getElementsByTagName("thead");h.length>0&&a.nTable.removeChild(h[0]);if(a.nTFoot!==null){k=a.nTable.getElementsByTagName("tfoot");k.length>0&&a.nTable.removeChild(k[0])}h=a.nTHead.cloneNode(true);a.nTable.insertBefore(h,a.nTable.childNodes[0]);if(a.nTFoot!==null){k=a.nTFoot.cloneNode(true);
a.nTable.insertBefore(k,a.nTable.childNodes[1])}if(a.oScroll.sX===""){d.style.width="100%";b.parentNode.style.width="100%"}var U=S(a,h);f=0;for(e=U.length;f<e;f++){u=Na(a,f);U[f].style.width=a.aoColumns[u].sWidth}a.nTFoot!==null&&P(function(I){I.style.width=""},k.getElementsByTagName("tr"));f=i(a.nTable).outerWidth();if(a.oScroll.sX===""){a.nTable.style.width="100%";if(B&&(d.scrollHeight>d.offsetHeight||i(d).css("overflow-y")=="scroll"))a.nTable.style.width=q(i(a.nTable).outerWidth()-a.oScroll.iBarWidth)}else if(a.oScroll.sXInner!==
"")a.nTable.style.width=q(a.oScroll.sXInner);else if(f==i(d).width()&&i(d).height()<i(a.nTable).height()){a.nTable.style.width=q(f-a.oScroll.iBarWidth);if(i(a.nTable).outerWidth()>f-a.oScroll.iBarWidth)a.nTable.style.width=q(f)}else a.nTable.style.width=q(f);f=i(a.nTable).outerWidth();e=a.nTHead.getElementsByTagName("tr");h=h.getElementsByTagName("tr");P(function(I,na){m=I.style;m.paddingTop="0";m.paddingBottom="0";m.borderTopWidth="0";m.borderBottomWidth="0";m.height=0;r=i(I).width();na.style.width=
q(r);H.push(r)},h,e);i(h).height(0);if(a.nTFoot!==null){j=k.getElementsByTagName("tr");k=a.nTFoot.getElementsByTagName("tr");P(function(I,na){m=I.style;m.paddingTop="0";m.paddingBottom="0";m.borderTopWidth="0";m.borderBottomWidth="0";m.height=0;r=i(I).width();na.style.width=q(r);H.push(r)},j,k);i(j).height(0)}P(function(I){I.innerHTML="";I.style.width=q(H.shift())},h);a.nTFoot!==null&&P(function(I){I.innerHTML="";I.style.width=q(H.shift())},j);if(i(a.nTable).outerWidth()<f){j=d.scrollHeight>d.offsetHeight||
i(d).css("overflow-y")=="scroll"?f+a.oScroll.iBarWidth:f;if(B&&(d.scrollHeight>d.offsetHeight||i(d).css("overflow-y")=="scroll"))a.nTable.style.width=q(j-a.oScroll.iBarWidth);d.style.width=q(j);b.parentNode.style.width=q(j);if(a.nTFoot!==null)L.parentNode.style.width=q(j);if(a.oScroll.sX==="")J(a,1,"The table cannot fit into the current element which will cause column misalignment. The table has been drawn at its minimum possible width.");else a.oScroll.sXInner!==""&&J(a,1,"The table cannot fit into the current element which will cause column misalignment. Increase the sScrollXInner value or remove it to allow automatic calculation")}else{d.style.width=
q("100%");b.parentNode.style.width=q("100%");if(a.nTFoot!==null)L.parentNode.style.width=q("100%")}if(a.oScroll.sY==="")if(B)d.style.height=q(a.nTable.offsetHeight+a.oScroll.iBarWidth);if(a.oScroll.sY!==""&&a.oScroll.bCollapse){d.style.height=q(a.oScroll.sY);B=a.oScroll.sX!==""&&a.nTable.offsetWidth>d.offsetWidth?a.oScroll.iBarWidth:0;if(a.nTable.offsetHeight<d.offsetHeight)d.style.height=q(i(a.nTable).height()+B)}B=i(a.nTable).outerWidth();c.style.width=q(B);b.style.width=q(B+a.oScroll.iBarWidth);
if(a.nTFoot!==null){L.style.width=q(a.nTable.offsetWidth+a.oScroll.iBarWidth);T.style.width=q(a.nTable.offsetWidth)}if(a.bSorted||a.bFiltered)d.scrollTop=0}function ea(a){if(a.oFeatures.bAutoWidth===false)return false;ga(a);for(var b=0,c=a.aoColumns.length;b<c;b++)a.aoColumns[b].nTh.style.width=a.aoColumns[b].sWidth}function Ha(a){var b=a.oLanguage.sSearch;b=b.indexOf("_INPUT_")!==-1?b.replace("_INPUT_",'<input type="text" />'):b===""?'<input type="text" />':b+' <input type="text" />';var c=p.createElement("div");
c.className=a.oClasses.sFilter;c.innerHTML="<label>"+b+"</label>";a.sTableId!==""&&typeof a.aanFeatures.f=="undefined"&&c.setAttribute("id",a.sTableId+"_filter");b=i("input",c);b.val(a.oPreviousSearch.sSearch.replace('"',"&quot;"));b.bind("keyup.DT",function(){for(var d=a.aanFeatures.f,f=0,e=d.length;f<e;f++)d[f]!=i(this).parents("div.dataTables_filter")[0]&&i("input",d[f]).val(this.value);this.value!=a.oPreviousSearch.sSearch&&N(a,{sSearch:this.value,bRegex:a.oPreviousSearch.bRegex,bSmart:a.oPreviousSearch.bSmart})});
b.bind("keypress.DT",function(d){if(d.keyCode==13)return false});return c}function N(a,b,c){Oa(a,b.sSearch,c,b.bRegex,b.bSmart);for(b=0;b<a.aoPreSearchCols.length;b++)Pa(a,a.aoPreSearchCols[b].sSearch,b,a.aoPreSearchCols[b].bRegex,a.aoPreSearchCols[b].bSmart);n.afnFiltering.length!==0&&Qa(a);a.bFiltered=true;i(a.oInstance).trigger("filter",a);a._iDisplayStart=0;E(a);C(a);oa(a,0)}function Qa(a){for(var b=n.afnFiltering,c=0,d=b.length;c<d;c++)for(var f=0,e=0,h=a.aiDisplay.length;e<h;e++){var j=a.aiDisplay[e-
f];if(!b[c](a,fa(a,j,"filter"),j)){a.aiDisplay.splice(e-f,1);f++}}}function Pa(a,b,c,d,f){if(b!==""){var e=0;b=pa(b,d,f);for(d=a.aiDisplay.length-1;d>=0;d--){f=qa(G(a,a.aiDisplay[d],c,"filter"),a.aoColumns[c].sType);if(!b.test(f)){a.aiDisplay.splice(d,1);e++}}}}function Oa(a,b,c,d,f){var e=pa(b,d,f);if(typeof c=="undefined"||c===null)c=0;if(n.afnFiltering.length!==0)c=1;if(b.length<=0){a.aiDisplay.splice(0,a.aiDisplay.length);a.aiDisplay=a.aiDisplayMaster.slice()}else if(a.aiDisplay.length==a.aiDisplayMaster.length||
a.oPreviousSearch.sSearch.length>b.length||c==1||b.indexOf(a.oPreviousSearch.sSearch)!==0){a.aiDisplay.splice(0,a.aiDisplay.length);oa(a,1);for(c=0;c<a.aiDisplayMaster.length;c++)e.test(a.asDataSearch[c])&&a.aiDisplay.push(a.aiDisplayMaster[c])}else{var h=0;for(c=0;c<a.asDataSearch.length;c++)if(!e.test(a.asDataSearch[c])){a.aiDisplay.splice(c-h,1);h++}}a.oPreviousSearch.sSearch=b;a.oPreviousSearch.bRegex=d;a.oPreviousSearch.bSmart=f}function oa(a,b){if(!a.oFeatures.bServerSide){a.asDataSearch.splice(0,
a.asDataSearch.length);b=typeof b!="undefined"&&b==1?a.aiDisplayMaster:a.aiDisplay;for(var c=0,d=b.length;c<d;c++)a.asDataSearch[c]=ra(a,fa(a,b[c],"filter"))}}function ra(a,b){var c="";if(typeof a.__nTmpFilter=="undefined")a.__nTmpFilter=p.createElement("div");for(var d=a.__nTmpFilter,f=0,e=a.aoColumns.length;f<e;f++)if(a.aoColumns[f].bSearchable)c+=qa(b[f],a.aoColumns[f].sType)+"  ";if(c.indexOf("&")!==-1){d.innerHTML=c;c=d.textContent?d.textContent:d.innerText;c=c.replace(/\n/g," ").replace(/\r/g,
"")}return c}function pa(a,b,c){if(c){a=b?a.split(" "):sa(a).split(" ");a="^(?=.*?"+a.join(")(?=.*?")+").*$";return new RegExp(a,"i")}else{a=b?a:sa(a);return new RegExp(a,"i")}}function qa(a,b){if(typeof n.ofnSearch[b]=="function")return n.ofnSearch[b](a);else if(b=="html")return a.replace(/\n/g," ").replace(/<.*?>/g,"");else if(typeof a=="string")return a.replace(/\n/g," ");else if(a===null)return"";return a}function R(a,b){var c,d,f,e,h=[],j=[],k=n.oSort;d=a.aoData;var m=a.aoColumns;if(!a.oFeatures.bServerSide&&
(a.aaSorting.length!==0||a.aaSortingFixed!==null)){h=a.aaSortingFixed!==null?a.aaSortingFixed.concat(a.aaSorting):a.aaSorting.slice();for(c=0;c<h.length;c++){var u=h[c][0];f=ta(a,u);e=a.aoColumns[u].sSortDataType;if(typeof n.afnSortData[e]!="undefined"){var r=n.afnSortData[e](a,u,f);f=0;for(e=d.length;f<e;f++)O(a,f,u,r[f])}}c=0;for(d=a.aiDisplayMaster.length;c<d;c++)j[a.aiDisplayMaster[c]]=c;var H=h.length;a.aiDisplayMaster.sort(function(L,T){var B,U;for(c=0;c<H;c++){B=m[h[c][0]].iDataSort;U=m[B].sType;
B=k[(U?U:"string")+"-"+h[c][1]](G(a,L,B,"sort"),G(a,T,B,"sort"));if(B!==0)return B}return k["numeric-asc"](j[L],j[T])})}if((typeof b=="undefined"||b)&&!a.oFeatures.bDeferRender)V(a);a.bSorted=true;i(a.oInstance).trigger("sort",a);if(a.oFeatures.bFilter)N(a,a.oPreviousSearch,1);else{a.aiDisplay=a.aiDisplayMaster.slice();a._iDisplayStart=0;E(a);C(a)}}function ja(a,b,c,d){i(b).bind("click.DT",function(f){if(a.aoColumns[c].bSortable!==false){var e=function(){var h,j;if(f.shiftKey){for(var k=false,m=0;m<
a.aaSorting.length;m++)if(a.aaSorting[m][0]==c){k=true;h=a.aaSorting[m][0];j=a.aaSorting[m][2]+1;if(typeof a.aoColumns[h].asSorting[j]=="undefined")a.aaSorting.splice(m,1);else{a.aaSorting[m][1]=a.aoColumns[h].asSorting[j];a.aaSorting[m][2]=j}break}k===false&&a.aaSorting.push([c,a.aoColumns[c].asSorting[0],0])}else if(a.aaSorting.length==1&&a.aaSorting[0][0]==c){h=a.aaSorting[0][0];j=a.aaSorting[0][2]+1;if(typeof a.aoColumns[h].asSorting[j]=="undefined")j=0;a.aaSorting[0][1]=a.aoColumns[h].asSorting[j];
a.aaSorting[0][2]=j}else{a.aaSorting.splice(0,a.aaSorting.length);a.aaSorting.push([c,a.aoColumns[c].asSorting[0],0])}R(a)};if(a.oFeatures.bProcessing){K(a,true);setTimeout(function(){e();a.oFeatures.bServerSide||K(a,false)},0)}else e();typeof d=="function"&&d(a)}})}function V(a){var b,c,d,f,e,h=a.aoColumns.length,j=a.oClasses;for(b=0;b<h;b++)a.aoColumns[b].bSortable&&i(a.aoColumns[b].nTh).removeClass(j.sSortAsc+" "+j.sSortDesc+" "+a.aoColumns[b].sSortingClass);f=a.aaSortingFixed!==null?a.aaSortingFixed.concat(a.aaSorting):
a.aaSorting.slice();for(b=0;b<a.aoColumns.length;b++)if(a.aoColumns[b].bSortable){e=a.aoColumns[b].sSortingClass;d=-1;for(c=0;c<f.length;c++)if(f[c][0]==b){e=f[c][1]=="asc"?j.sSortAsc:j.sSortDesc;d=c;break}i(a.aoColumns[b].nTh).addClass(e);if(a.bJUI){c=i("span",a.aoColumns[b].nTh);c.removeClass(j.sSortJUIAsc+" "+j.sSortJUIDesc+" "+j.sSortJUI+" "+j.sSortJUIAscAllowed+" "+j.sSortJUIDescAllowed);c.addClass(d==-1?a.aoColumns[b].sSortingClassJUI:f[d][1]=="asc"?j.sSortJUIAsc:j.sSortJUIDesc)}}else i(a.aoColumns[b].nTh).addClass(a.aoColumns[b].sSortingClass);
e=j.sSortColumn;if(a.oFeatures.bSort&&a.oFeatures.bSortClasses){d=Q(a);if(a.oFeatures.bDeferRender)i(d).removeClass(e+"1 "+e+"2 "+e+"3");else if(d.length>=h)for(b=0;b<h;b++)if(d[b].className.indexOf(e+"1")!=-1){c=0;for(a=d.length/h;c<a;c++)d[h*c+b].className=i.trim(d[h*c+b].className.replace(e+"1",""))}else if(d[b].className.indexOf(e+"2")!=-1){c=0;for(a=d.length/h;c<a;c++)d[h*c+b].className=i.trim(d[h*c+b].className.replace(e+"2",""))}else if(d[b].className.indexOf(e+"3")!=-1){c=0;for(a=d.length/
h;c<a;c++)d[h*c+b].className=i.trim(d[h*c+b].className.replace(" "+e+"3",""))}j=1;var k;for(b=0;b<f.length;b++){k=parseInt(f[b][0],10);c=0;for(a=d.length/h;c<a;c++)d[h*c+k].className+=" "+e+j;j<3&&j++}}}function La(a){if(a.oScroll.bInfinite)return null;var b=p.createElement("div");b.className=a.oClasses.sPaging+a.sPaginationType;n.oPagination[a.sPaginationType].fnInit(a,b,function(c){E(c);C(c)});typeof a.aanFeatures.p=="undefined"&&a.aoDrawCallback.push({fn:function(c){n.oPagination[c.sPaginationType].fnUpdate(c,
function(d){E(d);C(d)})},sName:"pagination"});return b}function ma(a,b){var c=a._iDisplayStart;if(b=="first")a._iDisplayStart=0;else if(b=="previous"){a._iDisplayStart=a._iDisplayLength>=0?a._iDisplayStart-a._iDisplayLength:0;if(a._iDisplayStart<0)a._iDisplayStart=0}else if(b=="next")if(a._iDisplayLength>=0){if(a._iDisplayStart+a._iDisplayLength<a.fnRecordsDisplay())a._iDisplayStart+=a._iDisplayLength}else a._iDisplayStart=0;else if(b=="last")if(a._iDisplayLength>=0){b=parseInt((a.fnRecordsDisplay()-
1)/a._iDisplayLength,10)+1;a._iDisplayStart=(b-1)*a._iDisplayLength}else a._iDisplayStart=0;else J(a,0,"Unknown paging action: "+b);i(a.oInstance).trigger("page",a);return c!=a._iDisplayStart}function Ka(a){var b=p.createElement("div");b.className=a.oClasses.sInfo;if(typeof a.aanFeatures.i=="undefined"){a.aoDrawCallback.push({fn:Ra,sName:"information"});a.sTableId!==""&&b.setAttribute("id",a.sTableId+"_info")}return b}function Ra(a){if(!(!a.oFeatures.bInfo||a.aanFeatures.i.length===0)){var b=a._iDisplayStart+
1,c=a.fnDisplayEnd(),d=a.fnRecordsTotal(),f=a.fnRecordsDisplay(),e=a.fnFormatNumber(b),h=a.fnFormatNumber(c),j=a.fnFormatNumber(d),k=a.fnFormatNumber(f);if(a.oScroll.bInfinite)e=a.fnFormatNumber(1);e=a.fnRecordsDisplay()===0&&a.fnRecordsDisplay()==a.fnRecordsTotal()?a.oLanguage.sInfoEmpty+a.oLanguage.sInfoPostFix:a.fnRecordsDisplay()===0?a.oLanguage.sInfoEmpty+" "+a.oLanguage.sInfoFiltered.replace("_MAX_",j)+a.oLanguage.sInfoPostFix:a.fnRecordsDisplay()==a.fnRecordsTotal()?a.oLanguage.sInfo.replace("_START_",
e).replace("_END_",h).replace("_TOTAL_",k)+a.oLanguage.sInfoPostFix:a.oLanguage.sInfo.replace("_START_",e).replace("_END_",h).replace("_TOTAL_",k)+" "+a.oLanguage.sInfoFiltered.replace("_MAX_",a.fnFormatNumber(a.fnRecordsTotal()))+a.oLanguage.sInfoPostFix;if(a.oLanguage.fnInfoCallback!==null)e=a.oLanguage.fnInfoCallback(a,b,c,d,f,e);a=a.aanFeatures.i;b=0;for(c=a.length;b<c;b++)i(a[b]).html(e)}}function Ga(a){if(a.oScroll.bInfinite)return null;var b='<select size="1" '+(a.sTableId===""?"":'name="'+
a.sTableId+'_length"')+">",c,d;if(a.aLengthMenu.length==2&&typeof a.aLengthMenu[0]=="object"&&typeof a.aLengthMenu[1]=="object"){c=0;for(d=a.aLengthMenu[0].length;c<d;c++)b+='<option value="'+a.aLengthMenu[0][c]+'">'+a.aLengthMenu[1][c]+"</option>"}else{c=0;for(d=a.aLengthMenu.length;c<d;c++)b+='<option value="'+a.aLengthMenu[c]+'">'+a.aLengthMenu[c]+"</option>"}b+="</select>";var f=p.createElement("div");a.sTableId!==""&&typeof a.aanFeatures.l=="undefined"&&f.setAttribute("id",a.sTableId+"_length");
f.className=a.oClasses.sLength;f.innerHTML="<label>"+a.oLanguage.sLengthMenu.replace("_MENU_",b)+"</label>";i('select option[value="'+a._iDisplayLength+'"]',f).attr("selected",true);i("select",f).bind("change.DT",function(){var e=i(this).val(),h=a.aanFeatures.l;c=0;for(d=h.length;c<d;c++)h[c]!=this.parentNode&&i("select",h[c]).val(e);a._iDisplayLength=parseInt(e,10);E(a);if(a.fnDisplayEnd()==a.fnRecordsDisplay()){a._iDisplayStart=a.fnDisplayEnd()-a._iDisplayLength;if(a._iDisplayStart<0)a._iDisplayStart=
0}if(a._iDisplayLength==-1)a._iDisplayStart=0;C(a)});return f}function Ia(a){var b=p.createElement("div");a.sTableId!==""&&typeof a.aanFeatures.r=="undefined"&&b.setAttribute("id",a.sTableId+"_processing");b.innerHTML=a.oLanguage.sProcessing;b.className=a.oClasses.sProcessing;a.nTable.parentNode.insertBefore(b,a.nTable);return b}function K(a,b){if(a.oFeatures.bProcessing){a=a.aanFeatures.r;for(var c=0,d=a.length;c<d;c++)a[c].style.visibility=b?"visible":"hidden"}}function Na(a,b){for(var c=-1,d=0;d<
a.aoColumns.length;d++){a.aoColumns[d].bVisible===true&&c++;if(c==b)return d}return null}function ta(a,b){for(var c=-1,d=0;d<a.aoColumns.length;d++){a.aoColumns[d].bVisible===true&&c++;if(d==b)return a.aoColumns[d].bVisible===true?c:null}return null}function W(a,b){var c,d;c=a._iDisplayStart;for(d=a._iDisplayEnd;c<d;c++)if(a.aoData[a.aiDisplay[c]].nTr==b)return a.aiDisplay[c];c=0;for(d=a.aoData.length;c<d;c++)if(a.aoData[c].nTr==b)return c;return null}function Z(a){for(var b=0,c=0;c<a.aoColumns.length;c++)a.aoColumns[c].bVisible===
true&&b++;return b}function E(a){a._iDisplayEnd=a.oFeatures.bPaginate===false?a.aiDisplay.length:a._iDisplayStart+a._iDisplayLength>a.aiDisplay.length||a._iDisplayLength==-1?a.aiDisplay.length:a._iDisplayStart+a._iDisplayLength}function Sa(a,b){if(!a||a===null||a==="")return 0;if(typeof b=="undefined")b=p.getElementsByTagName("body")[0];var c=p.createElement("div");c.style.width=q(a);b.appendChild(c);a=c.offsetWidth;b.removeChild(c);return a}function ga(a){var b=0,c,d=0,f=a.aoColumns.length,e,h=i("th",
a.nTHead);for(e=0;e<f;e++)if(a.aoColumns[e].bVisible){d++;if(a.aoColumns[e].sWidth!==null){c=Sa(a.aoColumns[e].sWidthOrig,a.nTable.parentNode);if(c!==null)a.aoColumns[e].sWidth=q(c);b++}}if(f==h.length&&b===0&&d==f&&a.oScroll.sX===""&&a.oScroll.sY==="")for(e=0;e<a.aoColumns.length;e++){c=i(h[e]).width();if(c!==null)a.aoColumns[e].sWidth=q(c)}else{b=a.nTable.cloneNode(false);e=a.nTHead.cloneNode(true);d=p.createElement("tbody");c=p.createElement("tr");b.removeAttribute("id");b.appendChild(e);if(a.nTFoot!==
null){b.appendChild(a.nTFoot.cloneNode(true));P(function(k){k.style.width=""},b.getElementsByTagName("tr"))}b.appendChild(d);d.appendChild(c);d=i("thead th",b);if(d.length===0)d=i("tbody tr:eq(0)>td",b);h=S(a,e);for(e=d=0;e<f;e++){var j=a.aoColumns[e];if(j.bVisible&&j.sWidthOrig!==null&&j.sWidthOrig!=="")h[e-d].style.width=q(j.sWidthOrig);else if(j.bVisible)h[e-d].style.width="";else d++}for(e=0;e<f;e++)if(a.aoColumns[e].bVisible){d=Ta(a,e);if(d!==null){d=d.cloneNode(true);if(a.aoColumns[e].sContentPadding!==
"")d.innerHTML+=a.aoColumns[e].sContentPadding;c.appendChild(d)}}f=a.nTable.parentNode;f.appendChild(b);if(a.oScroll.sX!==""&&a.oScroll.sXInner!=="")b.style.width=q(a.oScroll.sXInner);else if(a.oScroll.sX!==""){b.style.width="";if(i(b).width()<f.offsetWidth)b.style.width=q(f.offsetWidth)}else if(a.oScroll.sY!=="")b.style.width=q(f.offsetWidth);b.style.visibility="hidden";Ua(a,b);f=i("tbody tr:eq(0)",b).children();if(f.length===0)f=S(a,i("thead",b)[0]);if(a.oScroll.sX!==""){for(e=d=c=0;e<a.aoColumns.length;e++)if(a.aoColumns[e].bVisible){c+=
a.aoColumns[e].sWidthOrig===null?i(f[d]).outerWidth():parseInt(a.aoColumns[e].sWidth.replace("px",""),10)+(i(f[d]).outerWidth()-i(f[d]).width());d++}b.style.width=q(c);a.nTable.style.width=q(c)}for(e=d=0;e<a.aoColumns.length;e++)if(a.aoColumns[e].bVisible){c=i(f[d]).width();if(c!==null&&c>0)a.aoColumns[e].sWidth=q(c);d++}a.nTable.style.width=q(i(b).outerWidth());b.parentNode.removeChild(b)}}function Ua(a,b){if(a.oScroll.sX===""&&a.oScroll.sY!==""){i(b).width();b.style.width=q(i(b).outerWidth()-a.oScroll.iBarWidth)}else if(a.oScroll.sX!==
"")b.style.width=q(i(b).outerWidth())}function Ta(a,b){var c=Va(a,b);if(c<0)return null;if(a.aoData[c].nTr===null){var d=p.createElement("td");d.innerHTML=G(a,c,b,"");return d}return Q(a,c)[b]}function Va(a,b){for(var c=-1,d=-1,f=0;f<a.aoData.length;f++){var e=G(a,f,b,"display")+"";e=e.replace(/<.*?>/g,"");if(e.length>c){c=e.length;d=f}}return d}function q(a){if(a===null)return"0px";if(typeof a=="number"){if(a<0)return"0px";return a+"px"}var b=a.charCodeAt(a.length-1);if(b<48||b>57)return a;return a+
"px"}function Za(a,b){if(a.length!=b.length)return 1;for(var c=0;c<a.length;c++)if(a[c]!=b[c])return 2;return 0}function ia(a){for(var b=n.aTypes,c=b.length,d=0;d<c;d++){var f=b[d](a);if(f!==null)return f}return"string"}function A(a){for(var b=0;b<D.length;b++)if(D[b].nTable==a)return D[b];return null}function ca(a){for(var b=[],c=a.aoData.length,d=0;d<c;d++)b.push(a.aoData[d]._aData);return b}function ba(a){for(var b=[],c=0,d=a.aoData.length;c<d;c++)a.aoData[c].nTr!==null&&b.push(a.aoData[c].nTr);
return b}function Q(a,b){var c=[],d,f,e,h,j;f=0;var k=a.aoData.length;if(typeof b!="undefined"){f=b;k=b+1}for(f=f;f<k;f++){j=a.aoData[f];if(j.nTr!==null){b=[];e=0;for(h=j.nTr.childNodes.length;e<h;e++){d=j.nTr.childNodes[e].nodeName.toLowerCase();if(d=="td"||d=="th")b.push(j.nTr.childNodes[e])}e=d=0;for(h=a.aoColumns.length;e<h;e++)if(a.aoColumns[e].bVisible)c.push(b[e-d]);else{c.push(j._anHidden[e]);d++}}}return c}function sa(a){return a.replace(new RegExp("(\\/|\\.|\\*|\\+|\\?|\\||\\(|\\)|\\[|\\]|\\{|\\}|\\\\|\\$|\\^)",
"g"),"\\$1")}function ua(a,b){for(var c=-1,d=0,f=a.length;d<f;d++)if(a[d]==b)c=d;else a[d]>b&&a[d]--;c!=-1&&a.splice(c,1)}function Fa(a,b){b=b.split(",");for(var c=[],d=0,f=a.aoColumns.length;d<f;d++)for(var e=0;e<f;e++)if(a.aoColumns[d].sName==b[e]){c.push(e);break}return c}function ka(a){for(var b="",c=0,d=a.aoColumns.length;c<d;c++)b+=a.aoColumns[c].sName+",";if(b.length==d)return"";return b.slice(0,-1)}function J(a,b,c){a=a.sTableId===""?"DataTables warning: "+c:"DataTables warning (table id = '"+
a.sTableId+"'): "+c;if(b===0)if(n.sErrMode=="alert")alert(a);else throw a;else typeof console!="undefined"&&typeof console.log!="undefined"&&console.log(a)}function la(a){a.aoData.splice(0,a.aoData.length);a.aiDisplayMaster.splice(0,a.aiDisplayMaster.length);a.aiDisplay.splice(0,a.aiDisplay.length);E(a)}function va(a){if(!(!a.oFeatures.bStateSave||typeof a.bDestroying!="undefined")){var b,c,d,f="{";f+='"iCreate":'+(new Date).getTime()+",";f+='"iStart":'+(a.oScroll.bInfinite?0:a._iDisplayStart)+",";
f+='"iEnd":'+(a.oScroll.bInfinite?a._iDisplayLength:a._iDisplayEnd)+",";f+='"iLength":'+a._iDisplayLength+",";f+='"sFilter":"'+encodeURIComponent(a.oPreviousSearch.sSearch)+'",';f+='"sFilterEsc":'+!a.oPreviousSearch.bRegex+",";f+='"aaSorting":[ ';for(b=0;b<a.aaSorting.length;b++)f+="["+a.aaSorting[b][0]+',"'+a.aaSorting[b][1]+'"],';f=f.substring(0,f.length-1);f+="],";f+='"aaSearchCols":[ ';for(b=0;b<a.aoPreSearchCols.length;b++)f+='["'+encodeURIComponent(a.aoPreSearchCols[b].sSearch)+'",'+!a.aoPreSearchCols[b].bRegex+
"],";f=f.substring(0,f.length-1);f+="],";f+='"abVisCols":[ ';for(b=0;b<a.aoColumns.length;b++)f+=a.aoColumns[b].bVisible+",";f=f.substring(0,f.length-1);f+="]";b=0;for(c=a.aoStateSave.length;b<c;b++){d=a.aoStateSave[b].fn(a,f);if(d!=="")f=d}f+="}";Wa(a.sCookiePrefix+a.sInstance,f,a.iCookieDuration,a.sCookiePrefix,a.fnCookieCallback)}}function Xa(a,b){if(a.oFeatures.bStateSave){var c,d,f;d=wa(a.sCookiePrefix+a.sInstance);if(d!==null&&d!==""){try{c=typeof i.parseJSON=="function"?i.parseJSON(d.replace(/'/g,
'"')):eval("("+d+")")}catch(e){return}d=0;for(f=a.aoStateLoad.length;d<f;d++)if(!a.aoStateLoad[d].fn(a,c))return;a.oLoadedState=i.extend(true,{},c);a._iDisplayStart=c.iStart;a.iInitDisplayStart=c.iStart;a._iDisplayEnd=c.iEnd;a._iDisplayLength=c.iLength;a.oPreviousSearch.sSearch=decodeURIComponent(c.sFilter);a.aaSorting=c.aaSorting.slice();a.saved_aaSorting=c.aaSorting.slice();if(typeof c.sFilterEsc!="undefined")a.oPreviousSearch.bRegex=!c.sFilterEsc;if(typeof c.aaSearchCols!="undefined")for(d=0;d<
c.aaSearchCols.length;d++)a.aoPreSearchCols[d]={sSearch:decodeURIComponent(c.aaSearchCols[d][0]),bRegex:!c.aaSearchCols[d][1]};if(typeof c.abVisCols!="undefined"){b.saved_aoColumns=[];for(d=0;d<c.abVisCols.length;d++){b.saved_aoColumns[d]={};b.saved_aoColumns[d].bVisible=c.abVisCols[d]}}}}}function Wa(a,b,c,d,f){var e=new Date;e.setTime(e.getTime()+c*1E3);c=za.location.pathname.split("/");a=a+"_"+c.pop().replace(/[\/:]/g,"").toLowerCase();var h;if(f!==null){h=typeof i.parseJSON=="function"?i.parseJSON(b):
eval("("+b+")");b=f(a,h,e.toGMTString(),c.join("/")+"/")}else b=a+"="+encodeURIComponent(b)+"; expires="+e.toGMTString()+"; path="+c.join("/")+"/";f="";e=9999999999999;if((wa(a)!==null?p.cookie.length:b.length+p.cookie.length)+10>4096){a=p.cookie.split(";");for(var j=0,k=a.length;j<k;j++)if(a[j].indexOf(d)!=-1){var m=a[j].split("=");try{h=eval("("+decodeURIComponent(m[1])+")")}catch(u){continue}if(typeof h.iCreate!="undefined"&&h.iCreate<e){f=m[0];e=h.iCreate}}if(f!=="")p.cookie=f+"=; expires=Thu, 01-Jan-1970 00:00:01 GMT; path="+
c.join("/")+"/"}p.cookie=b}function wa(a){var b=za.location.pathname.split("/");a=a+"_"+b[b.length-1].replace(/[\/:]/g,"").toLowerCase()+"=";b=p.cookie.split(";");for(var c=0;c<b.length;c++){for(var d=b[c];d.charAt(0)==" ";)d=d.substring(1,d.length);if(d.indexOf(a)===0)return decodeURIComponent(d.substring(a.length,d.length))}return null}function Y(a,b){b=i(b).children("tr");var c,d,f,e,h,j,k,m,u=function(L,T,B){for(;typeof L[T][B]!="undefined";)B++;return B};a.splice(0,a.length);d=0;for(j=b.length;d<
j;d++)a.push([]);d=0;for(j=b.length;d<j;d++){f=0;for(k=b[d].childNodes.length;f<k;f++){c=b[d].childNodes[f];if(c.nodeName.toUpperCase()=="TD"||c.nodeName.toUpperCase()=="TH"){var r=c.getAttribute("colspan")*1,H=c.getAttribute("rowspan")*1;r=!r||r===0||r===1?1:r;H=!H||H===0||H===1?1:H;m=u(a,d,0);for(h=0;h<r;h++)for(e=0;e<H;e++){a[d+e][m+h]={cell:c,unique:r==1?true:false};a[d+e].nTr=b[d]}}}}}function S(a,b,c){var d=[];if(typeof c=="undefined"){c=a.aoHeader;if(typeof b!="undefined"){c=[];Y(c,b)}}b=0;
for(var f=c.length;b<f;b++)for(var e=0,h=c[b].length;e<h;e++)if(c[b][e].unique&&(typeof d[e]=="undefined"||!a.bSortCellsTop))d[e]=c[b][e].cell;return d}function Ya(){var a=p.createElement("p"),b=a.style;b.width="100%";b.height="200px";b.padding="0px";var c=p.createElement("div");b=c.style;b.position="absolute";b.top="0px";b.left="0px";b.visibility="hidden";b.width="200px";b.height="150px";b.padding="0px";b.overflow="hidden";c.appendChild(a);p.body.appendChild(c);b=a.offsetWidth;c.style.overflow="scroll";
a=a.offsetWidth;if(b==a)a=c.clientWidth;p.body.removeChild(c);return b-a}function P(a,b,c){for(var d=0,f=b.length;d<f;d++)for(var e=0,h=b[d].childNodes.length;e<h;e++)if(b[d].childNodes[e].nodeType==1)typeof c!="undefined"?a(b[d].childNodes[e],c[d].childNodes[e]):a(b[d].childNodes[e])}function o(a,b,c,d){if(typeof d=="undefined")d=c;if(typeof b[c]!="undefined")a[d]=b[c]}function fa(a,b,c){for(var d=[],f=0,e=a.aoColumns.length;f<e;f++)d.push(G(a,b,f,c));return d}function G(a,b,c,d){var f=a.aoColumns[c];
if((c=f.fnGetData(a.aoData[b]._aData))===undefined){if(a.iDrawError!=a.iDraw&&f.sDefaultContent===null){J(a,0,"Requested unknown parameter '"+f.mDataProp+"' from the data source for row "+b);a.iDrawError=a.iDraw}return f.sDefaultContent}if(c===null&&f.sDefaultContent!==null)c=f.sDefaultContent;else if(typeof c=="function")return c();if(d=="display"&&c===null)return"";return c}function O(a,b,c,d){a.aoColumns[c].fnSetData(a.aoData[b]._aData,d)}function aa(a){if(a===null)return function(){return null};
else if(typeof a=="function")return function(c){return a(c)};else if(typeof a=="string"&&a.indexOf(".")!=-1){var b=a.split(".");return b.length==2?function(c){return c[b[0]][b[1]]}:b.length==3?function(c){return c[b[0]][b[1]][b[2]]}:function(c){for(var d=0,f=b.length;d<f;d++)c=c[b[d]];return c}}else return function(c){return c[a]}}function Ba(a){if(a===null)return function(){};else if(typeof a=="function")return function(c,d){return a(c,d)};else if(typeof a=="string"&&a.indexOf(".")!=-1){var b=a.split(".");
return b.length==2?function(c,d){c[b[0]][b[1]]=d}:b.length==3?function(c,d){c[b[0]][b[1]][b[2]]=d}:function(c,d){for(var f=0,e=b.length-1;f<e;f++)c=c[b[f]];c[b[b.length-1]]=d}}else return function(c,d){c[a]=d}}this.oApi={};this.fnDraw=function(a){var b=A(this[n.iApiIndex]);if(typeof a!="undefined"&&a===false){E(b);C(b)}else da(b)};this.fnFilter=function(a,b,c,d,f){var e=A(this[n.iApiIndex]);if(e.oFeatures.bFilter){if(typeof c=="undefined")c=false;if(typeof d=="undefined")d=true;if(typeof f=="undefined")f=
true;if(typeof b=="undefined"||b===null){N(e,{sSearch:a,bRegex:c,bSmart:d},1);if(f&&typeof e.aanFeatures.f!="undefined"){b=e.aanFeatures.f;c=0;for(d=b.length;c<d;c++)i("input",b[c]).val(a)}}else{e.aoPreSearchCols[b].sSearch=a;e.aoPreSearchCols[b].bRegex=c;e.aoPreSearchCols[b].bSmart=d;N(e,e.oPreviousSearch,1)}}};this.fnSettings=function(){return A(this[n.iApiIndex])};this.fnVersionCheck=n.fnVersionCheck;this.fnSort=function(a){var b=A(this[n.iApiIndex]);b.aaSorting=a;R(b)};this.fnSortListener=function(a,
b,c){ja(A(this[n.iApiIndex]),a,b,c)};this.fnAddData=function(a,b){if(a.length===0)return[];var c=[],d,f=A(this[n.iApiIndex]);if(typeof a[0]=="object")for(var e=0;e<a.length;e++){d=v(f,a[e]);if(d==-1)return c;c.push(d)}else{d=v(f,a);if(d==-1)return c;c.push(d)}f.aiDisplay=f.aiDisplayMaster.slice();if(typeof b=="undefined"||b)da(f);return c};this.fnDeleteRow=function(a,b,c){var d=A(this[n.iApiIndex]);a=typeof a=="object"?W(d,a):a;var f=d.aoData.splice(a,1),e=i.inArray(a,d.aiDisplay);d.asDataSearch.splice(e,
1);ua(d.aiDisplayMaster,a);ua(d.aiDisplay,a);typeof b=="function"&&b.call(this,d,f);if(d._iDisplayStart>=d.aiDisplay.length){d._iDisplayStart-=d._iDisplayLength;if(d._iDisplayStart<0)d._iDisplayStart=0}if(typeof c=="undefined"||c){E(d);C(d)}return f};this.fnClearTable=function(a){var b=A(this[n.iApiIndex]);la(b);if(typeof a=="undefined"||a)C(b)};this.fnOpen=function(a,b,c){var d=A(this[n.iApiIndex]);this.fnClose(a);var f=p.createElement("tr"),e=p.createElement("td");f.appendChild(e);e.className=c;
e.colSpan=Z(d);if(typeof b.jquery!="undefined"||typeof b=="object")e.appendChild(b);else e.innerHTML=b;b=i("tr",d.nTBody);i.inArray(a,b)!=-1&&i(f).insertAfter(a);d.aoOpenRows.push({nTr:f,nParent:a});return f};this.fnClose=function(a){for(var b=A(this[n.iApiIndex]),c=0;c<b.aoOpenRows.length;c++)if(b.aoOpenRows[c].nParent==a){(a=b.aoOpenRows[c].nTr.parentNode)&&a.removeChild(b.aoOpenRows[c].nTr);b.aoOpenRows.splice(c,1);return 0}return 1};this.fnGetData=function(a,b){var c=A(this[n.iApiIndex]);if(typeof a!=
"undefined"){a=typeof a=="object"?W(c,a):a;if(typeof b!="undefined")return G(c,a,b,"");return typeof c.aoData[a]!="undefined"?c.aoData[a]._aData:null}return ca(c)};this.fnGetNodes=function(a){var b=A(this[n.iApiIndex]);if(typeof a!="undefined")return typeof b.aoData[a]!="undefined"?b.aoData[a].nTr:null;return ba(b)};this.fnGetPosition=function(a){var b=A(this[n.iApiIndex]),c=a.nodeName.toUpperCase();if(c=="TR")return W(b,a);else if(c=="TD"||c=="TH"){c=W(b,a.parentNode);for(var d=Q(b,c),f=0;f<b.aoColumns.length;f++)if(d[f]==
a)return[c,ta(b,f),f]}return null};this.fnUpdate=function(a,b,c,d,f){var e=A(this[n.iApiIndex]);b=typeof b=="object"?W(e,b):b;if(i.isArray(a)&&typeof a=="object"){e.aoData[b]._aData=a.slice();for(c=0;c<e.aoColumns.length;c++)this.fnUpdate(G(e,b,c),b,c,false,false)}else if(a!==null&&typeof a=="object"){e.aoData[b]._aData=i.extend(true,{},a);for(c=0;c<e.aoColumns.length;c++)this.fnUpdate(G(e,b,c),b,c,false,false)}else{a=a;O(e,b,c,a);if(e.aoColumns[c].fnRender!==null){a=e.aoColumns[c].fnRender({iDataRow:b,
iDataColumn:c,aData:e.aoData[b]._aData,oSettings:e});e.aoColumns[c].bUseRendered&&O(e,b,c,a)}if(e.aoData[b].nTr!==null)Q(e,b)[c].innerHTML=a}c=i.inArray(b,e.aiDisplay);e.asDataSearch[c]=ra(e,fa(e,b,"filter"));if(typeof f=="undefined"||f)ea(e);if(typeof d=="undefined"||d)da(e);return 0};this.fnSetColumnVis=function(a,b,c){var d=A(this[n.iApiIndex]),f,e;e=d.aoColumns.length;var h,j;if(d.aoColumns[a].bVisible!=b){if(b){for(f=j=0;f<a;f++)d.aoColumns[f].bVisible&&j++;j=j>=Z(d);if(!j)for(f=a;f<e;f++)if(d.aoColumns[f].bVisible){h=
f;break}f=0;for(e=d.aoData.length;f<e;f++)if(d.aoData[f].nTr!==null)j?d.aoData[f].nTr.appendChild(d.aoData[f]._anHidden[a]):d.aoData[f].nTr.insertBefore(d.aoData[f]._anHidden[a],Q(d,f)[h])}else{f=0;for(e=d.aoData.length;f<e;f++)if(d.aoData[f].nTr!==null){h=Q(d,f)[a];d.aoData[f]._anHidden[a]=h;h.parentNode.removeChild(h)}}d.aoColumns[a].bVisible=b;M(d,d.aoHeader);d.nTFoot&&M(d,d.aoFooter);f=0;for(e=d.aoOpenRows.length;f<e;f++)d.aoOpenRows[f].nTr.colSpan=Z(d);if(typeof c=="undefined"||c){ea(d);C(d)}va(d)}};
this.fnPageChange=function(a,b){var c=A(this[n.iApiIndex]);ma(c,a);E(c);if(typeof b=="undefined"||b)C(c)};this.fnDestroy=function(){var a=A(this[n.iApiIndex]),b=a.nTableWrapper.parentNode,c=a.nTBody,d,f;a.bDestroying=true;d=0;for(f=a.aoDestroyCallback.length;d<f;d++)a.aoDestroyCallback[d].fn();d=0;for(f=a.aoColumns.length;d<f;d++)a.aoColumns[d].bVisible===false&&this.fnSetColumnVis(d,true);i(a.nTableWrapper).find("*").andSelf().unbind(".DT");i("tbody>tr>td."+a.oClasses.sRowEmpty,a.nTable).parent().remove();
if(a.nTable!=a.nTHead.parentNode){i(a.nTable).children("thead").remove();a.nTable.appendChild(a.nTHead)}if(a.nTFoot&&a.nTable!=a.nTFoot.parentNode){i(a.nTable).children("tfoot").remove();a.nTable.appendChild(a.nTFoot)}a.nTable.parentNode.removeChild(a.nTable);i(a.nTableWrapper).remove();a.aaSorting=[];a.aaSortingFixed=[];V(a);i(ba(a)).removeClass(a.asStripeClasses.join(" "));if(a.bJUI){i("th",a.nTHead).removeClass([n.oStdClasses.sSortable,n.oJUIClasses.sSortableAsc,n.oJUIClasses.sSortableDesc,n.oJUIClasses.sSortableNone].join(" "));
i("th span."+n.oJUIClasses.sSortIcon,a.nTHead).remove();i("th",a.nTHead).each(function(){var e=i("div."+n.oJUIClasses.sSortJUIWrapper,this),h=e.contents();i(this).append(h);e.remove()})}else i("th",a.nTHead).removeClass([n.oStdClasses.sSortable,n.oStdClasses.sSortableAsc,n.oStdClasses.sSortableDesc,n.oStdClasses.sSortableNone].join(" "));a.nTableReinsertBefore?b.insertBefore(a.nTable,a.nTableReinsertBefore):b.appendChild(a.nTable);d=0;for(f=a.aoData.length;d<f;d++)a.aoData[d].nTr!==null&&c.appendChild(a.aoData[d].nTr);
if(a.oFeatures.bAutoWidth===true)a.nTable.style.width=q(a.sDestroyWidth);i(c).children("tr:even").addClass(a.asDestroyStripes[0]);i(c).children("tr:odd").addClass(a.asDestroyStripes[1]);d=0;for(f=D.length;d<f;d++)D[d]==a&&D.splice(d,1);a=null};this.fnAdjustColumnSizing=function(a){var b=A(this[n.iApiIndex]);ea(b);if(typeof a=="undefined"||a)this.fnDraw(false);else if(b.oScroll.sX!==""||b.oScroll.sY!=="")this.oApi._fnScrollDraw(b)};for(var xa in n.oApi)if(xa)this[xa]=s(xa);this.oApi._fnExternApiFunc=
s;this.oApi._fnInitialise=t;this.oApi._fnInitComplete=w;this.oApi._fnLanguageProcess=y;this.oApi._fnAddColumn=F;this.oApi._fnColumnOptions=x;this.oApi._fnAddData=v;this.oApi._fnCreateTr=z;this.oApi._fnGatherData=$;this.oApi._fnBuildHead=X;this.oApi._fnDrawHead=M;this.oApi._fnDraw=C;this.oApi._fnReDraw=da;this.oApi._fnAjaxUpdate=Ca;this.oApi._fnAjaxParameters=Da;this.oApi._fnAjaxUpdateDraw=Ea;this.oApi._fnServerParams=ha;this.oApi._fnAddOptionsHtml=Aa;this.oApi._fnFeatureHtmlTable=Ja;this.oApi._fnScrollDraw=
Ma;this.oApi._fnAdjustColumnSizing=ea;this.oApi._fnFeatureHtmlFilter=Ha;this.oApi._fnFilterComplete=N;this.oApi._fnFilterCustom=Qa;this.oApi._fnFilterColumn=Pa;this.oApi._fnFilter=Oa;this.oApi._fnBuildSearchArray=oa;this.oApi._fnBuildSearchRow=ra;this.oApi._fnFilterCreateSearch=pa;this.oApi._fnDataToSearch=qa;this.oApi._fnSort=R;this.oApi._fnSortAttachListener=ja;this.oApi._fnSortingClasses=V;this.oApi._fnFeatureHtmlPaginate=La;this.oApi._fnPageChange=ma;this.oApi._fnFeatureHtmlInfo=Ka;this.oApi._fnUpdateInfo=
Ra;this.oApi._fnFeatureHtmlLength=Ga;this.oApi._fnFeatureHtmlProcessing=Ia;this.oApi._fnProcessingDisplay=K;this.oApi._fnVisibleToColumnIndex=Na;this.oApi._fnColumnIndexToVisible=ta;this.oApi._fnNodeToDataIndex=W;this.oApi._fnVisbleColumns=Z;this.oApi._fnCalculateEnd=E;this.oApi._fnConvertToWidth=Sa;this.oApi._fnCalculateColumnWidths=ga;this.oApi._fnScrollingWidthAdjust=Ua;this.oApi._fnGetWidestNode=Ta;this.oApi._fnGetMaxLenString=Va;this.oApi._fnStringToCss=q;this.oApi._fnArrayCmp=Za;this.oApi._fnDetectType=
ia;this.oApi._fnSettingsFromNode=A;this.oApi._fnGetDataMaster=ca;this.oApi._fnGetTrNodes=ba;this.oApi._fnGetTdNodes=Q;this.oApi._fnEscapeRegex=sa;this.oApi._fnDeleteIndex=ua;this.oApi._fnReOrderIndex=Fa;this.oApi._fnColumnOrdering=ka;this.oApi._fnLog=J;this.oApi._fnClearTable=la;this.oApi._fnSaveState=va;this.oApi._fnLoadState=Xa;this.oApi._fnCreateCookie=Wa;this.oApi._fnReadCookie=wa;this.oApi._fnDetectHeader=Y;this.oApi._fnGetUniqueThs=S;this.oApi._fnScrollBarWidth=Ya;this.oApi._fnApplyToChildren=
P;this.oApi._fnMap=o;this.oApi._fnGetRowData=fa;this.oApi._fnGetCellData=G;this.oApi._fnSetCellData=O;this.oApi._fnGetObjectDataFn=aa;this.oApi._fnSetObjectDataFn=Ba;var ya=this;return this.each(function(){var a=0,b,c,d,f;a=0;for(b=D.length;a<b;a++){if(D[a].nTable==this)if(typeof g=="undefined"||typeof g.bRetrieve!="undefined"&&g.bRetrieve===true)return D[a].oInstance;else if(typeof g.bDestroy!="undefined"&&g.bDestroy===true){D[a].oInstance.fnDestroy();break}else{J(D[a],0,"Cannot reinitialise DataTable.\n\nTo retrieve the DataTables object for this table, please pass either no arguments to the dataTable() function, or set bRetrieve to true. Alternatively, to destory the old table and create a new one, set bDestroy to true (note that a lot of changes to the configuration can be made through the API which is usually much faster).");
return}if(D[a].sTableId!==""&&D[a].sTableId==this.getAttribute("id")){D.splice(a,1);break}}var e=new l;D.push(e);var h=false,j=false;a=this.getAttribute("id");if(a!==null){e.sTableId=a;e.sInstance=a}else e.sInstance=n._oExternConfig.iNextUnique++;if(this.nodeName.toLowerCase()!="table")J(e,0,"Attempted to initialise DataTables on a node which is not a table: "+this.nodeName);else{e.nTable=this;e.oInstance=ya.length==1?ya:i(this).dataTable();e.oApi=ya.oApi;e.sDestroyWidth=i(this).width();if(typeof g!=
"undefined"&&g!==null){e.oInit=g;o(e.oFeatures,g,"bPaginate");o(e.oFeatures,g,"bLengthChange");o(e.oFeatures,g,"bFilter");o(e.oFeatures,g,"bSort");o(e.oFeatures,g,"bInfo");o(e.oFeatures,g,"bProcessing");o(e.oFeatures,g,"bAutoWidth");o(e.oFeatures,g,"bSortClasses");o(e.oFeatures,g,"bServerSide");o(e.oFeatures,g,"bDeferRender");o(e.oScroll,g,"sScrollX","sX");o(e.oScroll,g,"sScrollXInner","sXInner");o(e.oScroll,g,"sScrollY","sY");o(e.oScroll,g,"bScrollCollapse","bCollapse");o(e.oScroll,g,"bScrollInfinite",
"bInfinite");o(e.oScroll,g,"iScrollLoadGap","iLoadGap");o(e.oScroll,g,"bScrollAutoCss","bAutoCss");o(e,g,"asStripClasses","asStripeClasses");o(e,g,"asStripeClasses");o(e,g,"fnPreDrawCallback");o(e,g,"fnRowCallback");o(e,g,"fnHeaderCallback");o(e,g,"fnFooterCallback");o(e,g,"fnCookieCallback");o(e,g,"fnInitComplete");o(e,g,"fnServerData");o(e,g,"fnFormatNumber");o(e,g,"aaSorting");o(e,g,"aaSortingFixed");o(e,g,"aLengthMenu");o(e,g,"sPaginationType");o(e,g,"sAjaxSource");o(e,g,"sAjaxDataProp");o(e,
g,"iCookieDuration");o(e,g,"sCookiePrefix");o(e,g,"sDom");o(e,g,"bSortCellsTop");o(e,g,"oSearch","oPreviousSearch");o(e,g,"aoSearchCols","aoPreSearchCols");o(e,g,"iDisplayLength","_iDisplayLength");o(e,g,"bJQueryUI","bJUI");o(e.oLanguage,g,"fnInfoCallback");typeof g.fnDrawCallback=="function"&&e.aoDrawCallback.push({fn:g.fnDrawCallback,sName:"user"});typeof g.fnServerParams=="function"&&e.aoServerParams.push({fn:g.fnServerParams,sName:"user"});typeof g.fnStateSaveCallback=="function"&&e.aoStateSave.push({fn:g.fnStateSaveCallback,
sName:"user"});typeof g.fnStateLoadCallback=="function"&&e.aoStateLoad.push({fn:g.fnStateLoadCallback,sName:"user"});if(e.oFeatures.bServerSide&&e.oFeatures.bSort&&e.oFeatures.bSortClasses)e.aoDrawCallback.push({fn:V,sName:"server_side_sort_classes"});else e.oFeatures.bDeferRender&&e.aoDrawCallback.push({fn:V,sName:"defer_sort_classes"});if(typeof g.bJQueryUI!="undefined"&&g.bJQueryUI){e.oClasses=n.oJUIClasses;if(typeof g.sDom=="undefined")e.sDom='<"H"lfr>t<"F"ip>'}if(e.oScroll.sX!==""||e.oScroll.sY!==
"")e.oScroll.iBarWidth=Ya();if(typeof g.iDisplayStart!="undefined"&&typeof e.iInitDisplayStart=="undefined"){e.iInitDisplayStart=g.iDisplayStart;e._iDisplayStart=g.iDisplayStart}if(typeof g.bStateSave!="undefined"){e.oFeatures.bStateSave=g.bStateSave;Xa(e,g);e.aoDrawCallback.push({fn:va,sName:"state_save"})}if(typeof g.iDeferLoading!="undefined"){e.bDeferLoading=true;e._iRecordsTotal=g.iDeferLoading;e._iRecordsDisplay=g.iDeferLoading}if(typeof g.aaData!="undefined")j=true;if(typeof g!="undefined"&&
typeof g.aoData!="undefined")g.aoColumns=g.aoData;if(typeof g.oLanguage!="undefined")if(typeof g.oLanguage.sUrl!="undefined"&&g.oLanguage.sUrl!==""){e.oLanguage.sUrl=g.oLanguage.sUrl;i.getJSON(e.oLanguage.sUrl,null,function(u){y(e,u,true)});h=true}else y(e,g.oLanguage,false)}else g={};if(typeof g.asStripClasses=="undefined"&&typeof g.asStripeClasses=="undefined"){e.asStripeClasses.push(e.oClasses.sStripeOdd);e.asStripeClasses.push(e.oClasses.sStripeEven)}c=false;d=i(this).children("tbody").children("tr");
a=0;for(b=e.asStripeClasses.length;a<b;a++)if(d.filter(":lt(2)").hasClass(e.asStripeClasses[a])){c=true;break}if(c){e.asDestroyStripes=["",""];if(i(d[0]).hasClass(e.oClasses.sStripeOdd))e.asDestroyStripes[0]+=e.oClasses.sStripeOdd+" ";if(i(d[0]).hasClass(e.oClasses.sStripeEven))e.asDestroyStripes[0]+=e.oClasses.sStripeEven;if(i(d[1]).hasClass(e.oClasses.sStripeOdd))e.asDestroyStripes[1]+=e.oClasses.sStripeOdd+" ";if(i(d[1]).hasClass(e.oClasses.sStripeEven))e.asDestroyStripes[1]+=e.oClasses.sStripeEven;
d.removeClass(e.asStripeClasses.join(" "))}c=[];var k;a=this.getElementsByTagName("thead");if(a.length!==0){Y(e.aoHeader,a[0]);c=S(e)}if(typeof g.aoColumns=="undefined"){k=[];a=0;for(b=c.length;a<b;a++)k.push(null)}else k=g.aoColumns;a=0;for(b=k.length;a<b;a++){if(typeof g.saved_aoColumns!="undefined"&&g.saved_aoColumns.length==b){if(k[a]===null)k[a]={};k[a].bVisible=g.saved_aoColumns[a].bVisible}F(e,c?c[a]:null)}if(typeof g.aoColumnDefs!="undefined")for(a=g.aoColumnDefs.length-1;a>=0;a--){var m=
g.aoColumnDefs[a].aTargets;i.isArray(m)||J(e,1,"aTargets must be an array of targets, not a "+typeof m);c=0;for(d=m.length;c<d;c++)if(typeof m[c]=="number"&&m[c]>=0){for(;e.aoColumns.length<=m[c];)F(e);x(e,m[c],g.aoColumnDefs[a])}else if(typeof m[c]=="number"&&m[c]<0)x(e,e.aoColumns.length+m[c],g.aoColumnDefs[a]);else if(typeof m[c]=="string"){b=0;for(f=e.aoColumns.length;b<f;b++)if(m[c]=="_all"||i(e.aoColumns[b].nTh).hasClass(m[c]))x(e,b,g.aoColumnDefs[a])}}if(typeof k!="undefined"){a=0;for(b=k.length;a<
b;a++)x(e,a,k[a])}a=0;for(b=e.aaSorting.length;a<b;a++){if(e.aaSorting[a][0]>=e.aoColumns.length)e.aaSorting[a][0]=0;k=e.aoColumns[e.aaSorting[a][0]];if(typeof e.aaSorting[a][2]=="undefined")e.aaSorting[a][2]=0;if(typeof g.aaSorting=="undefined"&&typeof e.saved_aaSorting=="undefined")e.aaSorting[a][1]=k.asSorting[0];c=0;for(d=k.asSorting.length;c<d;c++)if(e.aaSorting[a][1]==k.asSorting[c]){e.aaSorting[a][2]=c;break}}V(e);a=i(this).children("thead");if(a.length===0){a=[p.createElement("thead")];this.appendChild(a[0])}e.nTHead=
a[0];a=i(this).children("tbody");if(a.length===0){a=[p.createElement("tbody")];this.appendChild(a[0])}e.nTBody=a[0];a=i(this).children("tfoot");if(a.length>0){e.nTFoot=a[0];Y(e.aoFooter,e.nTFoot)}if(j)for(a=0;a<g.aaData.length;a++)v(e,g.aaData[a]);else $(e);e.aiDisplay=e.aiDisplayMaster.slice();e.bInitialised=true;h===false&&t(e)}})}})(jQuery,window,document);

/*
 * jQuery UI Checkbox @VERSION
 *
 * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * {{TODO replace with docs link once plugin is released}}
 * http://wiki.jqueryui.com/Checkbox
 * {{/TODO}}
 *
 * Depends:
 *   jquery.ui.core.js
 *   jquery.ui.widget.js
 */
(function( $ ) {

var checkboxId = 0;

$.widget( "ui.checkbox", {
	version: "@VERSION",
	options: {
		disabled : null
	},
	_create: function() {

		var that = this;

		// look for label as container of checkbox
		this.labelElement = this.element.closest( "label" );
		if ( this.labelElement.length ) {
			// move the checkbox outside (before) the label
			this.element.insertBefore( this.labelElement );

			// the checkbox needs an id since it's no longer inside the label
			if ( !this.element.attr( "id" ) ) {
				this.element.attr( "id", "ui-checkbox-" + checkboxId );
				checkboxId += 1;
			}

			// associate label by for=id of checkbox
			this.labelElement.attr( "for", this.element.attr("id") );
		} else {
			// look for label by for=id of checkbox
			this.labelElement = $( this.element[0].ownerDocument ).find( "label[for=" + this.element.attr("id") + "]" );
		}

// Added by m157y
		this.labelElement.html('<span class="ui-checkbox-labeltext">' + this.labelElement.html() + '</span>');
// End of add

		// wrap the checkbox in two new divs
		// move the checkbox's label inside the outer new div
		this.checkboxElement = this.element.wrap( "<div class='ui-checkbox-inputwrapper'></div>" ).parent().wrap( "<div></div>" ).parent()
			.addClass("ui-checkbox")
			.append(this.labelElement);
// Added by m157y
		this.labelElement.appendTo(this.checkboxElement);
// End of add

// Modified by m157y
//		this.boxElement = $("<div class='ui-checkbox-box ui-widget ui-state-active ui-corner-all'><span class='ui-checkbox-icon'></span></div>");
		this.boxElement = $("<div class='ui-checkbox-box ui-widget ui-state-default ui-corner-all'><span class='ui-checkbox-icon'></span></div>");
// End of mod
		this.iconElement = this.boxElement.children( ".ui-checkbox-icon" );
// Modified by m157y
//		this.checkboxElement.append(this.boxElement);
		this.labelElement.append(this.boxElement);
// End of mod

		this.element.bind("click.checkbox", function() {
			that._refresh();
		});

		this.element.bind("focus.checkbox", function() {
			if ( that.options.disabled ) {
				return;
			}
			that.boxElement
// Modified by m157y
//				.removeClass( "ui-state-active" )
				.removeClass( "ui-state-default" )
// End of mod
				.addClass( "ui-state-focus" );
		});

		this.element.bind("blur.checkbox", function() {
			if ( that.options.disabled ) {
				return;
			}
			that.boxElement
				.removeClass( "ui-state-focus" )
				.not(".ui-state-hover")
// Modified by m157y
//				.addClass( "ui-state-active" );
				.addClass( "ui-state-default" );
// End of mod
		});

		this.checkboxElement.bind("mouseover.checkbox", function() {
			if ( that.options.disabled ) {
				return;
			}
			that.boxElement
// Modified by m157y
//				.removeClass( "ui-state-active" )
				.removeClass( "ui-state-default" )
// End of mod
				.addClass( "ui-state-hover" );
		});

		this.checkboxElement.bind("mouseout.checkbox", function() {
			if ( that.options.disabled ) {
				return;
			}
			that.boxElement
				.removeClass( "ui-state-hover" )
				.not(".ui-state-focus")
// Modified by m157y
//				.addClass( "ui-state-active" );
				.addClass( "ui-state-default" );
// End of mod
		});

		if ( this.element.is(":disabled") ) {
			this._setOption( "disabled", true );
		}
		this._refresh();
	},

	_refresh: function() {
		var checked = this.element.is(":checked");
		this.iconElement.toggleClass( "ui-icon ui-icon-check", checked ).attr( "aria-checked", checked );
	},

	widget: function() {
		return this.checkboxElement;
	},

	destroy: function() {
		this.boxElement.remove();
		this.checkboxElement
			.after( this.labelElement ).end();
		this.element
			.unwrap( "<div></div>" )
			.unwrap( "<div></div>" );

		$.Widget.prototype.destroy.apply( this, arguments );
	},

	_setOption: function( key, value ) {
		if ( key === "disabled" ) {
			this.element
				.attr( "disabled", value );
			this.checkboxElement
				[ value ? "addClass" : "removeClass" ]( "ui-checkbox-disabled" );
		}

		$.Widget.prototype._setOption.apply( this, arguments );
	}

});

}( jQuery ));

/*
* jQuery UI input
*
* Copyright (c) 2011 m157y (ru.m157y@gmail.com)
* Dual licensed under the MIT (MIT-LICENSE.txt)
* and GPL (GPL-LICENSE.txt) licenses.
*/
(function(a){a.widget("ui.input",{_init:function(){a(this.element).addClass("ui-widget ui-state-default ui-corner-all ui-input");a(this.element).bind({focusin:function(){a(this).addClass("ui-state-active")},focusout:function(){a(this).removeClass("ui-state-active")}})}})})(jQuery);
/*
* Javascript Punycode converter (RFC3492)
*
* Copyright (c) 2008 some from stackoverflow.com <http://stackoverflow.com/users/36866/some>
*
* @todo rewrite this to object
*/
(function(u){var r=new (function(){function v(a){return a-48<10?a-22:a-65<26?a-65:a-97<26?a-97:k}function s(a,d){return a+22+75*(a<26)-((d!=0)<<5)}function t(a,d,c){a=c?Math.floor(a/w):a>>1;a+=Math.floor(a/d);for(d=0;a>(k-p)*q>>1;d+=k)a=Math.floor(a/(k-p));return Math.floor(d+(k-p+1)*a/(a+x))}function y(a,d){a-=(a-97<26)<<5;return a+((!d&&a-65<26)<<5)}this.utf16={decode:function(a){for(var d=[],c=0,f=a.length,e,l;c<f;){e=a.charCodeAt(c++);if((e&63488)===55296){l=a.charCodeAt(c++);if((e&64512)!==55296||
(l&64512)!==56320)throw new RangeError("UTF-16(decode): Illegal UTF-16 sequence");e=((e&1023)<<10)+(l&1023)+65536}d.push(e)}return d},encode:function(a){for(var d=[],c=0,f=a.length,e;c<f;){e=a[c++];if((e&63488)===55296)throw new RangeError("UTF-16(encode): Illegal UTF-16 value");if(e>65535){e-=65536;d.push(String.fromCharCode(e>>>10&1023|55296));e=56320|e&1023}d.push(String.fromCharCode(e))}return d.join("")}};var k=36,w=700,p=1,q=26,x=38;this.decode=function(a,d){var c=[],f=[],e=a.length,l,j,b,h,
g,i,m,n,o;l=128;b=0;h=72;g=a.lastIndexOf("-");if(g<0)g=0;for(i=0;i<g;++i){if(d)f[c.length]=a.charCodeAt(i)-65<26;if(a.charCodeAt(i)>=128)throw new RangeError("Illegal input >= 0x80");c.push(a.charCodeAt(i))}for(g=g>0?g+1:0;g<e;){i=b;j=1;for(m=k;;m+=k){if(g>=e)throw RangeError("punycode_bad_input(1)");n=v(a.charCodeAt(g++));if(n>=k)throw RangeError("punycode_bad_input(2)");if(n>Math.floor((2147483647-b)/j))throw RangeError("punycode_overflow(1)");b+=n*j;o=m<=h?p:m>=h+q?q:m-h;if(n<o)break;if(j>Math.floor(2147483647/
(k-o)))throw RangeError("punycode_overflow(2)");j*=k-o}j=c.length+1;h=t(b-i,j,i===0);if(Math.floor(b/j)>2147483647-l)throw RangeError("punycode_overflow(3)");l+=Math.floor(b/j);b%=j;d&&f.splice(b,0,a.charCodeAt(g-1)-65<26);c.splice(b,0,l);b++}if(d){b=0;for(a=c.length;b<a;b++)if(f[b])c[b]=String.fromCharCode(c[b]).toUpperCase().charCodeAt(0)}return this.utf16.encode(c)};this.encode=function(a,d){var c,f,e,l,j,b,h,g,i,m;if(d)m=this.utf16.decode(a);a=this.utf16.decode(a.toLowerCase());var n=a.length;
if(d)for(b=0;b<n;b++)m[b]=a[b]!=m[b];var o=[];c=128;f=0;j=72;for(b=0;b<n;++b)if(a[b]<128)o.push(String.fromCharCode(m?y(a[b],m[b]):a[b]));e=l=o.length;for(l>0&&o.push("-");e<n;){h=2147483647;for(b=0;b<n;++b){g=a[b];if(g>=c&&g<h)h=g}if(h-c>Math.floor((2147483647-f)/(e+1)))throw RangeError("punycode_overflow (1)");f+=(h-c)*(e+1);c=h;for(b=0;b<n;++b){g=a[b];if(g<c)if(++f>2147483647)return Error("punycode_overflow(2)");if(g==c){h=f;for(g=k;;g+=k){i=g<=j?p:g>=j+q?q:g-j;if(h<i)break;o.push(String.fromCharCode(s(i+
(h-i)%(k-i),0)));h=Math.floor((h-i)/(k-i))}o.push(String.fromCharCode(s(h,d&&m[b]?1:0)));j=t(f,e+1,e==l);f=0;++e}}++f;++c}return o.join("")};this.ToASCII=function(a){a=a.split(".");for(var d=[],c=0;c<a.length;++c){var f=a[c];d.push(f.match(/[^A-Za-z0-9-]/)?"xn--"+r.encode(f):f)}return d.join(".")};this.ToUnicode=function(a){a=a.split(".");for(var d=[],c=0;c<a.length;++c){var f=a[c];d.push(f.match(/^xn--/)?r.decode(f.slice(4)):f)}return d.join(".")}});u.punycode=r})(window);

/**
* jQuery bxSlider v3.0
* http://bxslider.com
*
* Copyright 2011, Steven Wanderski
* http://bxcreative.com
*
* Extremally modified by m157y
*
* Free to use and abuse under the MIT license.
* http://www.opensource.org/licenses/mit-license.php
*
*/
(function(d){d.fn.bxSlider=function(a){function H(){if(!(a.mode!=="horizontal"&&a.mode!=="vertical")){var b=K(c,0,a.moveSlideQty,"backward"),u=K(c,0,c.length+a.moveSlideQty-1-(c.length-a.displaySlideQty),"forward");d.each(b,function(){e.prepend(d(this))});a.infiniteLoop===true&&d.each(u,function(){e.append(d(this))})}}function O(){a.auto===true?a.infiniteLoop===false?a.autoDirection==="next"?p=setInterval(function(){b+=a.moveSlideQty;b>q&&(b%=c.length);g.goToSlide(b,false)},a.pause):a.autoDirection===
"prev"&&(p=setInterval(function(){b-=a.moveSlideQty;b<0&&(negativeOffset=b%c.length,b=negativeOffset==0?0:c.length+negativeOffset);g.goToSlide(b,false)},a.pause)):a.autoDirection==="next"?p=setInterval(function(){g.goToNextSlide(false)},a.pause):a.autoDirection==="prev"&&(p=setInterval(function(){g.goToPreviousSlide(false)},a.pause)):a.ticker&&(a.tickerSpeed*=10,f.children(".pager").each(function(){m+=d(this).width();n+=d(this).height()}),a.tickerDirection==="prev"&&a.mode==="horizontal"?e.css("left",
"-"+(m+v)+"px"):a.tickerDirection==="prev"&&a.mode==="vertical"&&e.css("top","-"+(n+w)+"px"),a.mode==="horizontal"?(A=parseInt(e.css("left")),j(A,m,a.tickerSpeed)):a.mode==="vertical"&&(B=parseInt(e.css("top")),j(B,n,a.tickerSpeed)),a.tickerHover===true&&P())}function j(b,c,d){a.mode==="horizontal"?a.tickerDirection==="next"?e.animate({left:"-="+c+"px"},d,"linear",function(){e.css("left",b);j(b,m,a.tickerSpeed)}):a.tickerDirection==="prev"&&e.animate({left:"+="+c+"px"},d,"linear",function(){e.css("left",
b);j(b,m,a.tickerSpeed)}):a.mode==="vertical"&&(a.tickerDirection==="next"?e.animate({top:"-="+c+"px"},d,"linear",function(){e.css("top",b);j(b,n,a.tickerSpeed)}):a.tickerDirection==="prev"&&e.animate({top:"+="+c+"px"},d,"linear",function(){e.css("top",b);j(b,n,a.tickerSpeed)}))}function Q(){f.children(".bx-window").hover(function(){i===true&&g.stopShow(false)},function(){i===true&&g.startShow(false)})}function P(){e.hover(function(){i===true&&g.stopTicker(false)},function(){i===true&&g.startTicker(false)})}
function I(){c.not(":eq("+b+")").fadeTo(a.speed,0).css("zIndex",98);c.eq(b).css("zIndex",99).fadeTo(a.speed,1,function(){h=false;jQuery.browser.msie&&c.eq(b).get(0).style.removeAttribute("filter");a.onAfterSlide(b,c.length,c.eq(b))})}function r(c){a.pagerType==="full"&&a.pager===true?(d("a",o).removeClass(a.pagerActiveClass),d("a",o).eq(c).addClass(a.pagerActiveClass)):a.pagerType==="short"&&a.pager===true&&d(".bx-pager-current",o).html(b+1)}function R(b,c,e,h){var i=d('<a href="" class="bx-next"></a>'),
x=d('<a href="" class="bx-prev"></a>');b==="text"?i.html(c):i.html('<img src="'+c+'" />');e==="text"?x.html(h):x.html('<img src="'+h+'" />');a.prevSelector!==null?d(a.prevSelector).append(x):f.append(x);a.nextSelector!==null?d(a.nextSelector).append(i):f.append(i);i.click(function(){g.goToNextSlide();return false});x.click(function(){g.goToPreviousSlide();return false})}function L(b){var e=c.length;a.moveSlideQty>1&&(e=c.length%a.moveSlideQty!==0?Math.ceil(c.length/a.moveSlideQty):c.length/a.moveSlideQty);
var h="";if(a.buildPager!==null)for(b=0;b<e;++b)h+=a.buildPager(b,c.eq(b*a.moveSlideQty));else if(b==="full")for(b=1;b<=e;b++)h+='<a href="" class="pager-link pager-'+b+'">'+b+"</a>";else b==="short"&&(h='<span class="bx-pager-current">'+(a.startingSlide+1)+"</span> "+a.pagerShortSeparator+' <span class="bx-pager-total">'+c.length+"</span>");a.pagerSelector!==null?(d(a.pagerSelector).append(h),o=d(a.pagerSelector)):(e=d('<div class="bx-pager"></div>'),e.append(h),a.pagerLocation==="top"?f.prepend(e):
a.pagerLocation==="bottom"&&f.append(e),o=f.children(".bx-pager"));o.children().click(function(){if(a.pagerType==="full"){var b=o.children().index(this);a.moveSlideQty>1&&(b*=a.moveSlideQty);g.goToSlide(b)}return false})}function C(){var e=d("img",c.eq(b)).attr("title");e!==""?a.captionsSelector?d(a.captionsSelector).html(e):f.children(".bx-captions").html(e):a.captionsSelector?d(a.captionsSelector).html("&nbsp;"):f.children(".bx-captions").html("&nbsp;")}function S(b,c,e,h){k=d('<a href="" class="bx-start"></a>');
D=b==="text"?c:'<img src="'+c+'" />';E=e==="text"?h:'<img src="'+h+'" />';a.autoControlsSelector?d(a.autoControlsSelector).append(k):(f.append('<div class="bx-auto"></div>'),f.children(".bx-auto").html(k));k.click(function(){a.ticker===true?d(this).hasClass("stop")?g.stopTicker():d(this).hasClass("start")&&g.startTicker():d(this).hasClass("stop")?g.stopShow(true):d(this).hasClass("start")&&g.startShow(true);return false})}function F(){a.infiniteLoop===false&&a.hideControlOnEnd&&(b===G?f.children(".bx-prev").hide():
f.children(".bx-prev").show(),b===q?f.children(".bx-next").hide():f.children(".bx-next").show())}function t(a,b){var c=e.children(".pager").eq(a).position();return b==="left"?c.left:c.top}function K(a,b,c,e){var g=[],h=c,f=false;e==="backward"&&(a=d.makeArray(a),a.reverse());for(;h>0;)d.each(a,function(a){if(h>0)f?(g.push(d(this).clone()),h--):a==b&&(f=true,g.push(d(this).clone()),h--);else return false});return g}var a=d.extend({mode:"horizontal",infiniteLoop:true,hideControlOnEnd:false,controls:true,
speed:500,easing:"swing",pager:false,pagerSelector:null,pagerType:"full",pagerLocation:"bottom",pagerShortSeparator:"/",pagerActiveClass:"pager-active",nextText:"next",nextImage:"",nextSelector:null,prevText:"prev",prevImage:"",prevSelector:null,captions:false,captionsSelector:null,auto:false,autoDirection:"next",autoControls:false,autoControlsSelector:null,autoStart:true,autoHover:false,autoDelay:0,pause:3E3,startText:"start",startImage:"",stopText:"stop",stopImage:"",ticker:false,tickerSpeed:5E3,
tickerDirection:"next",tickerHover:false,wrapperClass:"bx-wrapper",startingSlide:0,displaySlideQty:1,moveSlideQty:1,randomStart:false,onBeforeSlide:function(){},onAfterSlide:function(){},onLastSlide:function(){},onFirstSlide:function(){},onNextSlide:function(){},onPrevSlide:function(){},buildPager:null},a),g=this,e=null,c=null,f=null,y=null,o=null,k=null,D=null,E=null,M=0,z=0,J=0,N=0,p=null,i=true,s=0,l=0,b=0,v=0,w=0,m=0,n=0,A=0,B=0,h=false,G=0,q=0;this.goToSlide=function(d,f){if(h!==true){f=f||true;
h=true;b=d;a.onBeforeSlide(b,c.length,c.eq(b));f===true&&a.auto===true&&g.stopShow(true);slide=d;if(slide===G)a.onFirstSlide(b,c.length,c.eq(b));if(slide===q)a.onLastSlide(b,c.length,c.eq(b));a.mode==="horizontal"?e.animate({left:"-"+t(slide,"left")+"px"},a.speed,a.easing,function(){h=false;a.onAfterSlide(b,c.length,c.eq(b))}):a.mode==="vertical"?e.animate({top:"-"+t(slide,"top")+"px"},a.speed,a.easing,function(){h=false;a.onAfterSlide(b,c.length,c.eq(b))}):a.mode==="fade"&&I();F();a.moveSlideQty>
1&&(d=Math.floor(d/a.moveSlideQty));r(d);C()}};this.goToNextSlide=function(d){if(h!==true){(d||true)===true&&a.auto&&g.stopShow(true);var f=false;b+=a.moveSlideQty;a.infiniteLoop===false?b<=q?(F(),a.onNextSlide(b,c.length,c.eq(b)),g.goToSlide(b)):b-=a.moveSlideQty:(h=true,b>q&&(b%=c.length,f=true),a.onNextSlide(b,c.length,c.eq(b)),a.onBeforeSlide(b,c.length,c.eq(b)),a.mode==="horizontal"?e.animate({left:"-="+a.moveSlideQty*z+"px"},a.speed,a.easing,function(){h=false;f===true&&e.css("left","-"+t(b,
"left")+"px");a.onAfterSlide(b,c.length,c.eq(b))}):a.mode==="vertical"?e.animate({top:"-="+a.moveSlideQty*l+"px"},a.speed,a.easing,function(){h=false;f===true&&e.css("top","-"+t(b,"top")+"px");a.onAfterSlide(b,c.length,c.eq(b))}):a.mode==="fade"&&I(),a.moveSlideQty>1?r(Math.ceil(b/a.moveSlideQty)):r(b),C())}};this.goToPreviousSlide=function(d){if(h!==true){(d||true)===true&&a.auto===true&&g.stopShow(true);var u=false;b-=a.moveSlideQty;a.infiniteLoop===false?(b<0&&(b=0,a.hideControlOnEnd&&f.children(".bx-prev").hide()),
F(),a.onPrevSlide(b,c.length,c.eq(b)),g.goToSlide(b)):(h=true,b<0&&(negativeOffset=b%c.length,b=negativeOffset==0?0:c.length+negativeOffset,u=true),a.onPrevSlide(b,c.length,c.eq(b)),a.onBeforeSlide(b,c.length,c.eq(b)),a.mode==="horizontal"?e.animate({left:"+="+a.moveSlideQty*z+"px"},a.speed,a.easing,function(){h=false;u===true&&e.css("left","-"+t(b,"left")+"px");a.onAfterSlide(b,c.length,c.eq(b))}):a.mode==="vertical"?e.animate({top:"+="+a.moveSlideQty*l+"px"},a.speed,a.easing,function(){h=false;
u===true&&e.css("top","-"+t(b,"top")+"px");a.onAfterSlide(b,c.length,c.eq(b))}):a.mode==="fade"&&I(),a.moveSlideQty>1?r(Math.ceil(b/a.moveSlideQty)):r(b),C())}};this.goToFirstSlide=function(a){g.goToSlide(G,a||true)};this.goToLastSlide=function(a){g.goToSlide(q,a||true)};this.getCurrentSlide=function(){return b};this.getSlideCount=function(){return c.length};this.stopShow=function(b){b=b||true;clearInterval(p);b===true&&a.autoControls===true&&(k.html(D).removeClass("stop").addClass("start"),i=false)};
this.startShow=function(b){b=b||true;O();b===true&&a.autoControls===true&&(k.html(E).removeClass("start").addClass("stop"),i=true)};this.stopTicker=function(b){b=b||true;e.stop();b===true&&a.ticker===true&&(k.html(D).removeClass("stop").addClass("start"),i=false)};this.startTicker=function(b){b=b||true;if(a.mode==="horizontal"){if(a.tickerDirection==="next")var b=parseInt(e.css("left")),d=m+b+c.eq(0).width();else a.tickerDirection==="prev"&&(b=-parseInt(e.css("left")),d=b-c.eq(0).width());var f=d*
a.tickerSpeed/m;j(A,d,f)}else a.mode==="vertical"&&(a.tickerDirection==="next"?(d=parseInt(e.css("top")),d=n+d+c.eq(0).height()):a.tickerDirection==="prev"&&(d=-parseInt(e.css("top")),d-=c.eq(0).height()),f=d*a.tickerSpeed/n,j(B,d,f),b===true&&a.ticker===true&&(k.html(E).removeClass("start").addClass("stop"),i=true))};this.initShow=function(){e=d(this);e.clone();c=e.children();f=null;y=e.children(":first");k=o=null;E=D="";M=y.width();s=0;z=y.outerWidth();l=0;J=y.outerWidth()*a.displaySlideQty;N=y.outerHeight()*
a.displaySlideQty;h=false;w=v=b=0;p="";i=true;G=B=A=n=m=0;q=c.length-1;c.each(function(){d(this).outerHeight()>l&&(l=d(this).outerHeight());d(this).outerWidth()>s&&(s=d(this).outerWidth())});if(a.randomStart){var j=Math.floor(Math.random()*c.length);b=j;v=z*(a.moveSlideQty+j);w=l*(a.moveSlideQty+j)}else b=a.startingSlide,v=z*(a.moveSlideQty+a.startingSlide),w=l*(a.moveSlideQty+a.startingSlide);H(a.startingSlide);a.mode==="horizontal"?(e.wrap('<div class="'+a.wrapperClass+'" style="width: '+J+'px; position: relative;"></div>').wrap('<div class="bx-window" style="position: relative; overflow: hidden; width: '+
J+'px;"></div>').css({width:999999,position:"relative",left:"-"+v.toString()+"px"}).children().css({width:M,"float":"left",listStyle:"none"}),f=e.parent().parent(),c.addClass("pager")):a.mode==="vertical"?(e.wrap('<div class="'+a.wrapperClass+'" style="width: '+s+'px; position: relative;"></div>').wrap('<div class="bx-window" style="width: '+s+"px; height: "+N+'px; position: relative; overflow: hidden;"></div>').css({height:999999,position:"relative",top:"-"+w.toString()+"px"}).children().css({listStyle:"none",
height:l}),f=e.parent().parent(),c.addClass("pager")):a.mode==="fade"&&(e.wrap('<div class="'+a.wrapperClass+'" style="width: '+s+'px; position: relative;"></div>').wrap('<div class="bx-window" style="height: '+l+"px; width: "+s+'px; position: relative; overflow: hidden;"></div>').children().css({listStyle:"none",position:"absolute",top:0,left:0,zIndex:98}),f=e.parent().parent(),c.not(":eq("+b+")").fadeTo(0,0),c.eq(b).css("zIndex",99));a.captions===true&&a.captionsSelector===null&&f.append('<div class="bx-captions"></div>');
a.pager===true&&a.ticker===false&&(a.pagerType==="full"?L("full"):a.pagerType==="short"&&L("short"));if(a.controls===true&&a.ticker===false)a.nextImage===""?(nextContent=a.nextText,nextType="text"):(nextContent=a.nextImage,nextType="image"),a.prevImage===""?(prevContent=a.prevText,prevType="text"):(prevContent=a.prevImage,prevType="image"),R(nextType,nextContent,prevType,prevContent);if(a.auto===true||a.ticker===true){if(a.autoControls===true)a.startImage!==""?(startContent=a.startImage,startType=
"image"):(startContent=a.startText,startType="text"),a.stopImage!==""?(stopContent=a.stopImage,stopType="image"):(stopContent=a.stopText,stopType="text"),S(startType,startContent,stopType,stopContent);a.autoStart===true?setTimeout(function(){g.startShow(true)},a.autoDelay):g.stopShow(true);a.autoHover===true&&a.ticker===false&&Q()}a.moveSlideQty>1?r(Math.ceil(b/a.moveSlideQty)):r(b);F();a.captions===true&&C();a.onAfterSlide(b,c.length,c.eq(b))};this.destroyShow=function(){clearInterval(p);f.children(".bx-next, .bx-prev, .bx-pager, .bx-auto").remove();
e.unwrap().unwrap().removeAttr("style");e.children().removeAttr("style").not(".pager").remove();c.removeClass("pager")};this.reloadShow=function(){g.destroyShow();g.initShow()};this.each(function(){d(this).children().length>0&&g.initShow()});return this};var H=d.fn.jquery.toString().split(".");if(H[0]!=1||H[1]<6)console!==void 0&&console.log!==void 0&&console.log("bxSlider requires jQuery version 1.6 or higher, but you're running:"+d.fn.jquery),d.fn.bxSlider=void 0})(jQuery);

/* Lettering.JS 0.6.1 by Dave Rupert  - http://daverupert.com */
(function($){function injector(t,splitter,klass,after){var a=t.text().split(splitter),inject='';if(a.length){$(a).each(function(i,item){inject+='<span class="'+klass+(i+1)+'">'+item+'</span>'+after});t.empty().append(inject)}}var methods={init:function(){return this.each(function(){injector($(this),'','char','')})},words:function(){return this.each(function(){injector($(this),' ','word',' ')})},lines:function(){return this.each(function(){var r="eefec303079ad17405c889e092e105b0";injector($(this).children("br").replaceWith(r).end(),r,'line','')})}};$.fn.lettering=function(method){if(method&&methods[method]){return methods[method].apply(this,[].slice.call(arguments,1))}else if(method==='letters'||!method){return methods.init.apply(this,[].slice.call(arguments,0))}$.error('Method '+method+' does not exist on jQuery.lettering');return this}})(jQuery);

/**
* Inline Form Validation Engine 2.2.4, jQuery plugin
*
* Copyright(c) 2010, Cedric Dugas
* http://www.position-absolute.com
*
* 2.0 Rewrite by Olivier Refalo
* http://www.crionics.com
*
* Extremally modified by m157y
*
* Form validation engine allowing custom regex rules to be added.
* Licensed under the MIT License
*/
(function(f){f.fn.validationEngineLanguage=function(){};f.validationEngineLanguage={newLang:function(){f.validationEngineLanguage.allRules={required:{regex:"none",alertText:"* Необходимо заполнить",alertTextCheckboxMultiple:"* Вы должны выбрать вариант",alertTextCheckboxe:"* Необходимо отметить",
alertTextSelect:"* Необходимо выбрать вариант"},minSize:{regex:"none",alertText:"* Минимум ",alertText2:" символа(ов)"},maxSize:{regex:"none",alertText:"* Максимум ",alertText2:" символа(ов)"},groupRequired:{regex:"none",
alertText:"* Необходимо заполнить одно из следующих полей"},min:{regex:"none",alertText:"* Минимальное значение "},max:{regex:"none",alertText:"* Максимальное значение "},past:{regex:"none",alertText:"* Дата до "},future:{regex:"none",alertText:"* Дата от "},
maxCheckbox:{regex:"none",alertText:"* Нельзя выбрать столько вариантов"},minCheckbox:{regex:"none",alertText:"* Пожалуйста, выберите ",alertText2:" опцию(ии)"},equals:{regex:"none",alertText:"* Поля не совпадают"},
phone:{regex:/^([\+][0-9]{1,3}[ \.\-])?([\(]{1}[0-9]{2,6}[\)])?([0-9 \.\-\/]{3,20})((x|ext|extension)[ ]?[0-9]{1,4})?$/,alertText:"* Неправильный формат телефона"},email:{regex:/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i,
alertText:"* Неверный формат email"},integer:{regex:/^[\-\+]?\d+$/,alertText:"* Не целое число"},number:{regex:/^[\-\+]?(([0-9]+)([\.,]([0-9]+))?|([\.,]([0-9]+))?)$/,alertText:"* Неправильное число с плавающей точкой"},
date:{regex:/^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/,alertText:"* Неправильная дата (должно быть в ДД.MM.ГГГГ формате)"},ipv4:{regex:/^((([01]?[0-9]{1,2})|(2[0-4][0-9])|(25[0-5]))[.]){3}(([0-1]?[0-9]{1,2})|(2[0-4][0-9])|(25[0-5]))$/,alertText:"* Неправильный IP-адрес"},
url:{regex:/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,
alertText:"* Неправильный URL"},onlyNumberSp:{regex:/^[0-9\ ]+$/,alertText:"* Только числа"},onlyLetterSp:{regex:/^[a-zA-Z\u0400-\u04FF\ \']+$/,alertText:"* Только буквы"},onlyLetterNumber:{regex:/^[0-9a-zA-Z\u0400-\u04FF]+$/,alertText:"* Запрещены специальные символы"},
ajaxUserCall:{url:"ajaxValidateFieldUser",extraData:"name=eric",alertText:"* Этот пользователь уже занят",alertTextLoad:"* Проверка, подождите..."},ajaxNameCall:{url:"ajaxValidateFieldName",alertText:"* Это имя уже занято",
alertTextOk:"* Это имя доступно",alertTextLoad:"* Проверка, подождите..."},validate2fields:{alertText:"* Пожалуйста, введите HELLO"}}}};f.validationEngineLanguage.newLang()})(jQuery);
(function(f,o){var n={required:function(a,b,c,d){var e=false;switch(a.prop("type")){default:a.val()===""&&(e=a.prop("tagName")==="SELECT"?d.allrules[b[c]].alertTextSelect:d.allrules[b[c]].alertText);break;case "radio":case "checkbox":var f=a.closest("form"),a=a.attr("name");f.find('input[name="'+a+'"]:checked').size()===0&&(e=f.find('input[name="'+a+'"]').size()===1?d.allrules[b[c]].alertTextCheckboxe:d.allrules[b[c]].alertTextCheckboxMultiple);break;case "select-one":if(!a.val())e=d.allrules[b[c]].alertText;
break;case "select-multiple":if(!a.find("option:selected").val())e=d.allrules[b[c]].alertText}return e},groupRequired:function(a,b,c,d){var e=false;a.closest("form").find('[class*="'+b[c+1]+'"]').each(function(){if(n.required(f(this),b,c,d)===false)return e=true,false});return e===false?d.allrules[b[c]].alertText:false},custom:function(a,b,c,d){b=b[c+1];return b===o?"jqv:custom rule not found "+b:d.allrules[b].regex===o?"jqv:custom regex not found "+b:RegExp(d.allrules[b].regex).test(a.val())===false?
d.allrules[b].alertText:false},funcCall:function(a,b,c,d){var e=h.getFunctionByName(b[c+1]);return typeof e==="function"?e(a,b,c,d):false},equals:function(a,b,c,d){return a.val()!==f("#"+b[c+1]).val()?d.allrules.equals.alertText:false},maxSize:function(a,b,c,d){d=d.allrules.maxSize;return a.val().length>b[c+1]?d.alertText+b[c+1]+d.alertText2:false},minSize:function(a,b,c,d){d=d.allrules.minSize;return a.val().length<b[c+1]?d.alertText+b[c+1]+d.alertText2:false},min:function(a,b,c,d){b=parseFloat(b[c+
1]);d=d.allrules.min;return parseFloat(a.val())<b?d.alertText2?d.alertText+b+d.alertText2:d.alertText+b:false},max:function(a,b,c,d){b=parseFloat(b[c+1]);d=d.allrules.max;parseFloat(a.val());return parseFloat(a.val())>b?d.alertText2?d.alertText+b+d.alertText2:d.alertText+b:false},past:function(a,b,c,d){b=b[c+1];b=b.toLowerCase()==="now"?new Date:h.parseDate(b);d=d.allrules.past;return h.parseDate(a.val())<b?d.alertText2?d.alertText+h.dateToString(b)+d.alertText2:d.alertText+h.dateToString(b):false},
future:function(a,b,c,d){b=b[c+1];b=b.toLowerCase()==="now"?new Date:h.parseDate(b);d=d.allrules.future;return h.parseDate(a.val())>b?d.alertText2?d.alertText+h.dateToString(b)+d.alertText2:d.alertText+h.dateToString(b):false},isDate:function(a){return RegExp(/^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$|^(?:(?:(?:0?[13578]|1[02])(\/|-)31)|(?:(?:0?[1,3-9]|1[0-2])(\/|-)(?:29|30)))(\/|-)(?:[1-9]\d\d\d|\d[1-9]\d\d|\d\d[1-9]\d|\d\d\d[1-9])$|^(?:(?:0?[1-9]|1[0-2])(\/|-)(?:0?[1-9]|1\d|2[0-8]))(\/|-)(?:[1-9]\d\d\d|\d[1-9]\d\d|\d\d[1-9]\d|\d\d\d[1-9])$|^(0?2(\/|-)29)(\/|-)(?:(?:0[48]00|[13579][26]00|[2468][048]00)|(?:\d\d)?(?:0[48]|[2468][048]|[13579][26]))$/).test(a)},
isDateTime:function(a){return RegExp(/^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])\s+(1[012]|0?[1-9]){1}:(0?[1-5]|[0-6][0-9]){1}:(0?[0-6]|[0-6][0-9]){1}\s+(am|pm|AM|PM){1}$|^(?:(?:(?:0?[13578]|1[02])(\/|-)31)|(?:(?:0?[1,3-9]|1[0-2])(\/|-)(?:29|30)))(\/|-)(?:[1-9]\d\d\d|\d[1-9]\d\d|\d\d[1-9]\d|\d\d\d[1-9])$|^((1[012]|0?[1-9]){1}\/(0?[1-9]|[12][0-9]|3[01]){1}\/\d{2,4}\s+(1[012]|0?[1-9]){1}:(0?[1-5]|[0-6][0-9]){1}:(0?[0-6]|[0-6][0-9]){1}\s+(am|pm|AM|PM){1})$/).test(a)},dateCompare:function(a,
b){return new Date(a.toString())<new Date(b.toString())},dateRange:function(a,b,c,d,e){return!a.val()||!b.val()?e.allrules[c[d]].alertText+e.allrules[c[d]].alertText2:n.isDate(a.val())===false||n.isDate(b.val())===false?e.allrules[c[d]].alertText+e.allrules[c[d]].alertText2:n.dateCompare(a.val(),b.val())===false?e.allrules[c[d]].alertText+e.allrules[c[d]].alertText2:false},dateTimeRange:function(a,b,c,d,e){return!a.val()||!b.val()?e.allrules[c[d]].alertText+e.allrules[c[d]].alertText2:n.isDateTime(a.val())===
false||n.isDateTime(b.val())===false?e.allrules[c[d]].alertText+e.allrules[c[d]].alertText2:n.dateCompare(a.val(),b.val())===false?e.allrules[c[d]].alertText+e.allrules[c[d]].alertText2:false},maxCheckbox:function(a,b,c,d,e){return a.find('input[name="'+b.attr("name")+'"]:checked').size()>c[d+1]?(e.showArrow=false,e.allrules.maxCheckbox.alertText2?e.allrules.maxCheckbox.alertText+" "+c[d+1]+" "+e.allrules.maxCheckbox.alertText2:e.allrules.maxCheckbox.alertText):false},minCheckbox:function(a,b,c,d,
e){return a.find('input[name="'+b.attr("name")+'"]:checked').size()<c[d+1]?(e.showArrow=false,e.allrules.minCheckbox.alertText2?e.allrules.minCheckbox.alertText+" "+c[d+1]+" "+e.allrules.minCheckbox.alertText2:e.allrules.minCheckbox.alertText):false},ajax:function(a,b,c,d){var e=d.allrules[b[c+1]],b=e.extraData||"";if(c=e.extraDataDynamic){for(var g=[],l=String(c).split(","),j="",i="",c=0,k=l.length;c<k;++c)f(l[c]).length&&(j=a.closest("form").find(id).val(),i=id.replace("#","")+"="+escape(j),g.push(i));
c=g.join("&")}else c="";d.isError||f.ajax({type:"GET",url:e.url,cache:false,dataType:"json",data:"fieldId="+a.attr("id")+"fieldName="+a.attr("name")+"&fieldValue="+a.val()+"&extraData="+b+"&"+c,field:a,rule:e,methods:methods,options:d,beforeSend:function(){var b=e.alertTextLoad;b&&h.showPrompt(a,b,"load",true,d)},error:function(a,b){h.ajaxError(a,b)},success:function(a){var b=a[0],c=f(f("#"+b)[0]);if(c.length===1){var g=a[2];if(a[1]){d.ajaxValidCache[b]!==o&&(d.ajaxValidCache[b]=true);if(g){if(d.allrules[g])(a=
d.allrules[g].alertTextOk)&&(g=a)}else g=e.alertTextOk;g?h.showPrompt(c,g,"pass",true,d):h.closePrompt(c)}else{d.ajaxValidCache[b]=false;d.isError=true;if(g){if(d.allrules[g])(a=d.allrules[g].alertText)&&(g=a)}else g=e.alertText;h.showPrompt(c,g,"",true,d)}c.trigger("jqv.field.result",[c,!d.isError,g])}}})}},h={saveOptions:function(a,b){f.validationEngineLanguage===o&&f.error("jQuery.validationEngine rules are not loaded, plz add localization files to the page");f.validationEngine.defaults.allrules=
f.validationEngineLanguage.allRules;var c=f.extend({},f.validationEngine.defaults,b);a.data("form-validation",true);a.data("form-validation-options",c);return c},getPrompt:function(a){a=h.getClassName(a.attr("id"))+"formError";if(a=f("."+h.escapeExpression(a))[0])return f(a)},calculatePosition:function(a,b,c){var d=0,e=0,g=0,f=a.width(),h=b.height(),b=b.width();c.isOverflown===true?g=-h:(e=a.offset(),d=e.top,e=e.left);var i=a.data("promptPosition")||c.promptPosition,k="",m="",n=m=0;typeof i==="string"&&
i.indexOf(":")!==-1&&(k=i.substring(i.indexOf(":")+1),i=i.substring(0,i.indexOf(":")),k.indexOf(",")!==-1&&(m=k.substring(k.indexOf(",")+1),k=k.substring(0,k.indexOf(",")),n=parseInt(m),isNaN(n)&&(n=0)),m=parseInt(k),isNaN(k));switch(i){case "bottomLeft":d=d+a.height()+15;break;case "bottomRight":e+=f-30;d+=a.height()+5;break;case "centerLeft":e-=b+13;break;case "centerRight":e+=f+13;break;case "topLeft":d+=-h-10;break;default:c.isOverflown===true?e+=f-30:(e+=f-30,d+=-h-2)}e+=m;d+=n;return{callerTopPosition:d+
"px",callerleftPosition:e+"px",marginTopSize:g+"px"}},showPrompt:function(a,b,c,d,e,f){var l=h.getPrompt(a);f&&(l=false);l?h.updatePrompt(a,l,b,c,d,e):h.buildPrompt(a,b,c,d,e)},buildPrompt:function(a,b,c,d,e){var g=f("<div>");g.addClass(h.getClassName(a.attr("id"))+"formError");a.is(":input")&&g.addClass("parentForm"+h.getClassName(a.parents("form").attr("id")));g.addClass("formError");switch(c){case "pass":g.addClass("greenPopup");break;case "load":g.addClass("blackPopup");break;default:++e.InvalidCount}d===
true&&g.addClass("ajaxed");f("<div>").addClass("formErrorContent").html(b).appendTo(g);if(e.showArrow)switch(b=f("<div>").addClass("formErrorArrow"),c=a.data("promptPosition")||e.promptPosition,typeof c==="string"&&c.indexOf(":")!==-1&&(c=c.substring(0,c.indexOf(":"))),c){case "bottomLeft":case "bottomRight":g.find(".formErrorContent").before(b);b.addClass("formErrorArrowBottom").html('<div class="line1"><\!-- --\></div><div class="line2"><\!-- --\></div><div class="line3"><\!-- --\></div><div class="line4"><\!-- --\></div><div class="line5"><\!-- --\></div><div class="line6"><\!-- --\></div><div class="line7"><\!-- --\></div><div class="line8"><\!-- --\></div><div class="line9"><\!-- --\></div><div class="line10"><\!-- --\></div>');
break;case "topLeft":case "topRight":b.html('<div class="line10"><\!-- --\></div><div class="line9"><\!-- --\></div><div class="line8"><\!-- --\></div><div class="line7"><\!-- --\></div><div class="line6"><\!-- --\></div><div class="line5"><\!-- --\></div><div class="line4"><\!-- --\></div><div class="line3"><\!-- --\></div><div class="line2"><\!-- --\></div><div class="line1"><\!-- --\></div>'),g.append(b)}e.isOverflown===true?a.before(g):f("body").append(g);e.wrapper!==""&&g.wrap(e.wrapper);e=h.calculatePosition(a,
g,e);g.css({top:e.callerTopPosition,left:e.callerleftPosition,marginTop:e.marginTopSize,opacity:0}).data("callerField",a);return g.animate({opacity:0.87})},updatePrompt:function(a,b,c,d,e,f,l){b||(b.removeClass("greenPopup blackPopup ajaxed"),typeof d!=="undefined"&&(d==="pass"&&b.addClass("greenPopup"),d==="load"&&b.addClass("blackPopup")),e===true&&b.addClass("ajaxed"),b.find(".formErrorContent").html(c),a=h.calculatePosition(a,b,f),a={top:a.callerTopPosition,left:a.callerleftPosition,marginTop:a.marginTopSize},
l===true?b.css(a):b.animate(a))},closePrompt:function(a){var b=h.getPrompt(a),c=a.closest("form").data("form-validation-options");b&&b.fadeTo("fast",0,function(){c.wrapper!==""&&b.parent().remove();b.remove()})},validateField:function(a,b,c){a.attr("id")===o&&(a.attr("id","form-validation-field-"+f.validationEngine.fieldIdCounter),++f.validationEngine.fieldIdCounter);var d=/validate\[(.*)\]/.exec(a.attr("class"));if(d===null)return false;var e=a.closest("form"),g=d[1].split(/\[|,\s*|\]/),d=false,
l=a.attr("name"),j="",i=false,k=false,m=0,p=g.length;b.isError=false;for(b.showArrow=true;m<p;++m){k=false;switch(g[m]){case "required":i=true;k=n.required(a,g,m,b);break;case "groupRequired":var r='[class*="'+g[m+1]+'"]',q=e.find(r).eq(0);if(q[0]!=a[0]){h.validateField(q,b,c);b.showArrow=true;continue}k=n.groupRequired(a,g,m,b);k!==false&&(i=true);b.showArrow=false;break;case "ajax":c!==true&&(n.ajax(a,g,m,b),d=true);break;case "custom":case "minSize":case "maxSize":case "min":case "max":case "past":case "future":case "equals":case "funcCall":k=
n[g[m]](a,g,m,b);break;case "dateRange":case "dateTimeRange":r='[class*="'+g[m+1]+'"]';q=e.find(r).eq(0);r=e.find(r).eq(1);if(q[0].value||r[0].value)k=n[g[m]](q,r,g,m,b);k!==false&&(i=true);b.showArrow=false;break;case "maxCheckbox":case "minCheckbox":k=n[g[m]](e,a,g,m,b),a=f('input[name="'+l+'"]')}if(k!==false&&(j+=k+"<br />",b.isError=true,b.showFirstAlertForFieldOnly===true))break}if(i===false&&a.val()==="")b.isError=false;c=a.prop("type");if((c==="radio"||c==="checkbox")&&e.find('input[name="'+
l+'"]').size()>1)a=e.find('input[name="'+l+'"][type!="hidden"]:first'),b.showArrow=false;else if(c==="text"&&e.find('input[name="'+l+'"]').size()>1)a=e.find('input[name="'+l+'"][type!=hidden]:first'),b.showArrow=false;b.isError?h.showPrompt(a,j,"",false,b):d||h.closePrompt(a);d||a.trigger("jqv.field.result",[a,b.isError,j]);a.trigger("jqv.field.result",[a,b.isError,j]);e=f.inArray(a[0],b.InvalidFields);e==-1?b.isError&&b.InvalidFields.push(a[0]):b.isError||b.InvalidFields.splice(e,1);return b.isError},
validateFields:function(a,b){var c=a.data("form-validation-options"),d=false,e=null;a.trigger("jqv.form.validating");a.find('[class*="validate"]').not(":hidden").not(":disabled").each(function(){d|=h.validateField(f(this),c,b);d&&e===null&&(e=f(this));if(c.doNotShowAllErrorsOnSubmit===true)return false});a.trigger("jqv.form.result",[d]);if(d){if(c.scroll){var g=e.offset().top,l=e.offset().left,j=c.promptPosition;typeof j==="string"&&j.indexOf(":")!==-1&&(j=j.substring(0,j.indexOf(":")));if(c.promptPosition!==
"bottomRight"&&c.promptPosition!=="bottomLeft")g=methods._getPrompt(e).offset().top;f("html:not(:animated), body:not(:animated)").animate({scrollTop:g,scrollLeft:l},1100,function(){c.focusFirstField&&e.focus()});if(c.isOverflown){var j=f(c.overflownDiv),l=j.scrollTop(),j=-parseInt(j.offset().top),i=f(c.overflownDiv+":not(:animated)");g+=l+j-5;i.animate({scrollTop:g},1100)}}else c.focusFirstField&&e.focus();return false}return true},validateFormWithAjax:function(a,b){var c=a.serialize(),d=b.ajaxFormValidationURL?
b.ajaxFormValidationURL:a.attr("action");f.ajax({type:"GET",url:d,cache:false,dataType:"json",data:c,form:a,methods:methods,options:b,beforeSend:function(){return b.onBeforeAjaxFormValidation(a,b)},error:function(a,b){h.ajaxError(a,b)},success:function(c){if(c!==true){for(var d=false,l="",j="",j=null,i="",k=0,m=c.length;k<m;++k)if(l=c[k],j=l[0],j=f(f("#"+j)[0]),j.length===1)if(i=l[2],l[1]===true)if(i===""||!i)h.closePrompt(j);else{if(b.allrules[i])(txt=b.allrules[i].alertTextOk)&&(i=txt);h.showPrompt(j,
i,"pass",false,b,true)}else{d|=1;if(b.allrules[i])(txt=b.allrules[i].alertText)&&(i=txt);h.showPrompt(j,i,"",false,b,true)}b.onAjaxFormComplete(!d,a,c,b)}else b.onAjaxFormComplete(true,a,"",b)}})},checkAjaxStatus:function(a){var b=true;f.each(a.ajaxValidCache,function(a,d){if(!d)return b=false});return b},ajaxError:function(a,b){a.status===0&&b===null?alert("The page is not served from a server! ajax call failed"):typeof console!=="undefined"&&console.log("Ajax error: "+a.status+" "+b)},dateToString:function(a){return a.getFullYear()+
"-"+(a.getMonth()+1)+"-"+a.getDate()},parseDate:function(a){var b=a.split("-");b===a&&(b=a.split("/"));return new Date(b[0],b[1]-1,b[2])},escapeExpression:function(a){return a.replace(/([#;&,\.\+\*\~':"\!\^$\[\]\(\)=>\|])/g,"\\$1")},getClassName:function(a){return(a||"").replace(":","_").replace(".","_")},getFunctionByName:function(a){for(var a=a.split("."),b=a.pop(),c=window,d=0,e=a.length;d<e;++d)c=c[a[d]];return c[b]}},p=function(a){var b=f(this),c=b.closest("form").data("form-validation-options");
window.setTimeout(function(){h.validateField(b,c);if(c.onSuccess!==null&&c.InvalidFields.length===0)c.onSuccess();else if(c.onFailure!==null&&c.InvalidFields.length!==0)c.onFailure()},a.data?a.data.delay:0)},s=function(){var a=f(this),b=a.data("form-validation-options"),c=h.validateFields(a,true);if(c===true&&b.ajaxFormValidation===true)return h.validateFormWithAjax(a,b),false;else if(b.onValidationComplete!==null)return b.onValidationComplete(a,c),false;return c},q={init:function(a){if(this.data("form-validation")===
o||this.data("form-validation")===false)h.saveOptions(this,a),f(".formError").live("click",function(){f(this).fadeOut(150,function(){f(this).remove()})});return this},attach:function(a){if(this.data("form-validation-bind")===true)return this;a=a?h.saveOptions(this,a):this.data("form-validation-options");this.find('[data-validation-engine*="validate"]');a.bindMethod==="bind"?(this.find('[class*="validate"]').not('[type="checkbox"]').not('[type="radio"]').not(".datepicker").bind(a.validationEventTrigger,
p),this.find('[class*="validate"][type="checkbox"], [class*="validate"][type="radio"]').bind("click",p),this.find('[class*="validate"][class*="datepicker"]').bind(a.validationEventTrigger,{delay:300},p),this.bind("submit",s)):a.bindMethod==="live"&&(this.find('[class*="validate"]').not('[type="checkbox"]').not(".datepicker").live(a.validationEventTrigger,p),this.find('[class*="validate"][type="checkbox"]').live("click",p),this.find('[class*="validate"][class*="datepicker"]').live(a.validationEventTrigger,
{delay:300},p),this.live("submit",s));this.data("form-validation-bind",true);a.autoPositionUpdate===true&&f(window).bind("resize",{noAnimation:true,formElem:this},methods.updatePromptsPosition);return this},detach:function(){if(this.data("form-validation-bind")===null||this.data("form-validation-bind")===false)return this;var a=form.data("form-validation-options");this.find('[class*="validate"]').not('[type="checkbox"]').unbind(a.validationEventTrigger,p);this.find('[class*="validate"][type="checkbox"], [class*="validate"][type="radio"]').unbind("click",
p);this.unbind("submit",a.onAjaxFormComplete);this.find('[class*="validate"]"').not('[type="checkbox"]').die(a.validationEventTrigger,p);this.find('[class*="validate"][type="checkbox"]').die("click",p);this.die("submit",a.onAjaxFormComplete);this.removeData("form-validation");this.removeData("form-validation-options");a.autoPositionUpdate===true&&f(window).unbind("resize",methods.updatePromptsPosition);return this},updatePromptsPosition:function(a){var b=a!==o&&this===window?a.data.formElem:this.closest("form"),
c=a!==o&&this===window?a.data.noAnimation:false,d=form.data("form-validation-options");b.find('[class*="validate"]').not(":hidden").not(":disabled").each(function(){var a=f(this),b=h.getPrompt(a),l=f(b).find(".formErrorContent").html();b&&h.updatePrompt(a,f(b),l,o,false,d,c)});return this},showPrompt:function(a,b,c,d){var e=this.closest("form").data("form-validation-options");e||(e=h.saveOptions(this,e));if(c)e.promptPosition=c;e.showArrow=d==true;h.showPrompt(this,a,b,false,e);return this},hidePrompt:function(a){var b=
"."+h.getClassName(f(this).attr("id"))+"formError";a===true?f(b).fadeTo("fast",0.3,function(){f(this).remove()}):f(b).remove();return this},hide:function(a){var b="",b=f(this).is("form")===true?"parentForm"+f(this).attr("id"):f(this).attr("id")+"formError";a===true?f("."+b).fadeTo("fast",0.3,function(){f(this).remove()}):f("."+b).remove();return this},hideAll:function(a){a===true?f(".formError").fadeTo("fast",0.3,function(){f(this).remove()}):f(".formError").remove();return this},closePrompt:function(a){return h.closePrompt(a)},
validateField:function(a){a=h.validateField(f(a),f(this).data("form-validation-options"));if(options.onSuccess!==null&&options.InvalidFields.length===0)options.onSuccess();else if(options.onFailure!==null&&options.InvalidFields.length!==0)options.onFailure();return a},validate:function(){return h.validateFields(this)},validateForm:function(){return s.call(this)}};f.fn.validationEngine=function(a){var b=f(this);if(b.length===0)return false;if(typeof a==="string"&&q[a]!==o)return(b.data("form-validation")===
o||b.data("form-validation")===false)&&q.init.apply(b),q[a].apply(b,Array.prototype.slice.call(arguments,1));else if(typeof a==="object"||a===o)return q.init.apply(b,arguments),q.attach.apply(b);else f.error("Method "+a+" does not exist in jQuery.validationEngine")};f.validationEngine={defaults:{validationEventTrigger:"blur",bindMethod:"bind",scroll:true,focusFirstField:true,promptPosition:"topRight",wrapper:"",showFirstAlertForFieldOnly:false,doNotShowAllErrorsOnSubmit:false,isOverflown:false,overflownDiv:"",
inlineAjax:false,ajaxFormValidation:false,ajaxFormValidationURL:false,onAjaxFormComplete:f.noop,onBeforeAjaxFormValidation:f.noop,onValidationComplete:null,binded:false,showArrow:true,autoPositionUpdate:false,isError:false,ajaxValidCache:{},InvalidFields:[],onSuccess:null,onFailure:null},fieldIdCounter:0}})(jQuery);

/*******************************************************************
* Main riverlines class
********************************************************************/
(function($, window, document, undefined) {

/**
* Additional system resources (JavaScripts, CSS styles and images) handler
*/
riverlines.resources =
[
	{
		// Loads counter
		type:	'js',
		url:	'http://www.riverlines.ru/remote/js/counter.js',
		id:		'Riverlines-Scripts-Counter',
		callback:
			function()
			{
				// Set counter cookie
				this.additions.cookieSet('RiverLinesCounter', '1');
			}
	},
	{
		// Templates
		type:	'js',
		url:	'http://www.riverlines.ru/remote/js/template_{HOST_NAME}.js',
		id:		'Riverlines-Scripts-Template',
		callback:
			function()
			{
				var
					resourceIndex = (this.resources[0].id === 'Riverlines-Scripts-Counter') ? 5 : 4;

				// Update theme URL
				this.resources[resourceIndex].url = 'http://static.riverlines.ru/css/jquery-ui-themes/' + this.preferences.theme.toLowerCase().replace(/\s/g, '-') + '.css';
			}
	},
	{
		// Online tour image preload
		type:	'image',
		url:	'http://static.riverlines.ru/remote/images/content/online.png',
		id:		'Riverlines-Images-TourOnline'
	},
	{
		// Weekend tour image preload
		type:	'image',
		url:	'http://static.riverlines.ru/remote/images/content/weekend.png',
		id:		'Riverlines-Images-TourWeekend'
	},
	{
		// @todo split to base riverlines css and additional for riverlines module
		// Base CSS
		// jQuery UI (Base, theme-independent)
		// jQuery UI (Additions, theme-independent)
		// jQuery DataTables (Basic jQuery UI Style, theme-independent)
		// General RiverLines style (theme-independent)
		type:	'css',
		// @todo update css
		url:	'http://static.riverlines.ru/remote/css/jquery-ui-1.8.12.base.css',
		id:		'Riverlines-Styles-Base'
	},
	{
		// Theme CSS
		// jQuery UI (Cupertino theme)
		type:	'css',
		url:	'http://static.riverlines.ru/css/jquery-ui-themes/cupertino.css',
		id:		'Riverlines-Styles-Theme'
	},
	{
		// @todo move it to additional action
		// Basic form data
		type:	'js',
		url:	'http://www.riverlines.ru/remote/js/data.js',
		id:		'Riverlines-Scripts-Data',
		callback:
			function()
			{
				// Workaround for empty ships list (Temporarily)
				// Prepare variables
				var
					shipsCount = 0,
					fieldName = '';

				// Check how many ships we have
				for (fieldName in this.preferences.ships)
				{
					// Ignore prototype properties
					if (this.preferences.ships.hasOwnProperty(fieldName) === false)
					{
						continue;
					}

					// Update ships counter
					++shipsCount;
				}

				// Remove ships preference if it wasn't set
				if (shipsCount == 0)
				{
					this.preferences.ships = null;
				}
				// End of workaround

				// Show navigation row after loading
				this.cache.elements.navigationHandler.style.display = 'block';

				if (this.cache.ship === undefined)
				{
					// Build search form
					this.action('buildForm');

					// Fill search form
					this.action('fillForm');

					// Hide loading message
					this.action('hideLoading');

					/**
					* Parse specified hash and enable hash checker
					* NOTE: Used setTimeout() because this function will be
					* 		called before callback checker will complete
					* 		so it can't use second action
					*/
					setTimeout(
						function()
						{
							// Enable hash checker
							riverlines.action('hashSetInterval');
						},
						150
					);
				}
				else
				{
					// Build and store last search url
					this.data.lastSearchURL = 'ships=' + riverlines.cache.ship + ((riverlines.cache.city !== undefined) ? '&citiesFrom=' + riverlines.cache.city : '');

					// Reset current page
					this.data.currentPage = 1;

					// Set default values if need
					params =
					{
						callback: this.callbacks.afterResultsLoad
					};

					// Load search page
					setTimeout(
						function()
						{
							riverlines.action('loadSearch', params);
						},
						50
					);
				}
			}
	}
];

/*******************************************************************
* Define main RiverLines class
********************************************************************/
riverlines = $.extend({}, riverlines, {
	// Callback called state
	callbackCalled:	true,

	// Last resource index
	lastResource:	0,

	/**
	* Initialize Riverlines search engine
	*/
	initialize: function()
	{
		var
			// Store variables as local
			that = this;

		/**
		* Cache our loaded jQuery
		* NOTE: Cached for compability with two versions of jQuery on
		* 		the page, for example, your site can have jQuery v1.3.2
		*/
		that.cache.jQuery = window.jQuery;

		/**
		* Cleanup from previous execution
		* NOTE:	We really need this only on riverlines constructor and
		* 		extremally AJAXed sites
		*/
		that.action('cleanup');

		/**
		* Load external resources from window object:
		*  - Panguages from window.riverlinesLanguages
		*  - Preferences from window.riverlinesPreferences
		*/
		that.language		= that.additions.extend(that.language, window.riverlinesLanguages || {});
		that.preferences	= that.additions.extend(that.preferences, window.riverlinesPreferences || {});

		/**
		* Cache specified translation if it exists
		* or use russian as default at another case
		*/
		that.cache.language = that.language[that.preferences.language] || that.language.ru;

		// Build riverlines handler
		that.action('buildSkeleton');

		// Build and show loading handler
		// @todo move to buildSkeleton and before content
		that.action('buildLoading');
		that.action('showLoading');

		// Fix problems with IDN by converting "xn--" alias to original IDN name
		if (that.cache.page.host.substr(0, 4) === 'xn--')
		{
			that.cache.page.host = punycode.ToUnicode(that.cache.page.host);
		}

		// Add hostname to template URL
		that.resources[1].url = that.resources[1].url.replace('{HOST_NAME}', that.cache.page.host);

		// Use on-page (instead external) on www.riverlines.ru/dev at preview window
		if ((that.cache.page.host === 'www.riverlines.ru' || that.cache.page.host === 'www.riverlines.dev') && document.getElementById('Riverlines-Preview'))
		{
			// Remove counter resource
			that.resources.shift();

			// Remove templates resource
			that.resources.shift();

			// Load external template and theme from preview variables
			that.templates				= previewTemplates;
			that.preferences.theme		= previewTheme;
			that.preferences.validThru	= previewValidThru;
			that.preferences.ships		= previewSelectedShips;

			// Setup theme link
			this.resources[3].url = 'http://static.riverlines.ru/css/jquery-ui-themes/' + this.preferences.theme.toLowerCase().replace(/\s/g, '-') + '.css';
		}
		else
		{
			// Remove counter resource if need
			if (that.additions.cookieGet('RiverLinesCounter') !== null)
			{
				that.resources.shift();
			}
		}

		// Load additional external resources
		that.loadResources();
	},

	/**
	* Load new or update existing resources
	*/
	loadResource: function(params)
	{
		// Don't do anything if addition type or url not specified
		if (params === undefined || params.id === undefined || params.type === undefined || params.url === undefined)
		{
			return;
		}

		// Set default values
		params.callback = params.callback || null;

		// Prepare variables
		var
			// Store variables as local
			that			= riverlines,
			cacheElements	= that.cache.elements,

			// Function variables
			element				= document.getElementById(params.id),
			elementParent		= null,
			elementName			= '',
			elementAttributes	= {},
			elementAttribute	= '';

		// Remove resource if it was already loaded before
		if (element !== null)
		{
			element.parentNode.removeChild(element);
		}

		// Fix problems with UTF8
		params.url = encodeURI(params.url).replace(/%5B/g, '[').replace(/%5D/g, ']');

		// Fix problems with IE (KB927917)
// @todo temporarily deprecated
//		if (navigator.appVersion.indexOf("MSIE") != -1 && params.url.indexOf('&amp;') === -1)
//		{
//			params.url = params.url.replace(/&/g, '&amp;');
//		}

		// Disable resources caching
		if (params.url.indexOf('?') === -1)
		{
			params.url = params.url.concat('?');
		}
		params.url = params.url.concat('&_=' + Math.random());

		// Select element attributes
		if (params.type === 'css')
		{
			elementName			= 'link';
			elementAttributes	=
			{
				type:	'text/css',
				rel:	'stylesheet',
				href:	params.url
			};
			elementParent		= cacheElements.head;
		}
		else if (params.type === 'js')
		{
			elementName			= 'script';
			elementAttributes	=
			{
				type:	'text/javascript',
				src:	params.url
			};
			elementParent		= cacheElements.head;
		}
		else if (params.type === 'image')
		{
			elementName			= 'img';
			elementAttributes	=
			{
				type:	'image',
				src:	params.url,
				alt:	'',
				title:	''
			};
			elementParent		= cacheElements.body;
		}

		// Create element
		element = document.createElement(elementName);

		// Set element attributes
		element.id = params.id;
		for (elementAttribute in elementAttributes)
		{
			element[elementAttribute] = elementAttributes[elementAttribute];
		}

		// Hide image
		// Because we use it as image preloader
		// We don't need that they will be visible
		if (params.type === 'image')
		{
			element.style.display = 'none';
		}

		// Create callback script executor if need
		if (params.callback !== null && typeof params.callback === 'function')
		{
			// Pause next loads
			that.callbackCalled = false;

			// Store callback as element parameter, because onreadystatechange
			// callback can't access to params object
			element.callback = params.callback;

			// Add onload and onreadystatechange events parser
			// We need it to execute callback when script will be loaded
			element.onload = element.onreadystatechange = riverlines.callbacks.whileResourceLoading;
		}

		// Append element to parent
		elementParent.appendChild(element);
	},

	/**
	* Load resources (JavaScripts, CSS styles and images)
	*/
	loadResources: function()
	{
		// Prepare variables
		var
			// Store variables as local
			that = riverlines;

		// Don't do anything if all resources was loaded
		if (that.resources[that.lastResource] === undefined)
		{
			return;
		}

		// Load new resource
		if (that.callbackCalled === true)
		{
			if (that.resources[that.lastResource] !== null)
			{
				that.loadResource(that.resources[that.lastResource]);
			}

			++that.lastResource;
		}

		// Recall self
		setTimeout(that.loadResources, 50);
	},

	/**
	* Calls specified actions
	*/
	action: function(action, params)
	{
		// Don't do anything if action doesn't exists
		if (riverlines.actions[action] === undefined)
		{
			return;
		}

		// Call specified action
		return riverlines.actions[action].apply(riverlines, [params]);
	}
});

/*******************************************************************
* JavaScript additional functions class
********************************************************************/
riverlines.additions =
{
	/**
	* Insert new element after specified target
	*
	* Unfortunally JavaScript provides built-in only insertBefore() method
	* So we create insertAfter() method, because we need it for loading div creation
	* Before jQuery will be loaded
	*/
	insertAfter: function(target, needle)
	{
		// Prepare variables
		var
			parent = null;

		// Catch target element if only id was specified
		if (typeof(target) === 'string')
		{
			target = document.getElementById(target);
		}

		// Catch needle element if only id was specified
		if (typeof(needle) === 'string')
		{
			needle = document.getElementById(needle);
		}

		// Catch targets parent
		parent = target.parentNode;

		// Use appenChild if target is last child of the parent
		// Or insertBefore() for nextSibling at another case
		if (parent.lastchild === target)
		{
			parent.appendChild(needle);
		}
		else
		{
			parent.insertBefore(needle, target.nextSibling);
		}
	},

	/**
	* Merge objects values
	* Idea borrowed from PrototypeJS
	*/
	extend: function(destination, source)
	{
		// Prepare variables
		var
			property = '';

		for (property in source)
		{
			destination[property] = source[property];
		}

		return destination;
	},

	/**
	* Selects elements by class name
	* Used for compability with IE
	*
	* Developed by Robert Nyman, http://www.robertnyman.com
	* Code/licensing: http://code.google.com/p/getelementsbyclassname/
	*/
	getElementsByClassName: function(className, tag, element)
	{
		// FIX: Prototype 1.4 and below has some problems here
		var
			prototypeVersion	= (typeof(Prototype) !== 'undefined') ? Prototype.Version.split('.') : [0, 0, 0];

		if (document.getElementsByClassName && (prototypeVersion[0] != 1 && prototypeVersion[1] > 4))
		{
			getElementsByClassName =
				function(className, tag, element)
				{
					// Set default values
					element = element || document;

					// Prepare variables
					var
						elements		= element.getElementsByClassName(className),
						nodeName		= (tag) ? new RegExp("\\b" + tag + "\\b", 'i') : null,
						returnElements	= [],
						current			= null,

						i	= 0,
						il	= elements.length;

					for(; i < il; ++i)
					{
						current = elements[i];
						if (!nodeName || nodeName.test(current.nodeName))
						{
							returnElements.push(current);
						}
					}

					return returnElements;
				};
		}
		else if (document.evaluate)
		{
			getElementsByClassName =
				function(className, tag, element)
				{
					// Set default values
					tag		= tag || '*';
					element	= element || document;

					// Prepare variables
					var
						classes				= className.split(' '),
						classesToCheck		= '',
						xhtmlNamespace		= 'http://www.w3.org/1999/xhtml',
						namespaceResolver	= (document.documentElement.namespaceURI === xhtmlNamespace) ? xhtmlNamespace : null,
						returnElements		= [],
						elements			= null,
						node				= null,

						i	= 0,
						il	= classes.length;

					for(; i < il; ++i)
					{
						classesToCheck += "[contains(concat(' ', @class, ' '), ' " + classes[i] + " ')]";
					}

					try
					{
						elements = document.evaluate(".//" + tag + classesToCheck, element, namespaceResolver, 0, null);
					}
					catch (e)
					{
						elements = document.evaluate(".//" + tag + classesToCheck, element, null, 0, null);
					}

					while (node = elements.iterateNext())
					{
						returnElements.push(node);
					}

					return returnElements;
				};
		}
		else
		{
			getElementsByClassName =
				function(className, tag, element)
				{
					// Set default values
					tag		= tag || '*';
					element	= element || document;

					// Prepare variables
					var
						classes			= className.split(' '),
						classesToCheck	= [],
						elements		= (tag === '*' && element.all) ? element.all : element.getElementsByTagName(tag),
						current			= null,
						returnElements	= [],
						match			= false,

						i	= 0,
						il	= classes.length,
						j	= 0,
						jl	= 0;

					for(; i < il; ++i)
					{
						classesToCheck.push(new RegExp("(^|\\s)" + classes[i] + "(\\s|$)"));
					}

					for (i = 0, il = elements.length; i < il; ++i)
					{
						current	= elements[i];
						match	= false;
						for (jl = classesToCheck.length; j < jl; ++j)
						{
							match = classesToCheck[j].test(current.className);
							if (match === false)
							{
								break;
							}
						}

						if (match)
						{
							returnElements.push(current);
						}
					}

					return returnElements;
				};
		}

		return getElementsByClassName(className, tag, element);
	},

	/**
	* Sort options at select
	*/
	sortOptions: function(select)
	{
		// Prepare variables
		var
			options	= [],

			i	= 0,
			il	= select.options.length,

			/**
			* Compare options text callback
			*
			* return >0 if a>b
			*         0 if a=b
			*        <0 if a<b
			*/
			compareOptionText =
				function(a, b)
				{
					// Numerical comparison
					if (isFinite(a.text) && isFinite(b.text))
					{
						return a.text - b.text;
					}

					// textual comparison
					return (a.text != b.text) ? ((a.text < b.text) ? -1 : 1) : 0;
				};

		// Store options
		for (; i < il; ++i)
		{
			options[i] = new Option(select.options[i].text, select.options[i].value);
		}

		// Sort options using given function
		options.sort(compareOptionText);

		// Make copies of sorted options back to list
		for (i = 0; i < il; ++i)
		{
			select.options[i] = new Option(options[i].text, options[i].value);
		}
	},

	/**
	* Analog of PHP time() function
	*/
	time: function()
	{
		return Math.round(((new Date()).getTime() - (new Date()).UTC(1970, 0, 1)) / 1000);
	},

	/**
	* Set cookie
	*/
	cookieSet: function(name, value, expires, path, domain, secure)
	{
		// Don't do anything if required variables doesn't specified
		if (name === undefined || value === undefined)
		{
			return;
		}

		// Set default values
		expires	= expires	|| null;
		path	= path		|| '/';
		domain	= domain	|| null;
		secure	= secure	|| null;

		// Actually set cookie
		document.cookie =
			''.concat(
				name, '=', escape(value),
				((expires !== null)	? '; expires=' + expires	: ''),
				((path !== null)	? '; path=' + path			: ''),
				((domain !== null)	? '; domain=' + domain		: ''),
				((secure !== null)	? '; secure'				: '')
			);
	},

	/**
	* Get cookie
	*/
	cookieGet: function(name)
	{
		// Return null if page doesn't have cookies or name not specified
		if (document.cookie === '' || name === undefined)
		{
			return null;
		}

		// Prepare variables
		var
			cookiesString	= document.cookie;
			searchString	= name + '=',
			positionOffset	= 0,
			positionEnd		= 0;

		// Calculate cookie string offset
		positionOffset = cookiesString.indexOf(searchString);

		// Return null if cookie doesn't exist
		if (positionOffset === -1)
		{
			return null;
		}

		// Update offset to value position
		positionOffset = positionOffset + searchString.length;

		// Calculate value end position
		positionEnd = cookiesString.indexOf(';', positionOffset);

		// Set whole cookies line lenght if requested cookie last in list
		if (positionEnd === -1)
		{
			positionEnd = cookiesString.length;
		}

		// Actually catch cookie
		return unescape(cookiesString.substr(positionOffset, positionEnd));
	}
};

/*******************************************************************************
* Riverlines callbacks class
*******************************************************************************/
riverlines.callbacks =
{
	/***************************************************************************
	* Kernel callbacks
	***************************************************************************/
	whileResourceLoading: function()
	{
		if (riverlines.callbackCalled === false && (this.readyState === undefined || this === 'loaded' || this.readyState === 'loaded' || this.readyState === 'complete'))
		{
			// Call callback
			if (this.callback !== undefined && this.callback !== null)
			{
				this.callback.apply(riverlines);
			}

			// Remove callback from element
			this.callback = null;

			// Remove element events
			this.onload = this.onreadystatechange = null;

			// Set called state to true so we can call next callbacks
			riverlines.callbackCalled = true;
		}
	},
	/***************************************************************************
	* Callbacks for handbook
	***************************************************************************/
	/**
	* Handbook link click action
	*/
	handbookOpen: function()
	{
		// Store handbook current parent
		riverlines.data.handbook.parent = this.rel;

		// Show loading message
		riverlines.action('showLoading');

		// Open handbook dialog
		riverlines.action('loadHandbook');

		// Prevent default action
		return false;
	},

	/**
	* Handbook page load action
	*/
	handbookLoad: function()
	{
		// Store handbook current page
		riverlines.data.handbook.page = this.value || this.rel;

		// Show loading message
		riverlines.action('showLoadingHandbook');

		// Load handbook data
		riverlines.action('loadHandbookData');

		// Prevent default action
		return false;
	},

	/***************************************************************************
	* Callbacks for search form
	***************************************************************************/
	/**
	* Form submit action
	* NOTE: Don't use form submit action, instead click on submit button
	*/
	formSubmit: function()
	{
		// Click submit button
		riverlines.cache.elements.formSubmit.click();

		// Prevent original submit event
		return false;
	},

	/**
	* Form submit button click callback
	* NOTE: We use jQuery at inline function because this will be called
	*       when user submit form and this will be after form build action
	*       so it doesn't slows whole script
	*/
	formSubmitButton: function(callback)
	{
// @todo optimize
// @todo move params building to external function
		// Callback default action
		callback = (callback !== undefined && typeof callback === 'function') ? callback : undefined;
		// Prepare variables
		var
			// Store variables as local
			that	= riverlines, // Local stored object will work slightly faster
			cache	= that.cache,
			$		= cache.jQuery,

			// Function variables
			field	= '',
			fields	= that.data.fields,
			params	=
			[
				'submit=1'
			];

		// Show loading message
		that.action('showLoading');

		// Hide tour and order navigation links
		cache.elements.navigationTour.style.display = 'none';
		cache.elements.navigationOrder.style.display = 'none';

		// Add existing fields
		for (field in fields)
		{
			if (field === 'formSubmit')
			{
				continue;
			}
			else if (field === 'formCitiesInline' || field === 'formRivers')
			{
				var
					fieldName = encodeURIComponent(fields[field].name);

// @todo use cache
				// Add inline cities and rivers arrays
				$('#Riverlines-Form').find('input:checkbox[name="' + fieldName + '[]"]').each(
					function()
					{
						params.push(fieldName + '[]=' + encodeURIComponent(this.value));
					}
				);
			}
			else if (field === 'formOnline' || field === 'formWeekend')
			{
				if (cache.elements[field] !== undefined && cache.elements[field] !== null && cache.elements[field].checked)
				{
					params.push(fields[field].name + '=1');
				}
			}
			else
			{
				if (cache.elements[field] !== undefined && cache.elements[field] !== null && cache.elements[field].value)
				{
					params.push(fields[field].name + '=' + encodeURIComponent(cache.elements[field].value));
				}
			}
		}

		// Build and store last search url
		that.data.lastSearchURL = params.join('&') + that.data.ignore.ships;

		// Reset current page
		that.data.currentPage = 1;

		// Load results
		that.action('loadSearch', {callback: callback});

		// Prevent original click event
		return false;
	},

	/**
	* Ability to select few elements at "inline cities" or "rivers" selects
	* this context is select element
	*/
	formMultiselect: function()
	{
// @todo optimize
		// Prepare variables
		var
			// Store variables as local
			that	= riverlines, // Local stored object will work slightly faster

			// Store selected index, value and text
			selectedIndex	= this.selectedIndex,
			selectedValue	= this.value,
			selectedText	= this.options[selectedIndex].text,

			// Prepare checkbox id and element
			checkboxId	= this.id + '-' + selectedValue.replace(/\s/g, '-'),

			// Checkbox wrapper element
			spanElement;

		// Select first element
		this.options[0].selected = true;

		// Check is specified element already selected
		// Actually we can't select this element twice,
		// but we prefer double check :)
		if (document.getElementById(checkboxId) !== null)
		{
			// Open error dialog
			that.action('openDialogError', that.cache.language.formMultiselectError.replace('{element}', selectedText));

			// Exit from function
			return;
		}

		// Disable option at select
		this.options[selectedIndex].disabled = true;

		// Create checkbox and insert it in select handler
		spanElement = document.createElement('span');
		spanElement.innerHTML =
			''.concat(
				'<input type="checkbox" name="', this.name, '[]" value="', selectedValue, '" id="', checkboxId, '" rel="', selectedIndex, '" checked="checked" /> ',
				'<label for="', checkboxId, '">', selectedText, ' &nbsp; </label>',
				'<br />'
			);
		this.parentNode.appendChild(spanElement);

		// Add onChange handler to checkbox
		// NOTE: we doesn't use any event manager like addEventListener() or $().change()
		//       because we set only one action and this method works fast everywhere
		document.getElementById(checkboxId).onchange = that.callbacks.formMultiselectCheckbox;

		// Resize slide
		that.action('resizeForm');
		that.action('resizeSlide');
	},

	/**
	* Checkbox at multiselects
	* this context is checkbox
	*/
	formMultiselectCheckbox: function()
	{
		// Prepare variables
		var
			// Store variables as local
			that	= riverlines, // Local stored object will work slightly faster

			// Slightly speed-up next selects
			spanElement		= this.parentNode,
			selectHandler	= spanElement.parentNode,
			selectElement	= selectHandler.getElementsByTagName('select')[0],

			// Simplify the code
			selectedIndex	= this.getAttribute('rel');

		// Enable option
		selectElement.options[selectedIndex].disabled = false;

		// Remove <span> handler
		selectHandler.removeChild(spanElement);

		// Resize slide
		that.action('resizeForm');
		that.action('resizeSlide');
	},

	/**
	* Actions which must be don after results loaded
	*/
	afterResultsLoad: function()
	{
		// Update URL hash if need
		if (riverlines.cache.ship === undefined)
		{
			riverlines.action(
				'hashUpdate',
				{
					name:	'search',
					url:
						''.concat(
							riverlines.data.lastSearchURL,
							'&start=', riverlines.data.currentPage,
							'&perPage=', riverlines.preferences.resultsPerPage
						)
				}
			); // riverlines.action();
		}

		// Calculate pages count
		riverlines.data.totalPages = Math.ceil(riverlines.data.resultsCount / riverlines.preferences.resultsPerPage);

		// Build search results
		riverlines.action('displayResults');

		// Hide loading message
		riverlines.action('hideLoading');
	},

	/***************************************************************************
	* Callbacks for search results
	***************************************************************************/
	/**
	* Paginator switch page callback
	*/
	paginatorSwitchPage: function(page)
	{
		// Prepare variables
		var
			that	= riverlines; // Local stored object will work slightly faster

		// Show loading message
		that.action('showLoading');

		// Set specified page as current
		that.data.currentPage = page;

		// Scroll to navigation row
		that.action('goToByScroll', $('#Riverlines-Navigation').offset().top);

		// Load results
		that.action('loadSearch');

		// Prevent default action
		return false;
	}
};

/*******************************************************************
* Riverlines actions class
********************************************************************/
riverlines.actions =
{
	/*******************************************************************
	* General system actions
	********************************************************************/
	/**
	* Check is account valid or not
	*/
	validateAccount: function()
	{
// @todo disable valid thru date checker
//		if (this.preferences.validThru < this.additions.time())
//		{
//			return false;
//		}

		return true;
	},

	/**
	* Scroll to specified element
	*/
	goToByScroll: function(top)
	{
// @todo remove jQuery dependency
		// Prepare variables
		var
			// Store variables as local
			$	= this.cache.jQuery;

		// Scroll to specified position
		$('html, body').animate({scrollTop: top}, 'slow');
	},

	/*******************************************************************
	* System actions for URL hash
	********************************************************************/
	/**
	* Update hash with URL
	*/
	hashUpdate: function(params)
	{
// @todo optimize
		// Set default values
		params		= params		|| {};
		params.name	= params.name	|| '';
		params.url	= params.url	|| '';

		// Prepare variables
		var
			url = '#/';

		// Build and cache URL
		if (params.name !== '' && params.url !== '')
		{
			// Start URL building
			url = '#/RL/';

			// Catch module params
			if (params.name === 'search')
			{
				// Prepare variables
				var
					// Store variables as local
					$	= this.cache.jQuery,

					// Function variables
					field	= '',
					fields	= this.data.fields;

				// Append module prefix
				url = url + 'Search/';

				// Store form elements values
				for (field in fields)
				{
					// Ignore elements which not exsits and submit button
					if (riverlines.cache.elements[field] === undefined || riverlines.cache.elements[field] === null || field === 'formSubmit')
					{
						continue;
					}

					// Element specific action
					if (field === 'formCitiesInline' || field === 'formRivers')
					{
						// Add inline cities and rivers arrays
						var
							urlPart = '&';

						$('#Riverlines-Form').find('input:checkbox[name="' + fields[field].name + '[]"]').each(
							function()
							{
								urlPart = urlPart.concat(this.getAttribute('rel'), '&');
							}
						);
						url = url.concat(urlPart, '/');
					}
					else if (riverlines.cache.elements[field].tagName === 'SELECT')
					{
						// Select menu
// @todo hash fix
//						url = url.concat(riverlines.cache.elements[field].selectedIndex, '/');
//						url = url.concat(encodeURIComponent(riverlines.cache.elements[field].value), '/');
						url = url.concat(riverlines.cache.elements[field].value.replace(/\//g, '~'), '/');
					}
					else if (riverlines.cache.elements[field].tagName === 'INPUT')
					{
						if (riverlines.cache.elements[field].type === 'text')
						{
							// Text box
							url = url.concat(riverlines.cache.elements[field].value, '/');
						}
						else
						{
							// Check box
							url = url.concat(riverlines.cache.elements[field].checked, '/');
						}
					}
				} // for (field in fields)
			}
			else if (params.name === 'tour')
			{
				url = url.concat(params.url);
			}

			// Store url
			this.data.hash[params.name] = url;
		} // if (params.url !== undefined)
		else if (this.data.hash[params.name] !== undefined)
		{
			url = this.data.hash[params.name];
		}

// @todo hash fix
		// Store hash as last hash
		this.data.hash.lastHash = url;

		// Update URL
		window.location.assign(this.cache.page.url + url);
// @todo hash fix
/*
		// We need convert back hash for hash history
		// At FF (maybe at some other browsers) we need decode hash via decodeURIComponent (yeah, back)
		if (window.location.hash.indexOf('%') === -1)
		{
			var
				hashParts = url.split('/'),
				i	= 0,
				il	= hashParts.length;

			for (; i < il; ++i)
			{
				hashParts[i] = decodeURIComponent(hashParts[i]);
			}
			url = hashParts.join('/');
		}

		// Store hash as last hash
		this.data.hash.lastHash = url;
*/
	},

	/**
	* Update cache from URL hash
	*/
	hashParse: function()
	{
// @todo optimize
		// Prepare variables
		var
			// Store variables as local
			hash	= window.location.hash,
			data	= this.data,
			cache	= this.cache,
			$		= cache.jQuery,

			// Function variables
			hashParams	= [],
			module		= '';

		// Store hash as last hash
		data.hash.lastHash = hash;

		// Don't do anything if this hash is not our
		if (hash === '' || hash === '#' || hash.substr(0, 5) !== '#/RL/')
		{
			// Display search form
			this.action('displaySearch');

			return;
		}

		// Remove hash checker
		this.action('hashRemoveInterval');

		// Clean hash, hash params and module
		hash = hash.substr(5);

		// Catch hash params
		hashParams = hash.split('/');

		// Catch module
		module = hashParams.shift();

		// Cache for module
		data.hash[module.toLowerCase()] = data.hash.lastHash;

		// Parse module
		if (module === 'Search' && cache.ship !== undefined)
		{
// @todo do we really need this?
			// Just activate search results tab, if we use one-ship version
			$('#Riverlines-Tabs').tabs('select', 0);
		}
		else if (module === 'Tour')
		{
			// Catch tour id
			var
				tourId = hashParams.shift();

			setTimeout(
				function()
				{
					// Load tour
					riverlines.action('loadTour', {
						tourId:		tourId,
						callback:
							function()
							{
								// Display tour page
								riverlines.action('displayTour');

								// Hide loading message
								riverlines.action('hideLoading');
							}
					});
				},
				10
			);
		}
		else if (module === 'Search')
		{
// @todo optimize
			// Prepare variables
			var
				cacheElements	= cache.elements,

				field		= '',
				fields		= data.fields,
// @todo hash fix
				fieldValue	= '',

				checkedState		= false,
				multiSelect			= [],
				multiSelectValue	= '',
// @todo hash fix
				i	= 0,
				il	= 0;

			// Parse each field
			for (field in fields)
			{
				// Ignore field if it doesn't exists or if it's submit-button
				if (cacheElements[field] === undefined || cacheElements[field] === null || field === 'formSubmit')
				{
					continue;
				}

				// Field specific action
				if (field === 'formCitiesInline' || field === 'formRivers')
				{
					// Multiselect
					multiSelect = hashParams.shift().split('&');
					while ((multiSelectValue = multiSelect.shift()) !== undefined)
					{
						if (multiSelectValue === '')
						{
							continue;
						}

						cacheElements[field].selectedIndex = multiSelectValue;
						cacheElements[field].onchange();
					}
				}
				else if (cacheElements[field].tagName === 'SELECT')
				{
					// Select
// @todo hash fix
//					cacheElements[field].options[hashParams.shift()].selected = true;
//					fieldValue = decodeURIComponent(hashParams.shift());
					fieldValue = hashParams.shift().replace(/~/g, '/');
					for (i = 0, il = cacheElements[field].options.length; i < il; ++i)
					{
						if (cacheElements[field].options[i].value == fieldValue)
						{
							cacheElements[field].options[i].selected = true;
							break;
						}
					}
				}
				else if (cacheElements[field].tagName === 'INPUT')
				{
					if (cacheElements[field].type === 'text')
					{
						// Text box
						cacheElements[field].value = hashParams.shift();
					}
					else
					{
						// Checkbox
						checkedState = (hashParams.shift() === 'true') ? true : false;
						if (cacheElements[field].checked != checkedState)
						{
							cacheElements[field].click();
						}
					}
				}
			}

			// Submit search
			this.callbacks.formSubmitButton();
		}

		// Set hash checker
		this.action('hashSetInterval');
	},

	/**
	* Hash checker
	*/
	hashChecker: function()
	{
		// Don't do anything if hash not changed
		if (riverlines.data.hash.lastHash === window.location.hash)
		{
			return;
		}

		// Parse hash
		riverlines.action('hashParse');
	},

	/**
	* Set hash check interval
	*/
	hashSetInterval: function()
	{
		// Interval already set
		if (riverlines.data.hash.interval !== null)
		{
			return;
		}

		// Set interval for hash checker
		riverlines.data.hash.interval = window.setInterval(
			function()
			{
				riverlines.action('hashChecker');
			},
			250
		); // riverlines.data.hash.interval = window.setInterval();
	},

	/**
	* Remove hash check interval
	*/
	hashRemoveInterval: function()
	{
		// Don't do anything if interval not set
		if (riverlines.data.hash.interval === null)
		{
			return;
		}

		clearInterval(riverlines.data.hash.interval);
		riverlines.data.hash.interval = null;
	},

	/*******************************************************************
	* System actions for template
	********************************************************************/
	/**
	* Clean up action
	* This will remove all resources, and elements
	* which was created by previous instance of Riverlines
	*/
	cleanup: function()
	{
// @todo optimize
		// Prepare variables
		var
			// Store variables as local
			resources				= this.resources,
			getElementsByClassName	= this.additions.getElementsByClassName,

			// Function variables
			handler		= null,
			wrappers	= [],

			i	= 0,
			il	= 0;

		// Remove all resources
		for (i in resources)
		{
			if (handler = document.getElementById(resources[i].id))
			{
				handler.parentNode.removeChild(handler);
			}
		}

		// Remove all jQuery UI wrappers with their contents
		// NOTE: Greater then 1 because we must count a body tag
		while ((wrappers = getElementsByClassName('Riverlines-jQueryUI')), il = wrappers.length, il > 1)
		{
			// Remove all previous wrappers
			for (i = 0; i < il; i++)
			{
				// Don't remove <body/> tag
				if (wrappers[i].tagName === 'BODY')
				{
					continue;
				}

				wrappers[i].parentNode.removeChild(wrappers[i]);
			}
		}

		// Remove datepicker handler
		if (handler = document.getElementById('ui-datepicker-div'))
		{
			// If Riverlines was loaded before we already wrapped datepicker
			// So we must catch wrapper element and remove it with all it content
			if (handler.parentNode.tagName === 'DIV')
			{
				handler = handler.parentNode;
			}

			handler.parentNode.removeChild(handler);
		}

		// Remove handler
		if (handler = document.getElementById('Riverlines-Handler'))
		{
			handler.parentNode.removeChild(handler);
		}
	},

	/**
	* Fill loaded template with variables
	*/
	fillTemplate: function(params)
	{
		// Prepare variables
		var
			string		= '',
			index		= -1,
			lastIndex	= 0;

		// Parse variables
		for (string in params.vars)
		{
			index		= -1;
			lastIndex	= 0;

			while (index = params.template.indexOf(string, lastIndex), index !== -1)
			{
				params.template =
					''.concat(
						params.template.substring(0, index),
						params.vars[string],
						params.template.substring(index + string.length)
					);
				lastIndex = index + params.vars[string].length;
			}
		}

		return params.template;
	},

	/**
	* Build riverlines handler
	*/
	buildSkeleton: function()
	{
// @todo optimize
		// Prepare variables
		var
			// Store variables as local
			cache		= this.cache,
			elements	= cache.elements,
			language	= cache.language,

			// Function variables
			handlerElement	= document.createElement('div'), // Create handler element
			siblingElement	= document.getElementById('Riverlines-Preview') || document.getElementById('Riverlines'), // Catch sibling element
			contentHandler	= document.createElement('div'); // Create content slider element

		// Store specified ship
		// NOTE: If ship specified we'll enable single-ship mode
		if (siblingElement.getAttribute('data-ship') !== null)
		{
			cache.ship = siblingElement.getAttribute('data-ship');
		}

		// Store specified city
		if (siblingElement.getAttribute('data-city') !== null)
		{
			cache.city = siblingElement.getAttribute('data-city');
		}

		/**
		* Build and setup RiverLines handler
		*/
		// Set handler options
		handlerElement.id				= 'Riverlines-Handler';
		handlerElement.className		= 'Riverlines-jQueryUI';
		handlerElement.style.position	= 'relative';
// @todo do we really need this?
		handlerElement.style.width		= 'auto';
		handlerElement.style.height		= '100px';

		// Append handler to body
		elements.body.appendChild(handlerElement);

		// Move handler to specified page location
		this.additions.insertAfter(siblingElement, handlerElement);

		// Cache handler
		elements.handler = handlerElement;

		/**
		* Build and setup content skeleton
		*/
		// Build content skeleton
		contentHandler.id = 'Riverlines-Content-Handler';

		// Build content skeleton
		contentHandler.id = 'Riverlines-Content-Handler';
		contentHandler.innerHTML =
			''.concat(
				// Content header (Currently used in single-ship mode only)
				'<div id="Riverlines-Content-Header"></div>',

				// Navigation
				'<div id="Riverlines-Navigation" class="ui-widget ui-widget-content ui-corner-all ui-state-default" style="display: none;">',
					// Single default mode
					'<div id="Riverlines-Navigation-Search">',
						'<span>', language.navTitleSearch, '</span>',
					'</div>',

					// Both modes
					'<div id="Riverlines-Navigation-Results">',
						// Additional arrow used only in default mode
						((cache.ship === undefined) ? '<span class="ui-icon ui-icon-triangle-1-e" style="float: left;"></span> ' : ''),
						'<span id="Riverlines-Navigation-Results-Title">', language.navTitleSearchResults, '</span>',
					'</div>',
					'<div id="Riverlines-Navigation-Tour">',
						'<span class="ui-icon ui-icon-triangle-1-e" style="float: left;"></span> ',
						'<span id="Riverlines-Navigation-Tour-Title">', language.navTitleTour, '</span>',
					'</div>',
					'<div id="Riverlines-Navigation-Order">',
						'<span class="ui-icon ui-icon-triangle-1-e" style="float: left;"></span> ',
						'<span>', language.navTitleOrder, '</span>',
					'</div>',
				'</div>',

				// Content body
				'<div id="Riverlines-Content-Body">',
					// Workaround for some designs
					'<style>#Riverlines-Content-Slider li {margin: 0 !important;}</style>',

					// Content slider
					'<ul id="Riverlines-Content-Slider">',
						// Default mode
						'<li id="Riverlines-Content-Search"></li>',

						// Both modes
						'<li id="Riverlines-Content-Results"></li>',
						'<li id="Riverlines-Content-Tour"></li>',
						'<li id="Riverlines-Content-Order"></li>',
					'</ul>',
				'</div>',

				// Content footer (Currently used in single page mode only)
				'<div id="Riverlines-Content-Footer"></div>'
			);

		// Append content skeleton to handler
		handlerElement.appendChild(contentHandler);

		// Cache elements
		elements.navigationHandler	= document.getElementById('Riverlines-Navigation');
		elements.contentHeader		= document.getElementById('Riverlines-Content-Header');
		elements.contentBody		= document.getElementById('Riverlines-Content-Body');
		elements.contentFooter		= document.getElementById('Riverlines-Content-Footer');
		elements.contentSlider		= document.getElementById('Riverlines-Content-Slider');

		/**
		* Build and setup navigation and slides
		*/
		// Some additional actions required for default mode
		if (cache.ship !== undefined)
		{
			// Update content slides indexes
			--this.data.contentSlides.results;
			--this.data.contentSlides.tour;
			--this.data.contentSlides.order;

			// Catch not used elements
			var
				navigationElement = document.getElementById('Riverlines-Navigation-Search');
				contentElement = document.getElementById('Riverlines-Content-Search');

			// Remove them
			navigationElement.parentNode.removeChild(navigationElement);
			contentElement.parentNode.removeChild(contentElement);
		}

		// Cache navigation elements
		elements.navigationResults	= document.getElementById('Riverlines-Navigation-Results');
		elements.navigationTour		= document.getElementById('Riverlines-Navigation-Tour');
		elements.navigationOrder	= document.getElementById('Riverlines-Navigation-Order');

		// Cache navigation items' titles
		elements.navigationResultsTitle	= document.getElementById('Riverlines-Navigation-Results-Title');
		elements.navigationTourTitle	= document.getElementById('Riverlines-Navigation-Tour-Title');

		// Cache content slides
		elements.contentSearch	= document.getElementById('Riverlines-Content-Search');
		elements.contentResults	= document.getElementById('Riverlines-Content-Results');
		elements.contentTour	= document.getElementById('Riverlines-Content-Tour');
		elements.contentOrder	= document.getElementById('Riverlines-Content-Order');

		// Hide all navigation items by default
		elements.navigationResults.style.display	= 'none';
		elements.navigationTour.style.display		= 'none';
		elements.navigationOrder.style.display		= 'none';

		// Setup onClick actions for navigation items
		// Search results item
		elements.navigationResults.onclick	=
			function()
			{
				riverlines.cache.elements.$navigationSlider.goToSlide(riverlines.data.contentSlides.results);
				riverlines.action('hashUpdate', {name: 'search'});
			};
		// Tour item
		elements.navigationTour.onclick		=
			function()
			{
				riverlines.cache.elements.$navigationSlider.goToSlide(riverlines.data.contentSlides.tour);
				riverlines.action('hashUpdate', {name: 'tour'});
			};
		// Order item
		elements.navigationOrder.onclick	=
			function()
			{
				riverlines.cache.elements.$navigationSlider.goToSlide(riverlines.data.contentSlides.order);
// @todo update hash
//				riverlines.action('hashUpdate', {name: 'order'});
			};

		// And we still need additional actions for default mode
		if (cache.ship === undefined)
		{
			// Cache search form navigation element
			elements.navigationSearch	= document.getElementById('Riverlines-Navigation-Search');

			// Hide navigation element
			elements.navigationSearch.style.display = 'none';

			// Setup navigation element's onclick action
			elements.navigationSearch.onclick	=
				function()
				{
					riverlines.cache.elements.$navigationSlider.goToSlide(riverlines.data.contentSlides.search);
					riverlines.action('hashUpdate');
				};
		}

		/**
		* Create content slider
		*/
		elements.$navigationSlider =
			$('#Riverlines-Content-Slider').bxSlider(
				{
					infiniteLoop:	false,
					controls:		false,
					startingSlide:	0,

					// Workaround for some designs
					onBeforeSlide: function(currentSlideNumber, totalSlideQuantity, $currentSlide)
					{
						$currentSlide.css('font-size', '1em');

// @todo find another way
						// Workaround for IE
						$('#Riverlines-Content-Slider').width(999999);
						$('#Riverlines-Content-Body, #Riverlines-Content-Body > .bx-wrapper, #Riverlines-Content-Body > .bx-wrapper > .bx-window, #Riverlines-Content-Search > form').width($('#Riverlines-Handler').outerWidth());
						$currentSlide.width($('#Riverlines-Handler').outerWidth());

						// Close order form validation prompts if need
						if ($('#Riverlines-Order-Form').length !== 0 && $('#Riverlines-Order-Form').data('form-validation') === true)
						{
							$('#Riverlines-Order-Form').validationEngine('hide');
						}
					},

					// Resize content
					onAfterSlide: function(currentSlideNumber, totalSlideQuantity, $currentSlide)
					{
						riverlines.action('resizeSlide', $currentSlide);
/*
						// Animate it if height was specified or make it statically
						// Also don't forget overflow before animation
						if ($('#Riverlines-Content-Slider').height() != 0)
						{
							$('#Riverlines-Content-Slider').css('overflow', 'hidden');

							$('#Riverlines-Content-Slider').animate(
								{
									height: $currentSlide.outerHeight()
								},
								'fast'
							);
						}
						else
						{
							$('#Riverlines-Content-Slider').height($currentSlide.outerHeight());
						}
*/
					}
				}
			); // elements.$navigationSlider = $('#Riverlines-Content-Slider').bxSlider();
	},

	/**
	*
	*/
	resizeSlide: function($currentSlide)
	{
		$currentSlide = $currentSlide || this.cache.elements.$navigationSlider.find('li:eq(' + (this.cache.elements.$navigationSlider.getCurrentSlide() + 1) + ')');

		// Animate it if height was specified or make it statically
		// Also don't forget overflow before animation
		if ($('#Riverlines-Content-Slider').height() != 0)
		{
			$('#Riverlines-Content-Slider').css('overflow', 'hidden');

			$('#Riverlines-Content-Slider').animate(
				{
					height: $currentSlide.outerHeight()
				},
				'fast'
			);
		}
		else
		{
			$('#Riverlines-Content-Slider').height($currentSlide.outerHeight());
		}
	},

	/**
	* Create pagination
	*/
	buildPaginator: function()
	{
		// Prepare variables
		var
			// Store variables as local
			$		= this.cache.jQuery,
			data	= this.data,

			$pages	= null,

			paginatorHtml	= '',
			siblingPages	= ((this.preferences.pagesAtPaginator - 1) / 2),

			i	= 1,
			il	= 1;

		// Begin paginator HTML
		paginatorHtml =
			paginatorHtml.concat(
				'<div class="ui-widget-content ui-corner-all">',
					'<span data-page="1">&#8676;</span>',
					'<span data-page="', (data.currentPage - 1), '"', ((data.currentPage === 1) ? ' class="Disabled"' : ''), '>&larr;</span>'
			);

		// Prepare start and end page counters
		if (data.currentPage <= siblingPages)
		{
			i	= 1;
			il	= data.currentPage + siblingPages;
		}
		else if (data.currentPage > (data.totalPages - siblingPages))
		{
			i	= data.currentPage - siblingPages;
			il	= data.totalPages;
		}
		else
		{
			i	= data.currentPage - siblingPages;
			il	= data.currentPage + siblingPages;
		}

		// Additional check that we don't show excess pages
		if (il > data.totalPages)
		{
			il = data.totalPages;
		}

		// Build pages
		for (; i <= il; ++i)
		{
			paginatorHtml =
				paginatorHtml.concat(
					'<span data-page="', i, '"', ((data.currentPage === i) ? ' class="ui-state-active ui-corner-all"' : ''), '>', i, '</span>'
				);
		}

		// Finish paginator HTML
		paginatorHtml =
			paginatorHtml.concat(
					'<span data-page="', (data.currentPage + 1), '"', ((data.currentPage === data.totalPages) ? ' class="Disabled"' : ''), '>&rarr;</span>',
					'<span data-page="', data.totalPages, '">&#8677;</span>',
				'</div>'
			);

		// Append HTML
		$('#Riverlines-Search-Pagination').html(paginatorHtml);

		// Extend page links
		$('#Riverlines-Search-Pagination > div > span')
			.hover(
				function()
				{
					// Ignore current page and disabled pages
					if ($(this).hasClass('ui-state-active') === true || $(this).hasClass('Disabled') === true)
					{
						return;
					}

					// Update cursor
					$(this).css('cursor', 'pointer');
				}, // function() {}
				function()
				{
					// Ignore current page and disabled pages
					if ($(this).hasClass('ui-state-active') === true || $(this).hasClass('Disabled') === true)
					{
						return;
					}

					// Set back cursor
					$(this).css('cursor', 'default');
				} // function() {}
			) // .hover()
			.click(
				function(event)
				{
					// Ignore current page and disabled pages
					if ($(this).hasClass('ui-state-active') === true || $(this).hasClass('Disabled') === true)
					{
						return;
					}

					// Switch page
					riverlines.callbacks.paginatorSwitchPage($(this).data('page'));

					// Rebuild paginator
					riverlines.action('buildPaginator');

					// Prevent default action
					return false;
				} // function() {}
			); // .click()

		return;
	},

	/*******************************************************************
	* Actions for loading message
	********************************************************************/
	/**
	* Build loading overlay and loading message
	*/
	buildLoading: function()
	{
		// Prepare variables
		var
			// Store variables as local
			cache	= this.cache,

			// Function variables
			loadingOverlayElement	= document.createElement('div'), // Create loading overlay element
			loadingMessageElement	= document.createElement('div'); // Create loading message element

		// Set overlay options
		loadingOverlayElement.id	= 'Riverlines-Loading';

		// Set overlay style
		loadingOverlayElement.style.background	= 'transparent';
		loadingOverlayElement.style.display		= 'block';
		loadingOverlayElement.style.position	= 'absolute';
		loadingOverlayElement.style.zIndex		= 1;
		loadingOverlayElement.style.top			= '0px',
		loadingOverlayElement.style.left		= '0px';
		// Set opacity
		loadingOverlayElement.style.opacity			= '0.5';
		loadingOverlayElement.style.MozOpacity		= '0.5';
		loadingOverlayElement.style.KhtmlOpacity	= '0.5';
		loadingOverlayElement.style.filter			= 'progid:DXImageTransform.Microsoft.Alpha(opacity=50)';

		// Set loading message style
// @todo move to css
		loadingMessageElement.innerHTML	= '<span style="text-align: center; display: block; width: 100%; font-weight: bold; font-size: 16px;">' + cache.language.loadingMessage + '</span>';

		// Append loading overlay to riverlines handler
		cache.elements.handler.appendChild(loadingOverlayElement);

		// Append loading message to riverlines handler
		this.additions.insertAfter(cache.elements.navigationHandler, loadingMessageElement);

		// Cache loading overlay and message
		cache.elements.loadingOverlay	= loadingOverlayElement;
		cache.elements.loadingMessage	= loadingMessageElement;
	},

	/**
	* Show loading overlay and message
	*/
	showLoading: function()
	{
		// Prepare variables
		var
			// Store variables as local
			cache					= riverlines.cache,
			handlerElement			= cache.elements.handler,
			loadingOverlayElement	= cache.elements.loadingOverlay,
			loadingMessageElement	= cache.elements.loadingMessage;

		// Set overlay size and display it
		loadingOverlayElement.style.width	= handlerElement.clientWidth + 'px';
		loadingOverlayElement.style.height	= handlerElement.clientHeight + 'px';
		loadingOverlayElement.style.display	= 'block';

		// Show and position loading image
		loadingMessageElement.style.position	= 'relative';
// @todo
//		loadingMessageElement.style.left		= ((handlerElement.clientWidth - loadingImageElement.clientWidth) / 2) + 'px';
		loadingMessageElement.style.visibility	= 'visible';
	},

	/**
	* Hide loading overlay and message
	*/
	hideLoading: function()
	{
		// Prepare variables
		var
			// Store variables as local
			cache	= riverlines.cache;

		// Hide loading overlay and message
		cache.elements.loadingOverlay.style.display		= 'none';
		cache.elements.loadingMessage.style.visibility	= 'hidden';
	},

	/*******************************************************************
	* Actions for navigation
	********************************************************************/
	/**
	* Display search form
	*/
	displaySearch: function()
	{
// @todo maybe this?
		// Slide to search form or ship tours at single-ship mode
		if (riverlines.cache.ship === undefined)
		{
			riverlines.cache.elements.$navigationSlider.goToSlide(riverlines.data.contentSlides.search);
		}
		else
		{
			riverlines.cache.elements.$navigationSlider.goToSlide(riverlines.data.contentSlides.results);
		}
	},

	/**
	* Display search results or tours page (at single-ship mode)
	*/
	displayResults: function()
	{
		// Prepare variables
		var
			// Store variables as local
			cache			= this.cache,
			$				= cache.jQuery,
			language		= cache.language,
			cacheElements	= cache.elements,
			data			= this.data,
			resultsCount	= parseInt(data.resultsCount),

			// Function variables
			navigationElement		= cacheElements.navigationResults,
			navigationTitleElement	= cacheElements.navigationResultsTitle,

			tabSearch			= language.navTitleSearchResults,
			tabSearchResult		= language.navTitleSearchResultsOneValue,
			tabSearch2Results	= language.navTitleSearchResultsTwoValues,
			tabSearchResults	= language.navTitleSearchResultsLotOfValues,

			lastDigit			= parseInt(data.resultsCount.toString().substr(-1)); // Last digit at results count

		// Update variables for single-ship mode
		if (cache.ship !== undefined)
		{
			// Language variable
			tabSearch			= language.navTitleShip;
			tabSearchResult		= language.navTitleShipOneValue;
			tabSearch2Results	= language.navTitleShipTwoValues;
			tabSearchResults	= language.navTitleShipLotOfValues;
		}

		// Update results navigation title (Update results count)
		// NOTE: w/o jQuery to avoid slowdowns
		if (resultsCount === 1 || lastDigit === 1)
		{
			tabSearch = tabSearch.replace('{count}', tabSearchResult.replace('{count}', resultsCount));
		}
		else if ((resultsCount !== 12 && resultsCount !== 13 && resultsCount !== 14) && (lastDigit === 2 || lastDigit === 3 || lastDigit === 4))
		{
			tabSearch = tabSearch.replace('{count}', tabSearch2Results.replace('{count}', resultsCount));
		}
		else
		{
			tabSearch = tabSearch.replace('{count}', tabSearchResults.replace('{count}', resultsCount));
		}
		navigationTitleElement.innerHTML = tabSearch;

		// Build search results content or clean it
		if (document.getElementById('Riverlines-Search-Data'))
		{
// @todo optimize
			document.getElementById('Riverlines-Search-Data').innerHTML = '';
		}
		else
		{
			cacheElements.contentResults.innerHTML =
				''.concat(
					'<div style="padding: 5px; margin-bottom: 5px;" class="ui-corner-all ui-state-highlight">',
						'<span class="ui-icon ui-icon-info" style="float: left; margin: 0 7px 20px 0;"></span>',
						language.priceNotes,
					'</div>',
					'<div class="ui-helper-clearfix"></div>',
					'<div id="Riverlines-Search-Data"></div>',
					'<div id="Riverlines-Search-Pagination" class="RiverlinesPagination"></div>'
				);
			navigationElement.style.display = 'block';

			// Hide tour and order navigation links
			cacheElements.navigationTour.style.display = 'none';
			cacheElements.navigationOrder.style.display = 'none';

		}

		// Create paginator
		this.action('buildPaginator');

		// Don't show paginator if only one page of results
		if (data.resultsCount < this.preferences.resultsPerPage)
		{
// @todo optimize
// @todo use cache
			// Hide pagination handler
			// NOTE: w/o jQuery to avoid slowdowns
			document.getElementById('Riverlines-Search-Pagination').style.display = 'none';
		}

		// Fill search results
		this.action('fillSearch');

		// Slide to search results
		if (data.currentPage)
		cacheElements.$navigationSlider.stop(true, true).goToSlide(riverlines.data.contentSlides.results);
	},

	/**
	* Display tour page
	*/
	displayTour: function()
	{
		// Prepare variables
		var
			cache			= this.cache,
			cacheElements	= cache.elements,
			language		= cache.language;

		// Build tour content skeleton
		cacheElements.contentTour.innerHTML =
			''.concat(
				'<div id="Riverlines-Tour-Data"></div>',
				'<div id="Riverlines-Tour-Tabs">',
					'<ul>',
						'<li><a href="#Riverlines-Tour-Tabs-Prices">', language.tabTitlePlaces, '</a></li>',
						'<li><a href="#Riverlines-Tour-Tabs-Breakpoints">', language.tabTitleBreakpoins, '</a></li>',
						'<li><a href="#Riverlines-Tour-Tabs-Ship">', language.tabTitleShip, '</a></li>',
					'</ul>',
					'<div id="Riverlines-Tour-Tabs-Prices"></div>',
					'<div id="Riverlines-Tour-Tabs-Breakpoints"></div>',
					'<div id="Riverlines-Tour-Tabs-Ship"></div>',
				'</div>'
			);

// @todo optimize
			// Create tour tabs
			$('#Riverlines-Tour-Tabs').tabs({
				// Click on first column on tab show
				// This is just tricky workaround for width calculating at hidden tab
				show:
					function(event, ui)
					{
						// Click on datatable for right tablewidth
						$('#Riverlines-Tour-Tabs-Prices').find('th:eq(0)').click();

						// Workaround for content height
						var
							$tabs = $(this),
							$nav = $tabs.children('.ui-tabs-nav'),
							$tab = $('#' + ui.panel.id);

						// Update tabs height
						setTimeout(
							function()
							{
								// Don't forget navigation row
								$tabs.height($tab.outerHeight() + $nav.outerHeight());

								// Animate it if height was specified or make it statically
								// Also don't forget overflow before animation
								if ($('#Riverlines-Content-Slider').height() != 0)
								{
									$('#Riverlines-Content-Slider').css('overflow', 'hidden');

									$('#Riverlines-Content-Slider').animate(
										{
											height: $('#Riverlines-Content-Tour').outerHeight()
										},
										'fast'
									);
								}
								else
								{
									$('#Riverlines-Content-Slider').height($('#Riverlines-Content-Tour').outerHeight());
								}
							},
							15
						);
					}
			});

		// Update tour navigation title
		cacheElements.navigationTourTitle.innerHTML = language.navTitleTour.replace('{tour_name}', this.data.result.tourName).replace('{ship_name}', this.data.result.shipName);

		// Fill tour information
		this.action('fillTour');

		// Show tour navigation link
		cacheElements.navigationTour.style.display = 'block';

		// Hide order navigation link
		cacheElements.navigationOrder.style.display = 'none';

		// Slide to tour page
		cache.elements.$navigationSlider.stop(true, true).goToSlide(riverlines.data.contentSlides.tour);
	},

	/**
	* Display order page
	*/
	displayOrder: function()
	{
		// Fill order page
		this.action('fillOrder');

		// Show order navigation link
		this.cache.elements.navigationOrder.style.display = 'block';

		// Slide to order page
		this.cache.elements.$navigationSlider.stop(true, true).goToSlide(riverlines.data.contentSlides.order);
	},

	/*******************************************************************
	* Actions for search form
	********************************************************************/
	/**
	* Build search form
	* NOTE: At some places doesn't used jQuery methods because they
	*       slowdowns form building action, but this action already
	*       extremally slowed by jQuery UI stylings :(
	*/
	buildForm: function()
	{
		// Don't do anything if form template wasn't loaded
		// or account is invalid
		if (this.templates.form === '' || this.action('validateAccount') === false)
		{
			return;
		}

		// Prepare variables
		var
			// Store variables as local
			that			= riverlines,
			cache			= that.cache,
			cacheElements	= cache.elements,
			data			= that.data,
			callbacks		= that.callbacks,
			handlerElement	= cache.elements.handler,
			$				= cache.jQuery,
			language		= cache.language,

			// Function variables
			formElement	= document.createElement('form'),

			// Fields caching variables
			field	= '',
			fields	= data.fields,
			element	= null,

			// Datepicker styling variables
			wrapperElement,
			datepickerElement;

		// Display search form item
		cacheElements.navigationSearch.style.display = 'block';

		// Create riverlines search form
		formElement.id		= 'Riverlines-Form';
		formElement.name	= 'Riverlines';

		// Parse and append form template
		formElement.innerHTML = that.action(
			'fillTemplate',
			{
				template:	that.templates.form,
				vars:
				{
					'{rl_offers}':
						''.concat(
							'<div id="Riverlines-Offers-Handler" class="ui-widget-content ui-corner-all ui-state-highlight">',
								'<ul id="Riverlines-Offers-Slider"></ul>',
								'<div class="Riverlines-Offers-Buttons">',
									'<span class="Riverlines-Offers-Previous ui-icon ui-icon-triangle-1-n"></span>',
									'<span class="Riverlines-Offers-Next ui-icon ui-icon-triangle-1-s"></span>',
								'</div>',
							'</div>'
						),
// @todo move to css
					'{rl_handbook}':	'',
//						''.concat(
//							'<div id="Riverlines-Handbook" class="ui-state-highlight ui-corner-all" style="padding: 5px;">',
//								'<strong>', language.handbookTitle, ':</strong> ',
//								'<a href="#" id="Riverlines-Handbook-Ships" rel="ships">', language.handbookShips, '</a> &bull; ',
//								'<a href="#" id="Riverlines-Handbook-Cities" rel="cities">', language.handbookCities, '</a> &bull; ',
//								'<a href="#" id="Riverlines-Handbook-Routes" rel="routes">', language.handbookRoutes, '</a> &bull; ',
//								'<a href="#" id="Riverlines-Handbook-Rivers" rel="rivers">', language.handbookRivers, '</a>',
//							'</div>'
//						),

					'{rl_count_tours}':	data.totalTours,
					'{rl_count_ships}':	data.totalShips,

					'{rl_date_start}':
						''.concat(
							language.formDateStartFrom, '&nbsp;',
							'<input type="text" name="start_date_from" id="Riverlines-Form-DateStartFrom-Input" value="', data.dateStartFrom, '" maxlength="10" />',
							'&nbsp;', language.formDateStartUntil, '&nbsp;',
							'<input type="text" name="start_date_from" id="Riverlines-Form-DateStartUntil-Input" value="', data.dateStartUntil, '" maxlength="10" />'
						),
					'{rl_count_days}':
						''.concat(
							language.formDaysFrom, '&nbsp;',
							'<select name="daysFrom" id="Riverlines-Form-DaysFrom"></select>',
							'&nbsp;', language.formDaysUntil, '&nbsp;',
							'<select name="daysTo" id="Riverlines-Form-DaysTo"></select>',
							'&nbsp;', language.formDaysAppend
						),
					'{rl_list_ships}':		'<select name="ships" id="Riverlines-Form-Ships"></select>',
					'{rl_list_cities}':		'<select name="citiesFrom" id="Riverlines-Form-CitiesFrom"></select>',
					'{rl_list_rivers}':		'<select name="rivers" id="Riverlines-Form-Rivers"></select><br />',
					'{rl_list_points}':		'<select name="citiesInline" id="Riverlines-Form-CitiesInline"></select><br />',
					'{rl_list_routes}':		'<select name="routes" id="Riverlines-Form-Routes"></select>',
					'{rl_list_holidays}':	'<select name="holidays" id="Riverlines-Form-Holidays"></select>',
					'{rl_tours_online}':	'<label><input type="checkbox" name="online" id="Riverlines-Form-Online" /> &nbsp;</label>',
					'{rl_tours_weekend}':	'<label><input type="checkbox" name="weekend" id="Riverlines-Form-Weekend" /> &nbsp;</label>',
					'{rl_tour_num}':		'<input type="text" name="id" id="Riverlines-Form-Id" />',
					'{rl_search_btn}':		'<button id="Riverlines-Form-Submit">' + language.formSubmit + '</button>'
				}
			}
		); // formElement.innerHTML = this.action();

		// Clean content and append form to handler
		cacheElements.contentSearch.innerHTML = '';
		cacheElements.contentSearch.appendChild(formElement);
		formElement.style.width = formElement.parentNode.style.width;

		// Cache form elements
		// Used for speed up next search actions
		for (field in fields)
		{
			// Ignore field which doesn't exists
			if ((element = document.getElementById(fields[field].id)) === null)
			{
				continue;
			}

			// Extend multiselectable elements
			if (field === 'formCitiesInline' || field === 'formRivers')
			{
				element.onchange = callbacks.formMultiselect;
			}
			else if (field === 'formSubmit')
			{
				// Submit search on button click
				// NOTE: w/o jQuery to avoid slowdowns
				element.onclick = callbacks.formSubmitButton;
			}

			// Cache form element
			cacheElements[field] = element;
		}

		// Add handbook links onclick action if need
		if (document.getElementById('Riverlines-Handbook') !== undefined && document.getElementById('Riverlines-Handbook') !== null)
		{
			document.getElementById('Riverlines-Handbook-Ships').onclick	= callbacks.handbookOpen;
			document.getElementById('Riverlines-Handbook-Cities').onclick	= callbacks.handbookOpen;
			document.getElementById('Riverlines-Handbook-Routes').onclick	= callbacks.handbookOpen;
			document.getElementById('Riverlines-Handbook-Rivers').onclick	= callbacks.handbookOpen;
		}

// @todo optimize
		// Add datepickers to start date selectors
		data.startDatePickers =
			$('#Riverlines-Form-DateStartFrom-Input, #Riverlines-Form-DateStartUntil-Input').datepicker(
				{
					defaultDate:	'+1d',
					changeMonth:	true,
					dateFormat:		'dd.mm.yy',
					minDate:		data.dateStartFrom,
					maxDate:		data.dateStartUntil,
					showAnim:		'',
					beforeShow:
						function()
						{
							// Add our CSS scope to datepicker and show parent
							$('#ui-datepicker-div').parent().show().addClass('Riverlines-jQueryUI');
						},
					onClose:
						function()
						{
							// FIX: Workaround for some configurations
							if ($('#ui-datepicker-div').parent()[0].tagName === 'BODY')
							{
								return;
							}

							// Remove our CSS scope to datepicker and hide parent
							$('#ui-datepicker-div').parent().hide().removeClass('Riverlines-jQueryUI');
						},
					onSelect:
						function(selectedDate)
						{
							// Prepare variables
							var
								// Store variables as local
								$	= riverlines.cache.jQuery,

								// Catch updatable option
								option	= (this.id === 'Riverlines-Form-DateStartFrom-Input') ? 'minDate' : 'maxDate',

								// Catch instance of current datepicker
								instance	= $(this).data('datepicker'),

								// Calculate min/max date
								date = $.datepicker.parseDate(
										instance.settings.dateFormat || $.datepicker._defaults.dateFormat,
										selectedDate, instance.settings
									);

							// Set option value
							riverlines.data.startDatePickers
								.not(this).datepicker('option', option, date);
						}
				}
			); // .datepicker();

		// Wrap datepicker handler with another div
		// We need it to datepicker styling by out theme
		// NOTE: w/o jQuery to avoid slowdowns
		if (datepickerElement = document.getElementById('ui-datepicker-div'))
		{
			// Wrap only if it wasn't wrapped before
			if (datepickerElement.parentNode.tagName === 'BODY')
			{
				// Create wrapper
				wrapperElement = document.createElement('div');
				datepickerElement.parentNode.appendChild(wrapperElement);

				// Wrap datepicker
				wrapperElement.appendChild(datepickerElement);
			}
		}

		// Auto resize handler
		// NOTE: w/o jQuery to avoid slowdowns
		handlerElement.style.height	= 'auto';
		handlerElement.style.width	= 'auto';

		// Don't use form submit action, instead click on submit button
		// NOTE: w/o jQuery to avoid slowdowns
		document.getElementById('Riverlines-Form').onsubmit = callbacks.formSubmit;
	},

	/**
	* Fill search form
	*/
	fillForm: function()
	{
		// Don't do anything if form template wasn't loaded
		if (this.templates.form === '')
		{
			return;
		}

		// Prepare variables
		var
			// Store variables as local
			data			= this.data,
			cache			= this.cache,
			cacheElements	= cache.elements,
			$				= cache.jQuery,
			preferences		= this.preferences,
			sortOptions		= this.additions.sortOptions,

			// Function variables
			id				= '',
			field			= '',
			fieldName		= '',
			fields			= data.fields,
			element			= null,
			offersHtml		= '',
			$offers			= null,

			i	= 0,
			il	= 0;

		/**
		* NOTE:
		* 1. We doesn't use innerHTML for selects because it doesn't work in IE :(
		* 2. select.options[i] = new Option() works slightly faster then select.add()
		*    also it doesn't have differences between browser like select.add()
		*/
		for (field in fields)
		{
			// Ignore elements which doesn't exists
			if (cacheElements[field] === undefined || cacheElements[field] === null)
			{
				continue;
			}

			// Catch element
			element = cacheElements[field];

			// Ignore all tags which not <select/>, because we don't need others
			if (element.tagName !== 'SELECT')
			{
				continue;
			}

			// Catch field name
			fieldName = fields[field].name;

			// Reset incrementator
			i = 0;
			for (id in data[fieldName])
			{
				// Ignore prototype properties
				if (data[fieldName].hasOwnProperty(id) === false)
				{
					continue;
				}

				// Additional actions for some fields required
				if (fieldName === 'ships')
				{
					// Ignore not selected ships
					if (preferences.ships !== null && id !== '' && preferences.ships[id] === undefined)
					{
						data.ignore.ships = data.ignore.ships.concat('&ignore[ships][]=' + id);
						continue;
					}
				}
				else if (fieldName === 'routes')
				{
					if (id === 'По рекам Европы' && preferences.ships !== null && preferences.ships['Swiss Corona'] === undefined && preferences.ships['Swiss Pearl'] === undefined)
					{
						continue;
					}
				}

				element.options[i] = new Option(data[fieldName][id], id);
				++i;
			} // for (id in data[fieldName])

			// Additional actions for some fields required
			if (fieldName === 'daysFrom')
			{
				// Sort "days from" options
				sortOptions(element);

				// Select first option
				element.options[0].selected = true;
			}
			else if (fieldName === 'daysTo')
			{
				// Sort "days to" options
				sortOptions(element);

				// Select last option
				element.options[element.options.length - 1].selected = true;
			}
		} // for (field in fields)

		// Offers routine
		if ((il = data.offers.length) !== 0)
		{
			// Create offers list
			for (i = 0; i < il; ++i)
			{
				element = data.offers[i];

				offersHtml = offersHtml.concat(
					'<li>',
						'<a href="', ((element.offerUrl !== '') ? element.offerUrl : '#Riverlines-Dialog') ,'" class="Riverlines-Offer">', element.offerTitle ,'</a>',
						((element.offerUrl === '') ? '<div class="Riverlines-Dialog" style="display: none;">' + element.offerText + '</div>' : ''),
					'</li>'
				);
			} // for (i = 0; i < il; ++i)
			$('#Riverlines-Offers-Slider').html(offersHtml);

			// Wrap each letter to span
			$offers = $('#Riverlines-Offers-Slider > li');
			$('a', $offers).lettering();

			// Crop offer by gradient to transparent
			$offers.each(
				function()
				{
					// Prepare variables
					var
						$letters	= $('a > span', this),
						opacity		= 1,

						i	= 87,
						il	= $letters.length;

// @todo maybe not 95?
					// Crop if need
					if (il > 95)
					{
						// Set opacity for each letter at the end of line
						for (; i < il; ++i)
						{
							$($letters[i]).css('opacity', opacity);

							// Calculate opacity if need
							if (opacity !== 0)
							{
								opacity = (opacity - 0.1).toPrecision(1);
							}
						}
					} // if (il > 95)
				} // function()
			); // $offers.each();

			// Create offers slider
			cache.elements.$offersSlider = $('#Riverlines-Offers-Slider')
				.bxSlider(
					{
						mode:			'vertical',
						auto: 			true,
						infiniteLoop:	true,
						controls:		false,
						startingSlide:	0
					}
				) // $('#Riverlines-Offers-Slider').bxSlider();
				// Stop slider on mouseover and start on mouseout
				.hover(
					function()
					{
						cache.elements.$offersSlider.stopShow();
					},
					function()
					{
						cache.elements.$offersSlider.startShow();
					}
				); // $('#Riverlines-Offers-Slider').hover();

			// Go to next/previous slide on button click
			$('#Riverlines-Offers-Handler > .Riverlines-Offers-Buttons > span').click(
				function(event)
				{
					if ($(this).hasClass('Riverlines-Offers-Previous') == true)
					{
						cache.elements.$offersSlider.goToPreviousSlide();
					}
					else
					{
						cache.elements.$offersSlider.goToNextSlide();
					}

					// Prevent default event
					return false;
				}
			); // $('#Riverlines-Offers-Handler > .Riverlines-Offers-Buttons > span').click();

			// Append onClick handlers to offers links
			$('#Riverlines-Offers-Handler').find('a.Riverlines-Offer').click(
				function(event)
				{
					// Prepare variables
					var
						$this = $(this);

					if ($this.attr('href') === '#Riverlines-Dialog')
					{
						// Create dialog handler
						riverlines.action('buildDialog');

						// Set dialog message
						// NOTE: w/o jQuery to avoid slowdowns
						cacheElements.dialog.innerHTML = $this.next('div').html();

						// Open dialog
						riverlines.action(
							'openDialog',
							{
								title:		$this.html(),
								width:		600,
								height:		300,
								resizable:	false,
								modal:		true,
								buttons:
								[
									{
										text:	cache.language.dialogClosebutton,
										click:
											function()
											{
												// Close dialog
												$(this).dialog('close');
											}
									}
								]
							}
						); // this.action();
					} // if ($this.attr('href') === '#Riverlines-Dialog')
					else if ($this.attr('href').substr(0, 10) === '#/RL/Tour/')
					{
						// Load tour
						window.location.assign($this.attr('href'));
						riverlines.action('hashParse');
					} // else if ($this.attr('href').substr(0, 10) === '#/RL/Tour/')

					// Prevent default action
					return false;
				} // function()
			); // $('#Riverlines-Offers-Handler').find('a.Riverlines-Offer').click(
		} // if ((il = data.offers.length) !== 0)

		// Resize form element
		this.action('resizeForm');

		// Workaround for some cases when slide width doesn't calculated after form build/filling
		cacheElements.$navigationSlider.goToSlide(data.contentSlides.search);
	},

	/**
	* Resize search form
	*/
	resizeForm: function()
	{
// @todo optimize

		// Prepare variables
		var
			// Store variables as local
			$				= this.cache.jQuery,

			// Function variables
			formHeight		= 0,
			elementBottom	= 0;

		// Little workaround for right form height calculation
		// with inline absolute positioned elements
		formHeight = $('#Riverlines-Form').height(true);
		$('#Riverlines-Form').children().each(
			function()
			{
				// Calculate element bottom position
				elementBottom = $(this).position().top + $(this).height(true);

				// Store it as form height if it greater then already calculated form height
				if (elementBottom > formHeight)
				{
					formHeight = elementBottom;
				}
			}
		); // $('#Riverlines-Form').children().each();

		$('#Riverlines-Form').css('height', formHeight);
	},

	/*******************************************************************
	* Actions for search results
	********************************************************************/
	/**
	* Load search results
	*/
	loadSearch: function(params)
	{
		// Set default value
		params = params || {};

		// Show loading message and set default callback
		// if callback doesn't specified
		if (params.callback === undefined || typeof params.callback !== 'function')
		{
			// Show loading message
			riverlines.action('showLoading');

			// Set default values if need
			params.callback = riverlines.callbacks.afterResultsLoad;
		}

// @todo ship information
		if (riverlines.cache.ship !== undefined)
		{
			params.callback = function()
			{
// @todo optimize
				setTimeout(
					function()
					{
						riverlines.action(
							'loadInformation',
							{
								url:		'shipName=' + riverlines.cache.ship,
								callback:	function()
								{
									// NOTE: w/o jQuery to avoid slowdowns

									// Prepare variables
									var
										cache		= riverlines.cache,
										language	= cache.language,

										handlerElement			= cache.elements.handler,
										shipInformationHeader	= null,
										shipInformationFooter	= null,
										shipInformation			= riverlines.data.information,

										shipInformationFooterHTML	= '',

										cabinTypeId		= 0,
										cabinTypeData	= {};

									// Auto resize handler
									handlerElement.style.height	= 'auto';
									handlerElement.style.width	= 'auto';

									// Display header only if it wasn't displayed before
									if (document.getElementById('Riverlines-ShipInformation-Header') === null)
									{
										// Create header handler
										shipInformationHeader	= document.createElement('div');

										// Build ship information header block
										shipInformationHeader.className				= 'ui-widget ui-helper-clearfix';
										shipInformationHeader.style.marginBottom	= '10px';
										shipInformationHeader.innerHTML				=
											''.concat(
												'<div id="Riverlines-ShipInformation-Header" class="ui-widget-content ui-corner-all" style="padding: 0 10px 5px;">',
													'<h2>', shipInformation.global.shipName, '</h2>',
													'<table cellpadding="0" cellspacing="10" border="0" width="100%">',
													'<tr>',
														'<td valign="top">',
															(
																(shipInformation.global.shipImage.indexOf('nophoto') === -1) ?
																	''.concat(
																		'<a href="', shipInformation.global.shipImage, '" title="',
																			shipInformation.global.shipName,
																			// @todo
																			// language.shipImageTitle.replace('{ship_name}', shipInformation.shipName).replace('{ship_project}', shipInformation.shipProject),
																		'" class="Riverlines-ShipImage ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only">',
																			'<img src="', shipInformation.global.shipImageThumb, '" alt="" class="ui-corner-all" />',
																		'</a>'
																	)
																:
																	''.concat(
																		'<span title="',
																			shipInformation.global.shipName,
																			// @todo
																			// language.shipImageTitle.replace('{ship_name}', shipInformation.shipName).replace('{ship_project}', shipInformation.shipProject),
																		'" class="Riverlines-ShipImage ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only">',
																			'<img src="', shipInformation.global.shipImageThumb, '" alt="" class="ui-corner-all" />',
																		'</span>'
																	)
															),
														'</td>',
														'<td>',
															shipInformation.global.shipDescription,
														'</td>',
													'</tr>',
													'</table>',
												'</div>'
											);

										// Append ship information block to RiverLines' handler
										cache.elements.contentHeader.appendChild(shipInformationHeader);

										// Enable image previewer
										riverlines.action('setImagePreview', '#Riverlines-ShipInformation-Header');
									}

									// Build tabs and fill results
									riverlines.callbacks.afterResultsLoad();

									// Display footer only if it wasn't displayed before
									if (document.getElementById('Riverlines-ShipInformation-Footer') === null)
									{
										// Create footer handler
										shipInformationFooter	= document.createElement('div');

										// Begin ship footer block
										shipInformationFooterHTML =
											shipInformationFooterHTML.concat(
												'<div id="Riverlines-ShipInformation-Footer" class="ui-widget-content ui-corner-all" style="padding: 5px 10px">'
											);

										// Build "Price include" block if need
										if (shipInformation.global.shipInclude !== '')
										{
											shipInformationFooterHTML =
												shipInformationFooterHTML.concat(
													'<h2>', language.shipPriceInclude, ':</h2>',
													shipInformation.global.shipInclude
												);
										}

										// Build "Special conditions" block if need
										if (shipInformation.global.shipDiscount !== '')
										{
											shipInformationFooterHTML =
												shipInformationFooterHTML.concat(
													'<h2>', language.shipDiscount, ':</h2>',
													shipInformation.global.shipDiscount
												);
										}

										// Build "Ship scheme" block if need
										if (shipInformation.global.shipSchemeImagePath !== '')
										{
											shipInformationFooterHTML =
												shipInformationFooterHTML.concat(
													'<h2>', language.shipScheme, ':</h2>',
													'<img src="', shipInformation.global.shipSchemeImagePath, '" alt="', language.shipScheme, '" />'
												);
										}

										// Build "Cabin types' photos" block if need
										shipInformationFooterHTML = shipInformationFooterHTML.concat(
											'<h2>', language.shipCabinTypesPhotos, '</h2>',
											'<table cellpadding="0" cellspacing="10" border="0" width="100%">'
										);
										for (cabinTypeId in shipInformation.cabinTypes)
										{
											cabinTypeData = shipInformation.cabinTypes[cabinTypeId];

											shipInformationFooterHTML = shipInformationFooterHTML.concat(
												'<tr>',
													'<td valign="top">',
														'<a href="', cabinTypeData.typeImagePath, '" title="',
															language.shipCabinTypesPhotosTitle.replace('{type_name}', cabinTypeData.typeName),
														'" class="Riverlines-ShipImage ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only">',
															'<img src="', cabinTypeData.typeImagePath, '" width="100" alt="" class="ui-corner-all" />',
														'</a>',
													'</td>',
													'<td>',
														'<strong>', language.shipCabinTypesPhotosTitle.replace('{type_name}', cabinTypeData.typeName), '</strong><br />',
														cabinTypeData.typeDescription,
													'</td>',
												'</tr>'
											);
										}
										shipInformationFooterHTML = shipInformationFooterHTML.concat(
											'</table>'
										);

										// Build "Ship services" block if need
										if (shipInformation.global.shipServices !== '')
										{
											shipInformationFooterHTML =
												shipInformationFooterHTML.concat(
													'<h2>', language.shipServices, '</h2>',
													shipInformation.global.shipServices
												);
										}

										// Final ship footer block
										shipInformationFooterHTML = shipInformationFooterHTML.concat(
											'</div>'
										);

										// Build ship information header block
										shipInformationFooter.className			= 'ui-widget ui-helper-clearfix';
										shipInformationFooter.style.marginTop	= '10px';
										shipInformationFooter.innerHTML			= shipInformationFooterHTML;

										// Append ship information block to RiverLines' handler
										cache.elements.contentFooter.appendChild(shipInformationFooter);

										// Enable image previewer
										riverlines.action('setImagePreview', '#Riverlines-ShipInformation-Footer');
									}

									/**
									* Parse specified hash and enable hash checker
									* NOTE: Used setTimeout() because this function will be
									* 		called before callback checker will complete
									* 		so it can't use second action
									*/
									setTimeout(
										function()
										{
											// Enable hash checker
											riverlines.action('hashSetInterval');
										},
										10
									);
								}
							}
						);
					},
					50
				);
			};
		}

		// Load search results
		this.loadResource(
			{
				type:		'js',
				url:
					''.concat(
						this.data.searchURL, '?', this.data.lastSearchURL,
						'&start=', this.data.currentPage,
						'&perPage=', this.preferences.resultsPerPage
					),
				id:			'Riverlines-Scripts-Data',
				callback:	params.callback
			}
		); // this.loadResource();

	},

	/**
	* Fill results
	*/
	fillSearch: function()
	{
// @todo optimize
		// Don't do anything if results template wasn't loaded
		if (this.templates.results === '')
		{
			return;
		}

		// Prepare variables
		var
			// Store variables as local
			$				= this.cache.jQuery,
			data			= this.data,
			resultTemplate	= this.templates.results, // Catch result row template
			language		= this.cache.language,

			// Function variables
			parent	= '#Riverlines-Search-Data', // Set parent

			// Results loop variables
			i		= 0,
			il		= data.results.length,
			result	= {};

		// Show "No results" notice
		if (this.data.resultsCount == 0)
		{
// @todo optimize
			// Show "No results" notice
			$('#Riverlines-Search-Data').html(
				''.concat('<p>', language.noResults, '</p>')
			);

			// Exit from function
			return;
		}

		// Create results table if need
		if (resultTemplate.substring(0, 6) === '<table')
		{
// @todo optimize
// @todo add support of before/after table text
			// Prepare variables
			var
				// Catch table style
				tagStart	= resultTemplate.indexOf('<table'),
				tagEnd		= resultTemplate.indexOf('>', tagStart),
				startTag	= resultTemplate.substring(tagStart, tagEnd),

				// Full prices table
				$cabinTypeNameRow	= null,
				$cabinTypePriceRow	= null,

				// Short prices table
				tourPrices = '',
				// Cabin type variables (full/half/empty)
				cabinType		= '',
				cabinTypeName	= '';

				// Remove <table></table> and <tbody></tbody> tags
				startTagEnd	= resultTemplate.indexOf('<tbody>') + 7;
				endTagStart	= resultTemplate.lastIndexOf('</tbody>');

			// Prepare start tag
			startTag = startTag + 'id="Riverlines-Search-Data-Table">';

			// Remove start and end tags
			resultTemplate = resultTemplate.substring(startTagEnd, endTagStart);

			// Create table
			$(startTag + '</table>').appendTo('#Riverlines-Search-Data');

			// Set new parent
			parent = '#Riverlines-Search-Data-Table';
		}

		// Fill results
		for (; i < il; ++i)
		{
			// Catch current result
			result = riverlines.data.results[i];

			// Build ship image
			if (result.shipImage.indexOf('nophoto') === -1)
			{
				shipImage = ''.concat(
					'<a href="', result.shipImage, '" title="',
						language.shipImageTitle.replace('{ship_name}', result.shipName).replace('{ship_project}', result.shipProject),
					'" class="Riverlines-ShipImage ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only">',
						'<img src="', result.shipImageThumb, '" alt="" class="ui-corner-all" />',
					'</a>'
				);
			}
			else
			{
				shipImage = ''.concat(
					'<span title="',
						language.shipImageTitle.replace('{ship_name}', result.shipName).replace('{ship_project}', result.shipProject),
					'" class="Riverlines-ShipImage ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only">',
						'<img src="', result.shipImageThumb, '" alt="" class="ui-corner-all" />',
					'</span>'
				);
			}

			// Remove project text if need
			if (result.shipProject === '')
			{
// @todo do it better
				shipImage = shipImage.replace(/\(Проект: \)/g, '');
			}

			// Parse and append result
			$(
				this.action(
					'fillTemplate',
						{
							template:	resultTemplate,
							vars:
							{
								// Tour variables
								'{rl_tour_name}':			result.tourName,
								'{rl_tour_description}':	result.tourDescription,
								'{rl_tour_date_start}':		result.tourDateStart,
								'{rl_tour_date_end}':		result.tourDateEnd,
								'{rl_tour_time_start}':		result.tourTimeStart,
								'{rl_tour_time_end}':		result.tourTimeEnd,
								'{rl_tour_route}':			result.tourRoute,
								'{rl_tour_days}':			result.tourDays,
								'{rl_tour_nights}':			result.tourNights,
								'{rl_tour_free_places}':	result.tourFreePlaces,
								'{rl_tour_operator}':		result.tourOperator,
								'{rl_tour_prices}':			'<div class="dataTables_wrapper"><table cellpadding="0" cellspacing="0" border="0" width="100%" id="Riverlines-Search-Data-Prices-' + result.tourId + '" class="ui-widget dataTables_display"><thead><tr></tr></thead><tbody><tr></tr></tbody></table></div>',
								'{rl_tour_prices_short}':	'<div id="Riverlines-Search-Data-Prices-Short-' + result.tourId + '"></div>',
								'{rl_tour_weekend}':
									(
										(result.tourWeekend === true) ?
											'<button class="Riverlines-TourWeekend">&nbsp;</button>'
											: ''
									),
								'{rl_tour_online}':
									(
										(result.tourOnline === true) ?
											'<button class="Riverlines-TourOnline">&nbsp;</button>'
											// ''.concat(
											// 	'<div class="ui-state-highlight ui-corner-all Riverlines-TourOnline" style="background: inherit; border: inherit; color: inherit;">',
											// 		language.tourOnline,
											// 	'</div>'
											// )
											: ''
									),

								// Ship variables
								'{rl_ship_name}':			result.shipName,
								'{rl_ship_project}':		result.shipProject,
// @todo do it better
								'Проект:':					(result.shipProject !== '') ? 'Проект:' : '',
								'{rl_ship_image}':			shipImage,
								'{rl_ship_description}':	result.shipDescription,

								// Global variables
								'{rl_more_info}':
									''.concat(
										'<button class="Riverlines-MoreInfo" rel="', result.tourId, '">', language.moreInfoButton, '</button>'
									)
							}
						}
				) + // this.action()
				// Add result separator
				(
					(i !== (il - 1)) ?
						(parent === '#Riverlines-Search-Data') ?
							'<div class="ui-widget-header ui-corner-all" style="height: 3px; margin: 15px 0 5px 0;"></div>' :
							'<tr><td class="Riverlines-Results-Separator"><div class="ui-widget-header ui-corner-all" style="height: 3px; margin: 15px 0 5px 0;"></div></td></tr>'
					: ''
				)
			).appendTo(parent);

			// Build prices table if need
			if (result.tourPrices)
			{
				// Add cabins if need
				if (document.getElementById('Riverlines-Search-Data-Prices-' + result.tourId))
				{
					// Catch cabin type name and cabin type price rows
					$cabinTypeNameRow	= $('#Riverlines-Search-Data-Prices-' + result.tourId).find('tr:first');
					$cabinTypePriceRow	= $('#Riverlines-Search-Data-Prices-' + result.tourId).find('tr:last');

					for (cabinType in result.tourPrices)
					{
						// Catch cabin type name
						cabinTypeName	= '';
						helpText		= '';
						switch (cabinType)
						{
							case 'full':
								cabinTypeName	= language.tourPricesFull;
								helpText		= language.tourPricesFullHelp;
							break;

							case 'half':
								cabinTypeName	= language.tourPricesHalf;
								helpText		= language.tourPricesHalfHelp;
							break;

							case 'empty':
								cabinTypeName	= language.tourPricesEmpty;
								helpText		= language.tourPricesEmptyHelp;
							break;
						}

						// Add cabin type cells
						$(
							''.concat(
								'<th width="33%" class="ui-state-default" rel="', cabinType, '" style="cursor: help;"><div class="DataTables_sort_wrapper">', cabinTypeName, ' <span class="ui-icon ui-icon-help"></span></div></th>'
							)
						).appendTo($cabinTypeNameRow);

						// Store help text
						$('th[rel="' + cabinType + '"]').data('help-text', helpText);

						// Set cabin type name
						$cabinTypeCell = $('<td width="33%" valign="top" class="ui-widget-content"></td>').appendTo($cabinTypePriceRow);

						// Add prices
						for (price in result.tourPrices[cabinType])
						{
							// Ignore type without price
							if (result.tourPrices[cabinType][price] === '')
							{
								continue;
							}

							// Catch cabin name
							cabinName = '';

							switch (price)
							{
								case '4':
								case '3':
								case '22':
								case '21':
								case '1':
									cabinName	= language['tourPrices' + price.toString()];
								break;

								case 'suite':
									cabinName	= language.tourPricesSuite;
								break;

								case 'halfsuite':
									cabinName	= language.tourPricesHalfSuite;
								break;

								// Ignore minimum place price
								case 'min':
									continue;
							}

							// Add cabin price
							$(
								''.concat(
									'<div class="Riverlines-Prices-CabinType">',
										'<div class="Riverlines-Prices-CabinTypeName">', cabinName, '</div>',
										'<div class="Riverlines-Prices-CabinTypePrice">', result.tourPrices[cabinType][price], '</div>',
									'</div>'
								)
							).appendTo($cabinTypeCell);
						} // for (price in result.tourPrices[cabinType])
					} // for (cabinType in result.tourPrices)

					// Open help window
					$('#Riverlines-Search-Data-Prices-' + result.tourId).find('th').click(function() {
						riverlines.action('openDialogInformation', $(this).data('help-text'));
					});
				} // if if (document.getElementById('Riverlines-Search-Data-Prices-' + result.tourId))
				else if (document.getElementById('Riverlines-Search-Data-Prices-Short-' + result.tourId))
				{
					// Cleanup
					tourPrices = cabinType = cabinTypeName = '';

					// Start prices table
					tourPrices = tourPrices.concat(
						'<table cellpadding="0" cellspacing="0" border="0" style="margin: 7px 0;">'
					);

					// Add price rows
					for (cabinType in result.tourPrices)
					{
						if (result.tourPrices[cabinType]['min'] == 0)
						{
							continue;
						} // if (result.tourPrices[cabinType] == 0)

						switch (cabinType)
						{
							case 'full':
								cabinTypeName	= language.tourPricesFull;
							break;

							case 'half':
								cabinTypeName	= language.tourPricesHalf;
							break;

							case 'empty':
								cabinTypeName	= language.tourPricesEmpty;
							break;
						} // switch (cabinType) {}

						// Add price row
						tourPrices = tourPrices.concat(
							'<tr>',
								'<td width="200" rel="', cabinType, '" class="Riverlines-CabinType" style="cursor: help;">',
									'<span style="border-bottom: 1px dashed;">',
										cabinTypeName, ': ',
									'</span>',
								'</td>',
								'<td style="padding: 0 10px; font-weight: bold;" class="Riverlines-CabinTypePrice">',
									//@todo language support
									'от ', result.tourPrices[cabinType]['min'], ' руб.',
								'</td>',
							'</tr>'
						); // tourPrices = tourPrices.concat()
					} // for (cabinType in result.tourPrices)

					// Finish prices table
					tourPrices = tourPrices.concat(
						'</table>'
					);

					// Append prices table
					document.getElementById('Riverlines-Search-Data-Prices-Short-' + result.tourId).innerHTML = tourPrices;

					// Open help window
					// FIX: Workaround for Joomla with MooTools on some configurations
					// $('#Riverlines-Search-Data-Prices-' + result.tourId).find('.Riverlines-CabinType')
					$('#Riverlines-Search-Data-Prices-Short-' + result.tourId).find('.Riverlines-CabinType').each(
						function()
						{
							$(this).click(
								function()
								{
									// Prepare variables
									var
										helpText = '';

									switch ($(this).attr('rel'))
									{
										case 'full':
											helpText		= language.tourPricesFullHelp;
										break;

										case 'half':
											helpText		= language.tourPricesHalfHelp;
										break;

										case 'empty':
											helpText		= language.tourPricesEmptyHelp;
										break;
									}

									riverlines.action('openDialogInformation', helpText);
								} // function()
							); // $(this).click();
						} // function()
					); // $('#Riverlines-Search-Data-Prices-' + result.tourId).find('.Riverlines-CabinType').each(
				} // if (document.getElementById('Riverlines-Search-Data-Prices-Short-' + result.tourId))
			} // if (result.tourPrices)
/*
			// Style "more info" link
			$('.Riverlines-MoreInfo[rel="' + result.tourId + '"]').css(
				{
					color:			'inherit',
					font:			'inherit',
					textDecoration:	'inherit',
					background:		'inherit'
				}
			);
*/
		}

		// Extend tour weekend image
		$('.Riverlines-TourWeekend').click(
			function()
			{
				riverlines.action('openDialogInformation', language.tourWeekendHelp);

				// Prevent default action
				return false;
			} // function() {}
		); // $('.Riverlines-TourWeekend').click()

		// Extend tour online image
		$('.Riverlines-TourOnline').click(
			function()
			{
				riverlines.action('openDialogInformation', language.tourOnlineHelp);

				// Prevent default action
				return false;
			} // function() {}
		); // $('.Riverlines-TourOnline').click()

		// Fix length of table result separator
		if (parent !== '#Riverlines-Search-Data')
		{
			$('.Riverlines-Results-Separator').attr('colspan', $('tr:first > td', $(parent)).length);
		}

		// Add on click handler to "More info" links
		// jQuery UI
		// $('#Riverlines-Search-Data').find('a.Riverlines-MoreInfo').click(
		// FIX: Workaround for Joomla with MooTools on some configurations
		// $('#Riverlines-Search-Data').find('.Riverlines-MoreInfo').button().click(
		$('#Riverlines-Search-Data').find('.Riverlines-MoreInfo').each(
			function()
			{
				$(this).button().click(
					function(event)
					{
						// Load tour
						riverlines.action(
							'loadTour',
							{
								tourId: $(this).attr('rel')
							}
						); // riverlines.action();

						// Prevent default action
						return false;
					}
				);
			}
		);

		// Enable image previewer
		this.action('setImagePreview', '#Riverlines-Search-Data');
	},

	/*******************************************************************
	* Actions for tour
	********************************************************************/
	/**
	* Load specified tour
	*/
	loadTour: function(params)
	{
		// Don't do anything if tour id not specified
		if (params.tourId === undefined)
		{
			return false;
		}

		// Show loading message and set default callback
		// if callback doesn't specified
		if (params.callback === undefined || typeof params.callback !== 'function')
		{
			// Show loading message
			riverlines.action('showLoading');

			// Set default values if need
			params.callback =
				function()
				{
					// Update URL hash
					riverlines.action(
						'hashUpdate',
						{
							name:	'tour',
							url:	'Tour/' + params.tourId
						}
					); // riverlines.action();

					// Fill result page
					riverlines.action(((params.order === true) ? 'displayOrder' : 'displayTour'));

					// Hide loading message
					riverlines.action('hideLoading');
				};
		}

		// Load result
		riverlines.loadResource(
			{
				type:		'js',
				url:
					''.concat(
						this.data.tourURL,
						'?id=', params.tourId,
						((params.order === true) ? '&order=1' + params.cabins : '')
					),
				id:			'Riverlines-Scripts-Data',
				callback:	params.callback
			}
		); // riverlines.loadResource();
	},

	/**
	* Fill result page
	* NOTE: At some places doesn't used jQuery methods because they
	*       slowdowns form building action, but this action already
	*       extremally slowed by jQuery UI stylings :(
	*/
	fillTour: function()
	{
		// Don't do anything if result page template wasn't loaded
		if (this.templates.result === '')
		{
			return;
		}
// @todo optimize
		// Prepare variables
		var
			// Store variables as local
			cache		= this.cache,
			language	= cache.language,
			$			= cache.jQuery,

			// Function variables
			result				= this.data.result, // Catch current result
			resultsTourElement	= document.getElementById('Riverlines-Tour-Data'); // Catch tour information handler

		// Cleanup tour data and subtabs
		$(
			''.concat(
				'#Riverlines-Tour-Data, ',
				'#Riverlines-Tour-Tabs-Ship, ',
				'#Riverlines-Tour-Tabs-Breakpoints, ',
				'#Riverlines-Tour-Tabs-Prices'
			)
		).html('');

		// Build ship image
		shipImage = ''.concat(
			'<a href="', result.shipImage, '" title="',
				language.shipImageTitle.replace('{ship_name}', result.shipName).replace('{ship_project}', result.shipProject),
			'" class="Riverlines-ShipImage ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only">',
				'<img src="', result.shipImageThumb, '" alt="" class="ui-corner-all" />',
			'</a>'
		);

		// Remove project text if need
		if (result.shipProject === '')
		{
// @todo do it better
			shipImage = shipImage.replace(/\(Проект: \)/g, '');
		}

		// Add tour data
		// NOTE: w/o jQuery to avoid slowdowns
		resultsTourElement.innerHTML = this.action(
			'fillTemplate',
			{
				template:	this.templates.result,
				vars:
				{
					// Tour variables
					'{rl_tour_id}':				result.tourId,
					'{rl_tour_name}':			result.tourName,
					'{rl_tour_description}':	result.tourDescription,
					'{rl_tour_offer}':			result.tourOffer,
					'{rl_tour_date_start}':		result.tourDateStart,
					'{rl_tour_date_end}':		result.tourDateEnd,
					'{rl_tour_time_start}':		result.tourTimeStart,
					'{rl_tour_time_end}':		result.tourTimeEnd,
					'{rl_tour_cities}':			result.tourCities,
					'{rl_tour_days}':			result.tourDays,
					'{rl_tour_nights}':			result.tourNights,
					'{rl_tour_operator}':		result.tourOperator,
					'{rl_tour_online}':			result.tourOnline,

					// Ship variables
					'{rl_ship_id}':				result.shipId,
					'{rl_ship_name}':			result.shipName,
					'{rl_ship_project}':		result.shipProject,
					'Проект:':					(result.shipProject !== '') ? 'Проект:' : '',
					'{rl_ship_image}':			shipImage,
					'{rl_ship_description}':	result.shipDescription,
					'{rl_ship_decks}':			result.shipDecks,
					'{rl_ship_cabins}':			result.shipCabins,
					'{rl_ship_places}':			result.shipPlaces
				}
			}
		); // this.action()

		// Enable tour tab
// @todo cache
		$('#Riverlines-Tabs').tabs('enable', 1);

		/**
		* Set default subtabs state:
		* - Enable and select tour/places tab
		* - Disable breakpoints tab
		* - Disable ship tab
		*/
// @todo cache
		$('#Riverlines-Tour-Tabs')
			.tabs('enable', 0)
			.tabs('disable', 1)
			.tabs('disable', 2)
			.tabs('select', 0);

// @todo optimize
		// Set ship description to ship tab and show it if need
		// It need only if ship description was specified
		// and this is not one-ship page
		if (result.shipDescription !== '' && cache.ship === undefined)
		{
			// Build "Ship scheme" block if need
			if (result.shipScheme !== '')
			{
				result.shipDescription =
					result.shipDescription.concat(
						'<br />',
						'<h2>', language.shipScheme, ':</h2>',
						'<a href="', result.shipScheme, '" title="', language.shipScheme, '" class="Riverlines-ShipImage"><img src="', result.shipScheme, '" alt="', language.shipScheme, '" style="max-width: 400px;" /></a>'
					);
			}

			$('#Riverlines-Tour-Tabs-Ship').html('<span>' + result.shipDescription + '</span>');
			$('#Riverlines-Tour-Tabs').tabs('enable', 2);

			// Wrap images on offline tours
			if (result.tourOnline === false)
			{
				$('#Riverlines-Tour-Tabs-Ship').find('img').each(
					function()
					{
						// Ignore images which already wrapped
						if ($(this).parent().prop('tagName') === 'A')
						{
							return;
						}

						$(this)
							.css('width', '100%')
							.prop('hspace', '')
							.wrap('<a href="' + $(this).attr('src') + '" class="Riverlines-ShipImage"></a>');
					}
				);
			}

			// Enable image previewer
			this.action('setImagePreview', '#Riverlines-Tour-Tabs-Ship');
		}

		// Add breakpoints if need
		if (result.excursions !== undefined)
		{
			// Prepare variables
			var
				breakpointsHtml	= '',

				i	= 0,
				il	= result.excursions.length;

			// Enable breakpoints tab
			$('#Riverlines-Tour-Tabs').tabs('enable', 1);

			// Start breakpoints html
			breakpointsHtml = breakpointsHtml.concat(
				'<table id="Riverlines-Tour-Breakpoints-Table" cellpadding="0" cellspacing="0" border="0" class="dataTables_display ui-widget" style="width: 100%;">',
				'<thead>',
					'<tr>',
						'<th class="ui-state-default">', language.tourExcursionsStay, '</th>',
						'<th class="ui-state-default">', language.tourExcursionsArrival, '</th>',
						'<th class="ui-state-default">', language.tourExcursionsDeparture, '</th>',
						'<th class="ui-state-default">', language.tourExcursionsDescription, '</th>',
					'</tr>',
				'</thead>',
				'<tbody>'
			);

			// Parse breakpoints
			for (; i < il; ++i)
			{
				// Catch breakpoints
				excursion = result.excursions[i];

				// Append new breakpoint
				breakpointsHtml = breakpointsHtml.concat(
					'<tr>',
						'<td class="ui-widget-content" style="background: none;">', excursion.excursionCity, '</td>',
						'<td class="ui-widget-content" style="background: none;">', ((i === 0) ? '' : excursion.excursionDateStart), '</td>',
						'<td class="ui-widget-content" style="background: none;">', ((i === (il - 1)) ? '' : excursion.excursionDateEnd), '</td>',
						'<td class="ui-widget-content" style="background: none;">', excursion.excursionDescription, '</td>',
					'</tr>'
				);
			}

			// Final breakpoints html
			breakpointsHtml = breakpointsHtml.concat(
				'</tbody>',
				'</table>'
			);

			// Append breakpoints table
			$('#Riverlines-Tour-Tabs-Breakpoints').html(breakpointsHtml);
		} // if (result.excursions !== undefined)

		// Create places tab content
		// And append price information and child prices information
		// NOTE: w/o jQuery to avoid slowdowns
// @todo optimize
		document.getElementById('Riverlines-Tour-Tabs-Prices').innerHTML =
			''.concat(
				'<span>', result.tourPrice, '<br />', result.tourChild, '<br /><br /></span>',
				'<table id="Riverlines-Tour-Places-Table" cellpadding="0" cellspacing="0" border="0" class="dataTables_display" style="width: 100%;"></table>',
				'<button class="Riverlines-OrderButton" rel="', result.tourId, '" style="display: none;">', language.orderButton, '</button>'
			);

		// Fill places table for online tour or remove places table handler
		if (result.tourOnline === true)
		{
			// Prepare variables for online tour
			var
				tableData	= [],
				cabins		= result.cabins,

				i	= 0,
				il	= cabins.length,

				cabin		= {},
				excursion	= {},

				rowOccupiedState	= '';

			// Build cabins array for DataTables
			for (; i < il; ++i)
			{
				// Catch current cabin
				cabin = cabins[i];

				// Select row background color
				rowOccupiedState = (cabin.sOccupied === true) ? 'occupied' : 'free';

				// Add cabin data to array
				tableData.push(
					[
						(
							(cabin.cabinPhotosCount != 0) ?
								''.concat(
									'<span class="Riverlines-CabinName" rel="', i, '">', cabin.cabinName, '</span>'
								) : '<span>' + cabin.cabinName + '</span>'
						),
						''.concat(
							'<span class="Riverlines-CabinGroup" rel="', cabin.groupId, '">', cabin.groupName, '</span>'
						),
						cabin.deckName,
						cabin.placePrice,
						''.concat(
							cabin.placesMainFree, '/', cabin.placesMain, '<br />',
								'<em>', cabin.placesAdditionalFree, '/', cabin.placesAdditional, '</em>',
								((cabin.sCeil === true) ? '<br /><small>' + language.tourPlacesByPlaces + '</small>' : '')
						),
						((cabin.sOccupied === true) ? '&nbsp;' : '<input type="checkbox" name="cabins[' + cabin.cabinId + ']" value="' + cabin.cabinId + '" />'),
						rowOccupiedState
					]
				); // tableData.push();
			} // for (; i < il; ++i)

			// Build places table
			$('#Riverlines-Tour-Places-Table').dataTable(
				{
					bJQueryUI:		true, // Enable jQueryUI support
					bPaginate:		false, // Disable pagination
					bLengthChange:	false, // Disable length selector
					bFilter:		false, // Disable filtering
					bInfo:			false, // Disable footer information
					bAutoWidth:		false, // Disable automatic width calculation
					oLanguage:		language.dataTables, // Load translation

					// Move order button to table header and footer
					fnInitComplete:
						function()
						{
// @todo optimize
							// Add order button to table header and footer
							$('#Riverlines-Tour-Tabs-Prices > .Riverlines-OrderButton')
								.clone()
								.appendTo('#Riverlines-Tour-Places-Table_wrapper > .fg-toolbar')
								.show();

							// Add onclick action to cabin name title
							$('.Riverlines-CabinName').parent()
								.css('cursor', 'help')
								.click(
									function()
									{
										// Prepare variables
										var
											that	= riverlines,
											cache	= that.cache,

											cabinIndex	= $(this).find('.Riverlines-CabinName').attr('rel'),
											cabinData	= that.data.result.cabins[cabinIndex],

											photosHtml	= '',
											i	= 0;

										// Create dialog handler
										that.action('buildDialog');

										for (i = 0; i < cabinData.cabinPhotosCount; ++i)
										{
											photosHtml = photosHtml.concat(
												'<img src="', cabinData.cabinPhotos[i], '" style="max-width: 350px; max-height: 200px; float: left; margin: 5px;" /> '
											);
										}
										photosHtml = photosHtml.concat('<br style="clear: both;" />');

										// Set dialog message
										// NOTE: w/o jQuery to avoid slowdowns
										cache.elements.dialog.innerHTML = photosHtml;

										// Open dialog
										that.action(
											'openDialog',
											{
												title:		cache.language.dialogInformationTitle,
												minWidth:	800,
												resizable:	false,
												modal:		true,
												buttons:
												[
													{
														text:	cache.language.dialogClosebutton,
														click:
															function()
															{
																// Close dialog
																$(this).dialog('close');
															}
													}
												]
											}
										); // this.action();
									}
								);

							// Add onclick action to cabin group title
							$('.Riverlines-CabinGroup').parent()
								.css('cursor', 'help')
								.click(
									function()
									{
										riverlines.action(
											'loadInformation',
											{
												url: 'groupId=' + $('span[rel]', $(this)).attr('rel')
											}
										); // riverlines.action();
									}
								);

							// Move order buttons to right
							$('#Riverlines-Tour-Places-Table_wrapper > .fg-toolbar').css('text-align', 'right');
						},

					// Table coloring additions
					fnDrawCallback:
						function()
						{
// @todo optimize
							// Style table and cells as widget then remove coloring background,
							// because we already colored rows by occupied state
							$('#Riverlines-Tour-Places-Table')
								.addClass('ui-widget')
								.find('td')
									.addClass('ui-widget-content')
									.css('background', 'none');
						},

					// Row coloring additions
					fnRowCallback:
						function(nRow, aData, iDisplayIndex, iDisplayIndexFull)
						{
							// Color row by occupied state
							$(nRow).addClass((aData[6] === 'free') ? 'cabinFree' : 'cabinOccupied');

							return nRow;
						},

					aaData:		tableData, // Set default data
					aoColumns: // Set headers
					[

						{
							sTitle: language.tourPlacesCabin
						},
						{
							sTitle: language.tourPlacesCabinType
						},
						{
							sTitle: language.tourPlacesDeck
						},
						{
							sTitle: language.tourPlacesPrice
						},
						{
							sTitle: language.tourPlacesCount
						},
						{
							sTitle: '&nbsp;',
							bSearchable: false,
							bSortable: false
						},
						{
							// Row coloring workaround
							bVisible: false
						}
					]
				}
			); //$('#Riverlines-Tour-Places-Table').dataTable()
		} // if (result.tourOnline === true)
		else
		{
// @todo optimize
			// Create order button to prices subtab (for offline tour)
			var
				placesTable = document.getElementById('Riverlines-Tour-Places-Table');

			placesTable.parentNode.removeChild(placesTable);

			// Display order button
			$('#Riverlines-Content-Tour .Riverlines-OrderButton').show();
		}

		// Style order button and add onclick handler
// @todo optimize
		$('#Riverlines-Content-Tour .Riverlines-OrderButton').button().click(
			function(event)
			{
				// Prepare variables
				var
					// Store global varibales
					$	= riverlines.cache.jQuery,

					// Function variables
					cabins	= '';

				// Store selected cabins if tour is online
				if (riverlines.data.result.tourOnline === true)
				{
					// Don't do anthing if no places selected
					if ($('#Riverlines-Tour-Places-Table').find('input:checkbox[name^="cabins"]:checked').length === 0)
					{
						// Open error dialog
						riverlines.action('openDialogError', language.orderErrorOnlineCabins);

						return;
					}

					// Store cabin ids
					$('#Riverlines-Tour-Places-Table').find('input:checkbox[name^="cabins"]:checked').each(
						function()
						{
							cabins = cabins.concat('&cabins[', $(this).val(), ']=');
						}
					);
				} // if (riverlines.data.result.tourOnline === true)

				// Load order data
				riverlines.action(
					'loadTour',
					{
						tourId:	$(this).attr('rel'),
						order:	true,
						cabins:	cabins
					}
				); // riverlines.action();

				// Prevent default action
				return false;
			}
		); // $('#Riverlines-Content-Tour .Riverlines-OrderButton').click()

// @todo optimize
		// Show active tabs
		$('#Riverlines-Tour-Tabs').find('ul.ui-tabs-nav').find('li:not(".ui-state-disabled")').show();

		// Hide inactive tabs
		$('#Riverlines-Tour-Tabs').find('ul.ui-tabs-nav').find('li.ui-state-disabled').hide();

		// Enable image previewer
		this.action('setImagePreview', '#Riverlines-Tour-Data');
	},

	/*******************************************************************
	*
	********************************************************************/
	/**
	* Load order page data
	*/
// @todo not used
	loadOrder: function(params)
	{
		// Set default value
		params = params || {};

		// Show loading message and set default callback
		// if callback doesn't specified
		if (params.callback === undefined || typeof params.callback !== 'function')
		{
			// Show loading message
			riverlines.action('showLoading');

			// Set default values if need
			params.callback = riverlines.callbacks.afterResultsLoad;
		}

		// Load search results
		this.loadResource(
			{
				type:		'js',
				url:
					''.concat(
						this.data.searchURL, '?', this.data.lastSearchURL,
						'&start=', this.data.currentPage,
						'&perPage=', this.preferences.resultsPerPage
					),
				id:			'Riverlines-Scripts-Data',
				callback:	params.callback
			}
		); // this.loadResource();
	},


	/*******************************************************************
	* Actions for dialog
	********************************************************************/
	/**
	* Create dialog
	*/
	buildDialog: function()
	{
		// Prepare variables
		var
			// Store variables as local
			cache = this.cache;

		// Create dialog handler
		cache.elements.dialog		= document.createElement('div');
		cache.elements.dialog.id	= 'Riverlines-Dialog';
		cache.elements.handler.appendChild(cache.elements.dialog);
	},

	/**
	* Open dialog
	*/
	openDialog: function(params)
	{
// @todo optimize
// $('#Riverlines-Dialog') -> this.cache.$dialog
		// Prepare variables
		var
			// Store variables as local
			$	= this.cache.jQuery,

			$dialog	= $('#Riverlines-Dialog');

		// Set default value
		params = params || {};

		// Prepare dialog parameters
		// NOTE: w/o jQuery to avoid slowdowns
		params = this.additions.extend(params,
			{
				/**
				* Originally it was workaround for styling with Riverlines
				* jQuery UI theme.
				* Say hello to jQuery UI developers for stupid theming support
				* and effects with it
				* But now, it style and show/hide dialog with some effects
				*/
				open:
					function()
					{
						var
							$dialogHandler	= $dialog.dialog('widget');

						// Hide dialog handler
						$dialogHandler.hide();

						// Create dialog theming wrapper
						$('<div class="Riverlines-jQueryUI" id="Riverlines-Dialog-Theme" style="position: absolute; top: 0; left: 0; z-index: 1000;"></div>').appendTo('body');

						// Move dialog and overlay to theming wrapper
						$dialogHandler.appendTo('#Riverlines-Dialog-Theme');
						$('body > div.ui-widget-overlay').appendTo('#Riverlines-Dialog-Theme');

						// Center dialog
						$dialog.dialog('option', 'position', 'center');

						// And one more hello to jQuery UI developers
						// Overlay calculates wrong size with custom themes
						$.ui.dialog.overlay.resize();

						// Fade in dialog handler, so and dialog to
						$dialogHandler.fadeIn();
					},
				close:
					function()
					{
						var
							$dialogHandler	= $dialog.dialog('widget');

						// Show dialog handler and fadeout it by effect
						// and then destroy all our dialog HTML
						$dialogHandler
							.show()
							.fadeOut(
								'fast',
								function()
								{

									// Destroy our dialog, because it'll be recreated
									$dialog.dialog('destroy');

									// Remove dialog style wrapper
									$('body').children('.Riverlines-jQueryUI:empty').remove();

									// Remove dialog content
									$dialog.remove();

									// Remove dialog theming wrapper
									$('#Riverlines-Dialog-Theme').remove();
								}
							);
					}
			}
		); // this.additions.extend();

		// Create dialog
		$dialog
			.dialog(params)
			// We don't need min-height
			.css('min-height', '0');
	},

	/**
	* Open error dialog
	*/
	openDialogError: function(text)
	{
		// Prepare variables
		var
			// Store variables as local
			cache	= this.cache,
			$		= cache.jQuery;

		// Create dialog handler
		this.action('buildDialog');

		// Set dialog message
		// NOTE: w/o jQuery to avoid slowdowns
		cache.elements.dialog.innerHTML = '<span class="ui-icon ui-icon-alert" style="float: left; margin: 0 7px 20px 0;"></span>' + text;

		// Open dialog
		this.action(
			'openDialog',
			{
				title:		cache.language.dialogErrorTitle,
				minWidth:	500,
				resizable:	false,
				modal:		true,
				buttons:
				[
					{
						text:	cache.language.dialogClosebutton,
						click:
							function()
							{
								// Close dialog
								$(this).dialog('close');
							}
					}
				]
			}
		); // this.action();
	},

	/**
	* Open information dialog
	*/
	openDialogInformation: function(text)
	{
		// Prepare variables
		var
			// Store variables as local
			cache	= this.cache,
			$		= cache.jQuery;

		// Create dialog handler
		this.action('buildDialog');

		// Set dialog message
		// NOTE: w/o jQuery to avoid slowdowns
		cache.elements.dialog.innerHTML = '<span class="ui-icon ui-icon-info" style="float: left; margin: 0 7px 20px 0;"></span>' + text;

		// Open dialog
		this.action(
			'openDialog',
			{
				title:		cache.language.dialogInformationTitle,
				minWidth:	500,
				resizable:	false,
				modal:		true,
				buttons:
				[
					{
						text:	cache.language.dialogClosebutton,
						click:
							function()
							{
								// Close dialog
								$(this).dialog('close');
							}
					}
				]
			}
		); // this.action();
	},

	/*******************************************************************
	* Actions for image preview
	********************************************************************/
	/**
	* Open image preview
	* NOTE: At some places doesn't used jQuery methods because they
	*       slowdowns form building action, but this action already
	*       extremally slowed by jQuery UI stylings :(
	*/
	openImagePreview: function(params)
	{
		// Set default values
		params			= params		|| {};
		params.title	= params.title	|| '';

		// Don't do anything if params not specified
		if (params.url === undefined)
		{
			return false;
		}

		// Prepare variables
		var
			// Store variables as local
			cache	= this.cache,
			$		= cache.jQuery,

			// Function variables
			image	= new Image();

		// Create dialog handler
		this.action('buildDialog');

		// Set dialog message
		// NOTE: w/o jQuery to avoid slowdowns
		cache.elements.dialog.innerHTML = cache.language.imagePreviewLoading;

		// Open dialog
		this.action(
			'openDialog',
			{
				title:		params.title,
//				width:		500,
//				height:		300,
				resizable:	false,
				modal:		true,
				buttons:
				[
					{
						text:	cache.language.dialogClosebutton,
						click:
							function()
							{
								// Close dialog
								$(this).dialog('close');
							}
					}
				]
			}
		); // this.action();

		// Load image
		// NOTE: w/o jQuery to avoid slowdowns
		image.onload =
			function()
			{
				// Prepare variables
				var
					// Store variables as local
					that			= riverlines, // Local stored object will work slightly faster
					cache			= that.cache,
					dialogElement	= cache.elements.dialog,
					$				= cache.jQuery,

					// Function variables
					dialogElements	= dialogElement.parentNode.getElementsByTagName('div'),
					contentWidth	= 0,
					contentHeight	= 0,
// @todo optimize
					$dialog			= $('#Riverlines-Dialog'),
					$dialogHandler	= $('#Riverlines-Dialog').dialog('widget');

				// Don't do anything if dialog already closed
				// NOTE: w/o jQuery to avoid slowdowns
				if (dialogElement === undefined)
				{
					return;
				}

				// Setup image in dialog, but hidden by default
				// NOTE: w/o jQuery to avoid slowdowns
				dialogElement.innerHTML = '<img src="' + image.src + '" id="Riverlines-Dialog-Image" style="display: none;" />';

				// IE6 workaround
				// It doesn't setup image.[width|height] by default
				image.width		= $('#Riverlines-Dialog-Image').width();
				image.height	= $('#Riverlines-Dialog-Image').height();

				// Calculate new dialog size
				contentWidth =
					parseInt(image.width) +
					parseInt($dialog.css('padding-left')) +
					parseInt($dialog.css('padding-right'));
				contentHeight =
					parseInt(image.height) +
					parseInt($dialog.css('padding-top')) +
					parseInt($dialog.css('padding-bottom'));

				// Catch current dialog position
				var
					dialogLeft	= parseInt($dialogHandler.css('left'));
					dialogTop	= parseInt($dialogHandler.css('top'));

				// Animate dialog resize to image size
				$dialog
					.animate(
						{
							width:		contentWidth,
							height:		contentHeight
						},
						{
							duration:	'slow',
							easing:		'easeOutBounce',
							complete:	function()
								{
									// Show image
									$('#Riverlines-Dialog-Image').fadeIn();
								},
							step:	function(now, fx)
								{
									// Set new dialog handler size
									if (fx.prop !== 'opacity')
									{
										var
											parentProp	= (fx.prop === 'width') ? 'left' : 'top',
											parentPrev	= (fx.prop === 'width') ? dialogLeft : dialogTop,
											parentNow	= parseInt(parentPrev - (now / 4));

										$dialogHandler.css(parentProp, parentNow);
									}

									// Set new dialog size
									$dialog
										.dialog('option', fx.prop, now)
								}
						}
					);

				// Hide dialog footer
				dialogElements[2].style.display = 'none';
			};
		image.src = params.url;
	},

	/**
	* Set preview action to links
	*/
	setImagePreview: function(parent)
	{
// @todo optimize
// @todo remove jquery
		// Prepare variables
		var
			// Store variables as local
			$	= this.cache.jQuery;

		// Find image links
		$(parent).find('a.Riverlines-ShipImage').click(
			function(event)
			{
				// Open image preview
				riverlines.action(
					'openImagePreview',
					{
						title:	$(this).attr('title'),
						url:	$(this).attr('href')
					}
				); // riverlines.action();

				// Prevent default action
				return false;
			}
		); // $(parent).find('a.Riverlines-ShipImage').click();
	},

	/*******************************************************************
	* Actions for handbook
	********************************************************************/
	/**
	* Load handbook
	*/
	loadHandbook: function()
	{
		// Load handbook type data
		this.loadResource(
			{
				type:	'js',
				url:	this.data.handbookURL + '?parent=' + this.data.handbook.parent,
				id:		'Riverlines-Scripts-Data',
				callback:
					function()
					{
						// Fill result page
						riverlines.action('openHandbook');

						// Hide loading message
						riverlines.action('hideLoading');
					}
			}
		); // this.loadResource();
	},

	/**
	* Open handbook dialog
	*/
	openHandbook: function()
	{
		// Prepare variables
		var
			// Store variables as local
			cache		= this.cache,
			handbook	= this.data.handbook,

			// Function variables
			header			= null,
			headerContent	= '',
			lastLetter		= '',
			currentLetter	= '',
			inGroup			= false,

			id			= 0,
			item		= {},
			childId		= 0,
			childItem	= {};

		// Create dialog
		this.action('buildDialog');

		// Set up dialog content structure
		cache.elements.dialog.innerHTML =
			''.concat(
				'<div id="Riverlines-Handbook">',
					'<div id="Riverlines-Handbook-Header"></div>',
					'<div id="Riverlines-Handbook-Content" style="height: 500px; overflow-y: scroll; overflow-x: none;"></div>',
				'</div>'
			);

		// Set up dialog content
		document.getElementById('Riverlines-Handbook-Content').innerHTML = handbook.data['.'][handbook.parent].text;

		// Set up header links
		header = document.getElementById('Riverlines-Handbook-Header');

		// Start quick menu
		headerContent = headerContent.concat(
			cache.language.handbookMenuTitle, ':',
			'<select id="Riverlines-Handbook-QuickMenu">',
				'<option value="0" selected="selected" disabled="disabled">', cache.language.handbookMenuSelectPage, '</option>'
		);

		// Add pages to quick menu
		for (id in handbook.pages)
		{
			// Catch item
			item	= handbook.pages[id];

			// Catch current letter
			currentLetter	= item.title.charAt(0);

			// Start/end <optgroup> if need
			if (currentLetter !== lastLetter)
			{
				// Close <optgroup> if need
				if (inGroup === true)
				{
					headerContent	= headerContent.concat('</optgroup>');
					inGroup			= false;
				}

				// Start new group if need
				if (item.childsNum === 0)
				{
					headerContent	= headerContent.concat('<optgroup label="', currentLetter, '">');
					inGroup			= true;

					// Store current letter as last letter
					lastLetter	= currentLetter;
				}
			}

			// Add item childs if they are exists and mark item as <optgroup>
			if (item.childsNum !== 0)
			{
				// Start item group
				headerContent = headerContent.concat(
					'<optgroup label="', item.title, '">'
				);

				// Add childs
				for (childId in item.childs)
				{
					// Catch child item
					childItem = item.childs[childId];

					// Add child item
					headerContent = headerContent.concat(
						'<option value="', childId, '"> &nbsp; ', childItem.title, '</option>'
					);
				}

				// End item group
				headerContent = headerContent.concat('</optgroup>');
			}
			else
			{
				// Add item
				headerContent = headerContent.concat(
					'<option value="', id, '">', item.title, '</option>'
				);
			}
		}

		// Close group if need
		if (inGroup === true)
		{
			headerContent = headerContent.concat('</optgroup>');
		}

		// End quick menu
		headerContent = headerContent.concat('</select>');

		// Append quick menu
		header.innerHTML = headerContent;

		// Append onChange callback to quick menu
		document.getElementById('Riverlines-Handbook-QuickMenu').onchange = this.callbacks.handbookLoad;

		// Open dialog
		this.action(
			'openDialog',
			{
				title:		cache.language.handbookDialogTitle,
				width:		800,
				height:		600,
				resizable:	true,
				modal:		true,
				buttons:
				[
					{
						text:	cache.language.dialogClosebutton,
						click:
							function()
							{
								// Close dialog
								$(this).dialog('close');
							}
					}
				]
			}
		); // this.action();
	},

	/**
	* Show loading at handbook dialog
	*/
	showLoadingHandbook: function()
	{
		document.getElementById('Riverlines-Handbook-Content').innerHTML = this.cache.language.handbookDialogLoading;
	},

	/**
	* Load handbook data
	*/
	loadHandbookData: function()
	{
		this.loadResource(
			{
				type:	'js',
				url:	this.data.handbookURL + '?parent=' + this.data.handbook.parent + '&page=' + this.data.handbook.page,
				id:		'Riverlines-Scripts-Data',
				callback:
					function()
					{
						// Fill result page
						riverlines.action('showHandbookData');
					}
			}
		); // this.loadResource();
	},

	/**
	* Show handbook data
	*/
	showHandbookData: function()
	{
		// Prepare variables
		var
			// Store variables as local
			handbook	= this.data.handbook;

		// Set handbook data content
		document.getElementById('Riverlines-Handbook-Content').innerHTML = handbook.data[handbook.parent][handbook.page].text;
	},

// @todo move to dialog actions
	/*******************************************************************
	* Actions for information dialog
	********************************************************************/
// @todo
	/**
	* Load information for dialog
	*/
	loadInformation: function(params)
	{
		// Set default values
		params		= params		|| {};
		params.url	= params.url	|| '';

		// Don't do anything if url not specified
		if (params.url === '')
		{
			return;
		}

		// Set default callback if it was not specified
		if (params.callback === undefined || typeof params.callback !== 'function')
		{
			params.callback = function()
			{
				// Fill information
				riverlines.action('fillInformation');

				// Hide loading message
				riverlines.action('hideLoading');
			};
		}

		// Show loading message
		this.action('showLoading');

		// Actually load information
		this.loadResource(
			{
				type:		'js',
				url:		this.data.infoURL + '?' + params.url,
				id: 		'Riverlines-Scripts-Data',
				callback:	params.callback
			}
		); // this.loadResource();
	},

// @todo optimize load
	/**
	* Fill information dialog
	*/
	fillInformation: function()
	{
		this.action('openDialogInformation', '<span>' + this.data.information.title + '<br /><br />' + this.data.information.text + '</span>');
	},

	/*******************************************************************
	* Page fill actions
	********************************************************************/
	/**
	* Fill order page
	* NOTE: At some places doesn't used jQuery methods because they
	*       slowdowns form building action, but this action already
	*       extremally slowed by jQuery UI stylings :(
	*/
	fillOrder: function()
	{
		// Prepare variables
		var
			// Store variables as local
			cache		= this.cache,
			result		= this.data.result, // Catch current result
			language	= cache.language,

			// Function variables
			orderContent	= '';

		// Fill basic dialog fields
		// NOTE: w/o jQuery to avoid slowdowns
		orderContent = orderContent.concat(
			'<form name="Riverlines" id="Riverlines-Order-Form" action="" method="POST">',
				'<table id="Riverlines-Order-Table" cellpadding="4" cellspacing="0" border="0">',
				'<tr>',
					'<td class="Riverlines-Required"><label for="Riverlines-Order-Form-Name">', language.orderCustomerName, ':</label></td>',
					'<td><input type="text" id="Riverlines-Order-Form-Name" class="validate[required,minSize[5],maxSize[64]]" /></td>',
				'</tr>',
				'<tr>',
					'<td class="Riverlines-Required"><label for="Riverlines-Order-Form-Phone">', language.orderCustomerPhone, ':</label></td>',
					'<td><input type="text" id="Riverlines-Order-Form-Phone" class="validate[required,minSize[5],maxSize[18]]" /></td>',
				'</tr>',
				'<tr>',
					'<td><label for="Riverlines-Order-Form-Email">', language.orderCustomerEmail, ':</label></td>',
					'<td><input type="text" id="Riverlines-Order-Form-Email" class="validate[custom[email]]" /></td>',
				'</tr>'
		);

// @todo additional excursions
		// Extend form by tour online/offline state
		if (result.tourOnline === true)
		{
			// Prepare variables for online tour
			var
				cabinIndex	= '',
				cabin		= {},
				cabinRow	= '',
				placeIndex	= '',
				place		= {};

			// Add field for online tour

			// Add cabins
			for (cabinIndex in result.cabins)
			{
				// Ignore prototype properties
				if (result.cabins.hasOwnProperty(cabinIndex) === false)
				{
					continue;
				}

				// Load cabin information
				cabin = result.cabins[cabinIndex];

				// Add dialog fields
				// Start cabin row
				// NOTE: w/o jQuery to avoid slowdowns
				orderContent = orderContent.concat(
					'<tr>',
						'<td colspan="2">',
							'<table id="Riverlines-Order-Places-Table" cellpadding="5" cellspacing="0" border="0" width="100%" class="ui-corner-all ui-state-highlight">',
							'<tr>',
								'<th>',
									language.orderOnlineCabinNumber, ': ',
									'<strong>', cabin.cabinName, '</strong>',
								'</th>',
								'<th>',
									language.orderOnlineCabinClass, ': ',
									'<strong>', cabin.groupName, '</strong>',
								'</th>',
								'<th>',
									language.orderOnlinePlacesCount, ': ',
									'<strong>',
										(parseInt(cabin.placesMainFree)	+ parseInt(cabin.placesAdditionalFree)),
										'/',
										(parseInt(cabin.placesMain)		+ parseInt(cabin.placesAdditional)),
									'</strong>',
								'</th>',
							'</tr>',

							'<tr>',
								'<th colspan="3" class="Riverlines-Big-Font">',
									language.orderOnlineTouristsDetails,
								'</th>',
							'</tr>',
							'<tr>',
								'<td colspan="3">',
									'<table cellpadding="5" cellspacing="0" border="0" class="Riverlines-Detail-Places">',
									'<tr class="ui-state-active">',
										'<th>', language.orderOnlinePlaceDetails, '</th>',
										'<th width="10">', language.orderOnlinePlacePrice, '</th>',
										'<th>', language.orderOnlineTouristsNames, '</th>',
										'<th>', language.orderOnlinePassport, '</th>',
									'</tr>'
				);

				// Add places
				for (placeIndex in cabin.places)
				{
					// Ignore prototype properties
					if (cabin.places.hasOwnProperty(placeIndex) === false)
					{
						continue;
					}

					// Load place information
					place = cabin.places[placeIndex];

					// Add dialog fields
					// Add place row
					// NOTE: w/o jQuery to avoid slowdowns
					orderContent = orderContent.concat(
						'<tr>',
							'<td>', place.placeType, '</td>',
							'<td class="Riverlines-Big-Font">', ((place.placePrice) ? place.placePrice : 0), '</td>',
							'<td><input type="text" name="riverlines_place_name[', place.placeId, ']" class="ui-corner-all ui-state-default" /></td>',
							'<td>',
								'<input type="hidden" name="riverlines_place_cabin[', place.placeId, ']" value="', cabin.cabinId, '" />',
								language.orderOnlinePassportBirthday, ' <input type="text" name="riverlines_place_passport_birthday[', place.placeId, ']" size="10" class="ui-corner-all ui-state-default Riverlines-Order-Narrow" /> <br />',
								language.orderOnlinePassportNumber, ' <input type="text" name="riverlines_place_passport_number[', place.placeId, ']" size="5" class="ui-corner-all ui-state-default Riverlines-Order-Narrow" /> ',

							'</td>',
						'</tr>'
					);
				} // for (placeIndex in cabin.places)

				// Add dialog fields
				// End cabin row
				// NOTE: w/o jQuery to avoid slowdowns
				orderContent = orderContent.concat(
								'</table>',
							'</td>',
						'</tr>',
						'<tr>',
							'<td colspan="3" class="Riverlines-CabinsSpaces">&nbsp;</td>',
						'</tr>',
						'</table>',
					'</td>',
				'</tr>'
				);
			} // for (cabinIndex in result.cabins)
		} // if (result.tourOnline === true)
		else
		{
			// Add dialog fields for offline tour
			// NOTE: w/o jQuery to avoid slowdowns
			orderContent = orderContent.concat(
				'<tr>',
					'<td class="Riverlines-Required">', language.orderOfflineCabin, ':</td>',
					'<td><input type="text" id="Riverlines-Order-Form-CabinType" class="ui-corner-all ui-state-default" /></td>',
				'</tr>',
				'<tr>',
					'<td class="Riverlines-Required">', language.orderOfflinePlaces, ':</td>',
					'<td>',
						'<table cellpadding="5" cellspacing="0" border="0">',
						'<tr>',
							'<td>', language.orderOfflinePlacesAdult, ':</td>',
							'<td>',
								'<input type="text" id="Riverlines-Order-Form-PlacesAdult" class="validate[custom[onlyNumberSp]] ui-corner-all ui-state-default Riverlines-Order-Narrow" />',
							'</td>',
						'</tr>',
						'<tr>',
							'<td>', language.orderOfflinePlacesChild, ':</td>',
							'<td>',
								'<input type="text" id="Riverlines-Order-Form-PlacesChild" class="validate[custom[onlyNumberSp]] ui-corner-all ui-state-default Riverlines-Order-Narrow" />',
							'</td>',
						'</tr>',
						'</table>',
					'</td>',
				'</tr>'
			);
		}

		// Complete dialog fields
		// NOTE: w/o jQuery to avoid slowdowns
		orderContent = orderContent.concat(
				'<tr>',
					'<td>', language.orderAdditionalInfo, ':</td>',
					'<td><textarea id="Riverlines-Order-Form-AdditionalInfo" class="ui-corner-all ui-state-default"></textarea></td>',
				'</tr>',
				'</table>',
				'<button id="Riverlines-Order-Submit">', language.orderSubmit, '</button>',
			'</form>'
		);

		// Set dialog content
		cache.elements.contentOrder.innerHTML = orderContent;

		// Append on click action to submit button
		$('#Riverlines-Order-Submit').button().click(
			function(event)
			{
				// Don't do anything if form not valid
				if ($('#Riverlines-Order-Form').validationEngine('validate') === false)
				{
					return;
				}

				// Close form validation prompts
				$('#Riverlines-Order-Form').validationEngine('hide');

				// Show loading message
				riverlines.action('showLoading');

				// Build basic params
				var
					params =
						''.concat(
							'&name=', $('#Riverlines-Order-Form-Name').val(),
							'&phone=', $('#Riverlines-Order-Form-Phone').val(),
							'&email=', $('#Riverlines-Order-Form-Email').val(),
							'&info=', $('#Riverlines-Order-Form-AdditionalInfo').val()
						);

				// Add params by tour online/offline state
				if (riverlines.data.result.tourOnline === true)
				{
					// Add tourists data for online tours
					$('input:hidden[name^="riverlines_place_cabin"]').each(
						function()
						{
							// Prepare variables
							var
								placeId = $(this).attr('name').slice(23, -1),
								cabinId = $(this).val();

							params = params.concat(
								'&cabins[', cabinId, '][', placeId, '][name]=', $('input:text[name="riverlines_place_name[' + placeId + ']"]').val(),
								'&cabins[', cabinId, '][', placeId, '][number]=', $('input:text[name="riverlines_place_passport_number[' + placeId + ']"]').val(),
								'&cabins[', cabinId, '][', placeId, '][birthday]=', $('input:text[name="riverlines_place_passport_birthday[' + placeId + ']"]').val()
							);
						}
					); // $('input:hidden[name^="riverlines_place_cabin"]').each();
				} // if (riverlines.data.result.tourOnline === true)
				else
				{
					// Add field for offline tours
					params = params.concat(
						'&cabin=', $('#Riverlines-Order-Form-CabinType').val(),
						'&adult=', $('#Riverlines-Order-Form-PlacesAdult').val(),
						'&child=', $('#Riverlines-Order-Form-PlacesChild').val()
					);
				}

				// Load result
				riverlines.loadResource(
					{
						type:		'js',
						url:
							''.concat(
								riverlines.data.orderURL, '?host=', location.host, '&id=', riverlines.data.result.tourId, params
							),
						id:			'Riverlines-Scripts-Data',
						callback:
							function()
							{
								// Prepare variables
								var
									$			= riverlines.cache.jQuery,
									language	= riverlines.cache.language;

								// Activate search results tab and disable other tabs
								$('#Riverlines-Tabs')
									.tabs('select', 0) // Activate search results tab
									.tabs('disable', 1); // Disable tour tab

								// Hide inactive tabs
								$('#Riverlines-Tabs').find('ul.ui-tabs-nav').find('li.ui-state-disabled').hide();

								// Open information dialog
								if (riverlines.data.error)
								{
									riverlines.action('openDialogError', language.orderErrorSubmit);
								}
								else
								{
									riverlines.action('openDialogInformation', language.orderSuccessSubmit);
								}

								// Hide loading message
								riverlines.action('hideLoading');
							}
					}
				); // riverlines.loadResource();

// @todo slide back to tour

				// Prevent default action
				return false;
			}
		); // $('#Riverlines-Order-Submit').click();

		// Initialize form validator
		$('#Riverlines-Order-Form').validationEngine({
			scroll: false,
			showFirstAlertForFieldOnly: true,
			promptPosition: 'right',
			wrapper: '<div class="Riverlines-jQueryUI"></div>'
		});
	}
};

})(jQuery, window, document);

/*******************************************************************
* Initialize riverlines
********************************************************************/
riverlines.initialize();

/**
* Riverlines compability
* Revert back original page's jQuery
*/
window.$ = riverlines.cache.page.jsFramework;

/**
* Public riverlines object
*/
window.riverlines =
{
	// Data handler
	data:	riverlines.data,

	// Templates handler
	templates:	riverlines.templates,

	// Language definitions
	language:	riverlines.language,

	// Preferencs handler
	preferences:	riverlines.preferences
};

})(window, document);

