/* 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[62905] = new paymentOption(62905,'8&quot; x 20&quot; Print (incl. post to UK)','12.00');
paymentOptions[62854] = new paymentOption(62854,'Any 10 Cards for £8.50 (incl. post to UK)','0.85');
paymentOptions[62896] = new paymentOption(62896,'8&quot; x 10&quot;(includes UK delivery)','7.25');
paymentOptions[83197] = new paymentOption(83197,'10&quot; x !0&quot;','9.50');
paymentOptions[83198] = new paymentOption(83198,'17&quot; x 17&quot;','26.00');
paymentOptions[63113] = new paymentOption(63113,'12&quot; x 16&quot;','14.00');
paymentOptions[63114] = new paymentOption(63114,'16&quot; x 22&quot;','25.50');
paymentOptions[63115] = new paymentOption(63115,'12&quot; x 30&quot;','25.75');
paymentOptions[63116] = new paymentOption(63116,'16&quot; x 40&quot;','45.50');
/***************************************************************************
* Create the array of payment groups. If site does notuse groups create    *
* just one with an ID of 0                                                 *
***************************************************************************/
var paymentGroups = new Object();
			paymentGroups[19220] = new paymentGroup(19220,'Note Cards','62854');
			paymentGroups[19240] = new paymentGroup(19240,'Panoramic Prints','62905,63115,63116');
			paymentGroups[19237] = new paymentGroup(19237,'Rectangular Prints','62896,63113,63114');
			paymentGroups[25806] = new paymentGroup(25806,'Square Prints','83197,83198');
	/***************************************************************************
* 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;
}


