/* 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[84443] = new paymentOption(84443,'Cornwall Bear Large (inc UK P&P)','14.50');
paymentOptions[81968] = new paymentOption(81968,'2012 Calendar (inc UK p&p)','10.50');
paymentOptions[83327] = new paymentOption(83327,'Sold Out ','0.00');
paymentOptions[84442] = new paymentOption(84442,'Cornwall Bears Small (inc UK P&P)','11.00');
paymentOptions[47616] = new paymentOption(47616,'6&quot;x 4&quot; print in 8&quot;x 6&quot; mount (inc UK P&P)','4.50');
paymentOptions[47617] = new paymentOption(47617,'7&quot;x 5&quot; print in 10&quot;x 8&quot; mount (inc P&P UK)','7.50');
paymentOptions[47618] = new paymentOption(47618,'Greeting Card With Envelope (inc P&P UK) ','2.75');
paymentOptions[62368] = new paymentOption(62368,'Hardback book 11&quot;x 8.5&quot;  Inc UK P&P ','14.50');
paymentOptions[62369] = new paymentOption(62369,'Softcover book 11&quot; x 8.5&quot; Inc UK P&P','9.99');
paymentOptions[52290] = new paymentOption(52290,'Set of five mixed Christmas cards inc UK P&P','10.99');
paymentOptions[47615] = new paymentOption(47615,'Pack of 6 Postcards mixed (inc P&P UK)','4.99');
paymentOptions[46161] = new paymentOption(46161,'9&quot;x 7&quot; Print in 14&quot;x11&quot; mount(inc p&p in UK)              ','15.99');
paymentOptions[46165] = new paymentOption(46165,'16&quot; x 12&quot; Print in ivory mount(inc p&p in UK)','30.00');
paymentOptions[49575] = new paymentOption(49575,'Large Russ Bear (inc UK P&P)','16.99');
paymentOptions[49576] = new paymentOption(49576,'Large Russ Bear  (inc UK P&P)','14.99');
paymentOptions[49577] = new paymentOption(49577,'Small Bear (inc UK P&P)','11.50');
paymentOptions[49578] = new paymentOption(49578,'Small Bear  (inc UK P&P)','10.50');
paymentOptions[49579] = new paymentOption(49579,'Small Bear  (inc UK P&P)','9.50');
paymentOptions[52289] = new paymentOption(52289,'Deckchair inc UK P&P','16.99');
/***************************************************************************
* Create the array of payment groups. If site does notuse groups create    *
* just one with an ID of 0                                                 *
***************************************************************************/
var paymentGroups = new Object();
			paymentGroups[19094] = new paymentGroup(19094,'Books','62368,62369');
			paymentGroups[25434] = new paymentGroup(25434,'Calendar ','81968');
			paymentGroups[26225] = new paymentGroup(26225,'Cornwall Bears ','84443,84442');
			paymentGroups[26224] = new paymentGroup(26224,'Cornwall Bears Small','84442');
			paymentGroups[15890] = new paymentGroup(15890,'Deckchair','52289');
			paymentGroups[15862] = new paymentGroup(15862,'greeting cards/postcards','47618,47615');
			paymentGroups[19093] = new paymentGroup(19093,'Hardback Book.','62368');
			paymentGroups[15054] = new paymentGroup(15054,'Large Bear 1','49575');
			paymentGroups[15055] = new paymentGroup(15055,'Large Bear 2','49576');
			paymentGroups[13977] = new paymentGroup(13977,'Prints','47616,47617,46161,46165');
			paymentGroups[15891] = new paymentGroup(15891,'Set of five mixed Christmas cards','52290');
			paymentGroups[15051] = new paymentGroup(15051,'Small Bears 1','49577');
			paymentGroups[15052] = new paymentGroup(15052,'Small Bears 2','49578');
			paymentGroups[15053] = new paymentGroup(15053,'Small Bears 3','49579');
			paymentGroups[25861] = new paymentGroup(25861,'SOLD OUT','83327');
	/***************************************************************************
* 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;
}


