/* 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[82443] = new paymentOption(82443,'12 x 8 Print mounted at 16 x 12ins','35.00');
paymentOptions[82444] = new paymentOption(82444,'18 x 12 Print mounted at 24 x 16ins','55.00');
paymentOptions[82445] = new paymentOption(82445,'16 x 12 Frame','59.00');
paymentOptions[82446] = new paymentOption(82446,'24 x 16 Framed','80.00');
paymentOptions[74371] = new paymentOption(74371,'Canvas Wrap - 24 x 16 ins','75.00');
paymentOptions[74372] = new paymentOption(74372,'Canvas Wrap - 30 x 20 ins','95.00');
paymentOptions[74373] = new paymentOption(74373,'Canvas Wrap - 36 x 24 ins','145.00');
paymentOptions[74374] = new paymentOption(74374,'Canvas Wrap - 40 x 30 ins','165.00');
paymentOptions[74375] = new paymentOption(74375,'Canvas Wrap - 42 x 30 ins','195.00');
paymentOptions[74376] = new paymentOption(74376,'Canvas Wrap - 48 x 36 ins','220.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[22952] = new paymentGroup(22952,'Gallery Wrap Canvas','74371,74372,74373,74374,74375,74376');
			paymentGroups[25585] = new paymentGroup(25585,'Mounted Giclee Prints','82443,82444');
			paymentGroups[25587] = new paymentGroup(25587,'Mounted print framed in Black Ash','82445,82446');
			paymentGroups[25586] = new paymentGroup(25586,'Mounted print framed in Natural Ash','82445,82446');
	/***************************************************************************
* 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;
}


