/* 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[40297] = new paymentOption(40297,'P&P per ORDER','4.99');
paymentOptions[40295] = new paymentOption(40295,'7.5x7.5 inch on A4 Art Paper','25.00');
paymentOptions[46699] = new paymentOption(46699,'11x7.5 inch on A4 Art Paper','25.00');
paymentOptions[40296] = new paymentOption(40296,'Complete series','100.00');
paymentOptions[41836] = new paymentOption(41836,'6x Postcards','10.00');
paymentOptions[41837] = new paymentOption(41837,'6x A6 Greetings Cards','18.00');
paymentOptions[61678] = new paymentOption(61678,'9.5x12&quot; Silver Based Paper','75.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[18877] = new paymentGroup(18877,'£75 One offs','40297,61678');
			paymentGroups[18878] = new paymentGroup(18878,'£75 Series','40297,61678');
			paymentGroups[14212] = new paymentGroup(14212,'Cyano A4','40297,46699,40296,41836,41837');
			paymentGroups[12486] = new paymentGroup(12486,'Cyano Square','40297,40295,40296,41836,41837');
	/***************************************************************************
* 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;
}


