/* 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[82436] = new paymentOption(82436,'Book','150.00');
paymentOptions[38356] = new paymentOption(38356,'9 inch (22.9 cm) tall print (signed by Ian Bramham)','45.00');
paymentOptions[38355] = new paymentOption(38355,'14 inch (35.5 cm) tall print (signed by Ian Bramham)','65.00');
paymentOptions[38354] = new paymentOption(38354,'21 inch (53.3 cm) tall print (signed by Ian Bramham)','95.00');
paymentOptions[38361] = new paymentOption(38361,'9 inch (22.9 cm) wide print (signed by Ian Bramham)  ','45.00');
paymentOptions[38360] = new paymentOption(38360,'14 inch (35.5 cm) wide print (signed by Ian Bramham)','65.00');
paymentOptions[38359] = new paymentOption(38359,'21 inch (53.3 cm) wide print (signed by Ian Bramham)','95.00');
paymentOptions[38511] = new paymentOption(38511,'10 inch x 10 inch (25.4 cm x 25.4 cm) square print (signed by Ian Bramham)','60.00');
paymentOptions[38510] = new paymentOption(38510,'14inch x 14inch (35.5 cm x 35.5 cm) square print (signed by Ian Bramham)','85.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[11859] = new paymentGroup(11859,'Landscape format print prices','38361,38360,38359');
			paymentGroups[11858] = new paymentGroup(11858,'Portrait format print prices','38356,38355,38354');
			paymentGroups[25584] = new paymentGroup(25584,'Shadows & Light Book','82436');
			paymentGroups[11911] = new paymentGroup(11911,'Square format Prints','38511,38510');
	/***************************************************************************
* 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;
}


