/* 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[29103] = new paymentOption(29103,'Limited Edition Large Format Print','250.00');
paymentOptions[29097] = new paymentOption(29097,'Limited Edition Large Format Print','100.00');
paymentOptions[29099] = new paymentOption(29099,'Limited Edition Large Format Print','120.00');
paymentOptions[29101] = new paymentOption(29101,'Limited Edition Large Format Print','150.00');
paymentOptions[29102] = new paymentOption(29102,'Limited Edition Large Format Print 20x24','160.00');
paymentOptions[29100] = new paymentOption(29100,'Limited Edition Large Format Print 20x24','110.00');
paymentOptions[29098] = new paymentOption(29098,'Limited Edition Large Format Print 20x24','85.00');
paymentOptions[29104] = new paymentOption(29104,'Limited Edition Large Format Print 20x24','270.00');
paymentOptions[29106] = new paymentOption(29106,'Small Format Print 10x8','20.00');
paymentOptions[51220] = new paymentOption(51220,'20&quot;x24&quot; Canvas Print','150.00');
paymentOptions[51221] = new paymentOption(51221,'30&quot;x24&quot; Canvas Print','190.00');
paymentOptions[51222] = new paymentOption(51222,'20&quot;x16&quot; Print','75.00');
paymentOptions[51223] = new paymentOption(51223,'A3 Print','45.00');
paymentOptions[51224] = new paymentOption(51224,'A4 Print','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[8944] = new paymentGroup(8944,'2-5','29097,29098,29106');
			paymentGroups[8947] = new paymentGroup(8947,'21-35','29101,29102,29106');
			paymentGroups[8948] = new paymentGroup(8948,'36-50','29103,29104,29106');
			paymentGroups[8946] = new paymentGroup(8946,'6-20','29099,29100,29106');
			paymentGroups[8938] = new paymentGroup(8938,'Limited Edition Large Format Prints (Tier 1)','29097,51221,51222,51223,51224');
			paymentGroups[8939] = new paymentGroup(8939,'Limited Edition Large Format Prints (Tier 2)','29099,51221,51222,51223,51224');
			paymentGroups[8940] = new paymentGroup(8940,'Limited Edition Large Format Prints (Tier 3)','29101,29102,51223,51224');
			paymentGroups[8941] = new paymentGroup(8941,'Limited Edition Large Format Prints (Tier 4)','29103,29104,51223,51224');
			paymentGroups[8949] = new paymentGroup(8949,'Unlimited.','29106');
	/***************************************************************************
* 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;
}


