// This is an array of the form elements
// It supports setting default values and calculating costs
// Here are the fields
// [0] --> field name
// [1] --> price per item (zero if none)
// [2] --> TEST value
// [3] --> Required/not required field
// [4] --> buffered form elements
// [5] --> Product description
// [6] --> Buffered value (yuck)
// [7] --> Reset value
formFields = new Array(
  // SHIPPING METHOD  THESE MUST BE FIRST!!!
	'shipMethod', '0',  'usaPriority',    '', 0, 'Shipping Method', 0, 'nu',
	'po',         '0',  'ThisPONum',      '', 0, 'Purchase Order',  0, '',
	'invoice',    '0',  'ThisInvoiceNum', '', 0, 'Invoice',         0, '',

 // MULTIPLE TARGET SIMULATORS
	'etpu2cpusim_fl', '2960', 0, '', 0, 'eTPU2/CPU32 Sim License', 0, 0,
	'etpu2cpusim_ss',  '990', 0, '', 0, 'eTPU/CPU32 Sim 1 yr Maintenance', 0, 0,
	'etpucpusim_ss',  '985', 0, '', 0, 'eTPU/CPU32 Sim 1 yr Maintenance', 0, 0,
	'mts32_fl',      '2350', 0, '', 0, 'TPU/CPU32 Sim License', 0, 0,
	'mts32_ss',       '470', 0, '', 0, 'TPU/CPU32 Sim 1 yr Maintenance', 0, 0,
	'mtssm_fl',       '495', 0, '', 0, 'TPU Std Mask Sim License', 0, 0,
	'mtssm_ss',        '99', 0, '', 0, 'TPU Std Mask Sim 1 yr Maintenance', 0, 0,
 // SINGLE TARGET SIMULATORS
	'etpu2Sim_fl', '2870',  0, '', 0,'eTPU/eTPU2 Sim License', 0, 0,
	'etpu2Sim_ss', '690',  0, '', 0, 'eTPU/eTPU2 Sim 1 yr Maintenance', 0, 0,
	'etpuSim_ss',  '680',  0, '', 0, 'eTPU Sim 1 yr Maintenance', 0, 0,
	'tpuSim_fl',  '1850',  0, '', 0, 'TPU Sim License', 0, 0,
	'tpuSim_ss',   '370',  0, '', 0, 'TPU Sim 1 yr Maintenance', 0, 0,
	'sim32_fl',    '295',  0, '', 0, 'CPU32 Sim License', 0, 0,
	'sim32_ss',     '59',  0, '', 0, 'CPU32 Sim 1 yr Maintenance', 0, 0,
	'sim16_fl',    '295',  0, '', 0, 'CPU16 Sim License', 0, 0,
	'sim16_ss',     '59',  0, '', 0, 'CPU16 Sim 1 yr Maintenance', 0, 0,
 // HARDWARE DEBUGGERS
	'bdm32_fl',    '995',  0, '', 0, '683xx HW Dbg License', 0, 0,
	'bdm32_ss',    '395',  0, '', 0, '683xx HW Dbg 1 yr Maintenance', 0, 0,
 // COMPILERS
	'etec_pkg_fl', '4800', 0, '', 0, 'eTPU C Compiler & Simulator License', 0, 0,
	'etec_pkg_ss', '1450', 0, '', 0, 'eTPU C Compiler & Simulator Maintenance', 0, 0,
	'etec_fl',     '3200', 0, '', 0, 'eTPU C Compiler Tools Suite License', 0, 0,
	'etec_ss',     '1250', 0, '', 0, 'eTPU C Compiler Tools Suite Maintenance', 0, 0,
	'gnuppc',        '85', 0, '', 0, 'Coldfire/683xx and MPC5xx/PPC GNU Compiler', 0, 0,
	'gnu68k',        '85', 1, '', 0, 'Coldfire/683xx and MPC5xx/PPC GNU Compiler', 0, 0,
 // LITERATURE
	'etpuCode_book',  '120', 0, '', 0, 'eTPU Programming Made Easy', 0, 0,
	'etpuj_book',     '149', 0, '', 0, 'eTPU Programming in Japanese', 0, 0,
	'tpuCode_book',   '114', 0, '', 0, 'TPU Microcode for Beginners', 0, 0,
	'MPC5553_book',   '124', 0, '', 0, 'MPC5554/Mpc5553 Revealed', 0, 0,
	'coldfire_book',  '121', 0, '', 0, 'Coldfire Book', 0, 0,
	'coldfireCH_book','148', 0, '', 0, 'Coldfire Book in Chinese', 0, 0,

 // SHIPPING INFORMATION
 //     - This _MUST_ precede BILLING array
 //     - No products can be located after this point
 //     - NAMETOSHIP must be first
 //     - SHIPPING order must match BILLING order
	'NAMETOSHIP',     '',  'ShipToAndy', 'required', 0, '', 0, '',
	'ADDRESSTOSHIP',  '',  'ShipToAddress', 'required', 0, '', 0, '',
	'CITYTOSHIP',     '',  'ShipToBeaverton', 'required', 0,  '', 0, '',
	'STATETOSHIP',    '',  'ShipToOregon', 'required', 0, '', 0, '',
	'ZIPTOSHIP',      '',  'ShipTo97006', 'required', 0, '', 0, '',
	'COUNTRYTOSHIP',  '',  'ShipToUsa', 'required', 0, '', 0, '',
	'PHONETOSHIP',    '',  '5035330271', 'required', 0, '', 0, '',
	'FAXTOSHIP',      '',  '5032148693', 'optional', 0, '', 0, '',
	'EMAILTOSHIP',    '',  'ShipTosalesp@ashware.com', 'required', 0, '', 0, '',
 // BILLING INFORMATION        Warning: This MUST follow SHIPPING array
	'NAME',           '',  'BillToAndy', 'required', 0,  '', 0, '',
	'ADDRESS',        '',  'BillToAddress', 'required', 0, '', 0, '',
	'CITY',           '',  'BillToBeaverton', 'required', 0, '', 0, '',
	'STATE',          '',  'BillToOregon', 'required', 0, '', 0, '',
	'ZIP',            '',  '97006', 'required', 0, '', 0, '',
	'COUNTRY',        '',  'BillToUsa', 'required', 0, '', 0, '',
	'PHONE',          '',  '5035330271', 'required', 0, '', 0, '',
	'FAX',            '',  '5032148693', 'optional', 0, '', 0, '',
	'EMAIL',          '',  'BillToales@ashware.com', 'required', 0, '', 0, ''
);

