var CityWalkPartyPassPanel = Class.create(Panel, {
    initialize: function ($super, passportReference, tridionPanelId, panelPosition) {
		$super(passportReference, tridionPanelId);
		this.panelId = 'CityWalkPartyPass';
		this.panelPosition = panelPosition;
		this.strParams = [];
		this.classPrefix = 'cwpp';
    },
    doWork: function () {
		this.adultChildInput = this.panelHTML.select('[name=inputAdultChildQuantity]')[0];
	
		this.__setupInput(this.adultChildInput);
		
		this.cwppData = this.__filterDataGroupByProperty(this.data, 'Description');
		
		var bt = this.panelHTML.select('.park2Table')[0];

		this.__generateRowsFor1Price('dp1', 'productVariantCatalog', this.cwppData, bt, this.adultChildInput);

		this.__setupAddToCart();
		this.__loadValues(['text/inputAdultChildQuantity', 'radio/productVariantCatalog']);
    },
	_calculateTotalPrices: function() {
		this.__generateTotalPrice1Price('dp1', this.cwppData, this.adultChildInput);
	},
	_formatDataAndSend: function (data) {
        var ppqc = data.productVariantCatalog.split('|');
        var dataFormatted = {
            productID: ppqc[0],
            productVariantID: ppqc[1],
            qty: data.inputAdultChildQuantity,
            catalogName: ppqc[2]
        };
        this.passportReference.addToCart(dataFormatted);
    },
	_validateInputData: function (data) {
		var adultQuantity = jsHelper.toInt(data.inputAdultChildQuantity);
		return (data.productVariantCatalog != undefined && (adultQuantity > 0));
    }
});
