/* 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[7764] = new paymentOption(7764,'A4 GLOSS -----------------------','12.50');
paymentOptions[35313] = new paymentOption(35313,'A4 MATT -------------------------','12.50');
paymentOptions[7960] = new paymentOption(7960,'12 x 8 inch GLOSS ------------','12.50');
paymentOptions[35310] = new paymentOption(35310,'12 x 8 inch MATT --------------','12.50');
paymentOptions[7962] = new paymentOption(7962,'15 x 10 inch GLOSS ----------','19.50');
paymentOptions[35314] = new paymentOption(35314,'15 x 10 inch MATT -------------','19.50');
paymentOptions[7963] = new paymentOption(7963,'A3 GLOSS -----------------------','24.50');
paymentOptions[35315] = new paymentOption(35315,'A3 MATT -------------------------','24.50');
paymentOptions[21539] = new paymentOption(21539,'18 x 12 inch GLOSS ----------','24.50');
paymentOptions[35317] = new paymentOption(35317,'18 x 12 inch MATT ------------','24.50');
paymentOptions[75534] = new paymentOption(75534,'30x20 inch GLOSS ------------','45.00');
paymentOptions[35320] = new paymentOption(35320,'30 x 20 inch MATT ------------','45.00');
paymentOptions[27072] = new paymentOption(27072,'36 x 24 inch GLOSS ----------','84.50');
paymentOptions[35322] = new paymentOption(35322,'36 x 24 inch MATT ------------','84.50');
paymentOptions[41857] = new paymentOption(41857,'A4 in 14x11inch Mount -------','18.00');
paymentOptions[75535] = new paymentOption(75535,'12x8inch in 16x12 Mount ----','22.00');
paymentOptions[75533] = new paymentOption(75533,'15x10inch in 20x16 Mount --','30.00');
paymentOptions[83109] = new paymentOption(83109,'12 x 8 inch CANVAS  ---------','46.00');
paymentOptions[35329] = new paymentOption(35329,'18 x 12 inch CANVAS -------','64.00');
paymentOptions[35324] = new paymentOption(35324,'30 x 20 inch CANVAS -------','110.00');
paymentOptions[62129] = new paymentOption(62129,'36 x 24 inch CANVAS -------','140.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[25779] = new paymentGroup(25779,'3 x 2 sizes + Canvas - small','7960,35310,7962,35314,41857,75535,75533,83109,35329');
			paymentGroups[12019] = new paymentGroup(12019,'3x2 & A sizes - Small sizes only','7764,35313,7960,35310,7962,35314,7963,35315,21539,35317,75534,41857,75535,75533,83109,35329');
			paymentGroups[25172] = new paymentGroup(25172,'3x2 No A sizes or Canvas','7960,35310,7962,35314,21539,35317,75534,35320,27072,35322,41857,75535,75533');
			paymentGroups[6548] = new paymentGroup(6548,'3x2 Prints & A sizes','7764,35313,7960,35310,7962,35314,7963,35315,21539,35317,75534,35320,27072,35322,41857,75535,75533,83109,35329,35324,62129');
			paymentGroups[15883] = new paymentGroup(15883,'3x2 sizes only - No A sizes','7960,35310,7962,35314,21539,35317,75534,35320,27072,35322,41857,75535,75533,83109,35329,35324,62129');
			paymentGroups[17158] = new paymentGroup(17158,'3x2 sizes only - No canvas - small sizes','7960,35310,7962,35314,21539,35317,41857,75535,75533');
			paymentGroups[2338] = new paymentGroup(2338,'NOT AVAILABLE FOR SALE','');
	/***************************************************************************
* 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;
}


