/* 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[14109] = new paymentOption(14109,'20x30  framed and mounted','40.00');
paymentOptions[14129] = new paymentOption(14129,' 20x30 white mount only','30.00');
paymentOptions[14157] = new paymentOption(14157,'30x30 framed and mounted','70.00');
paymentOptions[14158] = new paymentOption(14158,'30x30 Mount only','45.00');
paymentOptions[14110] = new paymentOption(14110,'30x40  framed and mounted','85.00');
paymentOptions[14131] = new paymentOption(14131,'30x40 white mount only','55.00');
paymentOptions[14159] = new paymentOption(14159,'40x40  framed and mounted','110.00');
paymentOptions[14160] = new paymentOption(14160,'40x40  white mount only','80.00');
paymentOptions[45599] = new paymentOption(45599,'30x74 framed and mounted','145.00');
paymentOptions[46594] = new paymentOption(46594,'30x74 white mount only','105.00');
paymentOptions[14122] = new paymentOption(14122,'40x50  framed and mounted','125.00');
paymentOptions[14133] = new paymentOption(14133,'40x50 white mount only','90.00');
paymentOptions[14161] = new paymentOption(14161,'25x60 framed and mounted','125.00');
paymentOptions[14162] = new paymentOption(14162,'25x60 white mount only','90.00');
paymentOptions[14134] = new paymentOption(14134,'60x80 framed and mounted','175.00');
paymentOptions[14135] = new paymentOption(14135,'60x80 white mount only','125.00');
paymentOptions[14163] = new paymentOption(14163,'70x70 mounted and framed','175.00');
paymentOptions[14164] = new paymentOption(14164,'70x70 white mount only','125.00');
paymentOptions[14234] = new paymentOption(14234,'35x100 mounted and framed','175.00');
paymentOptions[14236] = new paymentOption(14236,'35x100 white mount only','125.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[4301] = new paymentGroup(4301,'Landscape - 3 sizes','14109,14129,14110,14131,14122,14133');
			paymentGroups[4249] = new paymentGroup(4249,'Landscape - 4 sizes','14109,14129,14110,14131,14122,14133,14134,14135');
			paymentGroups[13903] = new paymentGroup(13903,'Long - 1 Size','14109,14129,45599,46594,14161,14162,14234,14236');
			paymentGroups[4266] = new paymentGroup(4266,'Long - 2 sizes','14109,14129,14110,14131');
			paymentGroups[4268] = new paymentGroup(4268,'Long Block - 7 sizes','14109,14129,14157,14158,14110,14131,14159,14160,14122,14133,14134,14135,14163,14164');
			paymentGroups[4271] = new paymentGroup(4271,'Square - 1 size','14157,14158');
			paymentGroups[4270] = new paymentGroup(4270,'Square - 2 sizes','14157,14158,14159,14160');
			paymentGroups[4265] = new paymentGroup(4265,'Square - 3 sizes','14157,14158,14159,14160,14163,14164');
			paymentGroups[4269] = new paymentGroup(4269,'Superlong - 2 sizes','14109,14129,14161,14162');
			paymentGroups[4267] = new paymentGroup(4267,'Superlong - 3 sizes','14109,14129,14110,14131,14161,14162');
			paymentGroups[4305] = new paymentGroup(4305,'Superlong - 4 sizes','14109,14129,14110,14131,14161,14162,14234,14236');
	/***************************************************************************
* 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;
}


