/* 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[75307] = new paymentOption(75307,'7x5 inch - free print','0.00');
paymentOptions[61953] = new paymentOption(61953,'6x4 inch','4.00');
paymentOptions[65267] = new paymentOption(65267,'6x4 inch - b&w','4.00');
paymentOptions[61954] = new paymentOption(61954,'7x5 inch','6.00');
paymentOptions[65268] = new paymentOption(65268,'7x5 inch - b&w','6.00');
paymentOptions[75298] = new paymentOption(75298,'5x5 inch square','6.00');
paymentOptions[61957] = new paymentOption(61957,'8x6 inch','8.00');
paymentOptions[65270] = new paymentOption(65270,'8x6 inch - b&w','8.00');
paymentOptions[67179] = new paymentOption(67179,'8x6 inch','8.00');
paymentOptions[61958] = new paymentOption(61958,'10x8 inch','12.50');
paymentOptions[65271] = new paymentOption(65271,'10x8 inch - b&w','12.50');
paymentOptions[75299] = new paymentOption(75299,'8x8 inch square','12.50');
paymentOptions[61959] = new paymentOption(61959,'12x8 inch','15.00');
paymentOptions[65272] = new paymentOption(65272,'12x8 inch - b&w','15.00');
paymentOptions[82301] = new paymentOption(82301,'20x16 inch ','30.00');
paymentOptions[73109] = new paymentOption(73109,'CD / DVD of all images within gallery - voucher / discount','50.00');
paymentOptions[20655] = new paymentOption(20655,'(D) 8 x 6 inch - gloss','10.00');
paymentOptions[65941] = new paymentOption(65941,'CD / DVD of all images within gallery (group)','40.00');
paymentOptions[65214] = new paymentOption(65214,'CD / DVD of all images within gallery','75.00');
paymentOptions[63317] = new paymentOption(63317,'Individual high-res photo (jpeg)','5.00');
paymentOptions[63857] = new paymentOption(63857,'NCT Photo Fundraising Event - sitting fee','7.50');
paymentOptions[75300] = new paymentOption(75300,'CD / DVD of all images within gallery','40.00');
paymentOptions[75301] = new paymentOption(75301,'2nd CD / DVD of all images (B&W)','15.00');
paymentOptions[75302] = new paymentOption(75302,'Set of 3 photo key rings (same photo)','10.00');
paymentOptions[75303] = new paymentOption(75303,'Set of 4 wallet / mini photos (same photo)','5.00');
paymentOptions[75304] = new paymentOption(75304,'Special offer 1','30.00');
paymentOptions[75305] = new paymentOption(75305,'Special offer 2','65.00');
paymentOptions[75306] = new paymentOption(75306,'Special offer 3','95.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[22546] = new paymentGroup(22546,'2011 prices - individual session','61953,65267,61954,65268,65270,67179,61958,65271,61959,65272,73109,65214,63317');
			paymentGroups[19910] = new paymentGroup(19910,'Group photo session prices (no CD or JPEG option)','61953,65267,61954,65268,61957,65270,61958,65271,61959,65272');
			paymentGroups[20159] = new paymentGroup(20159,'Group photo session prices 2012 (no individual jpeg option)','61953,61954,75298,61957,61958,75299,61959,75300,75301,75302,75303,75304,75305,75306');
			paymentGroups[19532] = new paymentGroup(19532,'NCT photo fundraising session','63857');
			paymentGroups[20634] = new paymentGroup(20634,'Photo party prices for guests','61953,61954,75298,67179,61958,75299,61959,65214,63317,75302,75303');
			paymentGroups[6164] = new paymentGroup(6164,'Wedding photo prices','61953,61954,61957,61958,61959,63317');
	/***************************************************************************
* 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;
}


