/* 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[81956] = new paymentOption(81956,'10cm x 10cm','10.00');
paymentOptions[81403] = new paymentOption(81403,'20cm x 20cm','30.00');
paymentOptions[81404] = new paymentOption(81404,'30cm x 30cm','50.00');
paymentOptions[81405] = new paymentOption(81405,'30cm x 30cm Limited Edition 50','95.00');
paymentOptions[81407] = new paymentOption(81407,'42cm x 28cm','65.00');
paymentOptions[81406] = new paymentOption(81406,'42cm x 28cm Limited Edition 50','125.00');
paymentOptions[81408] = new paymentOption(81408,'28cm x 42cm','65.00');
paymentOptions[81409] = new paymentOption(81409,'28cm x 42cm Limited Edition 50','125.00');
paymentOptions[81410] = new paymentOption(81410,'42cm x 22.5cm','60.00');
paymentOptions[81411] = new paymentOption(81411,'35cm x 28cm','60.00');
paymentOptions[81412] = new paymentOption(81412,'28cm x 35cm','60.00');
paymentOptions[81547] = new paymentOption(81547,'22.5cm x 42cm','60.00');
paymentOptions[82032] = new paymentOption(82032,'42cm x 28cm Limited Edition 20','190.00');
paymentOptions[82033] = new paymentOption(82033,'42cm x 22.5cm Limited Edition 20','180.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[25431] = new paymentGroup(25431,'Camera Phone Images','81956');
			paymentGroups[25190] = new paymentGroup(25190,'Horizontal Images 15:8 ratio','81410');
			paymentGroups[25465] = new paymentGroup(25465,'Horizontal Images 15:8 ratio Limited Edition 20','82033');
			paymentGroups[25189] = new paymentGroup(25189,'Horizontal Images 3:2 ratio','81407');
			paymentGroups[25464] = new paymentGroup(25464,'Horizontal Images 3:2 ratio Limited Edition 20','82032');
			paymentGroups[25458] = new paymentGroup(25458,'Horizontal Images 3:2 ratio Limited Edition 50','81406');
			paymentGroups[25191] = new paymentGroup(25191,'Horizontal Images 5:4 ratio','81411');
			paymentGroups[25187] = new paymentGroup(25187,'Square Images','81403,81404');
			paymentGroups[25460] = new paymentGroup(25460,'Square Images Limited Edition 50','81405');
			paymentGroups[25247] = new paymentGroup(25247,'Vertical Images 15:8 ratio','81547');
			paymentGroups[25188] = new paymentGroup(25188,'Vertical Images 3:2 ratio','81408');
			paymentGroups[25457] = new paymentGroup(25457,'Vertical Images 3:2 ratio Limited Edition 50','81409');
			paymentGroups[25192] = new paymentGroup(25192,'Vertical Images 5:4 ratio','81412');
	/***************************************************************************
* 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;
}


