/* 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[49812] = new paymentOption(49812,'6 x 4 Prints','4.50');
paymentOptions[49811] = new paymentOption(49811,'7 x 5 Prints','5.50');
paymentOptions[80562] = new paymentOption(80562,'8 x 6 Prints','7.00');
paymentOptions[49810] = new paymentOption(49810,'10 x 8 Prints','8.50');
paymentOptions[49809] = new paymentOption(49809,'A4 Prints','10.00');
paymentOptions[49807] = new paymentOption(49807,'A3 Prints','13.50');
paymentOptions[73105] = new paymentOption(73105,'A2 Prints','25.50');
paymentOptions[73106] = new paymentOption(73106,'A1 Prints','35.50');
paymentOptions[63840] = new paymentOption(63840,'Canvas A3 Size','40.00');
paymentOptions[63839] = new paymentOption(63839,'Canvas A2 Size','80.00');
paymentOptions[49808] = new paymentOption(49808,'Canvas A1 size','114.00');
/***************************************************************************
* Create the array of payment groups. If site does notuse groups create    *
* just one with an ID of 0                                                 *
***************************************************************************/
var paymentGroups = new Object();
			paymentGroups[15123] = new paymentGroup(15123,'prices for all groups','49812,49811,80562,49810,49809,49807,73105,73106,63840,63839,49808');
	/***************************************************************************
* 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;
}


