jQuery.cookie=function(a,b,c){if(arguments.length>1&&String(b)!=="[object Object]"){c=jQuery.extend({},c);if(b===null||b===undefined)c.expires=-1;if(typeof c.expires=="number"){var d=c.expires,e=c.expires=new Date;e.setDate(e.getDate()+d)}b=String(b);return document.cookie=[encodeURIComponent(a),"=",c.raw?b:encodeURIComponent(b),c.expires?"; expires="+c.expires.toUTCString():"",c.path?"; path="+c.path:"",c.domain?"; domain="+c.domain:"",c.secure?"; secure":""].join("")}c=b||{};var f,g=c.raw?function(a){return a}:decodeURIComponent;return(f=(new RegExp("(?:^|; )"+encodeURIComponent(a)+"=([^;]*)")).exec(document.cookie))?g(f[1]):null},this.JSON||(this.JSON={}),function(){function f(a){return a<10?"0"+a:a}function quote(a){escapable.lastIndex=0;return escapable.test(a)?'"'+a.replace(escapable,function(a){var b=meta[a];return typeof b=="string"?b:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+a+'"'}function str(a,b){var c,d,e,f,g=gap,h,i=b[a];i&&typeof i=="object"&&typeof i.toJSON=="function"&&(i=i.toJSON(a)),typeof rep=="function"&&(i=rep.call(b,a,i));switch(typeof i){case"string":return quote(i);case"number":return isFinite(i)?String(i):"null";case"boolean":case"null":return String(i);case"object":if(!i)return"null";gap+=indent,h=[];if(Object.prototype.toString.apply(i)==="[object Array]"){f=i.length;for(c=0;c<f;c+=1)h[c]=str(c,i)||"null";e=h.length===0?"[]":gap?"[\n"+gap+h.join(",\n"+gap)+"\n"+g+"]":"["+h.join(",")+"]",gap=g;return e}if(rep&&typeof rep=="object"){f=rep.length;for(c=0;c<f;c+=1)d=rep[c],typeof d=="string"&&(e=str(d,i),e&&h.push(quote(d)+(gap?": ":":")+e))}else for(d in i)Object.hasOwnProperty.call(i,d)&&(e=str(d,i),e&&h.push(quote(d)+(gap?": ":":")+e));e=h.length===0?"{}":gap?"{\n"+gap+h.join(",\n"+gap)+"\n"+g+"}":"{"+h.join(",")+"}",gap=g;return e}}typeof Date.prototype.toJSON!="function"&&(Date.prototype.toJSON=function(a){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null},String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(a){return this.valueOf()});var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;typeof JSON.stringify!="function"&&(JSON.stringify=function(a,b,c){var d;gap="",indent="";if(typeof c=="number")for(d=0;d<c;d+=1)indent+=" ";else typeof c=="string"&&(indent=c);rep=b;if(b&&typeof b!="function"&&(typeof b!="object"||typeof b.length!="number"))throw new Error("JSON.stringify");return str("",{"":a})}),typeof JSON.parse!="function"&&(JSON.parse=function(text,reviver){function walk(a,b){var c,d,e=a[b];if(e&&typeof e=="object")for(c in e)Object.hasOwnProperty.call(e,c)&&(d=walk(e,c),d!==undefined?e[c]=d:delete e[c]);return reviver.call(a,b,e)}var j;text=String(text),cx.lastIndex=0,cx.test(text)&&(text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)}));if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){j=eval("("+text+")");return typeof reviver=="function"?walk({"":j},""):j}throw new SyntaxError("JSON.parse")})}(),jQuery.store=function(){function h(){try{return e in b&&b[e]&&b[e][b.location.hostname]}catch(a){return!1}}function g(){try{return d in b&&b[d]}catch(a){return!1}}var a={},b=window,c=b.document,d="localStorage",e="globalStorage",f;a.disabled=!1,a.set=function(a,b){},a.get=function(a){},a.remove=function(a){},a.clear=function(){},a.transact=function(b,c){var d=a.get(b);typeof d=="undefined"&&(d={}),c(d),a.set(b,d)},a.serialize=function(a){return JSON.stringify(a)},a.deserialize=function(a){if(typeof a!="string")return undefined;return JSON.parse(a)};if(g())f=b[d],a.set=function(b,c){f.setItem(b,a.serialize(c))},a.get=function(b){return a.deserialize(f.getItem(b))},a.remove=function(a){f.removeItem(a)},a.clear=function(){f.clear()};else if(h())f=b[e][b.location.hostname],a.set=function(b,c){f[b]=a.serialize(c)},a.get=function(b){return a.deserialize(f[b]&&f[b].value)},a.remove=function(a){delete f[a]},a.clear=function(){for(var a in f)delete f[a]};else if(c.documentElement.addBehavior){var f=c.createElement("div");function i(b){return function(){var e=Array.prototype.slice.call(arguments,0);e.unshift(f),c.body.appendChild(f),f.addBehavior("#default#userData"),f.load(d);var g=b.apply(a,e);c.body.removeChild(f);return g}}a.set=i(function(b,c,e){b.setAttribute(c,a.serialize(e)),b.save(d)}),a.get=i(function(b,c){return a.deserialize(b.getAttribute(c))}),a.remove=i(function(a,b){a.removeAttribute(b),a.save(d)}),a.clear=i(function(a){var b=a.XMLDocument.documentElement.attributes;a.load(d);for(var c=0,e;e=b[c];c++)a.removeAttribute(e.name);a.save(d)})}else a.disabled=!0;return a}(),Array.prototype.indexOf||(Array.prototype.indexOf=function(a){"use strict";if(this===void 0||this===null)throw new TypeError;var b=Object(this),c=b.length>>>0;if(c===0)return-1;var d=0;arguments.length>0&&(d=Number(arguments[1]),d!==d?d=0:d!==0&&d!==1/0&&d!==-Infinity&&(d=(d>0||-1)*Math.floor(Math.abs(d))));if(d>=c)return-1;var e=d>=0?d:Math.max(c-Math.abs(d),0);for(;e<c;e++)if(e in b&&b[e]===a)return e;return-1})

/*
// jQuery multiSelect
*/
if(jQuery) (function($){

	// render the html for a single option
	function renderOption(id, option)
	{
		var html = '<label><input type="checkbox" name="' + id + '[]" value="' + option.value + '"';
		if( option.selected ){
			html += ' checked="checked"';
		}
		html += ' />' + option.text + '</label>';

		return html;
	}

	// render the html for the options/optgroups
	function renderOptions(id, options, o)
	{
		var html = "";

		for(var i = 0; i < options.length; i++) {
			if(options[i].optgroup) {
				html += '<label class="optGroup">';

				if(o.optGroupSelectable) {
					html += '<input type="checkbox" class="optGroup" />' + options[i].optgroup;
				}
				else {
					html += options[i].optgroup;
				}

				html += '</label><div class="optGroupContainer">';

				html += renderOptions(id, options[i].options, o);

				html += '</div>';
			}
			else {
				html += renderOption(id, options[i]);
			}
		}

		return html;
	}

	// Building the actual options
	function buildOptions(options)
	{
		var multiSelect = $(this);
		var multiSelectOptions = multiSelect.next('.multiSelectOptions');
		var o = multiSelect.data("config");
		var callback = multiSelect.data("callback");

		// clear the existing options
		multiSelectOptions.html("");
		var html = "";

		// if we should have a select all option then add it
		if( o.selectAll ) {
			html += '<label class="selectAll"><input type="checkbox" class="selectAll" />' + o.selectAllText + '</label>';
		}

		// generate the html for the new options
		html += renderOptions(multiSelect.attr('id'), options, o);

		multiSelectOptions.html(html);

		// variables needed to account for width changes due to a scrollbar
		var initialWidth = multiSelectOptions.width();
		var hasScrollbar = false;

		// set the height of the dropdown options
		if(multiSelectOptions.height() > o.listHeight) {
			multiSelectOptions.css("height", o.listHeight + 'px');
			hasScrollbar = true;
		} else {
			multiSelectOptions.css("height", '');
		}

		// if the there is a scrollbar and the browser did not already handle adjusting the width (i.e. Firefox) then we will need to manaually add the scrollbar width
		var scrollbarWidth = hasScrollbar && (initialWidth == multiSelectOptions.width()) ? 17 : 0;

		// set the width of the dropdown options
		if((multiSelectOptions.width() + scrollbarWidth) < multiSelect.outerWidth()) {
			multiSelectOptions.css("width", multiSelect.outerWidth() - 2/*border*/ + 'px');
		} else {
			multiSelectOptions.css("width", (multiSelectOptions.width() + scrollbarWidth) + 'px');
		}

		// Apply bgiframe if available on IE6
		if( $.fn.bgiframe ) multiSelect.next('.multiSelectOptions').bgiframe( { width: multiSelectOptions.width(), height: multiSelectOptions.height() });

		// Handle selectAll oncheck
		if(o.selectAll) {
			multiSelectOptions.find('INPUT.selectAll').click( function() {
				// update all the child checkboxes
				multiSelectOptions.find('INPUT:checkbox').attr('checked', $(this).attr('checked')).parent("LABEL").toggleClass('checked', $(this).attr('checked'));
			});
		}

		// Handle OptGroup oncheck
		if(o.optGroupSelectable) {
			multiSelectOptions.addClass('optGroupHasCheckboxes');

			multiSelectOptions.find('INPUT.optGroup').click( function() {
				// update all the child checkboxes
				$(this).parent().next().find('INPUT:checkbox').attr('checked', $(this).attr('checked')).parent("LABEL").toggleClass('checked', $(this).attr('checked'));
			});
		}

		// Handle all checkboxes
		multiSelectOptions.find('INPUT:checkbox').click( function() {
			// set the label checked class
			$(this).parent("LABEL").toggleClass('checked', $(this).attr('checked'));

			updateSelected.call(multiSelect);
			multiSelect.focus();
			if($(this).parent().parent().hasClass('optGroupContainer')) {
				updateOptGroup.call(multiSelect, $(this).parent().parent().prev());
			}
			if( callback ) {
				callback($(this));
			}
		});

		// Initial display
		multiSelectOptions.each( function() {
			$(this).find('INPUT:checked').parent().addClass('checked');
		});

		// Initialize selected and select all
		updateSelected.call(multiSelect);

		// Initialize optgroups
		if(o.optGroupSelectable) {
			multiSelectOptions.find('LABEL.optGroup').each( function() {
				updateOptGroup.call(multiSelect, $(this));
			});
		}

		// Handle hovers
		multiSelectOptions.find('LABEL:has(INPUT)').hover( function() {
			$(this).parent().find('LABEL').removeClass('hover');
			$(this).addClass('hover');
		}, function() {
			$(this).parent().find('LABEL').removeClass('hover');
		});

		// Keyboard
		multiSelect.keydown( function(e) {

			var multiSelectOptions = $(this).next('.multiSelectOptions');

			// Is dropdown visible?
			if( multiSelectOptions.css('visibility') != 'hidden' ) {
				// Dropdown is visible
				// Tab
				if( e.keyCode == 9 ) {
					$(this).addClass('focus').trigger('click'); // esc, left, right - hide
					$(this).focus().next(':input').focus();
					return true;
				}

				// ESC, Left, Right
				if( e.keyCode == 27 || e.keyCode == 37 || e.keyCode == 39 ) {
					// Hide dropdown
					$(this).addClass('focus').trigger('click');
				}
				// Down || Up
				if( e.keyCode == 40 || e.keyCode == 38) {
					var allOptions = multiSelectOptions.find('LABEL');
					var oldHoverIndex = allOptions.index(allOptions.filter('.hover'));
					var newHoverIndex = -1;

					// if there is no current highlighted item then highlight the first item
					if(oldHoverIndex < 0) {
						// Default to first item
						multiSelectOptions.find('LABEL:first').addClass('hover');
					}
					// else if we are moving down and there is a next item then move
					else if(e.keyCode == 40 && oldHoverIndex < allOptions.length - 1)
					{
						newHoverIndex = oldHoverIndex + 1;
					}
					// else if we are moving up and there is a prev item then move
					else if(e.keyCode == 38 && oldHoverIndex > 0)
					{
						newHoverIndex = oldHoverIndex - 1;
					}

					if(newHoverIndex >= 0) {
						$(allOptions.get(oldHoverIndex)).removeClass('hover'); // remove the current highlight
						$(allOptions.get(newHoverIndex)).addClass('hover'); // add the new highlight

						// Adjust the viewport if necessary
						adjustViewPort(multiSelectOptions);
					}

					return false;
				}

				// Enter, Space
				if( e.keyCode == 13 || e.keyCode == 32 ) {
					var selectedCheckbox = multiSelectOptions.find('LABEL.hover INPUT:checkbox');

					// Set the checkbox (and label class)
					selectedCheckbox.attr('checked', !selectedCheckbox.attr('checked')).parent("LABEL").toggleClass('checked', selectedCheckbox.attr('checked'));

					// if the checkbox was the select all then set all the checkboxes
					if(selectedCheckbox.hasClass("selectAll")) {
						multiSelectOptions.find('INPUT:checkbox').attr('checked', selectedCheckbox.attr('checked')).parent("LABEL").addClass('checked').toggleClass('checked', selectedCheckbox.attr('checked'));
					}

					updateSelected.call(multiSelect);

					if( callback ) callback($(this));
					return false;
				}

				// Any other standard keyboard character (try and match the first character of an option)
				if( e.keyCode >= 33 && e.keyCode <= 126 ) {
					// find the next matching item after the current hovered item
					var match = multiSelectOptions.find('LABEL:startsWith(' + String.fromCharCode(e.keyCode) + ')');

					var currentHoverIndex = match.index(match.filter('LABEL.hover'));

					// filter the set to any items after the current hovered item
					var afterHoverMatch = match.filter(function (index) {
						return index > currentHoverIndex;
					});

					// if there were no item after the current hovered item then try using the full search results (filtered to the first one)
					match = (afterHoverMatch.length >= 1 ? afterHoverMatch : match).filter("LABEL:first");

					if(match.length == 1) {
						// if we found a match then move the hover
						multiSelectOptions.find('LABEL.hover').removeClass('hover');
						match.addClass('hover');

						adjustViewPort(multiSelectOptions);
					}
				}
			} else {
				// Dropdown is not visible
				if( e.keyCode == 38 || e.keyCode == 40 || e.keyCode == 13 || e.keyCode == 32 ) { //up, down, enter, space - show
					// Show dropdown
					$(this).removeClass('focus').trigger('click');
					multiSelectOptions.find('LABEL:first').addClass('hover');
					return false;
				}
				//  Tab key
				if( e.keyCode == 9 ) {
					// Shift focus to next INPUT element on page
					multiSelectOptions.next(':input').focus();
					return true;
				}
			}
			// Prevent enter key from submitting form
			if( e.keyCode == 13 ) return false;
		});
	}

	// Adjust the viewport if necessary
	function adjustViewPort(multiSelectOptions)
	{
		// check for and move down
		var selectionBottom = multiSelectOptions.find('LABEL.hover').position().top + multiSelectOptions.find('LABEL.hover').outerHeight();

		if(selectionBottom > multiSelectOptions.innerHeight()){
			multiSelectOptions.scrollTop(multiSelectOptions.scrollTop() + selectionBottom - multiSelectOptions.innerHeight());
		}

		// check for and move up
		if(multiSelectOptions.find('LABEL.hover').position().top < 0){
			multiSelectOptions.scrollTop(multiSelectOptions.scrollTop() + multiSelectOptions.find('LABEL.hover').position().top);
		}
	}

	// Update the optgroup checked status
	function updateOptGroup(optGroup)
	{
		var multiSelect = $(this);
		var o = multiSelect.data("config");

		// Determine if the optgroup should be checked
		if(o.optGroupSelectable) {
			var optGroupSelected = true;
			$(optGroup).next().find('INPUT:checkbox').each( function() {
				if( !$(this).attr('checked') ) {
					optGroupSelected = false;
					return false;
				}
			});

			$(optGroup).find('INPUT.optGroup').attr('checked', optGroupSelected).parent("LABEL").toggleClass('checked', optGroupSelected);
		}
	}

	// Update the textbox with the total number of selected items, and determine select all
	function updateSelected() {
		var multiSelect = $(this);
		var multiSelectOptions = multiSelect.next('.multiSelectOptions');
		var o = multiSelect.data("config");

		var i = 0;
		var selectAll = true;
		var display = '';
		multiSelectOptions.find('INPUT:checkbox').not('.selectAll, .optGroup').each( function() {
			if( $(this).attr('checked') ) {
				i++;
				display = display + $.trim($(this).parent().text()) + ', ';
			}
			else selectAll = false;
		});

		// trim any end comma and surounding whitespace
		display = display.replace(/\s*\,\s*$/,'');

		if( i == 0 ) {
			multiSelect.find("span").html( o.noneSelected );
		} else {
			if( o.oneOrMoreSelected == '*' ) {
				multiSelect.find("span").html( display );
				multiSelect.attr( "title", display );
			} else {
				multiSelect.find("span").html( o.oneOrMoreSelected.replace('%', i) );
			}
		}

		// Determine if Select All should be checked
		if(o.selectAll) {
			multiSelectOptions.find('INPUT.selectAll').attr('checked', selectAll).parent("LABEL").toggleClass('checked', selectAll);
			if (selectAll) multiSelect.find("span").html('Találatok szűrése...');
		}
	}

	$.extend($.fn, {
		multiSelect: function(o, callback) {
			// Default options
			if( !o ) o = {};
			if( o.selectAll == undefined ) o.selectAll = true;
			if( o.selectAllText == undefined ) o.selectAllText = "Select All";
			if( o.noneSelected == undefined ) o.noneSelected = 'Select options';
			if( o.oneOrMoreSelected == undefined ) o.oneOrMoreSelected = '% selected';
			if( o.optGroupSelectable == undefined ) o.optGroupSelectable = false;
			if( o.listHeight == undefined ) o.listHeight = 150;

			// Initialize each multiSelect
			$(this).each( function() {
				var select = $(this);
				var html = '<a href="javascript:;" class="multiSelect"><span></span></a>';
				html += '<div class="multiSelectOptions" style="position: absolute; z-index: 99999; visibility: hidden;"></div>';
				$(select).after(html);

				var multiSelect = $(select).next('.multiSelect');
				var multiSelectOptions = multiSelect.next('.multiSelectOptions');

				// if the select object had a width defined then match the new multilsect to it
				multiSelect.find("span").css("width", $(select).width() + 'px');

				// Attach the config options to the multiselect
				multiSelect.data("config", o);

				// Attach the callback to the multiselect
				multiSelect.data("callback", callback);

				// Serialize the select options into json options
				var options = [];
				$(select).children().each( function() {
					if(this.tagName.toUpperCase() == 'OPTGROUP')
					{
						var suboptions = [];
						options.push({ optgroup: $(this).attr('label'), options: suboptions });

						$(this).children('OPTION').each( function() {
							if( $(this).val() != '' ) {
								suboptions.push({ text: $(this).html(), value: $(this).val(), selected: $(this).attr('selected') });
							}
						});
					}
					else if(this.tagName.toUpperCase() == 'OPTION')
					{
						if( $(this).val() != '' ) {
							options.push({ text: $(this).html(), value: $(this).val(), selected: $(this).attr('selected') });
						}
					}
				});

				// Eliminate the original form element
				$(select).remove();

				// Add the id that was on the original select element to the new input
				multiSelect.attr("id", $(select).attr("id"));

				// Build the dropdown options
				buildOptions.call(multiSelect, options);

				// Events
				multiSelect.hover( function() {
					$(this).addClass('hover');
				}, function() {
					$(this).removeClass('hover');
				}).click( function() {
					// Show/hide on click
					if( $(this).hasClass('active') ) {
						$(this).multiSelectOptionsHide();
					} else {
						$(this).multiSelectOptionsShow();
					}
					return false;
				}).focus( function() {
					// So it can be styled with CSS
					$(this).addClass('focus');
				}).blur( function() {
					// So it can be styled with CSS
					$(this).removeClass('focus');
				});

				// Add an event listener to the window to close the multiselect if the user clicks off
				$(document).click( function(event) {
					// If somewhere outside of the multiselect was clicked then hide the multiselect
					if(!($(event.target).parents().andSelf().is('.multiSelectOptions'))){
						multiSelect.multiSelectOptionsHide();
					}
				});
			});
		},

		// Update the dropdown options
		multiSelectOptionsUpdate: function(options) {
			buildOptions.call($(this), options);
		},

		// Hide the dropdown
		multiSelectOptionsHide: function() {
			$(this).removeClass('active').removeClass('hover').next('.multiSelectOptions').css('visibility', 'hidden');
		},

		// Show the dropdown
		multiSelectOptionsShow: function() {
			var multiSelect = $(this);
			var multiSelectOptions = multiSelect.next('.multiSelectOptions');
			var o = multiSelect.data("config");

			// Hide any open option boxes
			$('.multiSelect').multiSelectOptionsHide();
			multiSelectOptions.find('LABEL').removeClass('hover');
			multiSelect.addClass('active').next('.multiSelectOptions').css('visibility', 'visible');
			multiSelect.focus();

			// reset the scroll to the top
			multiSelect.next('.multiSelectOptions').scrollTop(0);

			// Position it
			var offset = multiSelect.position();
			multiSelect.next('.multiSelectOptions').css({ top:  offset.top + $(this).outerHeight() + 'px' });
			multiSelect.next('.multiSelectOptions').css({ left: offset.left + 'px' });
		},

		// get a coma-delimited list of selected values
		selectedValuesString: function() {
			var selectedValues = "";
			$(this).next('.multiSelectOptions').find('INPUT:checkbox:checked').not('.optGroup, .selectAll').each(function() {
				selectedValues += $(this).attr('value') + ",";
			});
			// trim any end comma and surounding whitespace
			return selectedValues.replace(/\s*\,\s*$/,'');
		}
	});

	// add a new ":startsWith" search filter
	$.expr[":"].startsWith = function(el, i, m) {
		var search = m[3];
		if (!search) return false;
		return eval("/^[/s]*" + search + "/i").test($(el).text());
	};

})(jQuery);