var numFormFields = 8;

var months =
['Jan','Feb','Mar','Apr','May','June','July','Aug','Sep','Oct','Nov','Dec'];

// name - name of the cookie
// value - value of the cookie
// [path] - path for which the cookie is valid (defaults to path of calling document)
// [domain] - domain for which the cookie is valid (defaults to domain of calling document)
// [secure] - Boolean value indicating if the cookie transmission requires a secure transmission
// * an argument defaults when it is assigned null as a placeholder
// * a null placeholder is not required for trailing omitted arguments
function SetCookie( name, value )
{
	var expires = new Date();
	var year = expires.getFullYear() + 1;
	//alert('Year ' + year );
	expires.setFullYear( year );
	
	var curCookie = 
		name + "=" + escape(value) + '; ' +
		"expires=" + expires.toGMTString() + '; ' +
		"path=/; ";
	if( location.hostname )
	    curCookie = curCookie + "domain=" + location.hostname + '; ';
	document.cookie = curCookie;
	//alert( curCookie );
	//var newCookie = GetCookie("OrderInfo");
	//alert(newCookie);
	//alert(name);
	//  alert(value);  alert(expires);  alert(path);  alert(domain);  alert(secure);
	//alert( curCookie );
}

// name - name of the desired cookie
// * return string containing value of specified cookie or null if cookie does not exist
function GetCookie(name)
{
	//alert('In GetCookie();');
	// Get the cookie that is being searched for
	var searchString = name + "=";
	
	// Split into an array of named cookies
	var cookies = document.cookie.split(';');
	for( var i=0; i<cookies.length; i++ )
	{
		var temp = cookies[i];
		//alert( temp );
		//alert('In GetCookie() Loop ' + i + ' Searching for ' + searchString + ' in ' + cookies[i] );
		if( cookies[i].indexOf( searchString ) == 0 )
		{
			// get the cookie, including the 'CookieName='
			var oneCookieWithEqu = cookies[i];
			// Find the c
			var equalsIndex = oneCookieWithEqu.indexOf('=') + 1;
			var OneCookie = oneCookieWithEqu.substring( equalsIndex );
			
			//alert('found named cookie ' + OneCookie );
			return unescape( OneCookie );
		}
	}
	//alert("Num: " + cookies.length + cookies[0]);
	return null;
}

