/* 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[39723] = new paymentOption(39723,'6 x 4 Prints (X 2)','6.00');
paymentOptions[39722] = new paymentOption(39722,'12 x 8 Print (+2 6x4\'s)','12.00');
paymentOptions[70074] = new paymentOption(70074,'12 x 8 (X 2 Same Print)','16.00');
paymentOptions[57864] = new paymentOption(57864,'15 x 10 Print ( + 2 6x4\'s)','16.00');
paymentOptions[39725] = new paymentOption(39725,'Electronic File (Full Size-On Disc)','10.00');
paymentOptions[46822] = new paymentOption(46822,'Email Full Size File','6.00');
paymentOptions[61627] = new paymentOption(61627,'Disc of ALL photos of rider (usually 3+)','16.00');
paymentOptions[71643] = new paymentOption(71643,'BWAC - Full size Email File','25.00');
paymentOptions[71644] = new paymentOption(71644,'BWAC 15 X 10 (+2 6x4\'s)','30.00');
paymentOptions[57865] = new paymentOption(57865,'Photo Mug','20.00');
paymentOptions[57866] = new paymentOption(57866,'12 x 8 Photo Jigsaw','20.00');
paymentOptions[57867] = new paymentOption(57867,'Photo Postcards (pack of 10)','15.00');
paymentOptions[57868] = new paymentOption(57868,'Photo Keyrings (pack of 3)','12.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','39723,39722,70074,57864,39725,46822,61627,71643,71644,57865,57866,57867,57868');
/***************************************************************************
* 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;
}


