/* 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[17533] = new paymentOption(17533,'7 x 5 inch Print in 10 x 8 inch Ivory Mount (including UK P&P)','6.50');
paymentOptions[69585] = new paymentOption(69585,'14 Page A4 Calendar (including Free Postage and Packaging)','5.99');
paymentOptions[10343] = new paymentOption(10343,'12 x 8 inch/A4 Print in 16 x 12 inch Ivory Mount (Free UK P&P)','14.99');
paymentOptions[10344] = new paymentOption(10344,'15 x 10 inch Print in 20 x 16 inch Ivory Mount (Free UK P&P)','24.99');
paymentOptions[10347] = new paymentOption(10347,'6 x 4 inch Greetings Card (Free UK P&P)','1.59');
paymentOptions[38492] = new paymentOption(38492,'A5 Greetings Cards (Free UK P&P)','2.00');
paymentOptions[57046] = new paymentOption(57046,'3 A5 Greetings Card (Free UK P & P)','5.00');
paymentOptions[83162] = new paymentOption(83162,'4 Mounts Bay Sunset Placemats (includes £4 Postage and Packaging)','22.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[21457] = new paymentGroup(21457,'A4 Calendar','69585');
			paymentGroups[25799] = new paymentGroup(25799,'All plus Placemats','17533,10343,10344,10347,38492,57046');
			paymentGroups[3068] = new paymentGroup(3068,'PRINTS','17533,10343,10344');
			paymentGroups[11896] = new paymentGroup(11896,'Prints and 2 Cards','17533,10343,10344,10347,38492,57046');
			paymentGroups[3067] = new paymentGroup(3067,'PRINTS AND 6X4 CARDS','17533,10343,10344,10347');
			paymentGroups[11897] = new paymentGroup(11897,'Prints and A5 Cards','17533,10343,10344,38492,57046');
	/***************************************************************************
* 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;
}


