/* 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[1461] = new paymentOption(1461,'10x8 Satin Finish Print in 12x10 Mount','15.00');
paymentOptions[7093] = new paymentOption(7093,'15x10 Satin Finish Print in 20x16 Mount','25.00');
paymentOptions[72905] = new paymentOption(72905,'A5 Greetings Cards - pack of 5','8.00');
paymentOptions[72906] = new paymentOption(72906,'A5 Greetings Cards - pack of 10','15.00');
paymentOptions[52463] = new paymentOption(52463,'A6 Note Cards - Pack of 6','4.99');
paymentOptions[56268] = new paymentOption(56268,'One Day Tuition Voucher','99.00');
paymentOptions[56269] = new paymentOption(56269,'Half Day Tuition Voucher','69.00');
paymentOptions[78606] = new paymentOption(78606,'2012 Calendar x 1','7.99');
paymentOptions[78607] = new paymentOption(78607,'2012 Calendar x 2','15.00');
paymentOptions[78608] = new paymentOption(78608,'2012 Calendar x 3','21.00');
paymentOptions[66306] = new paymentOption(66306,'Atmospheric Dorset - Book','9.99');
paymentOptions[56628] = new paymentOption(56628,'Not For Sale','0.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[17331] = new paymentGroup(17331,'A5 Cards','72905,72906');
			paymentGroups[17332] = new paymentGroup(17332,'A6 Note Cards','52463');
			paymentGroups[20280] = new paymentGroup(20280,'Book','66306');
			paymentGroups[17334] = new paymentGroup(17334,'Calendar','78606,78607,78608');
			paymentGroups[17330] = new paymentGroup(17330,'No Sale','56628');
			paymentGroups[17329] = new paymentGroup(17329,'Prints','1461,7093');
			paymentGroups[17333] = new paymentGroup(17333,'Tuition','56268,56269');
	/***************************************************************************
* 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;
}


