/* 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[81727] = new paymentOption(81727,'High resolution file by email','4.00');
paymentOptions[78353] = new paymentOption(78353,'7&quot;x5&quot; prints','6.00');
paymentOptions[78354] = new paymentOption(78354,'9&quot;x6&quot; prints','10.00');
paymentOptions[78355] = new paymentOption(78355,'A4','15.00');
paymentOptions[78356] = new paymentOption(78356,'18&quot;x12&quot;','20.00');
paymentOptions[78357] = new paymentOption(78357,'36&quot;x24&quot;','50.00');
paymentOptions[78358] = new paymentOption(78358,'Poster print 30&quot;x20&quot;','30.00');
paymentOptions[38042] = new paymentOption(38042,'Standard canvas 16x12','75.00');
paymentOptions[38043] = new paymentOption(38043,'Large canvas 32x24','125.00');
paymentOptions[38044] = new paymentOption(38044,'Extra Large Canvas 48x36','150.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[24188] = new paymentGroup(24188,'Canvas and posters','78358,38042,38043,38044');
			paymentGroups[24187] = new paymentGroup(24187,'Sports event prints','81727,78353,78354,78355,78356,78357,78358');
	/***************************************************************************
* 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;
}