(function(){function d(a){return function(b){this[a]=b}}function e(a){return function(){return this[a]}}var h;
function i(a,b,c){this.extend(i,google.maps.OverlayView);this.b=a;this.a=[];this.l=[];this.X=[53,56,66,78,90];this.h=[];this.z=false;c=c||{};this.f=c.gridSize||60;this.T=c.maxZoom||null;this.h=c.styles||[];this.S=c.imagePath||this.M;this.R=c.imageExtension||this.L;this.K=true;if(c.zoomOnClick!=undefined)this.K=c.zoomOnClick;this.p=false;if(c.averageCenter!=undefined)this.p=c.averageCenter;j(this);this.setMap(a);this.G=this.b.getZoom();var f=this;google.maps.event.addListener(this.b,"zoom_changed",
function(){var g=f.b.mapTypes[f.b.getMapTypeId()].maxZoom,l=f.b.getZoom();if(!(l<0||l>g))if(f.G!=l){f.G=f.b.getZoom();f.m()}});google.maps.event.addListener(this.b,"idle",function(){f.j()});b&&b.length&&this.B(b,false)}h=i.prototype;h.M="http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclusterer/images/m";h.L="png";h.extend=function(a,b){return function(c){for(property in c.prototype)this.prototype[property]=c.prototype[property];return this}.apply(a,[b])};
h.onAdd=function(){if(!this.z){this.z=true;m(this)}};h.draw=function(){};function j(a){if(!a.h.length)for(var b=0,c;c=a.X[b];b++)a.h.push({url:a.S+(b+1)+"."+a.R,height:c,width:c})}h.w=e("h");h.v=e("a");h.Q=e("a");h.F=function(){return this.T||this.b.mapTypes[this.b.getMapTypeId()].maxZoom};h.C=function(a,b){for(var c=0,f=a.length,g=f;g!==0;){g=parseInt(g/10,10);c++}c=Math.min(c,b);return{text:f,index:c}};h.V=d("C");h.D=e("C");h.B=function(a,b){for(var c=0,f;f=a[c];c++)n(this,f);b||this.j()};
function n(a,b){b.setVisible(false);b.setMap(null);b.r=false;b.draggable&&google.maps.event.addListener(b,"dragend",function(){b.r=false;a.m();a.j()});a.a.push(b)}h.o=function(a,b){n(this,a);b||this.j()};h.U=function(a){var b=-1;if(this.a.indexOf)b=this.a.indexOf(a);else for(var c=0,f;f=this.a[c];c++)if(f==a)b=c;if(b==-1)return false;this.a.splice(b,1);a.setVisible(false);a.setMap(null);this.m();this.j();return true};h.P=function(){return this.l.length};h.getMap=e("b");h.setMap=d("b");h.u=e("f");
h.W=d("f");function o(a,b){var c=a.getProjection(),f=new google.maps.LatLng(b.getNorthEast().lat(),b.getNorthEast().lng()),g=new google.maps.LatLng(b.getSouthWest().lat(),b.getSouthWest().lng());f=c.fromLatLngToDivPixel(f);f.x+=a.f;f.y-=a.f;g=c.fromLatLngToDivPixel(g);g.x-=a.f;g.y+=a.f;f=c.fromDivPixelToLatLng(f);c=c.fromDivPixelToLatLng(g);b.extend(f);b.extend(c);return b}h.N=function(){this.m();this.a=[]};
h.m=function(){for(var a=0,b;b=this.l[a];a++)b.remove();for(a=0;b=this.a[a];a++){b.r=false;b.setMap(null);b.setVisible(false)}this.l=[]};h.j=function(){m(this)};function m(a){if(a.z)for(var b=o(a,new google.maps.LatLngBounds(a.b.getBounds().getSouthWest(),a.b.getBounds().getNorthEast())),c=0,f;f=a.a[c];c++){var g=false;if(!f.r&&b.contains(f.getPosition())){for(var l=0,k;k=a.l[l];l++)if(!g&&k.getCenter()&&k.t.contains(f.getPosition())){g=true;k.o(f);break}if(!g){k=new p(a);k.o(f);a.l.push(k)}}}}
function p(a){this.i=a;this.b=a.getMap();this.f=a.u();this.p=a.p;this.d=null;this.a=[];this.t=null;this.k=new q(this,a.w(),a.u())}h=p.prototype;
h.o=function(a){var b;a:if(this.a.indexOf)b=this.a.indexOf(a)!=-1;else{b=0;for(var c;c=this.a[b];b++)if(c==a){b=true;break a}b=false}if(b)return false;if(this.d){if(this.p){b=(this.d.lat()+a.getPosition().lat())/2;c=(this.d.lng()+a.getPosition().lng())/2;this.d=new google.maps.LatLng(b,c);r(this)}}else{this.d=a.getPosition();r(this)}if(this.a.length==0){a.setMap(this.b);a.setVisible(true)}else if(this.a.length==1){this.a[0].setMap(null);this.a[0].setVisible(false)}a.r=true;this.a.push(a);if(this.b.getZoom()>
this.i.F())for(a=0;b=this.a[a];a++){b.setMap(this.b);b.setVisible(true)}else if(this.a.length<2)s(this.k);else{a=this.i.w().length;b=this.i.D()(this.a,a);this.k.setCenter(this.d);a=this.k;a.A=b;a.$=b.text;a.Y=b.index;if(a.c)a.c.innerHTML=b.text;b=Math.max(0,a.A.index-1);b=Math.min(a.h.length-1,b);b=a.h[b];a.J=b.url;a.g=b.height;a.n=b.width;a.H=b.textColor;a.anchor=b.anchor;a.I=b.textSize;this.k.show()}return true};h.getBounds=function(){r(this);return this.t};
h.remove=function(){this.k.remove();this.a.length=0;delete this.a};h.O=function(){return this.a.length};h.v=e("a");h.getCenter=e("d");function r(a){a.t=o(a.i,new google.maps.LatLngBounds(a.d,a.d))}h.getMap=e("b");function q(a,b,c){a.i.extend(q,google.maps.OverlayView);this.h=b;this.Z=c||0;this.q=a;this.d=null;this.b=a.getMap();this.A=this.c=null;this.s=false;this.setMap(this.b)}h=q.prototype;
h.onAdd=function(){this.c=document.createElement("DIV");if(this.s){this.c.style.cssText=t(this,u(this,this.d));this.c.innerHTML=this.A.text}this.getPanes().overlayImage.appendChild(this.c);var a=this;google.maps.event.addDomListener(this.c,"click",function(){var b=a.q.i;google.maps.event.trigger(b,"clusterclick",a.q);if(b.K){a.b.panTo(a.q.getCenter());a.b.fitBounds(a.q.getBounds())}})};
function u(a,b){var c=a.getProjection().fromLatLngToDivPixel(b);c.x-=parseInt(a.n/2,10);c.y-=parseInt(a.g/2,10);return c}h.draw=function(){if(this.s){var a=u(this,this.d);this.c.style.top=a.y+"px";this.c.style.left=a.x+"px"}};function s(a){if(a.c)a.c.style.display="none";a.s=false}h.show=function(){if(this.c){this.c.style.cssText=t(this,u(this,this.d));this.c.style.display=""}this.s=true};h.remove=function(){this.setMap(null)};
h.onRemove=function(){if(this.c&&this.c.parentNode){s(this);this.c.parentNode.removeChild(this.c);this.c=null}};h.setCenter=d("d");
function t(a,b){var c=[];document.all?c.push('filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale,src="'+a.J+'");'):c.push("background:url("+a.J+");");if(typeof a.e==="object"){typeof a.e[0]==="number"&&a.e[0]>0&&a.e[0]<a.g?c.push("height:"+(a.g-a.e[0])+"px; padding-top:"+a.e[0]+"px;"):c.push("height:"+a.g+"px; line-height:"+a.g+"px;");typeof a.e[1]==="number"&&a.e[1]>0&&a.e[1]<a.n?c.push("width:"+(a.n-a.e[1])+"px; padding-left:"+a.e[1]+"px;"):c.push("width:"+a.n+"px; text-align:center;")}else c.push("height:"+
a.g+"px; line-height:"+a.g+"px; width:"+a.n+"px; text-align:center;");c.push("cursor:pointer; top:"+b.y+"px; left:"+b.x+"px; color:"+(a.H?a.H:"black")+"; position:absolute; font-size:"+(a.I?a.I:11)+"px; font-family:Arial,sans-serif; font-weight:bold");return c.join("")}window.MarkerClusterer=i;i.prototype.addMarker=i.prototype.o;i.prototype.addMarkers=i.prototype.B;i.prototype.clearMarkers=i.prototype.N;i.prototype.getCalculator=i.prototype.D;i.prototype.getGridSize=i.prototype.u;
i.prototype.getMap=i.prototype.getMap;i.prototype.getMarkers=i.prototype.v;i.prototype.getMaxZoom=i.prototype.F;i.prototype.getStyles=i.prototype.w;i.prototype.getTotalClusters=i.prototype.P;i.prototype.getTotalMarkers=i.prototype.Q;i.prototype.redraw=i.prototype.j;i.prototype.removeMarker=i.prototype.U;i.prototype.resetViewport=i.prototype.m;i.prototype.setCalculator=i.prototype.V;i.prototype.setGridSize=i.prototype.W;i.prototype.onAdd=i.prototype.onAdd;i.prototype.draw=i.prototype.draw;
p.prototype.getCenter=p.prototype.getCenter;p.prototype.getSize=p.prototype.O;p.prototype.getMarkers=p.prototype.v;q.prototype.onAdd=q.prototype.onAdd;q.prototype.draw=q.prototype.draw;q.prototype.onRemove=q.prototype.onRemove;
})();


