/* Create a Payment option */
function paymentOption(id,payment_option,price) {
	this.id = id;
	this.payment_option = payment_option;
	this.price = price;
}

/* Create a Payment group */
function paymentGroup(id,payment_group,options) {
	this.id = id;
	this.payment_group = payment_group;
	this.options = options.split(",");
}

/***************************************************************************
* Update the payment submission form with the price and item description   *
* When a user selects an option from the list                              *
***************************************************************************/
function updateItemValues(form,id) {
					form.amount.value = paymentOptions[id].price;
			form.item_name.value = (paymentOptions[id].payment_option).replace(/&quot;/g,'"');
					}

/***************************************************************************
* Create the array of payment options. This contains all options for the   *
* site.The options available for a given photo are hardwired into the      *
* photo page whichis why we can't use the quick browse methods on payment  *
* enabled sites                                                            *
***************************************************************************/
var paymentOptions = new Object();
paymentOptions[82063] = new paymentOption(82063,'Wristband','2.49');
paymentOptions[82064] = new paymentOption(82064,'Mug ','7.49');
paymentOptions[82065] = new paymentOption(82065,'Wheelie Bin Decal','5.99');
paymentOptions[82066] = new paymentOption(82066,'Car Sticker','1.79');
paymentOptions[82067] = new paymentOption(82067,'P2B Car Sticker 8&quot;x 2.5&quot;','2.29');
paymentOptions[82068] = new paymentOption(82068,'P2B Car Sticker 12&quot;x 3&quot;','2.79');
paymentOptions[82038] = new paymentOption(82038,'Tax Disc Holder','2.49');
paymentOptions[79106] = new paymentOption(79106,'Bubble Gum','1.99');
paymentOptions[82034] = new paymentOption(82034,'Fresh Apple','1.99');
paymentOptions[82035] = new paymentOption(82035,'Tutti Frutti','1.99');
paymentOptions[82036] = new paymentOption(82036,'Vanilla','1.99');
/***************************************************************************
* Create the array of payment groups. If site does notuse groups create    *
* just one with an ID of 0                                                 *
***************************************************************************/
var paymentGroups = new Object();
paymentGroups[24508] = new paymentGroup(24508,'Air Fresheners','79106,82034,82035,82036');
	paymentGroups[25476] = new paymentGroup(25476,'Car Sticker','82066');
	paymentGroups[25474] = new paymentGroup(25474,'Mugs','82064');
	paymentGroups[25477] = new paymentGroup(25477,'P2B Car Sticker','82067,82068');
	paymentGroups[25468] = new paymentGroup(25468,'Tax Disc','82038');
	paymentGroups[25475] = new paymentGroup(25475,'Wheelie Bin Decal','82065');
	paymentGroups[25473] = new paymentGroup(25473,'Wristband','82063');
	/***************************************************************************
* Get payment options field for given payment group                        *
***************************************************************************/
function getPaymentOptions(payment_groups_id) {
	var temp = '';
		
		
		if(paymentGroups[payment_groups_id].options[0] != ''){
		$.each(paymentGroups[payment_groups_id].options, function(i){
						
			paymentOption = paymentOptions[paymentGroups[payment_groups_id].options[i]];
			temp = temp + '<option  value="' + paymentOption.id + '">' + paymentOption.payment_option + ' - &pound;' + paymentOption.price + '</option>';
		});
	}
		return temp;
}


