var CityWalkDinnerPanel = Class.create(Panel, {
    initialize: function ($super, passportReference, tridionPanelId, panelPosition) {
		$super(passportReference, tridionPanelId);
		this.panelId = 'CityWalkDinner';
		this.strParams = [jsHelper.formatDate(new Date(), 'm/d/Y'), jsHelper.formatDate(jsHelper.fromString('month+4'), 'm/d/Y')];
		this.panelPosition = panelPosition;
		this.classPrefix = 'cwd';
    },
    doWork: function () {
		var adultChildInput = this.panelHTML.select('[name=inputAdultChildQuantity]')[0];
		
		this.__setupInput(adultChildInput);
		
		var dataCollection = this.data.Edj;
		var calendarEl = this.panelHTML.select('.calendarLayer')[0];
		var spanDateEl = this.panelHTML.select('[id=cwdDateSelected]')[0];
		var spanPriceEl = this.panelHTML.select('[id=cwdPrice2]')[0];
		var spanTotalPriceEl = this.panelHTML.select('[id=cwdTotalPrice]')[0];
		
		this.__setupStaticCalendarWithNoTicket(dataCollection, false, calendarEl, adultChildInput, spanDateEl, spanPriceEl, spanTotalPriceEl);
		
		this.__setupAddToCart();
		this.__loadValues(['text/inputAdultChildQuantity', 'calendar/calendar']);
    },
	_formatDataAndSend: function (data) {
		var dateSelected = jsHelper.formatDate(this.calendar.options.selectedDate, 'm/d/Y');
		var itemSelected = this.eventItemSelected;
		var dataFormatted = {
			eventID: itemSelected.Eid.trim(),
			plu: itemSelected.PLU.trim(),
			resourceID: itemSelected.Rid.trim(),
			qty: data.inputAdultChildQuantity,
			date: dateSelected,
			catalogName: data.hdnVirtualCatalog
		};
		this.passportReference.addEventToCart(dataFormatted);
    },
	_validateInputData: function (data) {
		var quantity = jsHelper.toInt(data.inputAdultChildQuantity);
		return (quantity > 0 && this.eventItemSelected != null);
    }
});