// date - any instance of the Date object
// * hand all instances of the Date object to this function for "repairs"
function fixDate(date) 
{
	var base = new Date(0);
	var skew = base.getTime();
	if (skew > 0)
		date.setTime(date.getTime() - skew);
}

var g_now      = new Date();
var g_oneMonth = new Date();
var g_oneYear  = new Date();

// Prevents flags from accessing objects that are not yet loaded
var isLoaded=0;

function CalculateDates()
{
	// fix the bug in Navigator 2.0, Macintosh
	fixDate(g_now);
	fixDate(g_oneMonth);
	fixDate(g_oneYear);

	g_oneMonth.setTime(g_now.getTime() + 31 * 24 * 60 * 60 * 1000);
	g_oneYear.setTime(g_now.getTime() + 365 * 24 * 60 * 60 * 1000);
}

var g_shipArray = [
	'nu',                 0, 'invalid',
	'usaFedex',          49, 'United states FEDEX',
	'usaPriority',        0, 'USA Priority mail',
	'otherCountryFedex', 89, 'Outside USA FEDEX',
	'otherCountry',      25, 'Outside USA regular mail'
];

var g_shipArrayCnt = 3;

function GetShippingCost()
{
	var n = formFields[6];
	for(var i=0; i<g_shipArray.length; i+=g_shipArrayCnt)
		if( n==g_shipArray[i] )
			return g_shipArray[i+1];
	return 0;
}

function IsShipMethodValid()
{
	var n = formFields[6];
	if(n==null | n=='' | n=='nu')
		return 0;
	for(var i=0; i<g_shipArray.length; i+=g_shipArrayCnt)
		if( n==g_shipArray[i] )
			return 1;
	return 0;
}

function GetShippingDesc()
{
	var n = formFields[6];
	if(n==null | n=='' | n=='nu')
		return 'invalid';
	for(var i=0; i<g_shipArray.length; i+=g_shipArrayCnt)
		if( n==g_shipArray[i] )
			return g_shipArray[i+2];
	return 'invalid';
}

// Copy information from the cookies
// into the submittable form, entry_form
function CopyCookiesToEntryForm()
{
	if( !isLoaded ) return;

	var def = document.entry_form;

	// Erase all the form's dynamic elements
	for(var i=0; i<30; i++)
		def.elements["e" + i].value='';

	var k=0;
	for(var i=0; i<formFields.length; i+=numFormFields)
	{
		var partNum = formFields[i+0];
		var c = getxCookie(partNum);
		if(c==null | c=='') continue;

		var dstName =  "e" + k++;
		var elDst = def.elements[dstName];
		if( elDst==null) { continue; }
		elDst.name  = partNum;
		elDst.value = c;
//		alert(elDst.name + ' ' + elDst.value);
	}
}

function MakeQuote()
{
	CopyLocalFormToCookies();
	var w = window.open('../buy/quote.htm','Quote',config='height=480,width=640,toolbar,menubar,auto,scrollbars',feature='scrollbars,auto')
	if( w != null )
	{
		//alert('Focus');
		w.focus();
	}
	return true;
}

function MakeCheckout()
{
	//alert('In MakeCheckout()');
	CopyLocalFormToCookies();
	var w = window.open('../buy/checkout.htm','Checkout',config='height=480,width=640,toolbar,menubar,auto,scrollbars',feature='scrollbars,auto')
	if( w.focus )
	{
		//alert('Focus');
		w.focus();
	}
	return true;
}

function ToMoney(d)
{
	return '$ ' + d + '.00 U.S.';
}

function SetTestValues()
{
	//var temp = 0;
	for(var i=0; i<formFields.length; i+=numFormFields)
	{
		// Copy the 'test' value to the 'buffered' value
		formFields[i+6] = formFields[i+2];
		//if( temp < 3 )
		//	alert ( 'X ' + formFields[i+6] + ' Y ' + formFields[i+2] + ' Z ' );
		//temp = temp + 1;
	}
	CopyBufferToLocalForm();
	CopyBufferToCookies();
}

