/* 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[70762] = new paymentOption(70762,'26 x 21cm  10 x 8&quot;','20.00');
paymentOptions[71690] = new paymentOption(71690,'26 x 21 cm  10 x 8&quot;','20.00');
paymentOptions[70770] = new paymentOption(70770,'30 x 26 cm  12 x 10&quot;','30.00');
paymentOptions[71688] = new paymentOption(71688,'40 x 30 cm   16 x 12&quot;','40.00');
paymentOptions[70768] = new paymentOption(70768,'46 x 40 cm   18 x 16&quot;','60.00');
paymentOptions[71682] = new paymentOption(71682,'60 x 40cm   24 x 16&quot;','75.00');
paymentOptions[71689] = new paymentOption(71689,'75 x 50 cm  30 x 20&quot;','90.00');
paymentOptions[70764] = new paymentOption(70764,'Diaries 60 x 40 cm','50.00');
paymentOptions[70769] = new paymentOption(70769,'Diaries 75 x 50 cm','75.00');
paymentOptions[70765] = new paymentOption(70765,'Face up 60 x 40 cm','50.00');
paymentOptions[70771] = new paymentOption(70771,'Face Up 75 x 50 cm','75.00');
paymentOptions[70804] = new paymentOption(70804,'Face Up Posters','75.00');
paymentOptions[74707] = new paymentOption(74707,'Marble and Slate','50.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[21876] = new paymentGroup(21876,'Abbandonata','70762,71690,70770,71688,70768,71682,71689');
			paymentGroups[21409] = new paymentGroup(21409,'Addenbrookes Hospital','70762,71690,70770,71688,70768,71682,71689');
			paymentGroups[21880] = new paymentGroup(21880,'Cambridge Museum of Technology','70762,71690,70770,71688,70768,71682,71689');
			paymentGroups[22142] = new paymentGroup(22142,'Cambridge Museum of Technology Installation','70762,71690,70770,71688,70768,71682,71689');
			paymentGroups[21878] = new paymentGroup(21878,'Diaries','70764,70769');
			paymentGroups[21881] = new paymentGroup(21881,'Face Up - The World in Your Face','70765,70771');
			paymentGroups[21893] = new paymentGroup(21893,'Face up Posters','70804');
			paymentGroups[21879] = new paymentGroup(21879,'Leper Chapel Cambridge','70762,71690,70770,71688,70768,71682,71689');
			paymentGroups[23068] = new paymentGroup(23068,'Marble and Slate','');
			paymentGroups[21877] = new paymentGroup(21877,'Sardinian Images','70762,71690,70770,71688,70768,71682,71689');
	/***************************************************************************
* 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;
}


