/* 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[56522] = new paymentOption(56522,'Unlimited edition 7.5x11ins (19x28cm) unframed','45.00');
paymentOptions[56523] = new paymentOption(56523,'11x16ins (28x41cm) signed and numbered limited edition of 60 (unframed)','95.00');
paymentOptions[65660] = new paymentOption(65660,'11x16ins (28x41cm) signed and numbered limited edition of 30 (unframed)','105.00');
paymentOptions[56524] = new paymentOption(56524,'15x23ins (38x58cm) signed and numbered limited edition of 30 (unframed)','150.00');
paymentOptions[56653] = new paymentOption(56653,'Unlimited edition 7.5ins square (19cm) unframed','45.00');
paymentOptions[56654] = new paymentOption(56654,'11ins square (28cm) signed and numbered limited edition of 60 (unframed)','95.00');
paymentOptions[56655] = new paymentOption(56655,'15ins square (38mm) signed and numbered limited edition of 30 (unframed)','150.00');
paymentOptions[56598] = new paymentOption(56598,'Unlimited edition 7.5x11ins (18.5x27cm) unframed','45.00');
paymentOptions[56599] = new paymentOption(56599,'Limited edition 15x22ins (38x56cm) signed, numbered 500 edition (unframed)','79.00');
paymentOptions[56600] = new paymentOption(56600,'Original 15x22ins (38x56cm)','600.00');
paymentOptions[74345] = new paymentOption(74345,'Set of 8 different greetings cards (inc. envelopes)','20.00');
paymentOptions[74347] = new paymentOption(74347,'2 sets of 8 different greetings cards','35.00');
paymentOptions[74356] = new paymentOption(74356,'8 \'pick-n-mix\' greetings cards (send a note to say which ones)','20.00');
paymentOptions[74357] = new paymentOption(74357,'16 \'pick-n-mix\' greetings cards (send a note to say which ones)','35.00');
paymentOptions[74346] = new paymentOption(74346,'Postcards','8.00');
paymentOptions[74348] = new paymentOption(74348,'2 sets of postcards','14.00');
paymentOptions[74358] = new paymentOption(74358,'8 \'pick-n-mix\' postcards (send a note to say which ones)','8.00');
paymentOptions[74359] = new paymentOption(74359,'16 \'pick-n-mix\' postcards (send a note to say which ones)','14.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[22936] = new paymentGroup(22936,'Greetings cards','74345,74347,74356,74357');
			paymentGroups[17315] = new paymentGroup(17315,'Photos','56522,56523,56524');
			paymentGroups[17324] = new paymentGroup(17324,'Photos - large size sold out','56522,56523');
			paymentGroups[20047] = new paymentGroup(20047,'Photos - mid size restricted to 30 prints only','56522,65660,56524');
			paymentGroups[17323] = new paymentGroup(17323,'Photos - mid size sold out','56522,56524');
			paymentGroups[17325] = new paymentGroup(17325,'Photos - unlimited edition only, rest sold out','56522');
			paymentGroups[22937] = new paymentGroup(22937,'Postcards','74346,74348,74358,74359');
			paymentGroups[17343] = new paymentGroup(17343,'Square photos','56653,56654,56655');
			paymentGroups[17318] = new paymentGroup(17318,'Watercolours','56598,56599,56600');
			paymentGroups[17321] = new paymentGroup(17321,'Watercolours - limited edition sold, original still available','56598,56600');
			paymentGroups[17322] = new paymentGroup(17322,'Watercolours - only the unlimited edition still available','56598');
			paymentGroups[17320] = new paymentGroup(17320,'Watercolours prints - original sold','56598,56599');
	/***************************************************************************
* 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;
}


