/* 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[81429] = new paymentOption(81429,'Greetings Card (blank inside) inc P&P','2.95');
paymentOptions[77759] = new paymentOption(77759,'Limited Edition of 20 A2 Framed','345.00');
paymentOptions[41650] = new paymentOption(41650,'7x5 Mounted inc P&P','13.00');
paymentOptions[78019] = new paymentOption(78019,'7x5 Mounted with Natural Wood Frame inc P&P','27.00');
paymentOptions[44419] = new paymentOption(44419,'7x5 Mounted with Black Frame inc P&P','27.00');
paymentOptions[41654] = new paymentOption(41654,'A4 Mounted inc P&P','24.50');
paymentOptions[78020] = new paymentOption(78020,'A4 Mounted with Natural Wood Frame inc P&P','49.50');
paymentOptions[44420] = new paymentOption(44420,'A4 Mounted with Black Frame inc P&P','49.50');
paymentOptions[41655] = new paymentOption(41655,'A3 Mounted inc P&P','41.50');
paymentOptions[44421] = new paymentOption(44421,'A3 Mounted with Natural Wood Frame inc P&P','73.00');
paymentOptions[78021] = new paymentOption(78021,'A3 Mounted with Black Frame inc P&P','73.00');
paymentOptions[54057] = new paymentOption(54057,'Limited Edition Print 16x12&quot; Mounted inc P&P','50.50');
paymentOptions[54058] = new paymentOption(54058,'Limited Edition Print 16x12&quot; Framed inc P&P','89.50');
paymentOptions[47926] = new paymentOption(47926,'Limited Edition Print 20x16&quot; Mounted inc P&P','86.50');
paymentOptions[47927] = new paymentOption(47927,'Limited Edition Print 20x16&quot; Framed inc P&P','170.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[12842] = new paymentGroup(12842,'7 x 5&quot;','41650,78019,44419');
			paymentGroups[12845] = new paymentGroup(12845,'A3 Mounted','78020,41655,44421,78021');
			paymentGroups[12844] = new paymentGroup(12844,'A4 Mounted','41650,78019,44419,41654,78020,44420');
			paymentGroups[25204] = new paymentGroup(25204,'Greetings Card (Blank Inside)','81429');
			paymentGroups[12846] = new paymentGroup(12846,'Greetings Card, 7 x 5&quot; A4, A3 mounted ','41650,78019,44419,41654,78020,44420,41655,44421,78021');
			paymentGroups[12843] = new paymentGroup(12843,'Greetings Card, 7 x 5&quot; and A4 Mounted','41650,78019,44419,41654,78020,44420');
			paymentGroups[14575] = new paymentGroup(14575,'Greetings Card, 7x5&quot; ','41650,44419');
			paymentGroups[14576] = new paymentGroup(14576,'Limited Edition A3 Size','47926,47927');
			paymentGroups[16376] = new paymentGroup(16376,'Limited Edition A4 Size','54057,54058');
			paymentGroups[24002] = new paymentGroup(24002,'Limited Edition of 20 A2 Size','77759');
	/***************************************************************************
* 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;
}