function CopyBufferToLocalForm()
{
	var temp = 0;
	for(var i=0; i<formFields.length; i+=numFormFields)
	{
		// Is there a form element with this name???
		var l_name = formFields[i+0];
		var t = document.getElementById(l_name);
		if( t==null )
		{
			// This particular element does not exist on this particular page
			// So skip it
			//alert('No Exist ' + l_name );
			continue;
		}

		// This form-element DOES exist on this page,
		// Set it to the 'Buffered Value'
		var l_newVal = formFields[i+6];
		t.value = l_newVal;
		//alert('EXISTS: ' + l_name + ' ' + l_newVal);
		continue;

		// Get the 'Buffered Form Element' ???
		var e = formFields[i+4];
		//alert( e );
		if(e != null )
		{
			// Get the 'Buffered Form Value'
			var v = formFields[i+6];
			if( v==0)
				v = formFields[i+7];  // use reset value to avoid problems
				
				
			if( temp < 200 )
				alert ( 'E: ' + e + ' V: ' + v + ' Z ' );
			temp = temp + 1;

			if( e.value != null)
			{
				alert('e != NULL' + e.value );
				e.value = v;
			}
			
			var t = document.getElementById(v);
			if( t!=null )
			{
				var l_val = formFields[i+0];
			}
			
			
			// alert(formFields[i+0] + ' ' + v);
			else if( e.selectedIndex != null)
			{
				for(var j=0; j<e.options.length; j++)
					if(e.options[j].value == v)
						e.selectedIndex = j;
				//	alert(e.options[0].value + ' ' + e.value + ' ' + v + e.options.length)
			}
		}
	}
}

function CopyLocalFormToBuffer()
{
	var l_text = '';
	for(var i=0; i<formFields.length; i+=numFormFields)
	{
		// Is there a form element with this name???
		var l_name = formFields[i+0];
		var t = document.getElementById(l_name);
		if( t==null )
		{
			// This particular element does not exist on this particular page
			// So skip it
			//alert('No Exist ' + l_name );
			continue;
		}

		// Get the text that the user has set the form element to.
		// and place it into the buffer
		var l_val = t.value;
		formFields[i+6] = l_val;

		//============================================================
		// KEEP THIS!  It can be useful in printing all the fields
		// from this from into a formatted 
		//l_text = l_text + '<br>' + l_name + '=' + l_val + '  [' + i + ']';
		//document.getElementById('AshDbgConsole').innerHTML = l_text;
		//============================================================
	}
}

function CopyBufferToCookies()
{
	var c='';
	for(var i=0; i<formFields.length; i+=numFormFields)
	{
		var v = formFields[i+6];
		if( v!=0)
		{
			var partNum = formFields[i+0];
			c = c + partNum + '&&&' + v + '&&&';
		}
	}
	CalculateDates();
	//alert(c);
	SetCookie("OrderInfo", c );
}

function CopyCookiesToBuffer()
{
	//alert('In CopyCookiesToBuffer()');
	var oArray = [0];
	var oCookie = GetCookie("OrderInfo");

	if( oCookie!=null )
	{
		//alert('In CopyCookiesToBuffer(), cookies not null');
		oArray = oCookie.split('&&&');
		oArray.length -=1;

		for(var i=0; i<formFields.length; i+=numFormFields)
		{
			formFields[i+6] = 0;
			var partNum = formFields[i+0];
			for(var j=0; j<oArray.length; j+=2)
			{
				if(oArray[j]==partNum)
				{
					formFields[i+6] = oArray[j+1];
					//alert(formFields[i+0] + '   ' + formFields[i+6] );
				}
			}
		}
	}
}

function CopyFromShippingToBilling()
{
	CopyFrom( 'shipping' );
}

function CopyFromBillingToShipping()
{
	CopyFrom( 'billing' );
}

// Copies the billingInfo to the shippingInfo or visa-versa
function CopyFrom(src)
{
	CopyCookiesToBuffer();
	var shipIndex=-1, billIndex=-1;
	for(var i=0; i<formFields.length; i+=numFormFields)
	{
		if(formFields[i] == 'NAMETOSHIP') shipIndex=i;
		if(formFields[i] == 'NAME')       billIndex=i;
	}

	if(shipIndex==-1 || billIndex==-1)
		alert("ERROR: Couldn't find CopyFrom fields");
	var len = (billIndex - shipIndex)/numFormFields;
	for(var i=0; i<len; i++)
	{
		if( src == 'billing')
			formFields[shipIndex+6] = formFields[billIndex+6];
		else
			formFields[billIndex+6] = formFields[shipIndex+6];
	billIndex+=numFormFields;
	shipIndex+=numFormFields;
	}
	CopyBufferToLocalForm();
	CopyLocalFormToCookies();
}

