/* 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[67574] = new paymentOption(67574,'Unmounted print image size 15 x 11 ins','45.00');
paymentOptions[67563] = new paymentOption(67563,'Unmounted print image size 12 x 10 ins','35.00');
paymentOptions[67562] = new paymentOption(67562,'Unmounted b/w print image size 12 x 10 ins','35.00');
paymentOptions[67575] = new paymentOption(67575,'Unmounted print image size 12 x 8 ins','30.00');
paymentOptions[67576] = new paymentOption(67576,'Unmounted b/w print image size 12 x 8 ins','30.00');
paymentOptions[67577] = new paymentOption(67577,'Unmounted print image size 10 x 8 ins','25.00');
paymentOptions[67578] = new paymentOption(67578,'Unmounted b/w print image size 10 x 8 ins','22.00');
paymentOptions[67579] = new paymentOption(67579,'Unmounted print image size 10 x 7 ins','25.00');
paymentOptions[67580] = new paymentOption(67580,'Unmounted b/w print image size 10 x 7 ins','22.00');
paymentOptions[67581] = new paymentOption(67581,'Unmounted print image size 7 x 5 ins','15.00');
paymentOptions[75134] = new paymentOption(75134,'Unmounted print image size 12 x 7 ins','30.00');
paymentOptions[67582] = new paymentOption(67582,'Unmounted b/w print image size 7 x 5 ins','14.00');
paymentOptions[68037] = new paymentOption(68037,'Unmounted print image size 11 x 11 ins ','40.00');
paymentOptions[67621] = new paymentOption(67621,'Original available - price on application','0.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[20772] = new paymentGroup(20772,'Image size 10 x 7','67579');
			paymentGroups[20773] = new paymentGroup(20773,'Image size 10 x 7 b/w','67580');
			paymentGroups[20771] = new paymentGroup(20771,'Image size 10 x 8 b/w','67578');
			paymentGroups[20763] = new paymentGroup(20763,'Image size 10 x 8 ins','67577');
			paymentGroups[20956] = new paymentGroup(20956,'Image size 11 x 11 ins','68037');
			paymentGroups[20769] = new paymentGroup(20769,'Image size 12 x 10 b/w','67562');
			paymentGroups[20761] = new paymentGroup(20761,'Image size 12 x 10 ins','67563');
			paymentGroups[23207] = new paymentGroup(23207,'Image size 12 x 7 ins ','75134');
			paymentGroups[20770] = new paymentGroup(20770,'Image size 12 x 8 b/w','67576');
			paymentGroups[20762] = new paymentGroup(20762,'Image size 12 x 8 ins','67575');
			paymentGroups[20760] = new paymentGroup(20760,'Image size 15 x 11 ins','67574');
			paymentGroups[20774] = new paymentGroup(20774,'Image size 7 x 5 b/w','67582');
			paymentGroups[20764] = new paymentGroup(20764,'Image size 7 x 5 ins','67581');
			paymentGroups[20790] = new paymentGroup(20790,'Original available + 10 x 8 bw','67578,67621');
			paymentGroups[20789] = new paymentGroup(20789,'Original available + 10 x 8 c','67577,67621');
			paymentGroups[23208] = new paymentGroup(23208,'Original available + 12 x 7 c','75134,67621');
			paymentGroups[20792] = new paymentGroup(20792,'Original available + 12 x 8 bw','67576,67621');
			paymentGroups[20791] = new paymentGroup(20791,'Original available + 12 x 8 c','67575,67621');
			paymentGroups[20806] = new paymentGroup(20806,'Original available + 15 x 11c','67574,67621');
			paymentGroups[20803] = new paymentGroup(20803,'original available + 7 x 5 bw','67582,67621');
			paymentGroups[20802] = new paymentGroup(20802,'original available + 7 x 5 c','67581,67621');
			paymentGroups[20788] = new paymentGroup(20788,'Original no price 10 x 7 bw','67580,67621');
			paymentGroups[20787] = new paymentGroup(20787,'Originals no price 10 x 7 c','67579,67621');
	/***************************************************************************
* 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;
}


