/* 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.item_price_1.value = paymentOptions[id].price;
			form.item_name_1.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[79417] = new paymentOption(79417,'*NEW* Thumbnail Image for facebook','3.00');
paymentOptions[43528] = new paymentOption(43528,'6&quot; x 4&quot; Print','7.00');
paymentOptions[45476] = new paymentOption(45476,'6&quot; x 4&quot; Print with Ivory slip in mount','9.25');
paymentOptions[43506] = new paymentOption(43506,'5&quot; x 7&quot; Print','9.50');
paymentOptions[45478] = new paymentOption(45478,'5&quot; x 7&quot; Print with Ivory slip in mount','12.95');
paymentOptions[49580] = new paymentOption(49580,'6&quot; x 9&quot; Print','12.50');
paymentOptions[43527] = new paymentOption(43527,'12&quot; x 8&quot; Print','18.00');
paymentOptions[43529] = new paymentOption(43529,'18&quot; x 12&quot; Print','24.50');
paymentOptions[44431] = new paymentOption(44431,'24&quot; x 16&quot; Print','39.50');
paymentOptions[44429] = new paymentOption(44429,'12&quot; x 8&quot; Photo Canvas','85.00');
paymentOptions[44430] = new paymentOption(44430,'16&quot; x 12&quot; Photo Canvas','105.00');
paymentOptions[47610] = new paymentOption(47610,'20&quot; x 16&quot; Photo Canvas','130.00');
paymentOptions[78666] = new paymentOption(78666,'Digital Image - non commercial use','9.50');
paymentOptions[79416] = new paymentOption(79416,'Digital Image - COMMERCIAL USE','18.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','79417,43528,45476,43506,45478,49580,43527,43529,44431,44429,44430,47610,78666,79416');
/***************************************************************************
* 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;
}


