/* 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[20457] = new paymentOption(20457,'Deposit','300.00');
paymentOptions[49923] = new paymentOption(49923,'Tailored','350.00');
paymentOptions[20661] = new paymentOption(20661,'Balance - Silver (without album)','295.00');
paymentOptions[20662] = new paymentOption(20662,'Balance - Silver (with album)','495.00');
paymentOptions[20663] = new paymentOption(20663,'Balance - Gold (without album)','395.00');
paymentOptions[33130] = new paymentOption(33130,'Balance - Gold (with album)','595.00');
paymentOptions[20664] = new paymentOption(20664,'Balance - Platinum (without album)','625.00');
paymentOptions[33131] = new paymentOption(33131,'Balance - Platinum (with album)','945.00');
paymentOptions[13303] = new paymentOption(13303,'Photo reprint 6&quot;x4&quot;','8.00');
paymentOptions[6609] = new paymentOption(6609,'Photo reprint 7&quot;x5&quot;','10.00');
paymentOptions[6606] = new paymentOption(6606,'Photo reprint 8&quot;x6&quot;','12.00');
paymentOptions[6607] = new paymentOption(6607,'Photo reprint 10&quot;x8&quot;','15.00');
paymentOptions[6608] = new paymentOption(6608,'Photo reprint 15&quot;x10&quot;','25.00');
paymentOptions[39362] = new paymentOption(39362,'Digital image','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[1912] = new paymentGroup(1912,'Photo reprints price band A','13303,6609,6606,6607,6608,39362');
			paymentGroups[6111] = new paymentGroup(6111,'Wedding payment','20457,49923,20661,20662,20663,33130,20664,33131');
	/***************************************************************************
* 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;
}


