/* 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[73936] = new paymentOption(73936,'Print 9 x 6','15.00');
paymentOptions[62866] = new paymentOption(62866,'Framed print 18x12','150.00');
paymentOptions[63259] = new paymentOption(63259,'A4 print Black Border series','25.00');
paymentOptions[62874] = new paymentOption(62874,'Greetings cards - Black Border Series','15.00');
paymentOptions[63260] = new paymentOption(63260,'A3 print Black Border series','35.00');
paymentOptions[62867] = new paymentOption(62867,'Framed print 12 x 10','115.00');
paymentOptions[73937] = new paymentOption(73937,'Print 12 x 8','17.50');
paymentOptions[73938] = new paymentOption(73938,'Print 15 x 10','21.50');
paymentOptions[62868] = new paymentOption(62868,'Framed print 10 x8 ','95.00');
paymentOptions[62869] = new paymentOption(62869,'Canvas print A2','130.00');
paymentOptions[62870] = new paymentOption(62870,'Canvas print A3','100.00');
paymentOptions[63256] = new paymentOption(63256,'Print 24 x 16','45.00');
paymentOptions[63257] = new paymentOption(63257,'Print 18 x 12','35.00');
paymentOptions[63258] = new paymentOption(63258,'Print 9 x 6','25.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[19341] = new paymentGroup(19341,'Black Border series','63259,63260');
			paymentGroups[19227] = new paymentGroup(19227,'Fine Art Prints and Canvas Prints','62866,62867,62868,62869,62870,63256,63257,63258');
			paymentGroups[19229] = new paymentGroup(19229,'Greetings cards - Black Border Series','62874');
			paymentGroups[22835] = new paymentGroup(22835,'Wedding prints','73936,73937,73938');
	/***************************************************************************
* 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;
}


