/* 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[79425] = new paymentOption(79425,'Small Print (6&quot;x4&quot;) Incl P & P','6.00');
paymentOptions[79427] = new paymentOption(79427,'Large Print (9&quot;x6&quot;) Incl P & P','11.00');
paymentOptions[79429] = new paymentOption(79429,'X Large Print (A4) Incl P & P','16.00');
paymentOptions[79430] = new paymentOption(79430,'Photo Key Fob incl P & P','6.00');
paymentOptions[74001] = new paymentOption(74001,'8&quot; x 6&quot; Print','14.00');
paymentOptions[39958] = new paymentOption(39958,'7&quot;x5&quot; includes p&p','10.00');
paymentOptions[48900] = new paymentOption(48900,'SMALL (6&quot;x4&quot;) includes p&p','5.00');
paymentOptions[39959] = new paymentOption(39959,'9&quot;x6&quot; includes p&p','20.00');
paymentOptions[74002] = new paymentOption(74002,'A4 Print','20.00');
paymentOptions[48901] = new paymentOption(48901,'MEDIUM (9&quot;x6&quot;) includes p&p','10.00');
paymentOptions[74726] = new paymentOption(74726,'LARGE (A4) includes p&p','20.00');
paymentOptions[74003] = new paymentOption(74003,'12&quot;x18&quot; Print','28.00');
paymentOptions[39960] = new paymentOption(39960,'A4 includes p&p','30.00');
paymentOptions[39961] = new paymentOption(39961,'23.5&quot;x16.5&quot; (A2) includes p&p','48.00');
paymentOptions[69235] = new paymentOption(69235,'PHOTO KEY FOB (pic 5 x 3.5cm) incl p&p','6.00');
paymentOptions[69236] = new paymentOption(69236,'6&quot;x4&quot; Greetings Card Blank Inside + Envelope incl p&p','2.75');
/***************************************************************************
* Create the array of payment groups. If site does notuse groups create    *
* just one with an ID of 0                                                 *
***************************************************************************/
var paymentGroups = new Object();
			paymentGroups[12367] = new paymentGroup(12367,'Buy This Picture','39958,39959,39960,39961,69235,69236');
			paymentGroups[22846] = new paymentGroup(22846,'Councillors','74001,74002');
			paymentGroups[24322] = new paymentGroup(24322,'Evans','48900,74002,48901,74003');
			paymentGroups[12369] = new paymentGroup(12369,'Foreign Views','39958,39959,39960,39961,69235,69236');
			paymentGroups[12354] = new paymentGroup(12354,'Local Views','39958,39959,39960,39961,69235,69236');
			paymentGroups[12368] = new paymentGroup(12368,'Miscelaneous','39958,39959,39960,39961,69235,69236');
			paymentGroups[24622] = new paymentGroup(24622,'PET PAWTRAITS','79425,79427,79429,79430');
			paymentGroups[14868] = new paymentGroup(14868,'WEDDING REPRINTS','48900,48901,74726,69235');
	/***************************************************************************
* 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;
}


