var insection=0;
var vatrate="15%";
var vatmult=115;

/*
var	vatrate="17.5";
var vatmult=117.5;
*/

function w(s)
		{
		document.write(s);
		}


function wl(s)
		{
		document.writeln(s);
		}


function doAddToBasket(item, desc, price, shipping)
		{
		shop.item_name.value = desc;
		shop.item_number.value = item;
		shop.amount.value = price;
		shop.shipping.value = shipping;
		shop.submit();
		}


function doPayInvoice()
		{
		payinv.item_name.value = 'SwiftTec Invoice no. '+payinv.invno.value;
		payinv.item_number.value = 'INV-'+payinv.invno.value;
		payinv.amount.value = payinv.invamt.value;
		payinv.submit();
		}



function toCurrencyString(n)
		{
		var	m;
		var n1, n2;
		
		m = Math.floor(n);
		n1 = Math.floor(n * 10) % 10;
		n2 = Math.floor(n * 100) % 10;
		
		return 'n='+n+'m='+m+' n1='+n1+' n2='+n2;
		}


function addShopHeader(desc)
		{
		wl('<tr>');
		wl('<td align="left" colspan="5" bgcolor="teal"><b>'+desc+'</b></td>');
		wl('</tr>');
		}


function addShopEntry(item, desc, extra, price, pp, stock)
		{
		var	q="'";
		var	ev=price * 1;
		var sv=Math.round(pp*vatmult)/100;
		var iv=Math.round(ev*vatmult)/100;
		var inclvat=iv.toFixed(2);
		var exclvat=ev.toFixed(2);
		var shipping=sv.toFixed(2);
		var	dstr;

		dstr = desc;
		if (extra.length) dstr = dstr+'<br><font size=1 color=#800080><b>'+extra+'</b></font>';
		
		wl('<tr>');
		wl('<td align="left"><small><b>'+item+'</b></small></td>');
		wl('<td align="left">'+dstr+'</td>');
		wl('<td align="center"><small><b>'+stock+'</b></small></td>');
		wl('<td align="right"><font size="3" color="navy"><b>£'+inclvat+'</b></font><br><font color="red" size="1">Ex.VAT&nbsp;£'+exclvat+'</font></td>');
		//wl('<td align="right">£'+shipping+'</td>');
		//wl('<td align="right">£'+inclvat+'</td>');
		w('<td align="center">');
		w('<img alt="Add to paypal shopping basket" border="0" src="addtobasket.jpg" onclick="doAddToBasket(');
		w(q+item+q);
		w(','+q+desc+q);
		w(','+q+inclvat+q);
		w(','+q+shipping+q)
		wl(')"></td>');
		wl('</tr>');
		}

function endSection()
		{
		wl('</table>');
		insection = false;
		}
		
function addSection(title, tag)
		{
		if (insection) endSection();

		wl('<br><br><h4><a name="'+tag+'">'+title+'</a><br><font size=1><a href="#TOP">Back to top</a></font></h4>');
		wl('<table border="1" cellpadding="8" style="border-collapse: collapse" bordercolor="#000080" width="100%">');
		wl('<tr>');
		wl('<td align="left" bgcolor="#000080" width="70"><font color="#FFFFFF" size="3">Item</font></td>');
		wl('<td align="left" bgcolor="#000080" width="80%"><font color="#FFFFFF" size="3">Description</font></td>');
		wl('<td align="center" bgcolor="#000080"><font color="#FFFFFF" size="3">Stock</font></td>');
		wl('<td align="center" bgcolor="#000080"><font color="#FFFFFF" size="3">Price</font></td>');
		//wl('<td align="center" bgcolor="#000080"><font color="#FFFFFF" size="3">P&amp;P<br><font size="1">Excl.&nbsp;VAT</font></font></td>');
		//wl('<td align="center" bgcolor="#000080"><font color="#FFFFFF" size="3">Price<br><font size="1">Incl.&nbsp;VAT</font></font></td>');
		wl('<td align="center" bgcolor="#000080"><font color="#FFFFFF" size="3">Action</font></td>');
		wl('</tr>');
		
		insection = 1;
		}

