/* 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[84877] = new paymentOption(84877,'6&quot; x 4&quot; gloss print','6.50');
paymentOptions[84878] = new paymentOption(84878,'6&quot; x 4&quot; lustre print','6.50');
paymentOptions[84880] = new paymentOption(84880,'7&quot; x 5&quot; gloss print','9.00');
paymentOptions[84881] = new paymentOption(84881,'7&quot; x 5&quot; lustre print','9.00');
paymentOptions[84883] = new paymentOption(84883,'8&quot; x 6&quot; gloss print','10.50');
paymentOptions[84884] = new paymentOption(84884,'8&quot; x 6&quot; lustre print','10.50');
paymentOptions[85299] = new paymentOption(85299,'9&quot; x 6&quot; Gloss - special offer! 1 for','7.00');
paymentOptions[85306] = new paymentOption(85306,'9&quot; x 6&quot; Gloss - £5.00 each for 3*','5.00');
paymentOptions[84886] = new paymentOption(84886,'10&quot; x 8&quot; gloss print','13.00');
paymentOptions[84887] = new paymentOption(84887,'10&quot; x 8&quot; lustre print','13.00');
paymentOptions[84888] = new paymentOption(84888,'12&quot; x 8&quot; gloss print','16.00');
paymentOptions[84890] = new paymentOption(84890,'12&quot; x 8&quot; lustre print','16.00');
paymentOptions[84892] = new paymentOption(84892,'16&quot; x 12&quot; gloss print','28.00');
paymentOptions[84893] = new paymentOption(84893,'16&quot; x 12&quot; lustre print','28.00');
paymentOptions[84895] = new paymentOption(84895,'20&quot; x 16&quot; gloss print','43.00');
paymentOptions[84896] = new paymentOption(84896,'20&quot; x 16&quot; lustre print','43.00');
paymentOptions[84897] = new paymentOption(84897,'24&quot; x 20&quot; gloss print','65.00');
paymentOptions[84898] = new paymentOption(84898,'24&quot; x 20&quot; lustre print','65.00');
paymentOptions[84899] = new paymentOption(84899,'30&quot; x 24&quot; gloss print','82.00');
paymentOptions[84900] = new paymentOption(84900,'5&quot; x 5&quot; square gloss print','7.50');
paymentOptions[84905] = new paymentOption(84905,'5&quot; x 5&quot; square lustre print','6.50');
paymentOptions[84901] = new paymentOption(84901,'6&quot; x 6&quot; square gloss print','9.00');
paymentOptions[84931] = new paymentOption(84931,'6&quot; x 6&quot; square lustre print','10.50');
paymentOptions[84932] = new paymentOption(84932,'8&quot; x 8&quot; square gloss print','13.00');
paymentOptions[84933] = new paymentOption(84933,'8&quot; x 8&quot; square lustre print','13.00');
paymentOptions[84934] = new paymentOption(84934,'10&quot; x 10&quot; square gloss print ','15.00');
paymentOptions[84935] = new paymentOption(84935,'10&quot; x 10&quot; square lustre print','15.00');
paymentOptions[84936] = new paymentOption(84936,'12&quot; x 12&quot; square gloss print','22.00');
paymentOptions[84937] = new paymentOption(84937,'12&quot; x 12&quot; square lustre print','22.00');
paymentOptions[84938] = new paymentOption(84938,'16&quot; x 16&quot; square gloss print','38.00');
paymentOptions[84939] = new paymentOption(84939,'16&quot; x 16&quot; square lustre print','38.00');
paymentOptions[84940] = new paymentOption(84940,'20&quot; x20&quot; square gloss print','45.00');
paymentOptions[84941] = new paymentOption(84941,'20&quot; x 20&quot; square lustre print','45.00');
paymentOptions[84942] = new paymentOption(84942,'Mug','11.00');
paymentOptions[84943] = new paymentOption(84943,'Keyring (x2)','6.00');
paymentOptions[84944] = new paymentOption(84944,'Fridge Magnets (x2)','7.00');
paymentOptions[84945] = new paymentOption(84945,'Photographic Mouse Mat','13.00');
paymentOptions[84946] = new paymentOption(84946,'300 piece Jigsaw (17&quot; x 12&quot;)','17.00');
paymentOptions[84947] = new paymentOption(84947,'Glass Coaster (x1)','7.00');
paymentOptions[84948] = new paymentOption(84948,'Set of 4 Glass Coasters','20.00');
paymentOptions[84949] = new paymentOption(84949,'Set of 4 Glass Place Mats','54.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[0] = new paymentGroup(0,'Default group','84877,84878,84880,84881,84883,84884,85299,85306,84886,84887,84888,84890,84892,84893,84895,84896,84897,84898,84899,84900,84905,84901,84931,84932,84933,84934,84935,84936,84937,84938,84939,84940,84941,84942,84943,84944,84945,84946,84947,84948,84949');
/***************************************************************************
* 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;
}


