/* 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[28498] = new paymentOption(28498,'5 x 4','4.50');
paymentOptions[28499] = new paymentOption(28499,'6 x 4','5.25');
paymentOptions[28500] = new paymentOption(28500,'6 x 6','5.75');
paymentOptions[28501] = new paymentOption(28501,'6 x 9','7.50');
paymentOptions[28502] = new paymentOption(28502,'5 x 5','5.00');
paymentOptions[28503] = new paymentOption(28503,'7 x 5','5.25');
paymentOptions[28504] = new paymentOption(28504,'8 x 6','8.25');
paymentOptions[28505] = new paymentOption(28505,'8 x 8','9.50');
paymentOptions[28506] = new paymentOption(28506,'10 x 8','15.50');
paymentOptions[28507] = new paymentOption(28507,'10 x 10','15.75');
paymentOptions[28508] = new paymentOption(28508,'14 x 11','22.00');
paymentOptions[28509] = new paymentOption(28509,'20 x 16','35.00');
paymentOptions[28510] = new paymentOption(28510,'20 x 24','45.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[13391] = new paymentGroup(13391,'Speedway','28498,28499,28500,28501,28502,28503,28504,28505,28506,28507,28508,28509,28510');
			paymentGroups[13392] = new paymentGroup(13392,'Weddings','28498,28499,28500,28501,28502,28503,28504,28505,28506,28507,28508,28509,28510');
	/***************************************************************************
* 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;
}


