/* 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[32738] = new paymentOption(32738,'6 x 4&quot; print ','7.00');
paymentOptions[32739] = new paymentOption(32739,'7 x 5&quot; print','8.00');
paymentOptions[32740] = new paymentOption(32740,'9 x 6&quot; print','9.00');
paymentOptions[52109] = new paymentOption(52109,'9 x 9&quot; print','10.00');
paymentOptions[32741] = new paymentOption(32741,'10 x 8&quot; print','10.00');
paymentOptions[52108] = new paymentOption(52108,'10 x 10&quot; print','12.00');
paymentOptions[57498] = new paymentOption(57498,'9 x 6&quot; reprint ','8.00');
paymentOptions[32747] = new paymentOption(32747,'9 x 6&quot; retouched print','25.00');
paymentOptions[40983] = new paymentOption(40983,'9 x 6&quot; retouched print + high res JPEG','33.00');
paymentOptions[32746] = new paymentOption(32746,'10 x 8&quot; retouched print','30.00');
paymentOptions[40984] = new paymentOption(40984,'10 x 8&quot; retouched print + high res JPEG','38.00');
paymentOptions[32748] = new paymentOption(32748,'12 x 8&quot; retouched print','35.00');
paymentOptions[40985] = new paymentOption(40985,'12 x 8&quot; retouched print + high res JPEG','43.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[10163] = new paymentGroup(10163,'Event prints','32739,32740,32741');
			paymentGroups[10162] = new paymentGroup(10162,'Limited edition prints','');
			paymentGroups[10160] = new paymentGroup(10160,'Portrait prints','57498,32747,40983,32746,40984,32748,40985');
			paymentGroups[10161] = new paymentGroup(10161,'Wedding prints','32739,32740,52109,32741,52108');
	/***************************************************************************
* 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;
}


