/* 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[29047] = new paymentOption(29047,'Greetings card 5.8 x 8.3 ins (14.8 x 21.0 cms)','2.50');
paymentOptions[29026] = new paymentOption(29026,'8 x 12 ins (20.3 x 30.5 cms) photo ','25.00');
paymentOptions[29027] = new paymentOption(29027,'12 x 18 ins (30.5 x 45.7 cms) photo','30.00');
paymentOptions[29028] = new paymentOption(29028,'16 x 24 ins (40.6 x 61.0 cms) photo','48.00');
paymentOptions[29029] = new paymentOption(29029,'20 x 30 ins (50.8 x 76.2 cms) photo','60.00');
paymentOptions[29031] = new paymentOption(29031,'16 x 20 ins (40.6 x 50.8cms) photo','48.00');
paymentOptions[29030] = new paymentOption(29030,'8 x 12 ins (20.3 x 30.5 cms) plus off white mount','23.00');
paymentOptions[29038] = new paymentOption(29038,'8 x 12 ins (20.3 x 30.5 cms) plus black mount','23.00');
paymentOptions[29032] = new paymentOption(29032,'12 x 18 ins (30.5 x 45.7 cms) plus off white mount','30.00');
paymentOptions[29039] = new paymentOption(29039,'12 x 18 ins (30.5 x 45.7 cms) plus black mount','30.00');
paymentOptions[29033] = new paymentOption(29033,'16 x 24 ins (40.6 x 61.0 cms) plus off white mount','45.00');
paymentOptions[29041] = new paymentOption(29041,'16 x 24 ins (40.6 x 61.0 cms) plus black mount','45.00');
paymentOptions[29034] = new paymentOption(29034,'20 x 30 ins (50.8 x 76.2 cms) plus off white mount','65.00');
paymentOptions[29044] = new paymentOption(29044,'20 x 30 ins (50.8 x 76.2 cms) plus black mount','65.00');
paymentOptions[29035] = new paymentOption(29035,'16 x 20 ins (40.6 x 50.8cms) plus off white mount','45.00');
paymentOptions[29046] = new paymentOption(29046,'16 x 20 ins (40.6 x 50.8cms) plus black mount','45.00');
paymentOptions[38961] = new paymentOption(38961,'Limited Edition of 100.   16 x 24 ins (40.6 x 61.0 cms) plus off white mount','180.00');
paymentOptions[33632] = new paymentOption(33632,'Limited Edition of 100.   16 x 24 ins (40.6 x 61.0 cms) plus black mount','180.00');
paymentOptions[33660] = new paymentOption(33660,'Limited Edition of 100.  16 x 20 ins (40.6 x 50.8cms) plus off white mount','180.00');
paymentOptions[57352] = new paymentOption(57352,'Royalty Free Image','250.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[10427] = new paymentGroup(10427,'Limited Edition of 100.  16 x 20 ins.  Off white mount','33660');
			paymentGroups[10422] = new paymentGroup(10422,'Limited Edition of 100.  16 x 24 ins.  Off white mount','38961');
			paymentGroups[12038] = new paymentGroup(12038,'Limited Edition of 100. 16 x 24 ins. Black mount','33632');
			paymentGroups[8923] = new paymentGroup(8923,'Non-standard size 16 x 20 ins','29031');
			paymentGroups[17574] = new paymentGroup(17574,'Royalty Free Image','');
			paymentGroups[8925] = new paymentGroup(8925,'Single Greeting Card','29047');
			paymentGroups[8922] = new paymentGroup(8922,'Standard prices in GBP £, including UK P&P','29026,29027,29028,29029');
			paymentGroups[8927] = new paymentGroup(8927,'Standard to 12 x 18 ','29026,29027');
			paymentGroups[12401] = new paymentGroup(12401,'Standard to 16 x 24 ','29026,29027,29028');
			paymentGroups[8926] = new paymentGroup(8926,'Standard to 8 x 12 ','29026');
	/***************************************************************************
* 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;
}


