/* 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[81536] = new paymentOption(81536,'19x13 poster  one image','20.00');
paymentOptions[81537] = new paymentOption(81537,'19x13 poster Montage 5 images','30.00');
paymentOptions[51954] = new paymentOption(51954,'Canvas 16x12','49.00');
paymentOptions[51955] = new paymentOption(51955,'Canvas 12x8','38.00');
paymentOptions[51956] = new paymentOption(51956,'Montage 10x8','25.00');
paymentOptions[51961] = new paymentOption(51961,'Print 10x8 Mounted','10.00');
paymentOptions[51964] = new paymentOption(51964,'Print 7x5 Mounted','7.00');
paymentOptions[51968] = new paymentOption(51968,'x2 Images on CD','20.00');
paymentOptions[51960] = new paymentOption(51960,'Jigsaw Puzzle 16x12','22.00');
paymentOptions[51962] = new paymentOption(51962,'Jigsaw Puzzle 7x5','12.00');
paymentOptions[51965] = new paymentOption(51965,'Fridge Magnet','5.00');
paymentOptions[51966] = new paymentOption(51966,'Key Ring With x2 Images','3.50');
paymentOptions[67220] = new paymentOption(67220,'large Key Ring   2 images','4.00');
paymentOptions[51967] = new paymentOption(51967,'Key Ring With x1 Image & Light','3.50');
paymentOptions[81538] = new paymentOption(81538,'Small acylic block','23.00');
paymentOptions[81539] = new paymentOption(81539,'Large acrylic block','40.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[0] = new paymentGroup(0,'Default group','81536,81537,51954,51955,51956,51961,51964,51968,51960,51962,51965,51966,67220,51967,81538,81539');
/***************************************************************************
* 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;
}


