

		var RowsInForm = 3		//   Adjust the amount of rows displayed in the order form
		var ProductsInList = 30		//   Must equal highest subscript in product list
		var SalesTaxRate = 0.0825		//   Set to sales tax rate in decimal. e.g. 8.55% is 0.0855
		var TaxableState = "Click here if you live in California"
		var ProdSubscript = 0	
		var currencyAbv = "(USD)"


        function MakeArray(n) { 
               this.length = n
                for (var i = 1; i<= n; i++) {
                        this[i] = 0
                } 
                return this
        }

        function BuildZeroArray(n) {
                this.length = n


                for (var i = 0; i<= n; i++) {
                        this[i] = 0     
                }               
                return this
        }


        function prodobj(name, unitprice) {
                this.name = name

                this.unitprice = unitprice

        }
        function ordobj(prodsub, qty, unitprice, extprice) {
                this.prodsub = prodsub

                this.qty = qty

                this.unitprice = unitprice

                this.extprice = extprice

        }

        function strToZero(anyval) {
                anyval = ""+anyval
                if (anyval.substring(0,1) < "0" || anyval.substring(0,1) > "9") {
                        anyval = "0"
                }
                return eval(anyval)
        }

        function updateRow(rownum){
                var exec = 'ProdSubscript = document.ordform.prodchosen'+rownum+'.selectedIndex'
                eval (exec)
                ordData[rownum].prodsub=ProdSubscript
                var exec='tempqty=document.ordform.qty'+rownum+'.value'
                eval (exec)
                ordData[rownum].qty = strToZero(tempqty)  
                ordData[rownum].unitprice=prodlist[ProdSubscript].unitprice
                ordData[rownum].extprice = (ordData[rownum].qty) * ordData[rownum].unitprice
                var exec = 'document.ordform.unitprice'+rownum+'.value = currencyPad(ordData['+rownum+'].unitprice,10)'                
                eval (exec)
				var exec = 'document.ordform.extprice'+rownum+'.value = currencyPad(ordData['+rownum+'].extprice,10)'
                eval (exec)
                updateTotals() 
        }

        function updateTotals() {
                var subtotal = 0
                for (var i=1; i<=RowsInForm; i++) {
                        subtotal = subtotal + ordData[i].extprice
                }
                document.ordform.subtotal.value = currencyPad(subtotal,10)

                salestax = 0

                if (document.ordform.Taxable.checked) {
                        salestax = SalesTaxRate * subtotal
                }
                document.ordform.salestax.value = currencyPad(salestax,10)
                document.ordform.grandtotal.value = currencyPad(subtotal+salestax,10)

        }

        function currencyPad(anynum,width) {
                anynum = "" + eval(anynum)
                intnum = parseInt(anynum)
                intstr = ""+intnum
                if (intnum >= 1000) {
                        intlen = intstr.length
                        temp1=parseInt(""+(intnum/1000))
                        temp2=intstr.substring(intlen-3,intlen)
                        intstr = temp1+","+temp2
                }
                if (intnum >= 1000000) {
                        intlen = intstr.length
                        temp1=parseInt(""+(intnum/1000000))
                        temp2=intstr.substring(intlen-7,intlen)
                        intstr = temp1+","+temp2
                }
                decnum = Math.abs(parseFloat(anynum)-parseInt(anynum))
                decnum = decnum * 100 
                decstr = "" + Math.abs(Math.round(decnum))
                while (decstr.length < 2) {
                        decstr += "0"
                }
                retval = intstr + "." + decstr
                if (intnum < 0) {
                        retval=retval.substring(1,retval.length)

                        retval="("+retval+")"
                }
                retval = "$"+retval
                while (retval.length < width){
                        retval=" "+retval
                }
                return retval
        }



		/*   --------------------Copying User Information------------------ */

        function copyAddress(){
                document.ordform.ShipName.value = document.ordform.billName.value
                document.ordform.ShipCompany.value = document.ordform.billCompany.value
                document.ordform.ShipAdd1.value = document.ordform.billAdd1.value
                document.ordform.ShipCSZ.value = document.ordform.billCSZ.value
                document.ordform.ShipState.value = document.ordform.billState.value
                document.ordform.ShipC.value = document.ordform.billC.value
                document.ordform.ShipPhone.value = document.ordform.Phone.value
        }

        function copyBillName() {
                document.faxOrder.cardname.value= document.ordform.billName.value
	}

 		/*   ----------------Printout Information------------------ */

 function displayOrder()
 	{
         var yourname=document.ordform.billName.value
         var email=document.ordform.email.value
         var phone=document.ordform.Phone.value
         var company=document.ordform.billCompany.value
         var address=document.ordform.billAdd1.value
         var state=document.ordform.billState.value
         var pcode=document.ordform.billCSZ.value
         var country=document.ordform.billC.value
         var cardtype=document.faxOrder.cardtype.value
         var account=document.faxOrder.account.value
         var expiry=document.faxOrder.expiry.value
         var cardname=document.faxOrder.cardname.value
         var sub=document.ordform.subtotal.value
         var tax=document.ordform.salestax.value
         var total=document.ordform.grandtotal.value

 	printOrder=window.open();
        printOrder.document.write('<html><head><title>Hitek Software Order Form</title>');
        printOrder.document.write('</head><body bgcolor=ffffff text=black><left><font size=-1>');
        printOrder.document.write('<font face="arial, helvetica"><font size=+4><B>Hitek Software</B>');
        printOrder.document.write(' <font size=-2><BR><B>');
        printOrder.document.write(' 2647-A 38th Ave, Oakland, CA 94619 U.S.A.<BR>');
        printOrder.document.write(' <B><font color=888888>FAX </font> </B>(510) 536 4428 ');
        printOrder.document.write('  &nbsp &nbsp <B><font color=888888>PHONE </font></B>(510) 536 4428<p>');
        printOrder.document.write('</font></font><CENTER><table width=80%><tr><td><table border=0 width=100%>');
        printOrder.document.write(' <tr><td width=30% bgcolor=bbbbbb><font face="arial, helvetica">');
        printOrder.document.write(' <font size=-1>Received from:</td><td width=70%><font size=-1 ');
        printOrder.document.write(' font face="arial, helvetica"><B>'+yourname+'</B>&nbsp');
        printOrder.document.write(' <tr><td bgcolor=eeeeee><font size=-1 font face="arial, helvetica">Organization:');
        printOrder.document.write(' </td><td><font size=-1 font face="arial, helvetica">'+company+' &nbsp ');
        printOrder.document.write(' <tr><td bgcolor=eeeeee valign=top><font size=-1 font face="arial, helvetica">Address:');
        printOrder.document.write(' </td><td><font size=-1 font face="arial, helvetica">' +address+' &nbsp '+pcode+' &nbsp '+state+'<br>');
        printOrder.document.write(' <B>'+ country+'</B> &nbsp ');
        printOrder.document.write(' <tr><td bgcolor=eeeeee><font size=-1 font face="arial, helvetica">');
        printOrder.document.write(' Email:</td><td><font size=-1 font face="arial, helvetica">'+email+' &nbsp ');
        printOrder.document.write(' <tr><td bgcolor=eeeeee><font size=-1 font face="arial, helvetica">');
        printOrder.document.write(' Phone:</td><td><font size=-1 font face="arial, helvetica"> '+phone+' &nbsp ');
        printOrder.document.write(' <tr><td bgcolor=eeeeee><font size=-1 font face="arial, helvetica">Payment Method: ');
        printOrder.document.write(' </td><td><font size=-1 font face="arial, helvetica">'+cardtype+' &nbsp ');
        printOrder.document.write(' <tr><td bgcolor=eeeeee><font size=-1 font face="arial, helvetica">');
        printOrder.document.write(' Account:</td><td><font size=-1 font face="arial, helvetica"> '+account+' &nbsp ');
        printOrder.document.write(' <tr><td bgcolor=eeeeee><font size=-1 font face="arial, helvetica">Card Name: ');
        printOrder.document.write(' </td><td><font size=-1 font face="arial, helvetica">'+cardname+' &nbsp ');
        printOrder.document.write(' <tr><td bgcolor=eeeeee><font size=-1 font face="arial, helvetica">');
        printOrder.document.write(' Expires:</td><td><font size=-1 font face="arial, helvetica"> '+expiry+' &nbsp ');
        printOrder.document.write(' <tr><td bgcolor=eeeeee><font size=-1 font face="arial, helvetica">');
        printOrder.document.write(' <B>Sub Total</B>:</td><td><font size=-1 font face="arial, helvetica"><B> '+sub+'</B> &nbsp ');
        printOrder.document.write(' <tr><td bgcolor=eeeeee><font size=-1 font face="arial, helvetica">');
        printOrder.document.write(' <B>Sales Tax</B>:</td><td><font size=-1 font face="arial, helvetica"> <B>'+tax+'</B> &nbsp ');
        printOrder.document.write(' <tr><td><font face="arial, helvetica"><B>Total Investment</B>:</td><td bgcolor=eeeeee> ');
        printOrder.document.write(' <font size=-1 font face="arial, helvetica"><B> '+total+'</B> &nbsp (USD)');
        printOrder.document.write(' </td></tr></table></td></tr></table><P><font face="arial, helvetica">');
        printOrder.document.write(' <font size=+1><B>THANKYOU FOR YOUR ORDER</B><p>');
        printOrder.document.write(' <font size=-2></center><left>');
        printOrder.document.write('<li>To print, select <i>File </i>from the menubar or use the PRINT icon.');
        printOrder.document.write(' <li>Enquiries: <a href="mailto:isaiahkc@yahoo.com">Hitek Software</a></left><p>');
        printOrder.document.write('<center> ');
        printOrder.document.write('<a href="http://www.hiteksoft.com">Hitek Software</A> All Rights Reserved');
        printOrder.document.write(' </center></body></html>');
        printOrder.document.close();

        }

 		/*   ----------------How to use the form Information------------------ */
 function prodInfo()
 	{
 	newwin1=window.open("","prodinfo","height=190,width=380,scrollbars=yes,resizable=yes");
 	newwin1.document.write('<html><head><title>Purchases</title></head>');
 	newwin1.document.write('<body bgcolor=ffffff text=red link=red vlink=purple alink=green>');
 	newwin1.document.write('<font face="arial, helvetica"><ol type=1><B>');
 	newwin1.document.write('<font color=red><H1>Placing your Order</H1>');
 	newwin1.document.write('</font><font size=-1><font color=blue><font face="arial, helvetica"> ');
 	newwin1.document.write('<li>Make your selection from the products menu.');
 	newwin1.document.write('<li>Enter a  quantity. ');
 	newwin1.document.write('<li>Click total to confirm the value.');
 	newwin1.document.write('<li>Enter your details further down the page.');
 	newwin1.document.write('<li>Submit, Fax or Post');
 	newwin1.document.write('</B></ol></body></html>');
 	newwin1.document.close();
 		}


 	function statusName()
 		{
 	window.status='Ordering Products';
 		}

