/* 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[32786] = new paymentOption(32786,'A4 Print (11.62x8.25&quot;)','25.00');
paymentOptions[32734] = new paymentOption(32734,'A3 Print (16.5x11.62&quot;)','35.00');
paymentOptions[32729] = new paymentOption(32729,'A3+ Print(19x13&quot;)','39.00');
paymentOptions[59859] = new paymentOption(59859,'A2 Print ( 23 x 16.5&quot;)','59.00');
paymentOptions[33023] = new paymentOption(33023,'Limited Edition A3+ (19x13&quot;)','85.00');
paymentOptions[59860] = new paymentOption(59860,'Limited Edition A2 (23 x 16.5&quot;)','125.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[18429] = new paymentGroup(18429,'A2 ','');
			paymentGroups[10212] = new paymentGroup(10212,'A3','32734');
			paymentGroups[10284] = new paymentGroup(10284,'A3 - A4','32786,32734');
			paymentGroups[10211] = new paymentGroup(10211,'A3+','32729');
			paymentGroups[10213] = new paymentGroup(10213,'A4','32786');
			paymentGroups[10159] = new paymentGroup(10159,'ALL Sizes','32786,32734,32729,59859');
			paymentGroups[20178] = new paymentGroup(20178,'Limited Edition','33023,59860');
			paymentGroups[18430] = new paymentGroup(18430,'Limited Edition A2','59860');
			paymentGroups[10257] = new paymentGroup(10257,'Limited Edition A3+','33023');
	/***************************************************************************
* 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;
}