// This greatly speeds up a number of function running under NN
// the crazy way it is written is to work around a number of
// lovely but undocumented NN bugs.  Yay netscape.  ESAD.
function InitializeShoppingCart()
{
	//alert("In InitializeShoppingCart(); ");
	CopyCookiesToLocalForm();
}

function CopyCookiesToLocalForm()
{
	CopyCookiesToBuffer();
	CopyBufferToLocalForm();
}

function CopyLocalFormToCookies()
{
	//alert('In CopyLocalFormToCookies();');
	CopyCookiesToBuffer();
	CopyLocalFormToBuffer();
	CopyBufferToCookies();
}

function ClearShoppingCart()
{
	for(var i=numFormFields*3; i<formFields.length; i+=numFormFields)
	{
		if( formFields[i]== 'NAMETOSHIP')
			break;
		formFields[i+6] = 0;
	}
	CopyBufferToLocalForm();
	CopyBufferToCookies();
	if( location.reload )
		location.reload(true);
}

function IsValidOrder()
{
	var isValid = 1;
	CopyCookiesToBuffer();

	var totalCost=0;
	var reqdStr = '';
	for(var i=numFormFields*3; i<formFields.length; i+=numFormFields)
	{
		var costPer = formFields[i+1];
		var partNum = formFields[i+0];
		var qty = parseInt( formFields[i+6] );

		if(costPer != '' & costPer != 0 & qty>0 & !isNaN(qty) )
		{
			totalCost += (costPer*qty);
			var thisEbArray = partNum.split("_eb");
			if(thisEbArray[0]!=partNum)
			{
				var ssName = thisEbArray[0] + '_ss';
				for(var j=0; j<formFields.length; j+=numFormFields)
				{
					if(formFields[j+0]== ssName)
					{
						ssQty = parseInt( formFields[j+6] )
						if(ssQty < qty)
						{
							isValid = 0;
							alert("The early bird discount quantity\n" +
								  "cannot exceed the software subscription quantity,\n" +
								  "found on the following product:\n\n   "
								  + formFields[j+5]);
						}
					}
				}
			}
		}
		
		if( formFields[i+3] == 'required')
		{
			if(formFields[i+6] == 0 | formFields[i+6] == '')
			{
				reqdStr = reqdStr + ' ' + formFields[i+0];
			}
		}
	}
	if( reqdStr != '')
	{
		alert("Please enter the following required fields\n"
			  + "in the shipping and billing pages\n\n "
			  + reqdStr);
		return 0;
	}

	if( totalCost <= 0)
	{
		alert("Please select a product (total cost " + totalCost + ")");
		return 0;
	}

	if( IsShipMethodValid() == 0)
	{
		alert("Please select a shipping method");
		return 0;
	}

	return isValid;
}

function GotoVerisign()
{
	if( IsValidOrder() == 0)
	{
		alert('FAILURE checking order');
		return;
	}

	var def=document.entry_form;
	def.verify.value = 1;
	var totalCost = GetShippingCost();

	// Copy each required/optional field into its own element
	var k=0;
	var isEField=0;
	var orderString=formFields[6] + '=$' + GetShippingCost() + ',  ';
	var l_po =formFields[numFormFields*1+6];
	var l_inv =formFields[numFormFields*2+6];
	if(l_po!=null & l_po !=0 & l_po!='')
		orderString+= 'PO ' + l_po + ',  ';
	if(l_inv!=null & l_inv !=0 & l_inv!='')
		orderString+= 'Invoice ' + l_inv + ',  ';
	for(var i=numFormFields*3; i<formFields.length; i+=numFormFields)
	{
		if( formFields[i+0] == 'NAMETOSHIP')  isEField=1;

		var qty = formFields[i+6];
		var iQty = parseInt(qty);
		if(qty != 0 & isEField==0)
		{
			var partNum = formFields[i+0];
			if( qty > 0 )
			{
				var costPer = parseInt( formFields[i+1] );
				var thisCost = iQty * costPer;
				orderString += iQty + " " + partNum + "=$" + thisCost + ",  ";
				totalCost += thisCost;
			}
			else  // E.G. Power cable
				orderString += partNum + "=" + qty + ",  ";
		}

		if(formFields[i+3] != '' & isEField==1)
		{
			var dstName =  "e" + k++;
			var elDst = def.elements[dstName];
			elDst.name  = formFields[i+0];
			elDst.value = formFields[i+6];
			// alert( elDst.name + ' ' + elDst.value);
		}
	}

	def.DESCRIPTION.value = orderString;
	def.AMOUNT.value = totalCost;
	def.submit();
	alert('You are entering a secure server ' + totalCost);
//	alert(orderString);
}

