/* 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[72560] = new paymentOption(72560,'Pack of 5 Greetings Cards','7.99');
paymentOptions[72561] = new paymentOption(72561,'Pack of 10 Greetings cards','11.99');
paymentOptions[72569] = new paymentOption(72569,'Rocks and Sand, South Uist, 2008 - signed print','30.00');
paymentOptions[30874] = new paymentOption(30874,'8 inches square print','15.00');
paymentOptions[72557] = new paymentOption(72557,'Reflection, 2011 - 10 inch print','25.00');
paymentOptions[30873] = new paymentOption(30873,'5 inches square print','12.00');
paymentOptions[72558] = new paymentOption(72558,'Reflection, 2011 - framed print','75.00');
paymentOptions[72570] = new paymentOption(72570,'Rocks and Sand, South Uist, 2008 framed print','105.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[22415] = new paymentGroup(22415,'Greetings cards','72560,72561');
			paymentGroups[21384] = new paymentGroup(21384,'Landscapes - 2009 to 2010','30874,30873');
			paymentGroups[22414] = new paymentGroup(22414,'Reflection, 2011','72557,72558');
			paymentGroups[22416] = new paymentGroup(22416,'Rocks and Sand, South Uist, 2008','72569,72570');
			paymentGroups[21385] = new paymentGroup(21385,'Western Isles - 2008','72569,72570');
	/***************************************************************************
* 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;
}


