/* 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[38923] = new paymentOption(38923,'12 x 8in       (30 x 20cm) print','29.00');
paymentOptions[38960] = new paymentOption(38960,'12 x 10in   (30 x 26cm) print','32.00');
paymentOptions[38963] = new paymentOption(38963,'16 x 12in  (40 x 30cm) print','39.00');
paymentOptions[38964] = new paymentOption(38964,'18 x 12in  (46 x 30cm) print','42.00');
paymentOptions[38965] = new paymentOption(38965,'20 x 16in  (51 x 40cm) print','64.50');
paymentOptions[38966] = new paymentOption(38966,'24 x 16in  (61 x 40cm) print','79.00');
paymentOptions[38967] = new paymentOption(38967,'30 x 20in  (76 x 51cm) print','99.00');
paymentOptions[38968] = new paymentOption(38968,'16 x 12in  (40 x 30cm) stretched canvas','89.00');
paymentOptions[38969] = new paymentOption(38969,'20 x 16in  (51 x 40cm) stretched canvas','109.00');
paymentOptions[38970] = new paymentOption(38970,'24 x 16in  (61 x 40cm) stretched canvas','129.00');
paymentOptions[38971] = new paymentOption(38971,'20 x 30in  (51 x 76cm) stretched canvas','159.00');
paymentOptions[38972] = new paymentOption(38972,'36 x 24in  (91 x 61cm) stretched canvas','199.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[0] = new paymentGroup(0,'Default group','38923,38960,38963,38964,38965,38966,38967,38968,38969,38970,38971,38972');
/***************************************************************************
* 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;
}