function CalculateOrder(type)
{
	//alert(' In CalculateOrder();');
	if( IsValidOrder() ==0)
		window.close();

	isLoaded = 1;
	CalculateDates();
	CopyCookiesToBuffer();
	var lyr = document.getElementById('Layer1');

	var descStr = '<b>Description</b><br>', qtyStr='<b>Qty</b><br>', priceStr='<b>Price</b><br>', total=0;
	var shipStr='', billStr = '';
	var k=0;
	isEField=0;
	for(var i=numFormFields*3; i<formFields.length; i+=numFormFields)
	{
		if( formFields[i+0] == 'NAMETOSHIP')  isEField=1;
		if( formFields[i+0] == 'NAME')        isEField=2;

		var desc    = formFields[i+5];
		var partNum = formFields[i+0];
		var qty     = formFields[i+6];
		var price   = parseInt(formFields[i+1]);
		if(qty != 0 & isEField==0)
		{
			if( qty > 0 )
			{
				descStr  = descStr + desc + ' (' + partNum + ')<br>';
				qtyStr   = qtyStr  + qty + '<br>';
				priceStr = priceStr + ToMoney(price * qty) + '<br>';
				total    = total + (price * qty);
			}
			else  // E.G. Power cable
			{
				descStr  = descStr  + partNum + ' - ' + qty + '<br>';
				qtyStr   = qtyStr   + '<br>';
				priceStr = priceStr + '<br>';
			}
		}

		if( isEField==1 & formFields[i+6]!='' & formFields[i+6]!=0)
		{
			shipStr  = shipStr + formFields[i+6] + '<br>';
		}
		if( isEField==2 & formFields[i+6]!='' & formFields[i+6]!=0)
		{
			billStr  = billStr + formFields[i+6] + '<br>';
		}
	}

	var shipDesc = GetShippingDesc();
	descStr  = descStr + shipDesc + '<br>';
	qtyStr   = qtyStr  + 1 + '<br>';
	var shipCost = GetShippingCost();
	total += shipCost;
	priceStr = priceStr + ToMoney(shipCost) + '<br>';

	descStr = '<p class=\"smallHintText\">' + descStr + '<br>Total:</p>';
	qtyStr  = '<p class=\"smallHintText\">' + qtyStr  + '<br>&nbsp;</p>';
	var priceStr = '<p class=\"smallHintText\">' + priceStr + '<br><b>' + ToMoney(total) + '</b></p>';

	var l1='', l2='<hr width=\"100%\" align=\"center\">', l4='';
	if( type=='quote')
	{
		l1  = '<p>This quote is good until '
			+ g_oneMonth.getUTCDay() + '-'
			+ months[g_oneMonth.getUTCMonth()] + '-'
			+ g_oneMonth.getUTCFullYear() + '.</p>';
		l2 = '<p>Please note that our net terms are 30 days. Faxed purchase orders are accepted.</p>'
	}

	var l3 = '';
	if( type=='checkout')
	{
		l3 =  '<br><table width=\"90%\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\"><tr>'
			+ '<td><b>Billing<br></b>'  +  billStr + '</td>'
			+ '<td><b>Shipping<br></b>' +  shipStr + '</td>'
			+ '</tr></table><br>'
			+ '<hr width=\"100%\" align=\"center\">';
	}

var tableTxt = l1
+ '<table width=\"90%\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\">'
+ '<tr><td width=\"60%\">'
+  descStr
+ '</td>'
+ '<td width=\"10%\">'
+ '<div id=\"qtyText\">'
+  qtyStr
+ '</td>'
+ '<td width=\"30%\">'
+  priceStr
+ '</td></tr></table><br>'
+ l2
+ l3
+ '<p>Thank you for this opportunity.</p>'
+ '<p>Sales Department</p>';

	if( lyr != null )
		lyr.innerHTML = tableTxt;
}