function buildSoftwareShopTable()
		{
		addSection('Club Membership System', 'CMS');

		addShopHeader('Software Licences');
		addShopEntry('CMS1USE', 'Club Membership System - Single User Licence', 'Full system licence (all modules and features) for a single PC only', 121.74, 0.00, 'In Stock');
		addShopEntry('CMS3USE', 'Club Membership Systen - 3 User Licence', 'Full system licence (all modules and features) for installation on up to 3 PCs', 347.83, 0.00, 'In Stock');
		addShopEntry('CMS5USE', 'Club Membership Systen - 5 User Licence', 'Full system licence (all modules and features) for installation on up to 5 PCs', 573.91, 0.00, 'In Stock');
		addShopEntry('CMS10USE', 'Club Membership Systen - 10 User Licence', 'Full system licence (all modules and features) for installation on up to 10 PCs', 1086.96, 0.00, 'In Stock');

		//addShopHeader('Pre-Configured System Licences');
		//addShopEntry('CMSSYS1', 'Basic System Licence', '<font size=1 color=#800080><b>(Database with no extra features on a single PC + Back Office Module + Visit Logger Module)</b></font>', 126.81, 0.00, 'In Stock');
		//addShopEntry('CMSFULL1', 'Full System Licence', '<font size=1 color=#800080><b>(Database with all features on a single PC, Single User Licence for all modules)</b></font>', 424.68, 0.00, 'In Stock');
		//addShopEntry('CMSSITE', 'Site Licence', '<font size=1 color=#800080><b>(Database with all features on a single PC; All features and modules with unlimited uses)</b></font>', 4254.47, 0.00, 'In Stock');
		//addShopEntry('CMSEPRS', 'Enterprise Licence', '<font size=1 color=#800080><b>(Unlimited databases + all features and modules with unlimited uses)</b></font>', 8509.79, 0.00, 'In Stock');
		
		//addShopHeader('General Licences');
		//addShopEntry('CMSDB1', 'Database Licence - Single Use Licence', '<font color=red size=1><b>(Database Only - NO modules or features)</b></font>', 85.11, 0.00, 'In Stock');
		//addShopEntry('CMSFGT1', 'FrontGate Module - Single User Licence', 102.13, 0.00, 'In Stock');
		//addShopEntry('CMSFGT5', 'FrontGate Module - 5 User Licence', 485.11, 0.00, 'In Stock');
		//addShopEntry('CMSFGT10', 'FrontGate Module - 10 User Licence', 919.15, 0.00, 'In Stock');
		//addShopEntry('CMSVST1', 'Visit Logger Module - Single User Licence', 25.53, 0.00, 'In Stock');
		//addShopEntry('CMSVST5', 'Visit Logger Module - 5 User Licence', 121.28, 0.00, 'In Stock');
		//addShopEntry('CMSVST10', 'Visit Logger Module - 10 User Licence', 229.79, 0.00, 'In Stock');
		//addShopEntry('CMSBCK1', 'Back Office Module - Single User Licence', '<font color=#000080 size=1><b>(The main club membership program)</b></font>', 34.04, 0.00, 'In Stock');
		//addShopEntry('CMSBCK5', 'Back Office Module - 5 User Licence', 161.70, 0.00, 'In Stock');
		//addShopEntry('CMSBCK10', 'Back Office Module - 10 User Licence', 306.38, 0.00, 'In Stock');

		//addShopHeader('Features Licences');
		//addShopEntry('CMSOPER', 'CMS Operators Feature Licence', 42.55, 0.00, 'In Stock');
		//addShopEntry('CMSTRNS', 'CMS Transactions Feature Licence', 85.11, 0.00, 'In Stock');
		//addShopEntry('CMSPASS', 'CMS Passes Feature Licence', 42.55, 0.00, 'In Stock');
		//addShopEntry('CMSPNTS', 'CMS Loyalty Points Feature Licence', 42.55, 0.00, 'In Stock');
		//addShopEntry('CMSACCT', 'CMS Group Accounts Feature Licence', 42.55, 0.00, 'In Stock');


		addShopHeader('Other');
		addShopEntry('CMSMEDIA', 'Club Membership System Media (CD-ROM) - UK Only', '', 0.00, 2.55, 'In Stock');
		addShopEntry('CMSSCAN', 'Barcode Scanner for Club Membership System - UK Only', '', 130.43, 6.96, 'Ordered on Request');
		endSection();


		addSection('Loyalty Tracking System', 'LTS');
		addShopHeader('Software Licences');
		addShopEntry('LTS1USE', 'Loyalty Tracking System - Single User Licence', 'Full system licence (all modules and features) for a single PC only', 86.96, 0.00, 'In Stock');
		addShopEntry('LTS3USE', 'Loyalty Tracking Systen - 3 User Licence', 'Full system licence (all modules and features) for installation on up to 3 PCs', 243.48, 0.00, 'In Stock');
		addShopEntry('LTS5USE', 'Loyalty Tracking Systen - 5 User Licence', 'Full system licence (all modules and features) for installation on up to 5 PCs', 400.00, 0.00, 'In Stock');
		addShopEntry('LTS10USE', 'Loyalty Tracking Systen - 10 User Licence', 'Full system licence (all modules and features) for installation on up to 10 PCs', 739.13, 0.00, 'In Stock');


		//addShopHeader('Pre-Configured System Licences');
		//addShopEntry('LTSSYS1', 'Basic System Licence', '<font size=1 color=#800080><b>(Database on a single PC + Back Office Module + Points Logger Module)</b></font>', 106.38, 0.00, 'In Stock');
		//addShopEntry('LTSSITE', 'Site Licence', '<font size=1 color=#800080><b>(Database on a single PC; All features and modules with unlimited uses)</b></font>', 2126.81, 0.00, 'In Stock');
		////addShopEntry('LTSEPRS', 'Enterprise Licence', '<font size=1 color=#800080><b>(Unlimited databases + all features and modules with unlimited uses)</b></font>', 4254.47, 0.00, 'In Stock');

		//addShopHeader('General Licences');
		//addShopEntry('LTSDB1', 'Database Licence - Single Use Licence', '<font color=red size=1><b>(Database Only - NO modules or features)</b></font>', 85.11, 0.00, 'In Stock');
		//addShopEntry('LTSLOG1', 'Points Logger Module - Single User Licence', 34.04, 0.00, 'In Stock');
		//addShopEntry('LTSLOG5', 'Points Logger Module - 5 User Licence', 161.70, 0.00, 'In Stock');
		//addShopEntry('LTSLOG10', 'Points Logger Module - 10 User Licence', 306.38, 0.00, 'In Stock');
		//addShopEntry('LTSBCK1', 'Back Office Module - Single User Licence', '<font color=#000080 size=1><b>(The main loyalty tracking program)</b></font>', 34.04, 0.00, 'In Stock');
		//addShopEntry('LTSBCK5', 'Back Office Module - 5 User Licence', 161.70, 0.00, 'In Stock');
		//addShopEntry('LTSBCK10', 'Back Office Module - 10 User Licence', 306.38, 0.00, 'In Stock');

		addShopHeader('Other');
		addShopEntry('LTSMEDIA', 'Loyalty Tracking System Media (CD-ROM) - UK Only', '', 0.00, 2.55, 'In Stock');
		addShopEntry('LTSSCAN', 'Barcode Scanner for Loyalty Tracking System - UK Only', '', 130.43, 6.96, 'Ordered on Request');
		endSection();


		addSection('AVG Software', 'AVG');
		addShopEntry('AVGINET', 'AVG Internet Security', 'Single Computer - 2 Year Licence', 47.82, 0.00, 'In Stock');
		addShopEntry('AVGHOME', 'AVG Internet Security Home Edition', 'Up to 3 Computers - 2 Year Licence', 69.56, 0.00, 'In Stock');
		endSection();

		addSection('Other Software', 'OTH');
		addShopEntry('IMK1', 'InvoiceMaker - Single User Licence', '', 21.73, 0.00, 'In Stock');
		addShopEntry('JTRK1', 'JobTracker - Single User Licence', '', 26.08, 0.00, 'In Stock');
		endSection();
		}


