var j, k = 0;    
var maxprod = 200;
var stkcategory;
var stkhead;
var stkdescript;
var stkinvoiceline;
var stkprice;
var stkimage;
var stkcode;

var itemnum;
var stroutput = "";
var strout2="";

var stkcategoryarray = new Array(maxprod);
var stkheadarray = new Array(maxprod);
var stkcodearray = new Array(maxprod);
var stkdescriptarray = new Array(maxprod);
var stkpricearray = new Array(maxprod);
var stkimagearray = new Array(maxprod);
var deliveryarray = new Array(maxprod);
var stkinvoicelinearray = new Array(maxprod);
var basket = 'cartmanager.html';

var moneysign = '£';
var howmanyproducts = 20;

stkcategoryarray[1] = 'shopProducts';
stkheadarray[1] = 'TICKETS NASHVILLE ROSE';
stkdescriptarray[1] = 'Dowlais Catholic Hall, Merthyr Tydfil - 28th Oct. Admits ONE adult';
stkinvoicelinearray[1] = 'TICKETS NASHVILLE ROSE 28th Oct';
stkpricearray[1] = '7.00';
stkcodearray[1] = '000001';
deliveryarray[1] = '0.00';
stkimagearray[1] = 'cartimages/nopic.gif';

stkcategoryarray[2] = 'shopProducts';
stkheadarray[2] = 'TICKETS PAUL BAILEY';
stkdescriptarray[2] = 'Dowlais Catholic Hall, Merthyr Tydfil - 25th Nov. Admits ONE adult';
stkinvoicelinearray[2] = 'TICKETS PAUL BAILEY 25th Nov.';
stkpricearray[2] = '7.00';
stkcodearray[2] = '000002';
deliveryarray[2] = '0.00';
stkimagearray[2] = 'cartimages/nopic.gif';

stkcategoryarray[3] = 'shopProducts';
stkheadarray[3] = 'TICKETS NYE';
stkdescriptarray[3] = 'TICKETS NYE - Sat 31st Dec. Holy Trinity Church Hall Ystrad Mynach, CF82 7EG'
stkinvoicelinearray[3] = 'TICKETS NYE 31st Dec.';
stkpricearray[3] = '8.00';
stkcodearray[3] = '000003';
deliveryarray[3] = '0.00';
stkimagearray[3] = 'cartimages/nopic.gif';

stkcategoryarray[4] = 'shopProducts';
stkheadarray[4] = 'Dancers R Us Iron on Motif Crystal & Hot Pink.';
stkdescriptarray[4] = 'This Motif is Suitable for a Black T-shirt (Not Included) Clear Crystal and Hot Pink.';
stkinvoicelinearray[4] = 'Iron On Motif - Dancers R Us';
stkpricearray[4] = '8.00';
stkcodearray[4] = '000034';
deliveryarray[4] = '0.00';
stkimagearray[4] = 'cartimages/DRU-HP-CR.jpg';

stkcategoryarray[5] = 'shopProducts';
stkheadarray[5] = 'Dancers R Us Iron on Motif Jet Black & Hot Pink.';
stkdescriptarray[5] = 'This Motif is Suitable for a White T-shirt (Not Included) Jet Black and Hot Pink.';
stkinvoicelinearray[5] = 'Iron On Motif - Dancers R Us';
stkpricearray[5] = '8.00';
stkcodearray[5] = '000035';
deliveryarray[5] = '0.00';
stkimagearray[5] = 'cartimages/DRU-HP-JB.jpg';

stkcategoryarray[6] = 'shopProducts';
stkheadarray[6] = 'Dancers R Us Iron on Motif Clear Crystal & Jet Black.';
stkdescriptarray[6] = 'This Motif is Suitable for a Coloured T-shirt (Not Included) Jet Black and Clear Crystal.';
stkinvoicelinearray[6] = 'Iron On Motif - Dancers R Us';
stkpricearray[6] = '8.00';
stkcodearray[6] = '000036';
deliveryarray[6] = '0.00';
stkimagearray[6] = 'cartimages/DRU-JB-CR.jpg';

stkcategoryarray[15] = 'shopProducts';
stkheadarray[15] = 'LDT1-VHS';
stkdescriptarray[15] = 'Line Dance Tutor for Absolute Beginners - Volume 1 on VHS.';
stkinvoicelinearray[15] = 'LD Tutor VHS Vol 1';
stkpricearray[15] = '10.95';
stkcodearray[15] = '000041';
deliveryarray[15] = '0.00';
stkimagearray[15] = 'cartimages/LDTVol1pic.jpg';

stkcategoryarray[16] = 'shopProducts';
stkheadarray[16] = 'LDT1-DVD';
stkdescriptarray[16] = 'Line Dance Tutor for Absolute Beginners - Volume 1 on DVD.';
stkinvoicelinearray[16] = 'LD Tutor DVD Vol 1';
stkpricearray[16] = '10.95';
stkcodearray[16] = '000042';
deliveryarray[16] = '0.00';
stkimagearray[16] = 'cartimages/LDTVol1pic.jpg';

stkcategoryarray[17] = 'shopProducts';
stkheadarray[17] = 'LDT2-VHS';
stkdescriptarray[17] = 'Line Dance Tutor for Absolute Beginners - Volume 2 on VHS.';
stkinvoicelinearray[17] = 'LD Tutor VHS Vol 2';
stkpricearray[17] = '10.95';
stkcodearray[17] = '000043';
deliveryarray[17] = '0.00';
stkimagearray[17] = 'cartimages/LDTutorVol2DVD.jpg';

