/* 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[58109] = new paymentOption(58109,'Greeting Card','3.50');
paymentOptions[68341] = new paymentOption(68341,'7&quot; x 5&quot; Satin','10.00');
paymentOptions[6357] = new paymentOption(6357,'7&quot; x 5&quot; Gloss','10.00');
paymentOptions[6354] = new paymentOption(6354,'A4 21cm x 29.7cm Satin','35.00');
paymentOptions[6360] = new paymentOption(6360,'A4 21cm x 29.7cm Gloss','35.00');
paymentOptions[22529] = new paymentOption(22529,'A4 21cm x 29.7cm Matte','35.00');
paymentOptions[6356] = new paymentOption(6356,'A3 29.7cm x 42cm Satin Poster Print','65.00');
paymentOptions[22530] = new paymentOption(22530,'A3 29.7cm x 42cm Gloss Poster Print','65.00');
paymentOptions[25712] = new paymentOption(25712,'A3 29.7cm x 42cm Matte Poster Print','65.00');
paymentOptions[6358] = new paymentOption(6358,'A2 42cm x 59.4cm Satin Poster Print','125.00');
paymentOptions[6359] = new paymentOption(6359,'A1 59.4cm x 84.1cm Satin Poster Print','200.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','58109,68341,6357,6354,6360,22529,6356,22530,25712,6358,6359');
/***************************************************************************
* 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;
}


