/* 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[55742] = new paymentOption(55742,'A2 Print Only Ltd Edition Australia Incl Pack & Freight','160.00');
paymentOptions[55741] = new paymentOption(55741,'A2 Print Only Ltd Edition Overseas Incl Pack & Freight','180.00');
paymentOptions[41487] = new paymentOption(41487,'A3+ Print Only Ltd Edition Australia Incl Pack & Freight','106.00');
paymentOptions[41488] = new paymentOption(41488,'A3+ Print Only Ltd Edition Overseas Incl Pack & Freight','125.00');
paymentOptions[19932] = new paymentOption(19932,'A3+ Matted Ltd Edition in Australia Incl Pack & Freight','150.00');
paymentOptions[19933] = new paymentOption(19933,'A3+ Matted Ltd Edition Overseas  Incl. Pack & Freight','175.00');
paymentOptions[27053] = new paymentOption(27053,'Pano: Australian Purchases Incl. Packaging & Freight','150.00');
paymentOptions[27054] = new paymentOption(27054,'Pano: Overseas Purchases Incl. Packaging & Freight','175.00');
paymentOptions[29539] = new paymentOption(29539,'A3 Print only Ltd Edition in Australia Incl. pack & freight','47.00');
paymentOptions[29540] = new paymentOption(29540,'A3 Print only Ltd Edition Overseas Incl. pack & freight','59.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[8327] = new paymentGroup(8327,'Limited Editions.','55742,55741,41487,41488,19932,19933,29539,29540');
			paymentGroups[9512] = new paymentGroup(9512,'Panoramas','27053,27054');
	/***************************************************************************
* 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 + ' - AU$' + paymentOption.price + '</option>';
		});
	}
		return temp;
}


