﻿function selectOrderForm(result, context) {
	var pfx = "ctl00_phMain_";
	var arCells = result.split("|.|");
	var i = 0;
	var subTotal = 0;
	var tax = 0;
	var txtCurrentFormID = document.getElementById(pfx + "txtCurrentFormID");
	var lblFormName = document.getElementById(pfx + "lblFormName");
	var lblFormCount = document.getElementById(pfx + "lblFormCount");
	var lblOrderFormsCost = document.getElementById(pfx + "lblOrderFormsCost");
	var lblShippingCost = document.getElementById(pfx + "lblShippingCost");
	var lblTax = document.getElementById(pfx + "lblTax");
	var txtNotes = document.getElementById(pfx + "txtNotes");
	var txtOrderCount = document.getElementById(pfx + "txtOrderCount");
	var lblSubTotal = document.getElementById(pfx + "lblSubTotal");
	
	txtOrderCount.value = "1";
	txtNotes.value = "";
	
	// populate the controls
	txtCurrentFormID.value = arCells[0];
	lblFormName.innerHTML = "<strong>" + arCells[1] + "</strong>";
	lblOrderFormsCost.value = arCells[2];
	lblFormCount.innerHTML = arCells[3];
	
	// calculate the subtotal and format it.
	subTotal = fromCurrency(arCells[2]);
	i = 1;
	if (isInteger(txtOrderCount.value)) i = txtOrderCount.value;
	
	subTotal = (Number(subTotal) * Number(i));

	//lblSubTotal.value = toCurrency(subTotal);
	
	return true;
}