/* 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.item_price_1.value = paymentOptions[id].price;
			form.item_name_1.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[44265] = new paymentOption(44265,'Medium Limited Edition of 195 (unframed)','195.00');
paymentOptions[44266] = new paymentOption(44266,'Large Edition of 195 (unframed)','275.00');
paymentOptions[53332] = new paymentOption(53332,'Medium Limited Edition of 195 Square (unframed)','145.00');
paymentOptions[53333] = new paymentOption(53333,'Large Limited Edition of 195 Square (unframed)','245.00');
paymentOptions[53334] = new paymentOption(53334,'Medium Limited Edition of 12 (unframed)','450.00');
paymentOptions[53335] = new paymentOption(53335,'Large Limited Edition of 12 (unframed)','850.00');
paymentOptions[53336] = new paymentOption(53336,'Open Run Print 38cm x 18cm (mounted)','75.00');
paymentOptions[53337] = new paymentOption(53337,'Open Run Print 25cm x 25cm (mounted)','85.00');
paymentOptions[53339] = new paymentOption(53339,'Open Run Print 38cm x 19cm (mounted)','90.00');
paymentOptions[53340] = new paymentOption(53340,'Open Run Print 38cm x 25cm (mounted)','95.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[16140] = new paymentGroup(16140,'12','53334,53335');
			paymentGroups[13500] = new paymentGroup(13500,'195 ','44265,44266');
			paymentGroups[16139] = new paymentGroup(16139,'195 square','53332,53333');
			paymentGroups[25160] = new paymentGroup(25160,'Gift Vouchers','');
			paymentGroups[16141] = new paymentGroup(16141,'open run 1 x 1','53337');
			paymentGroups[16142] = new paymentGroup(16142,'Open Run 2 x 1','53339');
			paymentGroups[16143] = new paymentGroup(16143,'Open run 3 x 1','53336');
			paymentGroups[16144] = new paymentGroup(16144,'Open Run 3 x 2','53340');
	/***************************************************************************
* 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;
}


