/* 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[29602] = new paymentOption(29602,'6x4','1.50');
paymentOptions[29603] = new paymentOption(29603,'7x5','2.50');
paymentOptions[29604] = new paymentOption(29604,'A5','3.00');
paymentOptions[29605] = new paymentOption(29605,'8x6','3.50');
paymentOptions[29606] = new paymentOption(29606,'10x7','4.00');
paymentOptions[29607] = new paymentOption(29607,'10x8','4.50');
paymentOptions[29608] = new paymentOption(29608,'12x6','5.00');
paymentOptions[18651] = new paymentOption(18651,'A4 ','6.00');
paymentOptions[29609] = new paymentOption(29609,'12x10','7.00');
paymentOptions[18653] = new paymentOption(18653,'A3 ','15.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','29602,29603,29604,29605,29606,29607,29608,18651,29609,18653');
/***************************************************************************
* Get payment options field for given payment group                        *
***************************************************************************/
function getPaymentOptions(payment_groups_id) {
	var temp = '';
		
		
		if(paymentGroups[payment_groups_id].options[0] != ''){
		for (var i in paymentGroups[payment_groups_id].options) {
						
			paymentOption = paymentOptions[paymentGroups[payment_groups_id].options[i]];
			temp = temp + '<option  value="' + paymentOption.id + '">' + paymentOption.payment_option + ' - &pound;' + paymentOption.price + '</option>';
		}
	}
		return temp;
}


