/* 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[17748] = new paymentOption(17748,'6x4 ','10.00');
paymentOptions[26807] = new paymentOption(26807,'7x5','12.00');
paymentOptions[45038] = new paymentOption(45038,'8x8 (cropping required if not already square)','13.00');
paymentOptions[17750] = new paymentOption(17750,'10x8 (cropping required)','15.00');
paymentOptions[32031] = new paymentOption(32031,'A4','20.00');
paymentOptions[32032] = new paymentOption(32032,'14x10','25.00');
paymentOptions[34765] = new paymentOption(34765,'12 x 12 (cropping required if not already square)','27.00');
paymentOptions[32033] = new paymentOption(32033,'A3','30.00');
paymentOptions[64683] = new paymentOption(64683,'16x12','30.00');
paymentOptions[53366] = new paymentOption(53366,'24x16 Canvas','146.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[19165] = new paymentGroup(19165,'events','17748,26807,17750,32031');
			paymentGroups[5361] = new paymentGroup(5361,'print sales','17748,26807,45038,17750,32031,32032,34765,32033,64683,53366');
	/***************************************************************************
* 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;
}


