/* 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[30578] = new paymentOption(30578,'Low-res digital download','2.50');
paymentOptions[39966] = new paymentOption(39966,'A5','5.00');
paymentOptions[17326] = new paymentOption(17326,'Approx A4','10.00');
paymentOptions[17328] = new paymentOption(17328,'Up to A4','15.00');
paymentOptions[17329] = new paymentOption(17329,'up to A3+','30.00');
paymentOptions[29873] = new paymentOption(29873,'2 cards','4.00');
paymentOptions[29874] = new paymentOption(29874,'4 Cards','7.00');
paymentOptions[29875] = new paymentOption(29875,'6 cards','9.00');
paymentOptions[63730] = new paymentOption(63730,'Special purchase by prior arrangement only','15.00');
paymentOptions[69749] = new paymentOption(69749,'Deposit 2','10.00');
paymentOptions[69748] = new paymentOption(69748,'Deposit 1','20.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[13299] = new paymentGroup(13299,'A4 only','17326');
			paymentGroups[5249] = new paymentGroup(5249,'Art Prints','17328,17329');
			paymentGroups[9172] = new paymentGroup(9172,'Cards','29873,29874,29875');
			paymentGroups[9416] = new paymentGroup(9416,'Digital download + prints','30578,17326');
			paymentGroups[5248] = new paymentGroup(5248,'Prints','17326,17329');
			paymentGroups[13209] = new paymentGroup(13209,'Prints 1','39966,17326');
			paymentGroups[19549] = new paymentGroup(19549,'Prints 2','39966,17326,17329');
			paymentGroups[19534] = new paymentGroup(19534,'Prints 3','17326,17329,69749,69748');
			paymentGroups[12371] = new paymentGroup(12371,'prints including A5','39966,17326');
	/***************************************************************************
* Get payment options field for given payment group                        *
***************************************************************************/
function getPaymentOptions(payment_groups_id) {
	var temp = '';
		
		
		if(paymentGroups[payment_groups_id].options[0] != ''){
		for (var i in paymentGroups[payment_groups_id].options) {
						
			paymentOption = paymentOptions[paymentGroups[payment_groups_id].options[i]];
			temp = temp + '<option  value="' + paymentOption.id + '">' + paymentOption.payment_option + ' - &pound;' + paymentOption.price + '</option>';
		}
	}
		return temp;
}


