/* 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[24229] = new paymentOption(24229,'6x4 (15x10cm) Photo ','1.95');
paymentOptions[24230] = new paymentOption(24230,'8x6 (20x15cm) Photo ','3.50');
paymentOptions[24231] = new paymentOption(24231,'10x8 (25x20cm) Photo ','4.50');
paymentOptions[24232] = new paymentOption(24232,'16x12 (40x30cm) Photo','7.50');
paymentOptions[24233] = new paymentOption(24233,'20x16 (51x40cm) Photo','9.99');
paymentOptions[24234] = new paymentOption(24234,'17x12 (43x30cm) Photo Jigsaw','14.99');
paymentOptions[38003] = new paymentOption(38003,'10x8 (25x20cm) Framed Print','12.95');
/***************************************************************************
* Create the array of payment groups. If site does notuse groups create    *
* just one with an ID of 0                                                 *
***************************************************************************/
var paymentGroups = new Object();
			paymentGroups[7301] = new paymentGroup(7301,'Prices','24229,24230,24231,24232,24233,24234,38003');
	/***************************************************************************
* 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;
}