/*
 * Superfish v1.4.8 - jQuery menu widget
 * Copyright (c) 2008 Joel Birch
 *
 * Dual licensed under the MIT and GPL licenses:
 * 	http://www.opensource.org/licenses/mit-license.php
 * 	http://www.gnu.org/licenses/gpl.html
 *
 * CHANGELOG: http://users.tpg.com.au/j_birch/plugins/superfish/changelog.txt
 */

;(function($){
	$.fn.superfish = function(op){

		var sf = $.fn.superfish,
			c = sf.c,
			$arrow = $(['<span class="',c.arrowClass,'"> &#187;</span>'].join('')),
			over = function(){
				var $$ = $(this), menu = getMenu($$);
				clearTimeout(menu.sfTimer);
				$$.showSuperfishUl().siblings().hideSuperfishUl();
			},
			out = function(){
				var $$ = $(this), menu = getMenu($$), o = sf.op;
				clearTimeout(menu.sfTimer);
				menu.sfTimer=setTimeout(function(){
					o.retainPath=($.inArray($$[0],o.$path)>-1);
					$$.hideSuperfishUl();
					if (o.$path.length && $$.parents(['li.',o.hoverClass].join('')).length<1){over.call(o.$path);}
				},o.delay);
			},
			getMenu = function($menu){
				var menu = $menu.parents(['ul.',c.menuClass,':first'].join(''))[0];
				sf.op = sf.o[menu.serial];
				return menu;
			},
			addArrow = function($a){ $a.addClass(c.anchorClass).append($arrow.clone()); };

		return this.each(function() {
			var s = this.serial = sf.o.length;
			var o = $.extend({},sf.defaults,op);
			o.$path = $('li.'+o.pathClass,this).slice(0,o.pathLevels).each(function(){
				$(this).addClass([o.hoverClass,c.bcClass].join(' '))
					.filter('li:has(ul)').removeClass(o.pathClass);
			});
			sf.o[s] = sf.op = o;

			$('li:has(ul)',this)[($.fn.hoverIntent && !o.disableHI) ? 'hoverIntent' : 'hover'](over,out).each(function() {
				if (o.autoArrows) addArrow( $('>a:first-child',this) );
			})
			.not('.'+c.bcClass)
				.hideSuperfishUl();

			var $a = $('a',this);
			$a.each(function(i){
				var $li = $a.eq(i).parents('li');
				$a.eq(i).focus(function(){over.call($li);}).blur(function(){out.call($li);});
			});
			o.onInit.call(this);

		}).each(function() {
			var menuClasses = [c.menuClass];
			if (sf.op.dropShadows  && !($.browser.msie && $.browser.version < 7)) menuClasses.push(c.shadowClass);
			$(this).addClass(menuClasses.join(' '));
		});
	};

	var sf = $.fn.superfish;
	sf.o = [];
	sf.op = {};
	sf.IE7fix = function(){
		var o = sf.op;
		if ($.browser.msie && $.browser.version > 6 && o.dropShadows && o.animation.opacity!=undefined)
			this.toggleClass(sf.c.shadowClass+'-off');
		};
	sf.c = {
		bcClass     : 'sf-breadcrumb',
		menuClass   : 'sf-js-enabled',
		anchorClass : 'sf-with-ul',
		arrowClass  : 'sf-sub-indicator',
		shadowClass : 'sf-shadow'
	};
	sf.defaults = {
		hoverClass	: 'sfHover',
		pathClass	: 'overideThisToUse',
		pathLevels	: 1,
		delay		: 800,
		animation	: {opacity:'show'},
		speed		: 'normal',
		autoArrows	: true,
		dropShadows : true,
		disableHI	: false,		// true disables hoverIntent detection
		onInit		: function(){}, // callback functions
		onBeforeShow: function(){},
		onShow		: function(){},
		onHide		: function(){}
	};
	$.fn.extend({
		hideSuperfishUl : function(){
			var o = sf.op,
				not = (o.retainPath===true) ? o.$path : '';
			o.retainPath = false;
			var $ul = $(['li.',o.hoverClass].join(''),this).add(this).not(not).removeClass(o.hoverClass)
					.find('>ul').hide().css('visibility','hidden');
			o.onHide.call($ul);
			return this;
		},
		showSuperfishUl : function(){
			var o = sf.op,
				sh = sf.c.shadowClass+'-off',
				$ul = this.addClass(o.hoverClass)
					.find('>ul:hidden').css('visibility','visible');
			sf.IE7fix.call($ul);
			o.onBeforeShow.call($ul);
			$ul.animate(o.animation,o.speed,function(){ sf.IE7fix.call($ul); o.onShow.call($ul); });
			return this;
		}
	});

})(jQuery);


/* http://keith-wood.name/datepick.html
   Datepicker for jQuery 3.5.1.
   Written by Marc Grabanski (m@marcgrabanski.com) and
              Keith Wood (kbwood@virginbroadband.com.au).
   Dual licensed under the GPL (http://dev.jquery.com/browser/trunk/jquery/GPL-LICENSE.txt) and
   MIT (http://dev.jquery.com/browser/trunk/jquery/MIT-LICENSE.txt) licenses.
   Please attribute the authors if you use it. */
