/* 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[52279] = new paymentOption(52279,'Hahnemuhle William Turner  Print  40cm  x40cm','160.00');
paymentOptions[52280] = new paymentOption(52280,'Hahnemuhle William Turner  Print  50cm x 50cm','200.00');
paymentOptions[52281] = new paymentOption(52281,'Innova D\'Vinci FB Soft Gloss  Paper  40cm x 50cm','160.00');
paymentOptions[52282] = new paymentOption(52282,'Innova D\'Vinci FB Soft Gloss  Paper 50cm x60cm','200.00');
paymentOptions[61046] = new paymentOption(61046,'Ilford Galerie Smooth Pearl  20in x 12in','60.00');
paymentOptions[61396] = new paymentOption(61396,'Innova D\' Vinci FB Soft Gloss 300g paper   17in  x  9in','100.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[18779] = new paymentGroup(18779,'17in  X  9in','61396');
			paymentGroups[18711] = new paymentGroup(18711,'20in x 12in','61046');
			paymentGroups[16363] = new paymentGroup(16363,'40cm x 50cm','52281,52282');
			paymentGroups[16362] = new paymentGroup(16362,'50cm x50cm','52279,52280');
	/***************************************************************************
* 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;
}


