/* 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[70852] = new paymentOption(70852,'High Resolution jpeg via email','12.00');
paymentOptions[40198] = new paymentOption(40198,'A4 matt finish on 160g/m card.','14.50');
paymentOptions[65276] = new paymentOption(65276,'Glossy Poster ( 40&quot; by 30&quot; )','45.00');
paymentOptions[40672] = new paymentOption(40672,'A4 glossy on premium 255g/m paper','18.50');
paymentOptions[65277] = new paymentOption(65277,'Glossy Poster ( 30&quot; by 20&quot; )','35.00');
paymentOptions[51191] = new paymentOption(51191,'Calendar','7.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[15543] = new paymentGroup(15543,'Calendar','51191');
			paymentGroups[12459] = new paymentGroup(12459,'Photos','70852,40198,65276,40672,65277');
	/***************************************************************************
* 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;
}