(function($){var bn='datepick';function Datepick(){this.debug=false;this._curInst=null;this._keyEvent=false;this._disabledInputs=[];this._datepickerShowing=false;this._inDialog=false;this.regional=[];this.regional['']={clearText:'Clear',clearStatus:'Erase the current date',closeText:'Close',closeStatus:'Close without change',prevText:'&#x3c;Prev',prevStatus:'Show the previous month',prevBigText:'&#x3c;&#x3c;',prevBigStatus:'Show the previous year',nextText:'Next&#x3e;',nextStatus:'Show the next month',nextBigText:'&#x3e;&#x3e;',nextBigStatus:'Show the next year',currentText:'Today',currentStatus:'Show the current month',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'],monthStatus:'Show a different month',yearStatus:'Show a different year',weekHeader:'Wk',weekStatus:'Week of the year',dayNames:['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],dayNamesShort:['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],dayNamesMin:['Su','Mo','Tu','We','Th','Fr','Sa'],dayStatus:'Set DD as first week day',dateStatus:'Select DD, M d',dateFormat:'mm/dd/yy',firstDay:0,initStatus:'Select a date',isRTL:false};this._defaults={showOn:'focus',showAnim:'show',showOptions:{},duration:'normal',buttonText:'...',buttonImage:'',buttonImageOnly:false,defaultDate:null,appendText:'',closeAtTop:true,mandatory:false,hideIfNoPrevNext:false,navigationAsDateFormat:false,showBigPrevNext:false,stepMonths:1,stepBigMonths:12,gotoCurrent:false,changeMonth:true,changeYear:true,showMonthAfterYear:false,yearRange:'-10:+10',changeFirstDay:false,showOtherMonths:false,selectOtherMonths:false,highlightWeek:false,showWeeks:false,calculateWeek:this.iso8601Week,shortYearCutoff:'+10',showStatus:false,statusForDate:this.dateStatus,minDate:null,maxDate:null,numberOfMonths:1,showCurrentAtPos:0,rangeSelect:false,rangeSeparator:' - ',beforeShow:null,beforeShowDay:null,onChangeMonthYear:null,onHover:null,onSelect:null,onClose:null,altField:'',altFormat:'',constrainInput:true};$.extend(this._defaults,this.regional['']);this.dpDiv=$('<div id="'+this._mainDivId+'" style="display: none;"></div>')}$.extend(Datepick.prototype,{markerClassName:'hasDatepick',_mainDivId:'datepick-div',_inlineClass:'datepick-inline',_appendClass:'datepick-append',_triggerClass:'datepick-trigger',_dialogClass:'datepick-dialog',_promptClass:'datepick-prompt',_disableClass:'datepick-disabled',_oneMonthClass:'datepick-one-month',_unselectableClass:'datepick-unselectable',_currentClass:'datepick-current-day',_dayOverClass:'datepick-days-cell-over',_weekOverClass:'datepick-week-over',_coverClass:'datepick-cover',setDefaults:function(a){extendRemove(this._defaults,a||{});return this},_attachDatepick:function(a,b){var c=null;for(var d in this._defaults){var e=a.getAttribute('date:'+d);if(e){c=c||{};try{c[d]=eval(e)}catch(err){c[d]=e}}}var f=a.nodeName.toLowerCase();var g=(f=='div'||f=='span');if(!a.id)a.id='dp'+(++this.uuid);var h=this._newInst($(a),g);h.settings=$.extend({},b||{},c||{});if(f=='input'){this._connectDatepick(a,h)}else if(g){this._inlineDatepick(a,h)}},_newInst:function(a,b){var c=a[0].id.replace(/([:\[\]\.])/g,'\\\\$1');return{id:c,input:a,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:b,dpDiv:(!b?this.dpDiv:$('<div class="'+this._inlineClass+'"></div>'))}},_connectDatepick:function(d,e){var f=$(d);if(f.hasClass(this.markerClassName))return;var g=this._get(e,'appendText');var h=this._get(e,'isRTL');if(g)f[h?'before':'after']('<span class="'+this._appendClass+'">'+g+'</span>');var i=this._get(e,'showOn');if(i=='focus'||i=='both')f.focus(this._showDatepick);if(i=='button'||i=='both'){var j=this._get(e,'buttonText');var k=this._get(e,'buttonImage');var l=$(this._get(e,'buttonImageOnly')?$('<img/>').addClass(this._triggerClass).attr({src:k,alt:j,title:j}):$('<button type="button"></button>').addClass(this._triggerClass).html(k==''?j:$('<img/>').attr({src:k,alt:j,title:j})));f[h?'before':'after'](l);l.click(function(){if($.datepick._datepickerShowing&&$.datepick._lastInput==d)$.datepick._hideDatepick();else $.datepick._showDatepick(d);return false})}f.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).bind("setData.datepick",function(a,b,c){e.settings[b]=c}).bind("getData.datepick",function(a,b){return this._get(e,b)});$.data(d,bn,e)},_inlineDatepick:function(d,e){var f=$(d);if(f.hasClass(this.markerClassName))return;f.addClass(this.markerClassName).bind("setData.datepick",function(a,b,c){e.settings[b]=c}).bind("getData.datepick",function(a,b){return this._get(e,b)});$.data(d,bn,e);this._setDate(e,this._getDefaultDate(e));$('body').append(e.dpDiv);this._updateDatepick(e);e.dpDiv.width(this._getNumberOfMonths(e)[1]*$('.'+this._oneMonthClass,e.dpDiv)[0].offsetWidth);f.append(e.dpDiv);this._updateAlternate(e)},_dialogDatepick:function(a,b,c,d,e){var f=this._dialogInst;if(!f){var g='dp'+(++this.uuid);this._dialogInput=$('<input type="text" id="'+g+'" size="1" style="position: absolute; top: -100px;"/>');this._dialogInput.keydown(this._doKeyDown);$('body').append(this._dialogInput);f=this._dialogInst=this._newInst(this._dialogInput,false);f.settings={};$.data(this._dialogInput[0],bn,f)}extendRemove(f.settings,d||{});this._dialogInput.val(b);this._pos=(e?(isArray(e)?e:[e.pageX,e.pageY]):null);if(!this._pos){var h=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth;var i=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;var j=document.documentElement.scrollLeft||document.body.scrollLeft;var k=document.documentElement.scrollTop||document.body.scrollTop;this._pos=[(h/2)-100+j,(i/2)-150+k]}this._dialogInput.css('left',this._pos[0]+'px').css('top',this._pos[1]+'px');f.settings.onSelect=c;this._inDialog=true;this.dpDiv.addClass(this._dialogClass);this._showDatepick(this._dialogInput[0]);if($.blockUI)$.blockUI(this.dpDiv);$.data(this._dialogInput[0],bn,f)},_destroyDatepick:function(a){var b=$(a);if(!b.hasClass(this.markerClassName)){return}var c=a.nodeName.toLowerCase();$.removeData(a,bn);if(c=='input'){b.siblings('.'+this._appendClass).remove().end().siblings('.'+this._triggerClass).remove().end().removeClass(this.markerClassName).unbind('focus',this._showDatepick).unbind('keydown',this._doKeyDown).unbind('keypress',this._doKeyPress)}else if(c=='div'||c=='span')b.removeClass(this.markerClassName).empty()},_enableDatepick:function(b){var c=$(b);if(!c.hasClass(this.markerClassName)){return}var d=b.nodeName.toLowerCase();if(d=='input'){b.disabled=false;c.siblings('button.'+this._triggerClass).each(function(){this.disabled=false}).end().siblings('img.'+this._triggerClass).css({opacity:'1.0',cursor:''})}else if(d=='div'||d=='span'){c.children('.'+this._disableClass).remove()}this._disabledInputs=$.map(this._disabledInputs,function(a){return(a==b?null:a)})},_disableDatepick:function(b){var c=$(b);if(!c.hasClass(this.markerClassName)){return}var d=b.nodeName.toLowerCase();if(d=='input'){b.disabled=true;c.siblings('button.'+this._triggerClass).each(function(){this.disabled=true}).end().siblings('img.'+this._triggerClass).css({opacity:'0.5',cursor:'default'})}else if(d=='div'||d=='span'){var e=c.children('.'+this._inlineClass);var f=e.offset();var g={left:0,top:0};e.parents().each(function(){if($(this).css('position')=='relative'){g=$(this).offset();return false}});c.prepend('<div class="'+this._disableClass+'" style="'+'width: '+e.width()+'px; height: '+e.height()+'px; left: '+(f.left-g.left)+'px; top: '+(f.top-g.top)+'px;"></div>')}this._disabledInputs=$.map(this._disabledInputs,function(a){return(a==b?null:a)});this._disabledInputs.push(b)},_isDisabledDatepick:function(a){return(!a?false:$.inArray(a,this._disabledInputs)>-1)},_getInst:function(a){try{return $.data(a,bn)}catch(err){throw'Missing instance data for this datepicker';}},_optionDatepick:function(a,b,c){var d=b||{};if(typeof b=='string'){d={};d[b]=c}var e=this._getInst(a);if(e){if(this._curInst==e){this._hideDatepick(null)}extendRemove(e.settings,d);var f=new Date();extendRemove(e,{rangeStart:null,endDay:null,endMonth:null,endYear:null,selectedDay:f.getDate(),selectedMonth:f.getMonth(),selectedYear:f.getFullYear(),currentDay:f.getDate(),currentMonth:f.getMonth(),currentYear:f.getFullYear(),drawMonth:f.getMonth(),drawYear:f.getFullYear()});this._updateDatepick(e)}},_changeDatepick:function(a,b,c){this._optionDatepick(a,b,c)},_refreshDatepick:function(a){var b=this._getInst(a);if(b){this._updateDatepick(b)}},_setDateDatepick:function(a,b,c){var d=this._getInst(a);if(d){this._setDate(d,b,c);this._updateDatepick(d);this._updateAlternate(d)}},_getDateDatepick:function(a){var b=this._getInst(a);if(b&&!b.inline)this._setDateFromField(b);return(b?this._getDate(b):null)},_doKeyDown:function(a){var b=$.datepick._getInst(a.target);var c=true;var d=$.datepick._get(b,'isRTL');b._keyEvent=true;if($.datepick._datepickerShowing)switch(a.keyCode){case 9:$.datepick._hideDatepick(null,'');break;case 13:var e=$('td.'+$.datepick._dayOverClass+', td.'+$.datepick._currentClass,b.dpDiv);if(e[0])$.datepick._selectDay(a.target,b.selectedYear,b.selectedMonth,e[0]);else $.datepick._hideDatepick(null,$.datepick._get(b,'duration'));break;case 27:$.datepick._hideDatepick(null,$.datepick._get(b,'duration'));break;case 33:$.datepick._adjustDate(a.target,(a.ctrlKey?-$.datepick._get(b,'stepBigMonths'):-$.datepick._get(b,'stepMonths')),'M');break;case 34:$.datepick._adjustDate(a.target,(a.ctrlKey?+$.datepick._get(b,'stepBigMonths'):+$.datepick._get(b,'stepMonths')),'M');break;case 35:if(a.ctrlKey||a.metaKey)$.datepick._clearDate(a.target);c=a.ctrlKey||a.metaKey;break;case 36:if(a.ctrlKey||a.metaKey)$.datepick._gotoToday(a.target);c=a.ctrlKey||a.metaKey;break;case 37:if(a.ctrlKey||a.metaKey)$.datepick._adjustDate(a.target,(d?+1:-1),'D');c=a.ctrlKey||a.metaKey;if(a.originalEvent.altKey)$.datepick._adjustDate(a.target,(a.ctrlKey?-$.datepick._get(b,'stepBigMonths'):-$.datepick._get(b,'stepMonths')),'M');break;case 38:if(a.ctrlKey||a.metaKey)$.datepick._adjustDate(a.target,-7,'D');c=a.ctrlKey||a.metaKey;break;case 39:if(a.ctrlKey||a.metaKey)$.datepick._adjustDate(a.target,(d?-1:+1),'D');c=a.ctrlKey||a.metaKey;if(a.originalEvent.altKey)$.datepick._adjustDate(a.target,(a.ctrlKey?+$.datepick._get(b,'stepBigMonths'):+$.datepick._get(b,'stepMonths')),'M');break;case 40:if(a.ctrlKey||a.metaKey)$.datepick._adjustDate(a.target,+7,'D');c=a.ctrlKey||a.metaKey;break;default:c=false}else if(a.keyCode==36&&a.ctrlKey)$.datepick._showDatepick(this);else c=false;if(c){a.preventDefault();a.stopPropagation()}return!c},_doKeyPress:function(a){var b=$.datepick._getInst(a.target);if($.datepick._get(b,'constrainInput')){var c=$.datepick._possibleChars(b);var d=String.fromCharCode(a.charCode==undefined?a.keyCode:a.charCode);return a.ctrlKey||(d<' '||!c||c.indexOf(d)>-1)}},_possibleChars:function(a){var b=$.datepick._get(a,'dateFormat');var c=($.datepick._get(a,'rangeSelect')?$.datepick._get(a,'rangeSeparator'):'');var d=false;for(var e=0;e<b.length;e++)if(d)if(b.charAt(e)=="'"&&!lookAhead("'"))d=false;else c+=b.charAt(e);else switch(b.charAt(e)){case'd':case'm':case'y':case'@':c+='0123456789';break;case'D':case'M':return null;case"'":if(lookAhead("'"))c+="'";else d=true;break;default:c+=b.charAt(e)}return c},_showDatepick:function(b){b=b.target||b;if(b.nodeName.toLowerCase()!='input')b=$('input',b.parentNode)[0];if($.datepick._isDisabledDatepick(b)||$.datepick._lastInput==b)return;var c=$.datepick._getInst(b);var d=$.datepick._get(c,'beforeShow');extendRemove(c.settings,(d?d.apply(b,[b,c]):{}));$.datepick._hideDatepick(null,'');$.datepick._lastInput=b;$.datepick._setDateFromField(c);if($.datepick._inDialog)b.value='';if(!$.datepick._pos){$.datepick._pos=$.datepick._findPos(b);$.datepick._pos[1]+=b.offsetHeight}var e=false;$(b).parents().each(function(){e|=$(this).css('position')=='fixed';return!e});if(e&&$.browser.opera){$.datepick._pos[0]-=document.documentElement.scrollLeft;$.datepick._pos[1]-=document.documentElement.scrollTop}var f={left:$.datepick._pos[0],top:$.datepick._pos[1]};$.datepick._pos=null;c.rangeStart=null;c.dpDiv.css({position:'absolute',display:'block',top:'-1000px'});$.datepick._updateDatepick(c);c.dpDiv.width($.datepick._getNumberOfMonths(c)[1]*$('.'+$.datepick._oneMonthClass,c.dpDiv)[0].offsetWidth);f=$.datepick._checkOffset(c,f,e);c.dpDiv.css({position:($.datepick._inDialog&&$.blockUI?'static':(e?'fixed':'absolute')),display:'none',left:f.left+'px',top:f.top+'px'});if(!c.inline){var g=$.datepick._get(c,'showAnim')||'show';var h=$.datepick._get(c,'duration');var i=function(){$.datepick._datepickerShowing=true;if($.browser.msie&&parseInt($.browser.version,10)<7){var a=$.datepick._getExtras(c.dpDiv);$('iframe.'+$.datepick._coverClass).css({width:c.dpDiv.width()+a[0],height:c.dpDiv.height()+a[1]})}};if($.effects&&$.effects[g])c.dpDiv.show(g,$.datepick._get(c,'showOptions'),h,i);else c.dpDiv[g](h,i);if(h=='')i();if(c.input[0].type!='hidden')c.input[0].focus();$.datepick._curInst=c}},_updateDatepick:function(a){var b=this._getExtras(a.dpDiv);var c={width:a.dpDiv.width()+b[0],height:a.dpDiv.height()+b[1]};a.dpDiv.empty().append(this._generateHTML(a)).find('iframe.'+this._coverClass).css({width:c.width,height:c.height});var d=this._getNumberOfMonths(a);a.dpDiv[(d[0]!=1||d[1]!=1?'add':'remove')+'Class']('datepick-multi');a.dpDiv[(this._get(a,'isRTL')?'add':'remove')+'Class']('datepick-rtl');if(a.input&&a.input[0].type!='hidden'&&a==$.datepick._curInst)$(a.input[0]).focus()},_getExtras:function(b){var c=function(a){return{thin:1,medium:2,thick:3}[a]||a};return[parseInt(c(b.css('border-left-width')))+parseInt(c(b.css('border-right-width')))+parseInt(b.css('padding-left'))+parseInt(b.css('padding-right')),parseInt(c(b.css('border-top-width')))+parseInt(c(b.css('border-bottom-width')))+parseInt(b.css('padding-top'))+parseInt(b.css('padding-bottom'))]},_checkOffset:function(a,b,c){var d=a.input?this._findPos(a.input[0]):null;var e=window.innerWidth||(document.documentElement?document.documentElement.clientWidth:document.body.clientWidth);var f=window.innerHeight||(document.documentElement?document.documentElement.clientHeight:document.body.clientHeight);if(e==0)return b;var g=document.documentElement.scrollLeft||document.body.scrollLeft;var h=document.documentElement.scrollTop||document.body.scrollTop;if(this._get(a,'isRTL')||(b.left+a.dpDiv.width()-g)>e)b.left=Math.max((c?0:g),d[0]+(a.input?a.input.width():0)-(c?g:0)-a.dpDiv.width()-(c&&$.browser.opera?document.documentElement.scrollLeft:0));else b.left-=(c?g:0);if((b.top+a.dpDiv.height()-h)>f)b.top=Math.max((c?0:h),d[1]-(c?h:0)-(this._inDialog?0:a.dpDiv.height())-(c&&$.browser.opera?document.documentElement.scrollTop:0));else b.top-=(c?h:0);return b},_findPos:function(a){while(a&&(a.type=='hidden'||a.nodeType!=1)){a=a.nextSibling}var b=$(a).offset();return[b.left,b.top]},_hideDatepick:function(a,b){var c=this._curInst;if(!c||(a&&c!=$.data(a,bn)))return;var d=this._get(c,'rangeSelect');if(d&&c.stayOpen)this._selectDate('#'+c.id,this._formatDate(c,c.currentDay,c.currentMonth,c.currentYear));c.stayOpen=false;if(this._datepickerShowing){b=(b!=null?b:this._get(c,'duration'));var e=this._get(c,'showAnim');var f=function(){$.datepick._tidyDialog(c)};if(b!=''&&$.effects&&$.effects[e])c.dpDiv.hide(e,$.datepick._get(c,'showOptions'),b,f);else c.dpDiv[(b==''?'hide':(e=='slideDown'?'slideUp':(e=='fadeIn'?'fadeOut':'hide')))](b,f);if(b=='')this._tidyDialog(c);var g=this._get(c,'onClose');if(g)g.apply((c.input?c.input[0]:null),[(c.input?c.input.val():''),c]);this._datepickerShowing=false;this._lastInput=null;c.settings.prompt=null;if(this._inDialog){this._dialogInput.css({position:'absolute',left:'0',top:'-100px'});if($.blockUI){$.unblockUI();$('body').append(this.dpDiv)}}this._inDialog=false}this._curInst=null},_tidyDialog:function(a){a.dpDiv.removeClass(this._dialogClass).unbind('.datepick');$('.'+this._promptClass,a.dpDiv).remove()},_checkExternalClick:function(a){if(!$.datepick._curInst)return;var b=$(a.target);if(!b.parents().andSelf().is('#'+$.datepick._mainDivId)&&!b.hasClass($.datepick.markerClassName)&&!b.parents().andSelf().hasClass($.datepick._triggerClass)&&$.datepick._datepickerShowing&&!($.datepick._inDialog&&$.blockUI))$.datepick._hideDatepick(null,'')},_adjustDate:function(a,b,c){var d=this._getInst($(a)[0]);this._adjustInstDate(d,b+(c=='M'?this._get(d,'showCurrentAtPos'):0),c);this._updateDatepick(d)},_gotoToday:function(a){var b=$(a);var c=this._getInst(b[0]);if(this._get(c,'gotoCurrent')&&c.currentDay){c.selectedDay=c.currentDay;c.drawMonth=c.selectedMonth=c.currentMonth;c.drawYear=c.selectedYear=c.currentYear}else{var d=new Date();c.selectedDay=d.getDate();c.drawMonth=c.selectedMonth=d.getMonth();c.drawYear=c.selectedYear=d.getFullYear()}this._notifyChange(c);this._adjustDate(b)},_selectMonthYear:function(a,b,c){var d=$(a);var e=this._getInst(d[0]);e._selectingMonthYear=false;e['selected'+(c=='M'?'Month':'Year')]=e['draw'+(c=='M'?'Month':'Year')]=parseInt(b.options[b.selectedIndex].value,10);this._notifyChange(e);this._adjustDate(d)},_clickMonthYear:function(a){var b=this._getInst($(a)[0]);if(b.input&&b._selectingMonthYear&&!$.browser.msie)b.input[0].focus();b._selectingMonthYear=!b._selectingMonthYear},_changeFirstDay:function(a,b){var c=this._getInst($(a)[0]);c.settings.firstDay=b;this._updateDatepick(c)},_doHover:function(a,b,c,d){if($(d).hasClass(this._unselectableClass))return;var e=this._getInst($(a)[0]);var f=this._get(e,'onHover');f.apply((e.input?e.input[0]:null),[(b?new Date(b,c,$(d).text()):null),e])},_selectDay:function(a,b,c,d){if($(d).hasClass(this._unselectableClass))return;var e=this._getInst($(a)[0]);var f=this._get(e,'rangeSelect');if(f){e.stayOpen=!e.stayOpen;if(e.stayOpen){$('.datepick td',e.dpDiv).removeClass(this._currentClass);$(d).addClass(this._currentClass)}}e.selectedDay=e.currentDay=$('a',d).html();e.selectedMonth=e.currentMonth=c;e.selectedYear=e.currentYear=b;if(e.stayOpen){e.endDay=e.endMonth=e.endYear=null}else if(f){e.endDay=e.currentDay;e.endMonth=e.currentMonth;e.endYear=e.currentYear}this._selectDate(a,this._formatDate(e,e.currentDay,e.currentMonth,e.currentYear));if(e.stayOpen){e.rangeStart=this._daylightSavingAdjust(new Date(e.currentYear,e.currentMonth,e.currentDay));this._updateDatepick(e)}else if(f){e.selectedDay=e.currentDay=e.rangeStart.getDate();e.selectedMonth=e.currentMonth=e.rangeStart.getMonth();e.selectedYear=e.currentYear=e.rangeStart.getFullYear();e.rangeStart=null;if(e.inline)this._updateDatepick(e)}},_clearDate:function(a){var b=$(a);var c=this._getInst(b[0]);if(this._get(c,'mandatory'))return;c.stayOpen=false;c.endDay=c.endMonth=c.endYear=c.rangeStart=null;this._selectDate(b,'')},_selectDate:function(a,b){var c=this._getInst($(a)[0]);b=(b!=null?b:this._formatDate(c));if(this._get(c,'rangeSelect')&&b)b=(c.rangeStart?this._formatDate(c,c.rangeStart):b)+this._get(c,'rangeSeparator')+b;if(c.input)c.input.val(b);this._updateAlternate(c);var d=this._get(c,'onSelect');if(d)d.apply((c.input?c.input[0]:null),[b,c]);else if(c.input)c.input.trigger('change');if(c.inline)this._updateDatepick(c);else if(!c.stayOpen){this._hideDatepick(null,this._get(c,'duration'));this._lastInput=c.input[0];if(typeof(c.input[0])!='object')c.input[0].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');var d=this._getDate(a);dateStr=(isArray(d)?(!d[0]&&!d[1]?'':this.formatDate(c,d[0],this._getFormatConfig(a))+this._get(a,'rangeSeparator')+this.formatDate(c,d[1]||d[0],this._getFormatConfig(a))):this.formatDate(c,d,this._getFormatConfig(a)));$(b).each(function(){$(this).val(dateStr)})}},noWeekends:function(a){return[(a.getDay()||7)<6,'']},iso8601Week:function(a){var b=new Date(a.getTime());b.setDate(b.getDate()+4-(b.getDay()||7));var c=b.getTime();b.setMonth(0);b.setDate(1);return Math.floor((c-b)/(86400000*7))+1},dateStatus:function(a,b){return $.datepick.formatDate($.datepick._get(b,'dateStatus'),a,$.datepick._getFormatConfig(b))},parseDate:function(e,f,g){if(e==null||f==null)throw'Invalid arguments';f=(typeof f=='object'?f.toString():f+'');if(f=='')return null;g=g||{};var h=g.shortYearCutoff||this._defaults.shortYearCutoff;var j=g.dayNamesShort||this._defaults.dayNamesShort;var k=g.dayNames||this._defaults.dayNames;var l=g.monthNamesShort||this._defaults.monthNamesShort;var m=g.monthNames||this._defaults.monthNames;var n=-1;var o=-1;var p=-1;var q=-1;var r=false;var s=function(a){var b=(x+1<e.length&&e.charAt(x+1)==a);if(b)x++;return b};var t=function(a){s(a);var b=(a=='@'?14:(a=='y'?4:(a=='o'?3:2)));var c=new RegExp('^\\d{1,'+b+'}');var d=f.substring(w).match(c);if(!d)throw'Missing number at position '+w;w+=d[0].length;return parseInt(d[0],10)};var u=function(a,b,c){var d=(s(a)?c:b);for(var i=0;i<d.length;i++){if(f.substr(w,d[i].length)==d[i]){w+=d[i].length;return i+1}}throw'Unknown name at position '+w;};var v=function(){if(f.charAt(w)!=e.charAt(x))throw'Unexpected literal at position '+w;w++};var w=0;for(var x=0;x<e.length;x++){if(r)if(e.charAt(x)=="'"&&!s("'"))r=false;else v();else switch(e.charAt(x)){case'd':p=t('d');break;case'D':u('D',j,k);break;case'o':q=t('o');break;case'm':o=t('m');break;case'M':o=u('M',l,m);break;case'y':n=t('y');break;case'@':var y=new Date(t('@'));n=y.getFullYear();o=y.getMonth()+1;p=y.getDate();break;case"'":if(s("'"))v();else r=true;break;default:v()}}if(w<f.length)throw'Additional text found at end';if(n==-1)n=new Date().getFullYear();else if(n<100)n+=new Date().getFullYear()-new Date().getFullYear()%100+(n<=h?0:-100);if(q>-1){o=1;p=q;do{var z=this._getDaysInMonth(n,o-1);if(p<=z)break;o++;p-=z}while(true)}var y=this._daylightSavingAdjust(new Date(n,o-1,p));if(y.getFullYear()!=n||y.getMonth()+1!=o||y.getDate()!=p)throw'Invalid date';return y},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',TIMESTAMP:'@',W3C:'yy-mm-dd',formatDate:function(e,f,g){if(!f)return'';var h=(g?g.dayNamesShort:null)||this._defaults.dayNamesShort;var i=(g?g.dayNames:null)||this._defaults.dayNames;var j=(g?g.monthNamesShort:null)||this._defaults.monthNamesShort;var k=(g?g.monthNames:null)||this._defaults.monthNames;var l=function(a){var b=(q+1<e.length&&e.charAt(q+1)==a);if(b)q++;return b};var m=function(a,b,c){var d=''+b;if(l(a))while(d.length<c)d='0'+d;return d};var n=function(a,b,c,d){return(l(a)?d[b]:c[b])};var o='';var p=false;if(f)for(var q=0;q<e.length;q++){if(p)if(e.charAt(q)=="'"&&!l("'"))p=false;else o+=e.charAt(q);else switch(e.charAt(q)){case'd':o+=m('d',f.getDate(),2);break;case'D':o+=n('D',f.getDay(),h,i);break;case'o':o+=m('o',(f.getTime()-new Date(f.getFullYear(),0,0).getTime())/86400000,3);break;case'm':o+=m('m',f.getMonth()+1,2);break;case'M':o+=n('M',f.getMonth(),j,k);break;case'y':o+=(l('y')?f.getFullYear():(f.getYear()%100<10?'0':'')+f.getYear()%100);break;case'@':o+=f.getTime();break;case"'":if(l("'"))o+="'";else p=true;break;default:o+=e.charAt(q)}}return o},_get:function(a,b){return a.settings[b]!==undefined?a.settings[b]:this._defaults[b]},_setDateFromField:function(a){var b=this._get(a,'dateFormat');var c=a.input?a.input.val().split(this._get(a,'rangeSeparator')):null;a.endDay=a.endMonth=a.endYear=null;var d=defaultDate=this._getDefaultDate(a);if(isArray(c)){var e=this._getFormatConfig(a);if(c.length>1){d=this.parseDate(b,c[1],e)||defaultDate;a.endDay=d.getDate();a.endMonth=d.getMonth();a.endYear=d.getFullYear()}try{d=this.parseDate(b,c[0],e)||defaultDate}catch(event){d=defaultDate}}a.selectedDay=d.getDate();a.drawMonth=a.selectedMonth=d.getMonth();a.drawYear=a.selectedYear=d.getFullYear();a.currentDay=(c[0]?d.getDate():0);a.currentMonth=(c[0]?d.getMonth():0);a.currentYear=(c[0]?d.getFullYear():0);this._adjustInstDate(a)},_getDefaultDate:function(a){var b=this._determineDate(this._get(a,'defaultDate'),new Date());var c=this._getMinMaxDate(a,'min',true);var d=this._getMinMaxDate(a,'max');b=(c&&b<c?c:b);b=(d&&b>d?d:b);return b},_determineDate:function(i,j){var k=function(a){var b=new Date();b.setDate(b.getDate()+a);return b};var l=function(a,b){var c=new Date();var d=c.getFullYear();var e=c.getMonth();var f=c.getDate();var g=/([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g;var h=g.exec(a);while(h){switch(h[2]||'d'){case'd':case'D':f+=parseInt(h[1],10);break;case'w':case'W':f+=parseInt(h[1],10)*7;break;case'm':case'M':e+=parseInt(h[1],10);f=Math.min(f,b(d,e));break;case'y':case'Y':d+=parseInt(h[1],10);f=Math.min(f,b(d,e));break}h=g.exec(a)}return new Date(d,e,f)};i=(i==null?j:(typeof i=='string'?l(i,this._getDaysInMonth):(typeof i=='number'?(isNaN(i)?j:k(i)):i)));i=(i&&i.toString()=='Invalid Date'?j:i);if(i){i.setHours(0);i.setMinutes(0);i.setSeconds(0);i.setMilliseconds(0)}return this._daylightSavingAdjust(i)},_daylightSavingAdjust:function(a){if(!a)return null;a.setHours(a.getHours()>12?a.getHours()+2:0);return a},_setDate:function(a,b,c){var d=!(b);var e=a.selectedMonth;var f=a.selectedYear;b=this._determineDate(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(this._get(a,'rangeSelect')){if(c){c=this._determineDate(c,null);a.endDay=c.getDate();a.endMonth=c.getMonth();a.endYear=c.getFullYear()}else{a.endDay=a.currentDay;a.endMonth=a.currentMonth;a.endYear=a.currentYear}}if(e!=a.selectedMonth||f!=a.selectedYear)this._notifyChange(a);this._adjustInstDate(a);if(a.input)a.input.val(d?'':this._formatDate(a)+(!this._get(a,'rangeSelect')?'':this._get(a,'rangeSeparator')+this._formatDate(a,a.endDay,a.endMonth,a.endYear)))},_getDate:function(a){var b=(!a.currentYear||(a.input&&a.input.val()=='')?null:this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay)));if(this._get(a,'rangeSelect')){return[a.rangeStart||b,(!a.endYear?a.rangeStart||b:this._daylightSavingAdjust(new Date(a.endYear,a.endMonth,a.endDay)))]}else return b},_generateHTML:function(a){var b=new Date();b=this._daylightSavingAdjust(new Date(b.getFullYear(),b.getMonth(),b.getDate()));var c=this._get(a,'showStatus');var d=this._get(a,'initStatus')||'&#xa0;';var e=this._get(a,'isRTL');var f=(this._get(a,'mandatory')?'':'<div class="datepick-clear"><a onclick="jQuery.datepick._clearDate(\'#'+a.id+'\');"'+this._addStatus(c,a.id,this._get(a,'clearStatus'),d)+'>'+this._get(a,'clearText')+'</a></div>');var g='<div class="datepick-control">'+(e?'':f)+'<div class="datepick-close"><a onclick="jQuery.datepick._hideDatepick();"'+this._addStatus(c,a.id,this._get(a,'closeStatus'),d)+'>'+this._get(a,'closeText')+'</a></div>'+(e?f:'')+'</div>';var h=this._get(a,'prompt');var i=this._get(a,'closeAtTop');var j=this._get(a,'hideIfNoPrevNext');var k=this._get(a,'navigationAsDateFormat');var l=this._get(a,'showBigPrevNext');var m=this._getNumberOfMonths(a);var n=this._get(a,'showCurrentAtPos');var o=this._get(a,'stepMonths');var p=this._get(a,'stepBigMonths');var q=(m[0]!=1||m[1]!=1);var r=this._daylightSavingAdjust((!a.currentDay?new Date(9999,9,9):new Date(a.currentYear,a.currentMonth,a.currentDay)));var s=this._getMinMaxDate(a,'min',true);var t=this._getMinMaxDate(a,'max');var u=a.drawMonth-n;var v=a.drawYear;if(u<0){u+=12;v--}if(t){var w=this._daylightSavingAdjust(new Date(t.getFullYear(),t.getMonth()-m[1]+1,t.getDate()));w=(s&&w<s?s:w);while(this._daylightSavingAdjust(new Date(v,u,1))>w){u--;if(u<0){u=11;v--}}}a.drawMonth=u;a.drawYear=v;var x=this._get(a,'prevText');x=(!k?x:this.formatDate(x,this._daylightSavingAdjust(new Date(v,u-o,1)),this._getFormatConfig(a)));var y=(l?this._get(a,'prevBigText'):'');y=(!k?y:this.formatDate(y,this._daylightSavingAdjust(new Date(v,u-p,1)),this._getFormatConfig(a)));var z='<div class="datepick-prev">'+(this._canAdjustMonth(a,-1,v,u)?(l?'<a onclick="jQuery.datepick._adjustDate(\'#'+a.id+'\', -'+p+', \'M\');"'+this._addStatus(c,a.id,this._get(a,'prevBigStatus'),d)+'>'+y+'</a>':'')+'<a onclick="jQuery.datepick._adjustDate(\'#'+a.id+'\', -'+o+', \'M\');"'+this._addStatus(c,a.id,this._get(a,'prevStatus'),d)+'>'+x+'</a>':(j?'&#xa0;':(l?'<label>'+y+'</label>':'')+'<label>'+x+'</label>'))+'</div>';var A=this._get(a,'nextText');A=(!k?A:this.formatDate(A,this._daylightSavingAdjust(new Date(v,u+o,1)),this._getFormatConfig(a)));var B=(l?this._get(a,'nextBigText'):'');B=(!k?B:this.formatDate(B,this._daylightSavingAdjust(new Date(v,u+p,1)),this._getFormatConfig(a)));var C='<div class="datepick-next">'+(this._canAdjustMonth(a,+1,v,u)?'<a onclick="jQuery.datepick._adjustDate(\'#'+a.id+'\', +'+o+', \'M\');"'+this._addStatus(c,a.id,this._get(a,'nextStatus'),d)+'>'+A+'</a>'+(l?'<a onclick="jQuery.datepick._adjustDate(\'#'+a.id+'\', +'+p+', \'M\');"'+this._addStatus(c,a.id,this._get(a,'nextBigStatus'),d)+'>'+B+'</a>':''):(j?'&#xa0;':'<label>'+A+'</label>'+(l?'<label>'+B+'</label>':'')))+'</div>';var D=this._get(a,'currentText');var E=(this._get(a,'gotoCurrent')&&a.currentDay?r:b);D=(!k?D:this.formatDate(D,E,this._getFormatConfig(a)));var F=(i&&!a.inline?g:'')+'<div class="datepick-links">'+(e?C:z)+(this._isInRange(a,E)?'<div class="datepick-current">'+'<a onclick="jQuery.datepick._gotoToday(\'#'+a.id+'\');"'+this._addStatus(c,a.id,this._get(a,'currentStatus'),d)+'>'+D+'</a></div>':'')+(e?z:C)+'</div>'+(h?'<div class="'+this._promptClass+'"><span>'+h+'</span></div>':'');var G=parseInt(this._get(a,'firstDay'));G=(isNaN(G)?0:G);var H=this._get(a,'changeFirstDay');var I=this._get(a,'dayNames');var J=this._get(a,'dayNamesShort');var K=this._get(a,'dayNamesMin');var L=this._get(a,'monthNames');var M=this._get(a,'beforeShowDay');var N=this._get(a,'highlightWeek');var O=this._get(a,'showOtherMonths');var P=this._get(a,'selectOtherMonths');var Q=this._get(a,'showWeeks');var R=this._get(a,'calculateWeek')||this.iso8601Week;var S=this._get(a,'weekStatus');var T=(c?this._get(a,'dayStatus')||d:'');var U=this._get(a,'statusForDate')||this.dateStatus;var V=this._get(a,'onHover');var W=a.endDay?this._daylightSavingAdjust(new Date(a.endYear,a.endMonth,a.endDay)):r;var X=this._getDefaultDate(a);for(var Y=0;Y<m[0];Y++)for(var Z=0;Z<m[1];Z++){var bo=this._daylightSavingAdjust(new Date(v,u,a.selectedDay));F+='<div class="'+this._oneMonthClass+(Z==0?' datepick-new-row':'')+'">'+this._generateMonthYearHeader(a,u,v,s,t,bo,Y>0||Z>0,c,d,L)+'<table class="datepick" cellpadding="0" cellspacing="0"><thead>'+'<tr class="datepick-title-row">'+(Q?'<th'+this._addStatus(c,a.id,S,d)+'>'+this._get(a,'weekHeader')+'</th>':'');for(var bp=0;bp<7;bp++){var bq=(bp+G)%7;var br=(T.indexOf('DD')>-1?T.replace(/DD/,I[bq]):T.replace(/D/,J[bq]));F+='<th'+((bp+G+6)%7>=5?' class="datepick-week-end-cell"':'')+'>'+(!H?'<span'+this._addStatus(c,a.id,I[bq],d):'<a onclick="jQuery.datepick._changeFirstDay(\'#'+a.id+'\', '+bq+');"'+this._addStatus(c,a.id,br,d))+' title="'+I[bq]+'">'+K[bq]+(H?'</a>':'</span>')+'</th>'}F+='</tr></thead><tbody>';var bs=this._getDaysInMonth(v,u);if(v==a.selectedYear&&u==a.selectedMonth)a.selectedDay=Math.min(a.selectedDay,bs);var bt=(this._getFirstDayOfMonth(v,u)-G+7)%7;var bu=(q?6:Math.ceil((bt+bs)/7));var bv=this._daylightSavingAdjust(new Date(v,u,1-bt));for(var bw=0;bw<bu;bw++){F+='<tr class="datepick-days-row">'+(Q?'<td class="datepick-week-col"'+this._addStatus(c,a.id,S,d)+'>'+R(bv)+'</td>':'');for(var bp=0;bp<7;bp++){var bx=(M?M.apply((a.input?a.input[0]:null),[bv]):[true,'']);var by=(bv.getMonth()!=u);var bz=(by&&!P)||!bx[0]||(s&&bv<s)||(t&&bv>t);var bA=by&&!O;F+='<td class="datepick-days-cell'+((bp+G+6)%7>=5?' datepick-week-end-cell':'')+(by?' datepick-other-month':'')+((bv.getTime()==bo.getTime()&&u==a.selectedMonth&&a._keyEvent)||(X.getTime()==bv.getTime()&&X.getTime()==bo.getTime())?' '+$.datepick._dayOverClass:'')+(bz?' '+this._unselectableClass:'')+(bA?'':' '+bx[1]+(bv.getTime()>=r.getTime()&&bv.getTime()<=W.getTime()?' '+this._currentClass:'')+(bv.getTime()==b.getTime()?' datepick-today':''))+'"'+(!bA&&bx[2]?' title="'+bx[2]+'"':'')+' onmouseover="'+(bz?'':'jQuery(this).addClass(\''+this._dayOverClass+'\');')+(N?'jQuery(this).parent().addClass(\''+this._weekOverClass+'\');':'')+(!c||bA?'':'jQuery(\'#datepick-status-'+a.id+'\').html(\''+(U.apply((a.input?a.input[0]:null),[bv,a])||d)+'\');')+(V&&!bA?'jQuery.datepick._doHover(\'#'+a.id+'\','+bv.getFullYear()+','+bv.getMonth()+', this);':'')+'"'+' onmouseout="'+(bz?'':'jQuery(this).removeClass(\''+this._dayOverClass+'\');')+(N?'jQuery(this).parent().removeClass(\''+this._weekOverClass+'\');"':'')+(!c||bA?'':'jQuery(\'#datepick-status-'+a.id+'\').html(\''+d+'\');')+(V&&!bA?'jQuery.datepick._doHover(\'#'+a.id+'\');':'')+'"'+(bz?'':' onclick="jQuery.datepick._selectDay(\'#'+a.id+'\''+','+bv.getFullYear()+','+bv.getMonth()+',this);"')+'>'+(bA?'&#xa0;':(bz?bv.getDate():'<a>'+bv.getDate()+'</a>'))+'</td>';bv.setDate(bv.getDate()+1);bv=this._daylightSavingAdjust(bv)}F+='</tr>'}u++;if(u>11){u=0;v++}F+='</tbody></table></div>'}F+=(c?'<div style="clear: both;"></div><div id="datepick-status-'+a.id+'" class="datepick-status">'+d+'</div>':'')+(!i&&!a.inline?g:'')+'<div style="clear: both;"></div>'+($.browser.msie&&parseInt($.browser.version,10)<7&&!a.inline?'<iframe src="javascript:false;" class="'+this._coverClass+'"></iframe>':'');a._keyEvent=false;return F},_generateMonthYearHeader:function(a,b,c,d,e,f,g,h,i,j){d=(a.rangeStart&&d&&f<d?f:d);var k=this._get(a,'changeMonth');var l=this._get(a,'changeYear');var m=this._get(a,'showMonthAfterYear');var n='<div class="datepick-header">';var o='';if(g||!k)o+='<span>'+j[b]+'</span>';else{var p=(d&&d.getFullYear()==c);var q=(e&&e.getFullYear()==c);o+='<select class="datepick-new-month" '+'onchange="jQuery.datepick._selectMonthYear(\'#'+a.id+'\', this, \'M\');" '+'onclick="jQuery.datepick._clickMonthYear(\'#'+a.id+'\');"'+this._addStatus(h,a.id,this._get(a,'monthStatus'),i)+'>';for(var r=0;r<12;r++){if((!p||r>=d.getMonth())&&(!q||r<=e.getMonth()))o+='<option value="'+r+'"'+(r==b?' selected="selected"':'')+'>'+j[r]+'</option>'}o+='</select>'}if(!m)n+=o+(g||!k||!l?'&#xa0;':'');if(g||!l)n+='<span>'+c+'</span>';else{var s=this._get(a,'yearRange').split(':');var t=0;var u=0;if(s.length!=2){t=c-10;u=c+10}else if(s[0].charAt(0)=='+'||s[0].charAt(0)=='-'){t=c+parseInt(s[0],10);u=c+parseInt(s[1],10)}else{t=parseInt(s[0],10);u=parseInt(s[1],10)}t=(d?Math.max(t,d.getFullYear()):t);u=(e?Math.min(u,e.getFullYear()):u);n+='<select class="datepick-new-year" '+'onchange="jQuery.datepick._selectMonthYear(\'#'+a.id+'\', this, \'Y\');" '+'onclick="jQuery.datepick._clickMonthYear(\'#'+a.id+'\');"'+this._addStatus(h,a.id,this._get(a,'yearStatus'),i)+'>';for(;t<=u;t++){n+='<option value="'+t+'"'+(t==c?' selected="selected"':'')+'>'+t+'</option>'}n+='</select>'}if(m)n+=(g||!k||!l?'&#xa0;':'')+o;n+='</div>';return n},_addStatus:function(a,b,c,d){return(a?' onmouseover="jQuery(\'#datepick-status-'+b+'\').html(\''+(c||d)+'\');" '+'onmouseout="jQuery(\'#datepick-status-'+b+'\').html(\''+d+'\');"':'')},_adjustInstDate:function(a,b,c){var d=a.drawYear+(c=='Y'?b:0);var e=a.drawMonth+(c=='M'?b:0);var f=Math.min(a.selectedDay,this._getDaysInMonth(d,e))+(c=='D'?b:0);var g=this._daylightSavingAdjust(new Date(d,e,f));var h=this._getMinMaxDate(a,'min',true);var i=this._getMinMaxDate(a,'max');g=(h&&g<h?h:g);g=(i&&g>i?i:g);a.selectedDay=g.getDate();a.drawMonth=a.selectedMonth=g.getMonth();a.drawYear=a.selectedYear=g.getFullYear();if(c=='M'||c=='Y')this._notifyChange(a)},_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){var b=this._get(a,'numberOfMonths');return(b==null?[1,1]:(typeof b=='number'?[1,b]:b))},_getMinMaxDate:function(a,b,c){var d=this._determineDate(this._get(a,b+'Date'),null);return(!c||!a.rangeStart?d:(!d||a.rangeStart>d?a.rangeStart:d))},_getDaysInMonth:function(a,b){return 32-new Date(a,b,32).getDate()},_getFirstDayOfMonth:function(a,b){return new Date(a,b,1).getDay()},_canAdjustMonth:function(a,b,c,d){var e=this._getNumberOfMonths(a);var f=this._daylightSavingAdjust(new Date(c,d+(b<0?b:e[1]),1));if(b<0)f.setDate(this._getDaysInMonth(f.getFullYear(),f.getMonth()));return this._isInRange(a,f)},_isInRange:function(a,b){var c=(!a.rangeStart?null:this._daylightSavingAdjust(new Date(a.selectedYear,a.selectedMonth,a.selectedDay)));c=(c&&a.rangeStart<c?a.rangeStart:c);var d=c||this._getMinMaxDate(a,'min');var e=this._getMinMaxDate(a,'max');return((!d||b>=d)&&(!e||b<=e))},_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,d){if(!b){a.currentDay=a.selectedDay;a.currentMonth=a.selectedMonth;a.currentYear=a.selectedYear}var e=(b?(typeof b=='object'?b:this._daylightSavingAdjust(new Date(d,c,b))):this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay)));return this.formatDate(this._get(a,'dateFormat'),e,this._getFormatConfig(a))}});function extendRemove(a,b){$.extend(a,b);for(var c in b)if(b[c]==null||b[c]==undefined)a[c]=b[c];return a};function isArray(a){return(a&&a.constructor==Array)};$.fn.datepick=function(a){var b=Array.prototype.slice.call(arguments,1);if(typeof a=='string'&&(a=='isDisabled'||a=='getDate'))return $.datepick['_'+a+'Datepick'].apply($.datepick,[this[0]].concat(b));return this.each(function(){typeof a=='string'?$.datepick['_'+a+'Datepick'].apply($.datepick,[this].concat(b)):$.datepick._attachDatepick(this,a)})};$.datepick=new Datepick();$.datepick.uuid=new Date().getTime();$.datepick.version='3.5.1';$(function(){$(document).mousedown($.datepick._checkExternalClick).find('body').append($.datepick.dpDiv)})})(jQuery);

/* Hungarian initialisation for the jQuery UI date picker plugin. */
/* Written by Istvan Karaszi (jquerycalendar@spam.raszi.hu). */
(function($) {
	$.datepick.regional['hu'] = {
		clearText: 'törlés', clearStatus: '',
		closeText: 'bezárás', closeStatus: '',
		prevText: '&laquo;&nbsp;vissza', prevStatus: '',
		prevBigText: '&#x3c;&#x3c;', prevBigStatus: '',
		nextText: 'előre&nbsp;&raquo;', nextStatus: '',
		nextBigText: '&#x3e;&#x3e;', nextBigStatus: '',
		currentText: 'ma', currentStatus: '',
		monthNames: ['Január', 'Február', 'Március', 'Április', 'Május', 'Június',
		'Július', 'Augusztus', 'Szeptember', 'Október', 'November', 'December'],
		monthNamesShort: ['Jan', 'Feb', 'Már', 'Ápr', 'Máj', 'Jún',
		'Júl', 'Aug', 'Szep', 'Okt', 'Nov', 'Dec'],
		monthStatus: '', yearStatus: '',
		weekHeader: 'Hé', weekStatus: '',
		dayNames: ['Vasámap', 'Hétfö', 'Kedd', 'Szerda', 'Csütörtök', 'Péntek', 'Szombat'],
		dayNamesShort: ['Vas', 'Hét', 'Ked', 'Sze', 'Csü', 'Pén', 'Szo'],
		dayNamesMin: ['V', 'H', 'K', 'Sze', 'Cs', 'P', 'Szo'],
		dayStatus: 'DD', dateStatus: 'D, M d',
		dateFormat: 'yy-mm-dd', firstDay: 1,
		initStatus: '', isRTL: false};
	$.datepick.setDefaults($.datepick.regional['hu']);
})(jQuery);

$.frontendValidator = {

	_digit: function() {
		$(this).val($(this).val().replace(/[^0-9]/gi,""));
	},

	_instantRequest: function() {
		$(this).parents("form").submit();
	},

	_instantRequestFocus: function() {
		$.WBValidatorTempTextFocus = $(this).val();
	},

	_instantRequestBlur: function() {
		if ($.WBValidatorTempTextFocus != $(this).val()) $(this).parents("form").submit();
		$.WBValidatorTempTextFocus;
	},

	init: function(el) {
		var fv = this;
		var filter = "";

		if (typeof el != "undefined") filter = "#" + el.attr("id") + " ";

		$(filter + ".digitValidator")
			.unbind("keyup", fv._digit)
			.bind("keyup", fv._digit);

		$(filter + ".instantRequest").each(function() {
			$this = $(this);

			if ($this.attr("type") == "text") {
				$.WBValidatorTempTextFocus = "";
				$this.unbind("focus", fv._instantRequestFocus).bind("focus", fv._instantRequestFocus);
				$this.unbind("blur", fv._instantRequestBlur).bind("blur", fv._instantRequestBlur);
			} else {
				$this.unbind("change", fv._instantRequest).bind("change", fv._instantRequest);
			}



		});
	}

};

/* WB TAG Plugin */
$.wbTags = {
	add_tag: function () {

		var $ct = $("textarea", "#mainContent");
		var str = $(this).attr("lang");

		var selection = "";
		var value = $ct.val();
		var range = $ct.getSelection();
		var before = value.substring(0, range.start);
		var after = value.substring(range.end, value.length);

		if ((range.text.length > 0) || (str != "img" && str != "url")) {
			if ((str == "url" || str == "img") && range.text.substr(0,7) != "http://" ) {
				range.text = "http://" + range.text;
			}
			var trailing = "";
			if (range.text[range.length-1] == " ") {
				range.text = range.text.substring(0, range.length-1);
				trailing = " ";
			}
    		var selection = "["+str+"]" + range.text + "[/"+str+"]";
			$ct.val(before + selection + trailing + after);
		} else if (str == "url") {
			if (selection = prompt("Adja meg az urlt!","http://")) {
				$ct.val(before + "[url=" + selection + "]link[/url] " + after);
			}
		} else if (str == "img") {
			if (selection = prompt("Adja meg az kép url-t!","http://")) {
				$ct.val(before + "[img]" + selection + "[/img] " + after);
			}
		}

		return false;
	},

	html_to_BBCode: function (s) {
		s = $.trim(s);

		function rep(re, str) {
			s = s.replace(re, str);
		};

		rep(/<a.*?href=\"(.*?)\".*?>(.*?)<\/a>/gi,"[url=$1]$2[/url]");
		rep(/<font.*?color=\"(.*?)\".*?class=\"codeStyle\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]");
		rep(/<font.*?color=\"(.*?)\".*?class=\"quoteStyle\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]");
		rep(/<font.*?class=\"codeStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[code][color=$1]$2[/color][/code]");
		rep(/<font.*?class=\"quoteStyle\".*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[quote][color=$1]$2[/color][/quote]");
		rep(/<font.*?color=\"(.*?)\".*?>(.*?)<\/font>/gi,"[color=$1]$2[/color]");
		rep(/<font>(.*?)<\/font>/gi,"$1");
		rep(/<img.*?src=\"(.*?)\".*?>/gi,"[img]$1[/img]");
		rep(/<img.*?src=\"(.*?)\".*?\/>/gi,"[img]$1[/img]");
		rep(/<span class=\"codeStyle\">(.*?)<\/span>/gi,"[code]$1[/code]");
		rep(/<span class=\"quoteStyle\">(.*?)<\/span>/gi,"[quote]$1[/quote]");
		rep(/<strong class=\"codeStyle\">(.*?)<\/strong>/gi,"[code][b]$1[/b][/code]");
		rep(/<strong class=\"quoteStyle\">(.*?)<\/strong>/gi,"[quote][b]$1[/b][/quote]");
		rep(/<em class=\"codeStyle\">(.*?)<\/em>/gi,"[code][i]$1[/i][/code]");
		rep(/<em class=\"quoteStyle\">(.*?)<\/em>/gi,"[quote][i]$1[/i][/quote]");
		rep(/<u class=\"codeStyle\">(.*?)<\/u>/gi,"[code][u]$1[/u][/code]");
		rep(/<u class=\"quoteStyle\">(.*?)<\/u>/gi,"[quote][u]$1[/u][/quote]");
		rep(/<\/(strong|b)>/gi,"[/b]");
		rep(/<(strong|b)>/gi,"[b]");
		rep(/<\/(em|i)>/gi,"[/i]");
		rep(/<(em|i)>/gi,"[i]");
		rep(/<\/u>/gi,"[/u]");
		rep(/<u>/gi,"[u]");
		rep(/<br \/>/gi,"\n");
		rep(/<br\/>/gi,"\n");
		rep(/<br>/gi,"\n");
		rep(/<p>/gi,"");
		rep(/<\/p>/gi,"\n");
		rep(/&nbsp;/gi," ");
		rep(/&quot;/gi,"\"");
		rep(/&lt;/gi,"<");
		rep(/&gt;/gi,">");
		rep(/&amp;/gi,"&");
		rep(/&undefined;/gi,"'"); // quickfix
		return s;
	}
}

/* WB Comment System */
$.wbComments = {

	init: function() {
		var $c = $("#widget_comments");

		$c.find("form").submit(this.add).end()
		  .find("a.widget_comment_reply")	.die().live("click", this.reply).end()
		  .find("a.widget_comment_modify")	.die().live("click", this.modify).end()
		  .find("a.widget_comment_remove")	.die().live("click", this.remove).end()
		  .find("a.widget_comment_moderate").die().live("click", this.moderate).end()
		  .find("a.widget_comment_tag")		.die().live("click", $.wbTags.add_tag).end()
		  .find("a.widget_comment_more")	.die().live("click", this.more);
	},

	more: function() {
		var $c = $("#widget_comments");
		$('html, body').animate({scrollTop: $c.offset().top - 30}, 'slow');
		$.wbComments.show_message("Kérjük várjon!");

		$.post($.base+"comments/more", {url: $c.find("input[name=url]").val(), template: $c.find("input[name=template]").val()}, function(data) {
			$.wbComments.hide_message();
			$c.find(".widget_comment_container").html(data);
		});

		return false;
	},

	add: function() {
		var $f = $("#widget_comments").find("form");
		var pars = $f.serialize() + "&ajax=true";

		$f.find("input[type=submit]").attr("disabled", true);
		setTimeout('$("#widget_comments").find("input[type=submit]").attr("disabled", false);', 5000);

		$.wbComments.show_message("Kérjük várjon!");

		$.post($f.attr("action"), pars, function(data) {
			$.wbComments.hide_message();

			if ($f.attr("action").search("modify") >= 0) $.wbComments.refresh();

			var $c = $("#widget_comments");
			var commentkeys = new Array();
			$c.find(".widget_comment_reply").each(function() {
				commentkeys[$(this).attr("lang")] = true;
			});

			$("body").append("<div id='widget_comment_temporary_container'></div>");
			$("#widget_comment_temporary_container")
				.css({ width: '1px', height: '1px', overflow: 'hidden', opacity: 0 })
				.html(data)
				.find(".widget_comment")
					.each(function() {
						if (commentkeys[ $(this).find(".widget_comment_reply").attr("lang") ] != undefined) return $(this).remove();

						$(this).hide();
					})
					.end()
				.children()
					.prependTo("#widget_comments .widget_comment_container");

			$c.find(".widget_comment_caption")
				.html('Hozzászólás:').end()
			  	.find("input[name=replyto]").val("0").end()
			  .find("textarea[name=comment]").val("");

			$("#widget_comment_temporary_container").remove();

			$(".widget_comment", "#widget_comments").show("slow");

		});

		return false;
	},

	remove: function() {
		var $el = $(this);
		$.wbComments.show_message("Kérjük várjon!");
		$.post($.base+"comments/remove", {id: $el.attr("lang")}, function() {
			$.wbComments.hide_message();
			$el.closest(".widget_comment").hide("slow", function(){ $(this).remove(); })
		});

		return false;
	},

	moderate: function() {
		var $el = $(this);
		$.wbComments.show_message("Kérjük várjon!");

		$.post($.base+"comments/moderate", {id: $(this).attr("lang")}, function() {
			$.wbComments.hide_message();
			$el.closest(".widget_comment").hide("slow", function(){
				$(this)
					.find(".widget_comment_text")
						.html("MODERÁLVA")
						.end()
					.show("slow");
			});
		});

		return false;
	},

	reply: function() {
		var replyto = $(this).attr("lang");

		$('html, body').animate({scrollTop: $("#widget_comments").offset().top - 30}, 'slow');

		$(".widget_comment_caption", "#widget_comments")
			.html('Válasz erre: #'+replyto).end()
		  	.find("input[name=replyto]").val(replyto).end()
		  	.find("textarea").focus();

		return false;
	},

	modify: function() {
		var $c = $("#widget_comments");
		var $f = $c.find("form");
		var $t = $f.find("textarea");
		var id = $(this).attr("lang");

		$('html, body').animate({scrollTop: $c.offset().top - 30}, 'slow');
		$t.val($.wbTags.html_to_BBCode($(this).closest(".widget_comment").find(".widget_comment_text").html())).focus();

		$f.attr("action", $f.attr("action").replace("add", "modify"));
		$f.find("input[name=id]").val(id);

		$c.find(".widget_comment_caption").html("Hozzászólás szerkesztése:");

		return false;
	},

	refresh: function() {
		window.location = window.location.toString().split("?")[0]+"?refresh="+Math.floor(Math.random(10)*10);
	},

	show_message: function(msg) {
		$(".widget_comment_messages", "#widget_comments")
			.find("span")
				.html(msg)
				.end()
			.show("slow");
	},

	hide_message: function() {
		$(".widget_comment_messages", "#widget_comments").hide("slow");
	}

}


/*
 * jQuery plugin: fieldSelection - v0.1.0 - last change: 2006-12-16
 * (c) 2006 Alex Brem <alex@0xab.cd> - http://blog.0xab.cd
 */

var fieldSelection = {

	getSelection: function() {

		var e = this.jquery ? this[0] : this;

		return (

			/* mozilla / dom 3.0 */
			('selectionStart' in e && function() {
				var l = e.selectionEnd - e.selectionStart;
				return { start: e.selectionStart, end: e.selectionEnd, length: l, text: e.value.substr(e.selectionStart, l) };
			}) ||

			/* exploder */
			(document.selection && function() {

				e.focus();

				var r = document.selection.createRange();
				if (r == null) {
					return { start: 0, end: e.value.length, length: 0 }
				}

				var re = e.createTextRange();
				var rc = re.duplicate();
				re.moveToBookmark(r.getBookmark());
				rc.setEndPoint('EndToStart', re);

				return { start: rc.text.length, end: rc.text.length + r.text.length, length: r.text.length, text: r.text };
			}) ||

			/* browser not supported */
			function() {
				return { start: 0, end: e.value.length, length: 0 };
			}

		)();

	},

	replaceSelection: function() {

		var e = this.jquery ? this[0] : this;
		var text = arguments[0] || '';

		return (

			/* mozilla / dom 3.0 */
			('selectionStart' in e && function() {
				e.value = e.value.substr(0, e.selectionStart) + text + e.value.substr(e.selectionEnd, e.value.length);
				return this;
			}) ||

			/* exploder */
			(document.selection && function() {
				e.focus();
				document.selection.createRange().text = text;
				return this;
			}) ||

			/* browser not supported */
			function() {
				e.value += text;
				return this;
			}

		)();

	}

};

jQuery.each(fieldSelection, function(i) { jQuery.fn[i] = this; });


$.startStopSlider = function() {
	// SET THIS VARIABLE FOR DELAY, 1000 = 1 SECOND
	var delayLength = 6000;

	function doMove(panelWidth, tooFar) {
		var leftValue = $("#mover").css("left");

		// Fix for IE
		if (leftValue == "auto") { leftValue = 0; };

		var movement = parseFloat(leftValue, 10) - panelWidth;

		if (movement == tooFar) {
			$(".slide img").animate({
				"top": -200
			}, function() {
				$("#mover").animate({
					"left": 0
				}, function() {
					$(".slide img").animate({
						"top": 0
					});
				});
			});
		}
		else {
			$(".slide img").animate({
				"top": -200
			}, function() {
				$("#mover").animate({
					"left": movement
				}, function() {
					$(".slide img").animate({
						"top": 0
					});
				});
			});
		}
	}

	$(function(){

		var $slide1 = $("#slide-1");

		var panelWidth = $slide1.css("width");
		var panelPaddingLeft = $slide1.css("paddingLeft");
		var panelPaddingRight = $slide1.css("paddingRight");

		panelWidth = parseFloat(panelWidth, 10);
		panelPaddingLeft = parseFloat(panelPaddingLeft, 10);
		panelPaddingRight = parseFloat(panelPaddingRight, 10);

		panelWidth = panelWidth + panelPaddingLeft + panelPaddingRight;

		var numPanels = $(".slide").length;
		var tooFar = -(panelWidth * numPanels);
		var totalMoverwidth = numPanels * panelWidth;
		$("#mover").css("width", totalMoverwidth);

		$(".slide").append('<a href="#" class="slider-stopper sliderStop"><span>Stop</span></a>');

		sliderIntervalID = setInterval(function(){
			doMove(panelWidth, tooFar);
		}, delayLength);

		$(".slider-stopper").click(function(){
			if ($(this).hasClass("sliderStop")) {
				clearInterval(sliderIntervalID);
				//$(this).text("Start");
				$(this).removeClass("sliderStop").addClass("sliderPlay");
			}
			else {
				sliderIntervalID = setInterval(function(){
					doMove(panelWidth, tooFar);
				}, delayLength);
				//$(this).text("Stop");
				$(this).removeClass("sliderPlay").addClass("sliderStop");
			}

		});

	});
}

$.initShare = function() {
	var $sh = $('#shareBox');
	if (!$sh.length) return;

	$sh.find('.shareWithTumblr').click(function() {
		var d=document,w=window,e=w.getSelection,k=d.getSelection,x=d.selection,s=(e?e():(k)?k():(x?x.createRange().text:0)),f='http://www.tumblr.com/share',l=d.location,e=encodeURIComponent,p='?v=3&u='+e(l.href) +'&t='+e(d.title) +'&s='+e(s),u=f+p;try{if(!/^(.*\.)?tumblr[^.]*$/.test(l.host))throw(0);tstbklt();}catch(z){a =function(){if(!w.open(u,'t','toolbar=0,resizable=0,status=1,width=450,height=430'))l.href=u;};if(/Firefox/.test(navigator.userAgent))setTimeout(a,0);else a();}void(0);
		return false;
	});
}


/*---main advert---*/
$(function() {

    //if ($.lockMainAdvert) return;

    var $el = $('#mainAdvert'),
        $overlay = $("#mainAdvertOverlay"),
        $window = $(window),
        $document = $(document),
        width = $el.width(),
        height = $el.height();

    if (($el.length == 0) || ($overlay.length == 0)) return;

    //$("#header").css({ backgroundImage: 'url('+$.base+'public/css/images/header.jpg)' });

    $overlay.css({
        width: $document.width() + 'px',
        height: $document.height() + 'px',
        display: 'block',
        opacity: 0.5
    });

    $el.css({
        left: Math.round(($window.width() - width)/2) + 'px',
        top: Math.round(($window.height() - height)/2) + 'px',
        display: 'block'
    });

    $("object").hide();
    setTimeout(function() {$("object").hide(); }, 500);

    var hideAll = function() {
    	$("object").show();
        $overlay.fadeOut("fast");
        $el.fadeOut("slow");
        return false;
    }

    $overlay.click(hideAll);
    $el.find('a.close').click(hideAll);


});





$.mapSelectorField = function($form, $map, $search) {

	var $lat = $form.find("input[name=lat]"),
		$lng = $form.find("input[name=lng]");

    var defaultPosition = new google.maps.LatLng(47.13742464629386, 19.423828125),
		map = new google.maps.Map($map.get(0), {
			center: defaultPosition,
			zoom: 7,
			streetViewControl: false,
			disableDoubleClickZoom: true,
			mapTypeId: 'hybrid',
			mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU}
		}), marker;

	$search.unbind("keyup.map").bind("keyup.map", function() {
		var $this = $(this),
			val = $.trim($this.val()),
			geocoder = new google.maps.Geocoder(), loc;

		if (!val || (val == 'Keresés címre...')) return true;

        geocoder.geocode({address: val}, function(results, status) {
            if (status == google.maps.GeocoderStatus.OK) {
                loc = results[0].geometry.location;

				$lat.val(loc.lat());
				$lng.val(loc.lng());
                setMap(loc.lat(), loc.lng(), 12);
            }
        });

	});

	var initSearchlabel = $search.val();
	$search
		.unbind("blur.mapc").bind("blur.mapc", function() {
			var $this = $(this),
				val = $.trim($this.val());

			if (val == "") $this.val(initSearchlabel);
		})
		.unbind("focus.mapc").bind("focus.mapc", function() {
			var $this = $(this),
				val = $.trim($this.val());

			if (val == initSearchlabel) $this.val('');
			})
		.unbind("keydown.mapc").bind("keydown.mapc", function(e) {
			if (e.keyCode == 13) { e.preventDefault(); return false; }
		});

	var setMap = function(lat, lng, zoom, onlyMove) {
		var zoom = zoom || 12,
			position;

		if (!lat || !lng || (lng <= 0) || (lat <= 0)) {
			lat = 47.13742464629386;
			lng = 19.423828125;
			zoom = 7;
		}

		var position = new google.maps.LatLng(lat, lng);

		google.maps.event.trigger(map, 'resize');
		map.setCenter(position);
		map.setZoom(zoom);

		if (!onlyMove) {
			if (marker) marker.setMap(null);
			marker = new google.maps.Marker({
				map: map,
				draggable: true,
				title: 'Pontosítsa a helyet',
				position: position
			});

			google.maps.event.addListener(marker, 'dragend', function() {
				var pos = marker.getPosition();
				$lat.val(pos.lat());
				$lng.val(pos.lng());
			});
		}

		setTimeout(function() {
			google.maps.event.trigger(map, 'resize');
			map.setCenter(position);
			map.setZoom(zoom);
		}, 500);
	}

	$lng.unbind("change.map").bind("change.map", function() {
		var lat = parseFloat($lat.val(), 10),
			lng = parseFloat($lng.val(), 10);

		setMap(lat, lng, 12);
	});

  	google.maps.event.addListener(map, 'dblclick', function(e, point) {
		var lat = e.latLng.lat(),
			lng = e.latLng.lng();

		$lat.val(lat);
		$lng.val(lng);
		setMap(lat, lng, map.getZoom());
	});

	$lng.trigger('change.map');
};

$.mapCreator = function(opts) {
	var markers, infowindow, data, id, markerContent,
		$html = $('html, body');

	var createMarkers = function() {
		var markers, marker;

		markers = {
			event: [],
			experience: [],
			lake: [],
			lodging: [],
			shop: []
		};

		for (var i = 0; data = opts.dataset[i]; i++) {
			marker = new google.maps.Marker({
				position: new google.maps.LatLng(data.lat, data.lng),
				icon: new google.maps.MarkerImage($.base + 'public/css/images/googlemap_marker_'+data.type+'.png'),
				title: data.title.replace('<sup>','').replace('</sup>','')
			});

			id = 'marker_' + Math.floor( Math.random() * 100000 );

			infowindow = new google.maps.InfoWindow({
				content: markerContent.replace('%7Btitle%7D', data.title)
									  .replace('{title}', data.title)
									  .replace('%7Bimage%7D', data.image)
									  .replace('{image}', data.image)
									  .replace('%7Bdesc%7D', data.desc)
	                                  .replace('%7Bid%7D', id)
	                                  .replace('{id}', id)
	                                  .replace('%7Btype%7D', data.type)
	                                  .replace('{type}', data.type)
									  .replace('{desc}', data.desc)
									  .replace('%7Burl%7D', data.url)
									  .replace('{url}', data.url)
			});

			(function(ma, i, m, id) {
				google.maps.event.addListener(ma, 'click', function() {
					i.open(m, this);
					if (m.lastInfowindow) m.lastInfowindow.close();
					m.lastInfowindow = i;
					setTimeout(function() { $.setRemoteLink($("#"+id)); }, 500);
				});
			})(marker, infowindow, map, id);

			marker.datas = data;
			markers[data.type].push(marker);
		}

		return markers;
	}

	opts = $.extend({
		$map: '',
		lat: 47.13742464629386,
		lng: 19.423828125,
		zoom: 6,
		fullscreenZoom: 8,
		mapTypeId: 'terrain',
		dataset: '',
		$markerTemplate: '',
		$fullscreenOverlayTemplate: '',
		$fullscreenOpenTrigger: '',
		$fullScreenCloseTrigger: '',
		$filter: '',
		$mapJumper: ''
	}, opts);

	if (!opts.$markerTemplate.length) opts.$markerTemplate = $('#defaultMapMarker');

	var	defaultPosition = new google.maps.LatLng(opts.lat, opts.lng),
		map = new google.maps.Map(opts.$map.get(0), {
			center: defaultPosition,
			zoom: opts.zoom,
			streetViewControl: false,
			mapTypeId: opts.mapTypeId,
			mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DEFAULT}
		});

	markerContent = opts.$markerTemplate.html();

	// Get data from local storage
	if (opts.dataset === false) {
		opts.dataset = $.store.get('allMapDataset');
	} else {
		$.store.set('allMapDataset', opts.dataset);
		$.cookie('allMapDatasetDate', Math.floor(new Date().getTime() / 1000));
	}

	if ((typeof opts.dataset === 'undefined') && (!isNaN(parseInt($.cookie('allMapDatasetDate'), 10)))) {
		$.cookie('allMapDatasetDate', null);
		window.location = window.location.toString().split('?')[0]+'?rand='+(Math.round(Math.random()*100));
	}

	markers = createMarkers();

	var markerCluster = new MarkerClusterer(map, null, {
		gridSize: 40,
		maxZoom: 10,
		styles: $.googleMapClusterStyles
	});

	var initMarkerClusterer = function(filters) {
		var markersToAdd = [];

		if (!filters) filters = ['event', 'experience', 'lake', 'lodging', 'shop'];

		for (var i=0, filter; filter = filters[i]; i++) {
			markersToAdd = markersToAdd.concat(markers[filter]);
		}

		markerCluster.clearMarkers();
		markerCluster.addMarkers(markersToAdd);
	}

	var cbFilterChange = function() {
		var $selected = $('#'+filterId).next().find('input:checked').not('input[value=on]'), filters = [];

		$selected.each(function() { filters.push($(this).val()); });
        initMarkerClusterer(filters);
	}

	var filterId = opts.$filter.attr('id');
	opts.$filter.multiSelect({
		oneOrMoreSelected: '*',
		selectAllText: 'Mindet kijelöli',
		noneSelected: 'Jelölj ki legalább egy kategóriát'
	}, function(e) {
		cbFilterChange();
	});

	cbFilterChange();

	if (opts.$mapJumper.length)
	{
		opts.$mapJumper.unbind('click.mapJump').bind('click.mapJump', function(e) {
			e.preventDefault();

			var val = $(this).attr("lang").split(':'),
				lat = val[0],
				lng = val[1];

			map.setCenter(new google.maps.LatLng(lat, lng));
			map.setZoom(11);

			$html.animate({ scrollTop: (opts.$map.offset().top-50)+'px' });
		});
	}

	/* Fullscreen parts */
	if (opts.$fullscreenOpenTrigger.length) {
		(function() {
			var $parent = opts.$map.parent(),
				$window = $(window),
				$overlay,
				isFullscreen = false,
				defWidth = opts.$map.width(),
				defHeight = opts.$map.height(),
				$objects = $([]),

				resizeFullscreenMap = function() {
					opts.$map.css({ position: 'absolute', top: 0, left: 0, width: $window.width(), height: $window.height() });
					google.maps.event.trigger(map, 'resize');
				},

				showFullScreen = function() {
					$objects = $("object:visible").hide();
					$html.css({ overflow: 'hidden' }).animate({ scrollTop: 0 });
					opts.$map.appendTo('body').addClass('fullscreen');

					resizeFullscreenMap();

			    	map.setCenter(defaultPosition);
				    map.setZoom(opts.fullscreenZoom);

					$overlay.appendTo('body');
                	isFullscreen = true;
				},

				hideFullScreen = function() {
					$html.animate({ scrollTop: 0 }).css({ overflow: 'inherit' });
					opts.$map.appendTo($parent).css({ position: 'relative', top: 0, left: 0, width: defWidth, height: defHeight }).removeClass('fullscreen');

					google.maps.event.trigger(map, 'resize');
				    map.setCenter(defaultPosition);
				    map.setZoom(opts.zoom);

				    $objects.show();

					$overlay.appendTo(opts.$fullscreenOverlayTemplate);
	                isFullscreen = false;
				};

			if (!opts.$fullscreenOverlayTemplate.length) opts.$fullscreenOverlayTemplate = $('#defaultMapFullscreenOverlay');
			$overlay = opts.$fullscreenOverlayTemplate.children();

			if (!opts.$fullScreenCloseTrigger.length) opts.$fullScreenCloseTrigger = $('#mapFullScreenCloseTrigger');

			opts.$fullscreenOpenTrigger.unbind('click.fullscreenMap').bind('click.fullscreenMap', function(e) {
				e.preventDefault();
				showFullScreen();
			});

			opts.$fullScreenCloseTrigger.unbind('click.fullscreenMap').bind('click.fullscreenMap', function(e) {
				e.preventDefault();
				hideFullScreen();
			});

			$window.unbind('resize.fullscreenMap').bind('resize.fullscreenMap', function() {
				if (isFullscreen) resizeFullscreenMap();
			});
		})();
	}
};



