/* 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[52501] = new paymentOption(52501,'5 pack','5.00');
paymentOptions[52502] = new paymentOption(52502,'1 Card','2.00');
paymentOptions[14339] = new paymentOption(14339,'12x16&quot; Prints','85.00');
paymentOptions[14340] = new paymentOption(14340,'10x12&quot; Prints','55.00');
paymentOptions[14341] = new paymentOption(14341,'Digital print A4 maximum','40.00');
paymentOptions[66118] = new paymentOption(66118,'1 Postcard','0.60');
paymentOptions[14342] = new paymentOption(14342,'Pack of Postcards','4.00');
paymentOptions[14349] = new paymentOption(14349,'Digital image for reproduction','150.00');
paymentOptions[66119] = new paymentOption(66119,'1 Large Postcard','1.20');
paymentOptions[66120] = new paymentOption(66120,'5 Large Postcards','5.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[4342] = new paymentGroup(4342,'Digital prints','14341,14349');
			paymentGroups[15920] = new paymentGroup(15920,'Greetings Cards','52501,52502');
			paymentGroups[20228] = new paymentGroup(20228,'Large Postcards','66119,66120');
			paymentGroups[4341] = new paymentGroup(4341,'Original photographs ','14339,14340,14341');
			paymentGroups[4343] = new paymentGroup(4343,'Postcards','66118,14342');
	/***************************************************************************
* 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;
}


