﻿/// <reference name="MicrosoftAjax.js"/>
/// <reference path="~/scripts/jquery-1.4.1.js" />
/// <reference path="~/scripts/sailings.js" />

(function(j){j.tools=j.tools||{version:"1.2.3"};var e=[],i,k=[75,76,38,39,74,72,40,37],l={};i=j.tools.dateinput={conf:{format:"mm/dd/yy",yearRange:[-5,5],lang:"en",offset:[0,0],speed:0,firstDay:0,min:0,max:0,css:{prefix:"cal",input:"date",root:0,head:0,months:0,year:0,bodyOuter:0,bodyInner:0,today:0,current:0,active:0,month:0,bodyItem:0,title:0,weeks:0,week:0,days:0,off:0,sunday:0,focus:0,disabled:0}},localize:function(o,p){j.each(p,function(q,r){p[q]=r.split(",")});l[o]=p}};i.localize("en",{months:"January,February,March,April,May,June,July,August,September,October,November,December",shortMonths:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec",days:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday",shortDays:"Su,Mo,Tu,We,Th,Fr,Sa"});function b(p,o){return 32-new Date(p,o,32).getDate()}function n(p,o){p=""+p;o=o||2;while(p.length<o){p="0"+p}return p}var m=/d{1,4}|m{1,4}|yy(?:yy)?|"[^"]*"|'[^']*'/g,f=j("<a/>");function d(w,p,q){var o=w.getDate(),r=w.getDay(),t=w.getMonth(),u=w.getFullYear(),s={d:o,dd:n(o),ddd:l[q].shortDays[r],dddd:l[q].days[r],m:t+1,mm:n(t+1),mmm:l[q].shortMonths[t],mmmm:l[q].months[t],yy:String(u).slice(2),yyyy:u};var v=p.replace(m,function(x){return x in s?s[x]:x.slice(1,x.length-1)});return f.html(v).html()}function a(o){return parseInt(o,10)}function h(o,p){return o.getFullYear()===p.getFullYear()&&o.getMonth()==p.getMonth()&&o.getDate()==p.getDate()}function g(p){if(!p){return}if(p.constructor==Date){return p}if(typeof p=="string"){var o=p.split("-");if(o.length==3){return new Date(a(o[0]),a(o[1])-1,a(o[2]))}if(!/^-?\d+$/.test(p)){return}p=a(p)}var q=new Date();q.setDate(q.getDate()+p);return q}function c(y,J){var L=this,C=new Date(),I=J.css,o=l[J.lang],E=j("#"+I.root),x=E.find("#"+I.head),A=E.find("."+I.title),N,u,P,F,M=y.attr("data-value")||J.value||y.val(),z=y.attr("min")||J.min,G=y.attr("max")||J.max,K,O;M=g(M)||C;z=g(z||J.yearRange[0]*365);G=g(G||J.yearRange[1]*365);if(!o){throw"Dateinput: invalid language: "+J.lang}if(y.attr("type")=="date"){var s=j("<input/>");j.each("name,readonly,disabled,value,required".split(","),function(R,S){s.attr(S,y.attr(S))});y.replaceWith(s);y=s}y.addClass(I.input);var w=y.add(L);if(!E.length){E=j("<div><div/><div><div><div><div/><div/><div/></div></div></div></div>").hide().css({position:"absolute"}).attr("id",I.root);E.children().eq(0).attr("id",I.head).end().eq(1).attr("id",I.bodyOuter).children().eq(0).attr("id",I.bodyInner).children().eq(0).addClass(I.bodyItem).addClass(I.active).children().eq(0).addClass(I.title).end().eq(1).addClass(I.days).end().eq(2).addClass(I.weeks);x=E.find("#"+I.head);A=E.find("."+I.title);var D=j("<div/>").attr("id",I.months),v=j("<ul/>").attr("id",I.year);x.prepend(v.add(D));var r=E.find("."+I.days);for(var p=0;p<7;p++){r.append(j("<span/>").text(o.shortDays[(p+J.firstDay)%7]))}j("body").append(E)}if(J.trigger){N=J.trigger(y).click(function(R){if(K){L.hide()}else{L.show()}return R.preventDefault()})}var Q=E.find("."+I.weeks);v=E.find("#"+I.year);D=E.find("#"+I.months);function B(T,S,R){M=T;u=T.getFullYear();P=T.getMonth();F=T.getDate();y.val(d(T,S.format,S.lang));y.data("date",T);R=R||j.Event("api");R.type="change";w.trigger(R,[T]);L.hide(R)}function q(R){R.type="onShow";w.trigger(R);j(document).bind("keydown.d",function(U){var T=U.keyCode;if(T==8){y.val("");return L.hide(U)}if(T==27){return L.hide(U)}if(j(k).index(T)>=0){if(!K){L.show(U);return U.preventDefault()}var V=j("."+I.weeks+" a"),S=j("."+I.focus),W=V.index(S);S.removeClass(I.focus);if(T==74||T==40){W+=7}else{if(T==75||T==38){W-=7}else{if(T==76||T==39){W+=1}else{if(T==72||T==37){W-=1}}}}if(W==-1){L.addMonth(-1);S=j("."+I.weeks+" a:last")}else{if(W==35){L.addMonth();S=j("."+I.weeks+" a:first")}else{S=V.eq(W)}}S.addClass(I.focus);return U.preventDefault()}if(T==34){return L.addMonth()}if(T==33){return L.addMonth(-1)}if(T==36){return L.today()}if(T==13){if(!j(U.target).is("select")){j("."+I.focus).click()}}return j([16,17,18,9]).index(T)>=0});j(document).bind("click.d",function(T){var S=T.target;if(!j(S).parents("#"+I.root).length&&(!N||S!=N[0])){L.hide(T)}})}function t(T){O=true;var U=j("#"+I.bodyInner),R=j("."+I.bodyItem),S=R.clone().removeClass(I.active);if(T){R.before(S);S.css("margin-left","-"+R[0].scrollWidth+"px");U.css("left",R[0].scrollWidth+"px")}else{R.after(S);U.css("left","-"+R[0].scrollWidth+"px")}}function H(){j("#"+I.bodyInner).animate({left:"0px"},250,"linear",function(){j("."+I.bodyItem+":not(."+I.active+")").remove();O=false})}j.extend(L,{show:function(R){if(y.is("[readonly]")||K){return}R=R||j.Event();R.type="onBeforeShow";w.trigger(R);if(R.isDefaultPrevented()){return}j.each(e,function(){this.hide()});K=true;L.setValue(M);var S=y.offset();E.css({top:S.top+y.outerHeight({margins:true})+J.offset[0],left:S.left+J.offset[1]});if(J.speed){E.show(J.speed,function(){q(R)})}else{E.show();q(R)}return L},setValue:function(Z,T,V){var ae;if(parseInt(T,10)>=-1){Z=a(Z);T=a(T);V=a(V);ae=new Date(Z,T,V)}else{ae=Z||M;Z=ae.getFullYear();T=ae.getMonth();V=ae.getDate()}if(T==-1){T=11;Z--}else{if(T==12){T=0;Z++}}if(!K){B(ae,J);return L}P=T;u=Z;var U=new Date(Z,T,1-J.firstDay),ab=U.getDay(),S=b(Z,T),W=b(Z,T-1),aa,ac,R;D.empty();j.each(o.shortMonths,function(af,ag){if(af%6===0){aa=j("<div/>").addClass(I.month).appendTo(D)}R=j("<a/>").attr("href","#"+af).text(ag).data("month",af).appendTo(aa).click(function(ai){var ah=j(this),aj=ah.data("month");if(!O&&!ah.hasClass(I.disabled)&&aj!=P){t(aj>P);L.setValue(u,aj,F)}return false});if(z&&new Date(Z,af+1,0)<z){R.addClass(I.disabled)}if(G&&new Date(Z,af,1)>G){R.addClass(I.disabled)}});v.empty();for(var X=Z+J.yearRange[0];X<Z+J.yearRange[1];X++){if(z<new Date(X+1,-1,0)&&G>new Date(X,0,0)){j("<a/>").attr("href","#"+X).text(X).data("year",X).prependTo(j("<li/>").html("&#32;").appendTo(v)).click(function(af){var ag=j(this).data("year");if(!O&&ag!=u){t(ag>u);L.setValue(ag,P,F)}return false})}}A.html(o.months[T]+" "+Z);Q.empty();for(var ad=0,Y;ad<42;ad++){R=j("<a/>");if(ad%7===0){ac=j("<div/>").addClass(I.week);Q.append(ac)}if(ad<ab){R.addClass(I.off);Y=W-ab+ad+1;ae=new Date(Z,T-1,Y)}else{if(ad>=ab+S){R.addClass(I.off);Y=ad-S-ab+1;ae=new Date(Z,T+1,Y)}else{Y=ad-ab+1;ae=new Date(Z,T,Y);if(h(M,ae)){R.attr("id",I.current).addClass(I.focus)}else{if(h(C,ae)){R.attr("id",I.today)}}}}if(z&&ae<z){R.addClass(I.disabled)}if(G&&ae>G){R.addClass(I.disabled)}R.attr("href","#"+Y).text(Y).data("date",ae);ac.append(R);R.click(function(ag){var af=j(this);if(!af.hasClass(I.disabled)){j("#"+I.current).removeAttr("id");af.attr("id",I.current);B(af.data("date"),J,ag)}return false})}if(I.sunday){Q.find(I.week).each(function(){var af=J.firstDay?7-J.firstDay:0;j(this).children().slice(af,af+1).addClass(I.sunday)})}if(O){H()}return L},setMin:function(S,R){z=g(S);if(R&&M<z){L.setValue(z)}return L},setMax:function(S,R){G=g(S);if(R&&M>G){L.setValue(G)}return L},today:function(){return L.setValue(C)},addDay:function(R){return this.setValue(u,P,F+(R||1))},addMonth:function(R){return this.setValue(u,P+(R||1),F)},addYear:function(R){return this.setValue(u+(R||1),P,F)},hide:function(R){if(K){R=R||j.Event();R.type="onHide";w.trigger(R);j(document).unbind("click.d").unbind("keydown.d");if(R.isDefaultPrevented()){return}E.hide();K=false}return L},getConf:function(){return J},getInput:function(){return y},getCalendar:function(){return E},getValue:function(R){return R?d(M,R,J.lang):M},isOpen:function(){return K}});j.each(["onBeforeShow","onShow","change","onHide"],function(R,S){if(j.isFunction(J[S])){j(L).bind(S,J[S])}L[S]=function(T){j(L).bind(S,T);return L}})}j.expr[":"].date=function(o){var p=o.getAttribute("type");return p&&p=="date"||!!j(o).data("dateinput")};j.fn.dateinput=function(o){if(this.data("dateinput")){return this}o=j.extend(true,{},i.conf,o);j.each(o.css,function(q,r){if(!r&&q!="prefix"){o.css[q]=(o.css.prefix||"")+(r||q)}});var p;this.each(function(){var q=new c(j(this),o);e.push(q);var r=q.getInput().data("dateinput",q);p=p?p.add(r):r});return p?p:this}})(jQuery);

$(function () {
	hasFocusedReturnDate = (getValidationState('Return') != dateValidationState.dateInvalid);

	var onloadDepartureTime;
	var onloadReturnTime;
	if (Sys.Browser.agent === Sys.Browser.Firefox) {
		onloadDepartureTime = $('#DepartureTimeDropDownList').val();
		onloadReturnTime = $('#ReturnTimeDropDownList').val();
	} else {
		onloadDepartureTime = $('#DepartureTimeDropDownList').get(0).selectedIndex;
		onloadReturnTime = $('#ReturnTimeDropDownList').get(0).selectedIndex;
	}

	initialiseDateInput();
	updateDates(true);
	updateWithVehicle();
	setReturnDateVisibility();

	if (Sys.Browser.agent === Sys.Browser.Firefox) {
		$('#DepartureTimeDropDownList').val(onloadDepartureTime);
		$('#ReturnTimeDropDownList').val(onloadReturnTime);
	} else {
		$('#DepartureTimeDropDownList').get(0).selectedIndex = onloadDepartureTime;
		$('#ReturnTimeDropDownList').get(0).selectedIndex = onloadReturnTime;
	}

	$('#MelToDpoDropDownList, #DpoToMelDropDownList').click(handleDirectionChanged);
	$('#DepartureDayDropDownList, #DepartureMonthYearDropDownList').change(function (event, date) { handleDepartureChanged(false); updateDateInput(event, date); });
	$('#ReturnDayDropDownList, #ReturnMonthYearDropDownList').change(function (event, date) { handleReturnChanged(false); updateDateInput(event, date); });
	$('#ReturnDayDropDownList, #ReturnMonthYearDropDownList, #ReturnTimeDropDownList').focus(function () { hasFocusedReturnDate = true; });
	$('#DepartureTimeDropDownList').change(function () { handleSailingTimeChanged('Departure'); });
	$('#ReturnTimeDropDownList').change(function () { handleSailingTimeChanged('Return'); });
	$('#WithTrailerCheckBox').click(updateWithVehicle);
	$('#ReturnRadioButton, #OneWayRadioButton').click(handleFareTypeChanged);

	$("#passenger-tooltip").tooltip({ tip: '#passenger-tooltip-popup', position: 'center right', offset: [0, 5] });
});

var dateValidationState = { valid: 0, timeEmpty: 1, dateInvalid: 2 };
var hasFocusedReturnDate;

function handleDirectionChanged() {
	if (getSailingDirection() != sailingDirection.empty) {
		$('#DirectionValidator').hide();
	}
	updateDates(false);
}

function updateDates(loading) {
	if (!handleDepartureChanged(loading)) {
		handleReturnChanged(loading);
	}
	if (loading) {
		var date = Date.parseInvariant($('#DepartureDayDropDownList').val() + ' ' + $('#DepartureMonthYearDropDownList').val(), 'dd MMM yyyy');
		if (date) {
			$('#DepartureDayDropDownList').data('dateinput').setValue(date);
		}
		date = Date.parseInvariant($('#ReturnDayDropDownList').val() + ' ' + $('#ReturnMonthYearDropDownList').val(), 'dd MMM yyyy');
		if (date) {
			$('#ReturnDayDropDownList').data('dateinput').setValue(date);
		}
	}
}

function handleFareTypeChanged() {
	$('#FareTypeValidator').hide();
	setReturnDateVisibility();
}

function setReturnDateVisibility() {
	if ($('#OneWayRadioButton').is(':checked')) {
		$('#return-date-row').hide();
	} else {
		$('#return-date-row').show();
	}
}

function updateWithVehicle() {
	if ($('#WithTrailerCheckBox').is(':checked')) {
		$('#WithVehicleCheckBox').attr('checked', true);
	}
}

function updateDateValidation(ddp, vm, loading) {
	if (getValidationState(ddp) != dateValidationState.dateInvalid) {
		if (!loading) {
			$('#' + ddp + 'DateValidator').hide();
		}
	} else {
		var dateValidatorID = '#' + ddp + 'DateValidator';
		$(dateValidatorID).html(validationPrefix + vm + validationSuffix);
		tryRunPngFix(dateValidatorID);

		if ($('#' + ddp + 'DayDropDownList').val() != '' && $('#' + ddp + 'MonthYearDropDownList').val() != '') {
			$('#' + ddp + 'DateValidator').show();
		}
	}
}

function handleDepartureChanged(loading) {
	var updatedReturn = false;
	$('#DepartureTimeDropDownList option').remove();
	updateDateValidation('Departure', swValidationMessages.departureDateInvalid, loading);

	var sd = getSailingDirection();
	if (sd != sailingDirection.empty) {
		updateSailingTimes('Departure', sd == sailingDirection.melDpo ? sailingTimesMelDpo : sailingTimesDpoMel, function (date) {
			if (!hasFocusedReturnDate || ($('#ReturnDayDropDownList').val() == '' && $('#ReturnMonthYearDropDownList').val() == '')) {
				date.setDate(date.getDate() + 7);
				var m = date.format('MMM yyyy');
				if ($('#ReturnMonthYearDropDownList').find('option[text="' + m + '"]').length === 1) {
					$('#ReturnDayDropDownList').val(date.format('dd')).data('dateinput').setValue(date);
					$('#ReturnMonthYearDropDownList').val(m);
				} else {
					$('#ReturnDayDropDownList').val('');
					$('#ReturnMonthYearDropDownList').val('');
				}
				handleReturnChanged(loading);
				updatedReturn = true;
			}
		});
	} else if (getValidationState('Departure') != dateValidationState.dateInvalid) {
		$('#DepartureSelectDirectionMessage').show();
	}

	return updatedReturn;
}

function handleReturnChanged(loading) {
	$('#ReturnTimeDropDownList option').remove();
	updateDateValidation('Return', swValidationMessages.returnDateInvalid, loading);

	var sd = getSailingDirection();
	if (sd != sailingDirection.empty) {
		updateSailingTimes('Return', sd == sailingDirection.melDpo ? sailingTimesDpoMel : sailingTimesMelDpo);
	} else if (getValidationState('Return') != dateValidationState.dateInvalid) {
		$('#ReturnSelectDirectionMessage').show();
	}
}

function updateSailingTimes(ddp, sailingTimes, callOnValid) {
	$('#' + ddp + 'SelectDirectionMessage').hide();
	$('#' + ddp + 'NoSailingsMessage').hide();

	var jddl = $('#' + ddp + 'TimeDropDownList');

	var dayMonthYear = $('#' + ddp + 'DayDropDownList').val() + ' ' + $('#' + ddp + 'MonthYearDropDownList').val();
	var date = Date.parseInvariant(dayMonthYear, 'dd MMM yyyy');
	if (date != null) {
		if (!updateSailingTimesDropDownList(jddl.get(0), date, sailingTimes)) {
			$('#' + ddp + 'NoSailingsMessage').show();
		}

		if (callOnValid) {
			callOnValid(date);
		}
	}
}

function handleSailingTimeChanged(ddp) {
	if ($('#' + ddp + 'TimeDropDownList').val() != '') {
		$('#' + ddp + 'DateValidator').hide();
	}
}

function validateDepartureDate(sender, args) {
	if (getSailingDirection() != sailingDirection.empty) {
		var validationState = getValidationState('Departure');
		args.IsValid = validationState == 0;
		sender.innerHTML = validationPrefix + (validationState == 1 ? swValidationMessages.departureSailingTimeRequired : swValidationMessages.departureDateInvalid) + validationSuffix;
		tryRunPngFix(sender);
	}
}

function getValidationState(ddp) {
	var day = $('#' + ddp + 'DayDropDownList').val() || '';
	var monthYear = $('#' + ddp + 'MonthYearDropDownList').val() || '';
	var time = $('#' + ddp + 'TimeDropDownList').val() || '';

	var hasDayMonthYear = day.length > 0 && monthYear.length > 0;
	if (hasDayMonthYear && Date.parseInvariant(day + ' ' + monthYear, 'dd MMM yyyy')) {
		return (time.length != 0) ? dateValidationState.valid : dateValidationState.timeEmpty;
	} else {
		return dateValidationState.dateInvalid;
	}
}

function validateReturnDate(sender, args) {
	if (getSailingDirection() != sailingDirection.empty && $('#ReturnRadioButton').is(':checked')) {
		var vs = getValidationState('Return');
		args.IsValid = vs == dateValidationState.valid;
		sender.innerHTML = validationPrefix + (vs == dateValidationState.timeEmpty ? swValidationMessages.returnSailingTimeRequired : swValidationMessages.returnDateInvalid) + validationSuffix;

		if (args.IsValid) {
			if (getValidationState('Departure') == dateValidationState.valid) {
				args.IsValid = getSelectedDepartureDate() < getSelectedReturnDate();
				sender.innerHTML = validationPrefix + swValidationMessages.returnDateBeforeDepartureDate + validationSuffix;
			}
		}
		tryRunPngFix(sender);
	}
}

function getSelectedDepartureDate() {
	return dateParseInvariant($('#DepartureDayDropDownList').val(), $('#DepartureMonthYearDropDownList').val(), $('#DepartureTimeDropDownList').val());
}

function getSelectedReturnDate() {
	return dateParseInvariant($('#ReturnDayDropDownList').val(), $('#ReturnMonthYearDropDownList').val(), $('#ReturnTimeDropDownList').val());
}

function dateParseInvariant(day, month, time) {
	return Date.parseInvariant(day + ' ' + month + ' ' + time, 'dd MMM yyyy HH:mm');
}

function validatePassengerCount(sender, args) {
	var ac = parseInt($('#AdultCountDropDownList').val(), 10);
	var cc = parseInt($('#ChildCountDropDownList').val(), 10);
	var ic = parseInt($('#InfantCountDropDownList').val(), 10);
	var pc = parseInt($('#PensionerCountDropDownList').val(), 10);

	if (ac == 0 && pc == 0) {
		args.IsValid = false;
		sender.innerHTML = validationPrefix + swValidationMessages.adultOrPensionerRequired + validationSuffix;
		tryRunPngFix(sender);
	}
}

function validateDirection(sender, args) {
	args.IsValid = getSailingDirection() != sailingDirection.empty;
}

function validateFareType(sender, args) {
	args.IsValid = $('#ReturnRadioButton').is(':checked') || $('#OneWayRadioButton').is(':checked');
}

function getSailingDirection() {
	var melDpo = $('#MelToDpoDropDownList').is(':checked');
	var dpoMel = $('#DpoToMelDropDownList').is(':checked');

	return melDpo ? sailingDirection.melDpo : (dpoMel ? sailingDirection.dpoMel : sailingDirection.empty);
}

function tryRunPngFix(sender) {
	if (typeof runPngFix !== typeof undefined) {
		runPngFix($(sender).find('img.png'));
	}
}

function showWaitIcon() {
	if (Page_IsValid) {
		setTimeout('$(".wait-icon").show()', 200);
	}
}

function showCalendarFromSearch() {
	var sd = getSailingDirection();
	if (sd == sailingDirection.empty) {
		$('#DirectionValidator').show();
		return false;
	} else {
		var isReturn = $('#ReturnRadioButton').is(':checked');
		return showCalendar({
				departurePort: sd == sailingDirection.dpoMel ? 'DPO' : 'MEL',
				returnPort: isReturn ? (sd == sailingDirection.dpoMel ? 'MEL' : 'DPO') : null,
				departureDate: getSelectedDepartureDate() || dateParseInvariant($('#DepartureDayDropDownList').val(), $('#DepartureMonthYearDropDownList').val(), '00:00') || dateParseInvariant('01', $('#DepartureMonthYearDropDownList').val(), '00:00'),
				returnDate: isReturn ? (getSelectedReturnDate() || dateParseInvariant($('#ReturnDayDropDownList').val(), $('#ReturnMonthYearDropDownList').val(), '00:00') || dateParseInvariant('01', $('#ReturnMonthYearDropDownList').val(), '00:00')) : null,
				withPensioners: $('#PensionerCountDropDownList').val() != '0',
				withVehicle: $('#WithVehicleCheckBox').is(':checked'),
				withTrailer: $('#WithTrailerCheckBox').is(':checked'),
				selectDatesCallback: setFromAvailabilityCalendar
			});
	}
}

function setFromAvailabilityCalendar(selectedDepartureDate, selectedReturnDate) {
	$('#DepartureDayDropDownList').val(selectedDepartureDate.format('dd'));
	$('#DepartureMonthYearDropDownList').val(selectedDepartureDate.format('MMM yyyy'));
	$('#DepartureMonthYearDropDownList').change();
	$('#DepartureTimeDropDownList').val(selectedDepartureDate.format('HH:mm'));
	if (selectedReturnDate) {
		$('#ReturnDayDropDownList').val(selectedReturnDate.format('dd'));
		$('#ReturnMonthYearDropDownList').val(selectedReturnDate.format('MMM yyyy'));
		$('#ReturnMonthYearDropDownList').change();
		$('#ReturnTimeDropDownList').val(selectedReturnDate.format('HH:mm'));
	}
}

function initialiseDateInput() {
	$('select.day')
	.dateinput({
		format: 'dd',
		trigger: function (input) { return input.nextAll('img').eq(0); },
		min: baseDate,
		max: lastDate
	})
	.change(function (event, date) {
		if (date) {
			var el = $(this);
			el.nextAll('select.month').eq(0).val(date.format('MMM yyyy'));
		}
	});
	$('#calroot').bgiframe();
}

function updateDateInput(event, date) {
	if (!date) {
		var ddp = event.target.id.startsWith('Departure') ? 'Departure' : 'Return',
			daySelector = $('#' + ddp + 'DayDropDownList'),
			day = daySelector.val() || '',
			monthYear = $('#' + ddp + 'MonthYearDropDownList').val() || '';

		if (day.length && monthYear.length) {
			daySelector.data('dateinput').setValue(Date.parseInvariant(day + ' ' + monthYear, 'dd MMM yyyy'));
		}
	}
}
