/* 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[28316] = new paymentOption(28316,'A4 Gloss Print','15.00');
paymentOptions[28317] = new paymentOption(28317,'12 x 8 Gloss Print','15.00');
paymentOptions[74859] = new paymentOption(74859,'Woodland Birds Photography Workshop Deposit Single Payment','25.00');
paymentOptions[74903] = new paymentOption(74903,'Balance Payment per person for Max 2 person Woodland Birds Photography Workshop','50.00');
paymentOptions[82551] = new paymentOption(82551,'Deposit for 2 x Persons on Woodland Photography Workshop','50.00');
paymentOptions[82552] = new paymentOption(82552,'Full TWO Person Payment for Max 2 Person Woodland Birds Photography Workshop','150.00');
paymentOptions[28318] = new paymentOption(28318,'A4 Lustre Print','15.00');
paymentOptions[74904] = new paymentOption(74904,'Balance Payment for single person Woodland Birds Photography Workshop','70.00');
paymentOptions[74860] = new paymentOption(74860,'Full Single Payment for Max 2 Person Woodland Birds Photography Workshop','75.00');
paymentOptions[28319] = new paymentOption(28319,'12 x 8 Lustre Print','15.00');
paymentOptions[30534] = new paymentOption(30534,'6 x 4 Gloss Print','5.00');
paymentOptions[74861] = new paymentOption(74861,'Full Payment for Single Person Woodland Birds Photography Workshop','95.00');
paymentOptions[21066] = new paymentOption(21066,'Low Res Image file (72 DPI)','15.00');
paymentOptions[21067] = new paymentOption(21067,'Medium Res Image file (150 DPI)','25.00');
paymentOptions[21068] = new paymentOption(21068,'High Res Image file (300 DPI)','35.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[6281] = new paymentGroup(6281,'Digital File','21066,21067,21068');
			paymentGroups[8708] = new paymentGroup(8708,'Prints','28316,28317,28318,28319,30534');
			paymentGroups[23123] = new paymentGroup(23123,'Workshop Deposit','74859,74903,82551,82552,74904,74860,74861');
			paymentGroups[9403] = new paymentGroup(9403,'Zoe & Paul Wedding Prints','28317,30534,21066,21067,21068');
	/***************************************************************************
* 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;
}


