/* 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[45744] = new paymentOption(45744,'7&quot;x5&quot;','10.00');
paymentOptions[45745] = new paymentOption(45745,'A5','12.99');
paymentOptions[45746] = new paymentOption(45746,'10&quot;x8&quot;','15.00');
paymentOptions[45747] = new paymentOption(45747,'A4','20.00');
paymentOptions[45749] = new paymentOption(45749,'15&quot;x10&quot;','27.00');
paymentOptions[45964] = new paymentOption(45964,'Digital file','30.00');
paymentOptions[60506] = new paymentOption(60506,'CD','35.00');
paymentOptions[45750] = new paymentOption(45750,'A3 Canvas','65.00');
paymentOptions[45751] = new paymentOption(45751,'A2 Canvas','85.00');
paymentOptions[48399] = new paymentOption(48399,'Deposit 1','50.00');
paymentOptions[48400] = new paymentOption(48400,'Deposit 2','100.00');
paymentOptions[48401] = new paymentOption(48401,'Deposit 3','150.00');
paymentOptions[48402] = new paymentOption(48402,'Deposit 4','250.00');
paymentOptions[48404] = new paymentOption(48404,'Deposit 5','500.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[14732] = new paymentGroup(14732,'Events','45744,45745,45746,45747,45749,45750,45751');
			paymentGroups[14725] = new paymentGroup(14725,'Photographer hire','48399,48400,48401,48402,48404');
			paymentGroups[18589] = new paymentGroup(18589,'Portfolios','45745,45747,60506,45750,45751');
	/***************************************************************************
* 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;
}


