/* 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[18646] = new paymentOption(18646,'A4 Signed Open Edition print (UK P&P incl.)','35.00');
paymentOptions[38152] = new paymentOption(38152,'A3+ Signed Open Edition print (UK P&P incl.)','65.00');
paymentOptions[77326] = new paymentOption(77326,'A4 Signed Limited Edition of 150 (UK P&P incl.)','55.00');
paymentOptions[76492] = new paymentOption(76492,'A3+ Signed Limited Edition of 150 (UK P&P incl.)','95.00');
paymentOptions[76494] = new paymentOption(76494,'Five A6 Greetings Cards (P&P incl.  UK only)','7.50');
paymentOptions[76495] = new paymentOption(76495,'Ten A6 Greetings Cards (P&P incl.  UK only)','14.00');
paymentOptions[76501] = new paymentOption(76501,'1 Pk of 5 Assorted A6 Cards (UK P&P incl.)','7.50');
paymentOptions[76502] = new paymentOption(76502,'2 Pks of 5 Assorted A6 Cards (UK P&P incl.)','14.00');
paymentOptions[76520] = new paymentOption(76520,'5 A6 Xmas Cards (P&P incl. UK only)','7.50');
paymentOptions[76500] = new paymentOption(76500,'10 A6 Xmas cards (P&P incl. UK only)','13.00');
paymentOptions[76499] = new paymentOption(76499,'20 A6 Xmas cards (P&P incl. UK only)','23.00');
paymentOptions[76543] = new paymentOption(76543,'22 Postcards (2 of each) P&P incl. UK only','5.50');
paymentOptions[76544] = new paymentOption(76544,'24 Postcards (2 of each) P&P incl. UK only','6.00');
paymentOptions[76547] = new paymentOption(76547,'25 Postcards  (P&P incl. UK only)','6.25');
paymentOptions[76548] = new paymentOption(76548,'50 Postcards (P&P incl UK only)','11.00');
paymentOptions[76596] = new paymentOption(76596,'5 Panoramic Cards (P&P incl. UK only)','11.00');
paymentOptions[76597] = new paymentOption(76597,'10 Panoramic Cards (P&P incl. UK only)','20.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[23603] = new paymentGroup(23603,'22 Postcards','76543');
			paymentGroups[23604] = new paymentGroup(23604,'24 Postcards','76544');
			paymentGroups[23593] = new paymentGroup(23593,'Assorted A6','76501,76502');
			paymentGroups[23585] = new paymentGroup(23585,'Limited edition of 150','77326,76492');
			paymentGroups[23584] = new paymentGroup(23584,'Open editions','18646,38152,76494,76495');
			paymentGroups[23630] = new paymentGroup(23630,'Panoramic Cards','76596,76597');
			paymentGroups[23606] = new paymentGroup(23606,'Single Postcards','76547,76548');
			paymentGroups[23594] = new paymentGroup(23594,'Xmas Cards','76520,76500,76499');
	/***************************************************************************
* 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;
}