stkcategoryarray[18] = 'shopProducts';
stkheadarray[18] = 'LDT2-DVD';
stkdescriptarray[18] = 'Line Dance Tutor for Absolute Beginners - Volume 2 on DVD.';
stkinvoicelinearray[8] = 'LD Tutor DVD Vol 2';
stkpricearray[18] = '10.95';
stkcodearray[18] = '000044';
deliveryarray[18] = '0.00';
stkimagearray[18] = 'cartimages/LDTutorVol2DVD.jpg';

stkcategoryarray[19] = 'shopProducts';
stkheadarray[19] = 'LDW1-VHS';
stkdescriptarray[19] = 'Line Dance Workshop Easy Intermediate - Volume 1 on VHS.  Contains walkthrough instruction for 7 popular dances, including All Day Long, Mars Attack and Por Ti Sere';
stkinvoicelinearray[19] = 'LD Workshop VHS Vol 1';
stkpricearray[19] = '9.95';
stkcodearray[19] = '000045';
deliveryarray[19] = '0.00';
stkimagearray[19] = 'cartimages/LDWVol1.jpg';

stkcategoryarray[20] = 'shopProducts';
stkheadarray[20] = 'LDW1-DVD';
stkdescriptarray[20] = 'Line Dance Workshop Easy Intermediate - Volume 1 on DVD.  Contains walkthrough instruction for 7 popular dances, including All Day Long, Mars Attack and Por Ti Sere';
stkinvoicelinearray[20] = 'LD Workshop DVD Vol 1';
stkpricearray[20] = '9.95';
stkcodearray[20] = '000046';
deliveryarray[20] = '0.00';
stkimagearray[20] = 'cartimages/LDWVol1.jpg';

function dolist(thisvalue) {
var testval;
var k;
	for (var j = 1; j < howmanyproducts +1; j++ ) {
		testval = "Add Item " + stkcodearray[j] + " to Basket";
		if (testval == thisvalue) {
			k = j;
			mainorder.PRICE.value = stkpricearray[k];
			mainorder.NAME.value = stkinvoicelinearray[k];
			mainorder.ID_NUM.value = stkcodearray[k];
			mainorder.SHIPPING.value = deliveryarray[k];
			AddToCart(mainorder);
		}
	}
}	

for (var i = 1; i < howmanyproducts +1; i++)
   {
	if ( order.catHead.value == stkcategoryarray[i] ) {

	    stroutput = "";
		strout2 = "";
   		stkcategory = stkcategoryarray[i];
		stkhead = stkheadarray[i];
		stkdescript = stkdescriptarray[i];
		stkinvoiceline = stkinvoicelinearray[i];
		stkprice = stkpricearray[i];
		stkimage = stkimagearray[i];
		stkcode = stkcodearray[i];
	
		stkhead = stkhead.fontsize(3);
		stkhead = stkhead.fontcolor(990000);
		stkdescript = stkdescript.fontsize(2);
		stkinvoiceline = stkinvoiceline.fontsize(2);
		stkprice = stkprice.fontsize(3);
		stkprice = stkprice.fontcolor(990000);
		
		stroutput += "<input type=\"text\" size=\"2\" maxlength=\"3\" name=\"QUANTITY\" onChange=\"mainorder.QUANTITY.value=CKquantity(this.value)\" value=\"1\" >" + " " +
	         	 "<input type=\"hidden\" name=\"NAME\" value=\"" + stkinvoicelinearray[i] + "\">" +				  
				 "<input type=\"hidden\" name=\"PRICE\" value=\"" + stkpricearray[i] + "\">" +
                 "<input type=\"hidden\" name=\"SHIPPING\" value=\"" + deliveryarray[i] + "\">" +
 				 "<input type=\"hidden\" name=\"ID_NUM\" value=\"" + stkcodearray[i] + "\">";
				 
        strout2 +=   "<input type=\"button\" width=\"20\" value=\"Add Item " + stkcodearray[i] + " to Basket\" onClick=\"dolist(this.value)\" name=\"buybutton\">" + " " +
				 "<input type=\"submit\" width=\"50\" value=\"View Basket\">";
	
		document.write('<P>');
		document.write('<table width=\"630\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">');
		document.write('<tr>'); 
		document.write('<td rowspan=\"2\" width=\"490\" height=\"130\" valign=\"top\" > <B>' + stkcode + "  " + stkhead + '</B><br><br><B>' + stkinvoiceline + '</B><br><br>' + stkdescript);
		document.write('<td width=\"140\" height=\"130\" align =\"middle\" valign=\"top\"><img src=\"' + stkimage + '\" </td>');
		document.write('</tr>');
		document.write('<tr>'); 
		document.write('<td align= \"middle\" width=\"140\" valign=\"top\"><B>' + "Price " + moneysign + stkprice + '</B></td>');
		document.write('</tr>');
		document.write('</table>');
		document.write('<HR>');
		document.write('<table width=\"630\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">');
		document.write('<tr>');
		document.write('<td rowspan=\"2\" align= \"middle\" width=\"180\" valign=\"top\"><B>' + "Quantity: " + stroutput + '</B>');
		document.write('<td align= \"right\" width=\"450\" valign=\"top\"><B>' + " " + strout2 + '</B></td>');
		document.write('</tr>');
		document.write('</table>');
		document.write('<HR>');
		document.write('</P>');
	}
}

