/* 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[5016] = new paymentOption(5016,'A5 Unmounted Prints','7.50');
paymentOptions[3413] = new paymentOption(3413,'A4 Unmounted Prints','14.50');
paymentOptions[3412] = new paymentOption(3412,'A3 Unmounted Prints','29.50');
paymentOptions[5018] = new paymentOption(5018,'A5 Mounted Prints','17.50');
paymentOptions[5017] = new paymentOption(5017,'A4 Mounted Prints','22.50');
paymentOptions[5019] = new paymentOption(5019,'A3 Mounted Prints','39.00');
paymentOptions[4770] = new paymentOption(4770,'Photo Art Greetings Cards','1.20');
paymentOptions[7106] = new paymentOption(7106,'Large Photo Art Cards','1.60');
paymentOptions[61512] = new paymentOption(61512,'Prints 7&quot;x5&quot;','8.50');
paymentOptions[61511] = new paymentOption(61511,'Prints 9&quot;x6&quot;','10.50');
paymentOptions[61510] = new paymentOption(61510,'Prints 12&quot;x8&quot;','12.00');
paymentOptions[5267] = new paymentOption(5267,'The Spring Collection (small)','22.00');
paymentOptions[61513] = new paymentOption(61513,'High-resolution jpeg image','8.00');
paymentOptions[5240] = new paymentOption(5240,'The Spring Collection (large)','35.00');
paymentOptions[5446] = new paymentOption(5446,'A5 Limited Edition Print (mounted)','20.00');
paymentOptions[5448] = new paymentOption(5448,'A4 Limited Edition Print (mounted)','26.00');
paymentOptions[5449] = new paymentOption(5449,'A3 Limited Edition Print (mounted)','43.00');
paymentOptions[7110] = new paymentOption(7110,'Bookmark cards','2.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[2076] = new paymentGroup(2076,'Bookmark cards','7110');
			paymentGroups[1241] = new paymentGroup(1241,'Colour and Monochrome Prints','5016,3413,3412,5018,5017,5019');
			paymentGroups[18828] = new paymentGroup(18828,'Events ','61512,61511,61510,61513');
			paymentGroups[2074] = new paymentGroup(2074,'Large Photo Art Cards','7106');
			paymentGroups[1454] = new paymentGroup(1454,'Limited Edition Prints','5446,5448,5449');
			paymentGroups[1191] = new paymentGroup(1191,'Photo art greetings cards','4770');
			paymentGroups[1390] = new paymentGroup(1390,'The Spring Collection ','5267,5240');
	/***************************************************************************
* 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;
}


