/* 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[79444] = new paymentOption(79444,'2012 Calendar','5.00');
paymentOptions[66669] = new paymentOption(66669,'A4 Print - unmounted','10.00');
paymentOptions[66670] = new paymentOption(66670,'A4 Print - mounted','15.00');
paymentOptions[66671] = new paymentOption(66671,'A3 Print - unmounted','17.50');
paymentOptions[66672] = new paymentOption(66672,'A3 Print - mounted','22.50');
paymentOptions[66673] = new paymentOption(66673,'A2 Print - unmounted','27.50');
paymentOptions[51617] = new paymentOption(51617,'Christmas cards','5.00');
paymentOptions[66432] = new paymentOption(66432,'A3 Poster','7.50');
paymentOptions[66572] = new paymentOption(66572,'A2 Poster','12.50');
paymentOptions[70980] = new paymentOption(70980,'5 Greetings cards','8.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[24627] = new paymentGroup(24627,'Calendar','79444');
			paymentGroups[15697] = new paymentGroup(15697,'Christmas Cards & Prints','66669,66670,66671,66672,66673,51617');
			paymentGroups[20388] = new paymentGroup(20388,'Poster','66432,66572');
			paymentGroups[20450] = new paymentGroup(20450,'Prints','66669,66670,66671,66672,66673');
			paymentGroups[21930] = new paymentGroup(21930,'Prints & Greetings Cards','66669,66670,66671,66672,66673,70980');
	/***************************************************************************
* 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;
}


