/* 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[83507] = new paymentOption(83507,'6&quot; x 4&quot; Unframed Matt Print','2.49');
paymentOptions[83508] = new paymentOption(83508,'6&quot; x 4&quot; Unframed Gloss Print','2.49');
paymentOptions[83511] = new paymentOption(83511,'7&quot; x 5&quot; Unframed Matt Print','2.99');
paymentOptions[83512] = new paymentOption(83512,'7&quot; x 5&quot; Unframed Gloss Print','2.99');
paymentOptions[83515] = new paymentOption(83515,'9&quot; x 6&quot; Unframed Matt Print','3.39');
paymentOptions[83516] = new paymentOption(83516,'9&quot; x 6&quot; Unframed Gloss Print','3.39');
paymentOptions[83517] = new paymentOption(83517,'10&quot; x 7&quot; Unframed Matt Print','3.99');
paymentOptions[83518] = new paymentOption(83518,'10&quot; x 7&quot; Unframed Gloss Print','3.99');
paymentOptions[83519] = new paymentOption(83519,'A4 Unframed Matt Print','4.29');
paymentOptions[83520] = new paymentOption(83520,'A4 Unframed Gloss Print','4.29');
paymentOptions[83521] = new paymentOption(83521,'15&quot; x 10&quot; Unframed Matt Print','6.99');
paymentOptions[83522] = new paymentOption(83522,'15&quot; x 10&quot; Unframed Gloss Print','6.99');
paymentOptions[83523] = new paymentOption(83523,'A3 Unframed Matt Print','12.99');
paymentOptions[83524] = new paymentOption(83524,'A3 Unframed Gloss Print','12.99');
paymentOptions[83525] = new paymentOption(83525,'A2 Unframed Matt Print','16.99');
paymentOptions[83526] = new paymentOption(83526,'A2 Unframed Gloss Print','16.99');
paymentOptions[83527] = new paymentOption(83527,'30&quot; x 20&quot; Unframed Matt Print','22.49');
paymentOptions[83528] = new paymentOption(83528,'30&quot; x 20&quot; Unframed Gloss Print','22.99');
paymentOptions[83530] = new paymentOption(83530,'12&quot; x 8&quot; Framed Canvas','44.99');
paymentOptions[83531] = new paymentOption(83531,'24&quot; x 16&quot; Framed Canvas','80.99');
paymentOptions[83532] = new paymentOption(83532,'30&quot; x 20&quot; Framed Canvas','92.99');
paymentOptions[83533] = new paymentOption(83533,'5&quot; x 5&quot; Unframed Matt Print','2.99');
paymentOptions[83534] = new paymentOption(83534,'5&quot; x 5&quot; Unframed Gloss Print','2.99');
paymentOptions[83535] = new paymentOption(83535,'8&quot; x 8&quot; Unframed Matt Print','4.49');
paymentOptions[83536] = new paymentOption(83536,'8&quot; x 8&quot; Unframed Gloss Print','4.49');
paymentOptions[83537] = new paymentOption(83537,'12&quot; x 12&quot; Unframed Matt Print','10.99');
paymentOptions[83538] = new paymentOption(83538,'12&quot; x 12&quot; Unframed Gloss Print','10.99');
paymentOptions[83539] = new paymentOption(83539,'12&quot; x 12&quot; Mounted Canvas','50.99');
paymentOptions[83540] = new paymentOption(83540,'16&quot; x 12&quot; Mounted Canvas','59.99');
paymentOptions[83541] = new paymentOption(83541,'12&quot; x 5&quot; Unframed Matt Print','5.99');
paymentOptions[83542] = new paymentOption(83542,'12&quot; x 5&quot; Unframed Gloss Print','5.99');
paymentOptions[83543] = new paymentOption(83543,'20&quot; x 8&quot; Unframed Matt Print','11.99');
paymentOptions[83544] = new paymentOption(83544,'20&quot; x 8&quot; Unframed Gloss Print','11.99');
paymentOptions[83545] = new paymentOption(83545,'24&quot; x 12&quot; Mounted Canvas','57.99');
/***************************************************************************
* Create the array of payment groups. If site does notuse groups create    *
* just one with an ID of 0                                                 *
***************************************************************************/
var paymentGroups = new Object();
paymentGroups[25933] = new paymentGroup(25933,'Panoramic Prints','83541,83542,83543,83544,83545');
	paymentGroups[25932] = new paymentGroup(25932,'Square Prints','83533,83534,83535,83536,83537,83538,83539,83540');
	paymentGroups[25930] = new paymentGroup(25930,'Standard Prints','83507,83508,83511,83512,83515,83516,83517,83518,83519,83520,83521,83522,83523,83524,83525,83526,83527,83528,83530,83531,83532');
	/***************************************************************************
* 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;
}