function buildAccessoriesShopTable()
		{
		addSection('Accessories', 'ACC');
		addShopEntry('CMSSCAN', 'Barcode Scanner for Club Membership System - UK Only', '', 130.43, 6.96, 'Ordered on Request');
		addShopEntry('LTSSCAN', 'Barcode Scanner for Loyalty Tracking System - UK Only', '', 130.43, 6.96, 'Ordered on Request');
		endSection();
		}

function buildProAudioShopTable()
		{
		wl('<table border="1" cellpadding="8" style="border-collapse: collapse" bordercolor="#000080" id="table3" width="100%">');
		wl('<tr>');
		wl('<td align="left" bgcolor="#000080"><font color="#FFFFFF" size="3">Item</font></td>');
		wl('<td align="left" bgcolor="#000080" width="100%"><font color="#FFFFFF" size="3">Description</font></td>');
		wl('<td align="center" bgcolor="#000080"><font color="#FFFFFF" size="3">Stock</font></td>');
		wl('<td align="center" bgcolor="#000080"><font color="#FFFFFF" size="3">Cost</font></td>');
		wl('<td align="center" bgcolor="#000080"><font color="#FFFFFF" size="3">P&amp;P</font></td>');
		wl('<td align="center" bgcolor="#000080"><font color="#FFFFFF" size="3">Action</font></td>');
		wl('</tr>');

		addShopEntry('SQ7', 'Samson Q7 Microphone', '39.99', '6.50', '8');
		//addShopEntry('SM58', 'Shure SM58', '99.99', '6.50', 'Ordered on Request');

		wl('</table>');
		}
