<!--- 
// begin cloaking from non-JavaScript browsers.
        // Written by: Paul DeBrino of Infinity Research and Development.
        // Email:   IRandD@aol.com

//Define function to manipulate the form total per item selected/deselected:
function checkChoice(whichbox) {
        with (whichbox.form)
        {
        //Ensure negative or non-numeric values were not entered:
        //Otherwise, set field back to prior value.
        if (isNaN(whichbox.value))
                {
                whichbox.value=whichbox.priorval;
                whichbox.focus();
                }
        whichbox.value=Math.abs(whichbox.value);

        //Ensure a decimal place was not keyed, otherwise set field back to prior value,
        // show error and leave function while passing current (unchanged) total value:
        var dec = whichbox.value.indexOf('.', 1)
        if (dec > 0)
                {
                alert('No decimal places allowed for \"' +whichbox.name +'\" !');
                whichbox.value=whichbox.priorval;
                whichbox.focus();
                }

        //First, back out the prior qty from the total:
        hiddentotal.value = eval(hiddentotal.value) - eval(whichbox.price * whichbox.priorval);

        //Then, save the current qty:
        whichbox.priorval=whichbox.value;

        //Now, apply the current qty to the total:
        hiddentotal.value = eval(hiddentotal.value) + eval(whichbox.price * whichbox.value);
        return(formatCurrency(hiddentotal.value));
        }
}

//Define function to setup form fields/buttons/checkbox that..
//..have non-HTML compliant properties (Netscrape requires this, however
//..IE works by simply specifying these properties directly on the
//..INPUT specification):
function setInput(whichbox,myprice) {
        with (whichbox.form)
        {
                //Only do this once per input field:
                if (!whichbox.price)
                        {
                        whichbox.price = myprice;
                        whichbox.priorval = 0;
                        }
        }
}

//Define function to format value in the proper currency:
function formatCurrency(num) {
        <!-- Function courtesy of:  Cyanide_7 (leo7278@hotmail.com) -->
        <!-- Web Site:  http://www7.ewebcity.com/cyanide7 -->
        num = num.toString().replace(/\$|\,/g,'');
        if(isNaN(num)) num = "0";
        cents = Math.floor((num*100+0.5)%100);
        num = Math.floor((num*100+0.5)/100).toString();
        if(cents < 10) cents = "0" + cents;
        for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
        num = num.substring(0,num.length-(4*i+3))+','+num.substring(num.length-(4*i+3));
        return ("$" + num + "." + cents);
}

//Define function to init the form on reload and-or refresh button:
function InitForm() {
        //Reset the displayed total on form:
        document.myform.total.value='$0';
        document.myform.hiddentotal.value=0;
        document.myform2.total.value='$0';
        document.myform2.hiddentotal.value=0;

        //Set all text fields on forms to unchecked:
        for (xx=0; xx < document.myform.elements.length; xx++)
           {
           if (document.myform.elements[xx].type == 'text')
                {
                document.myform.elements[xx].value = 0;
                }
           }
        for (xx=0; xx < document.myform2.elements.length; xx++)
           {
           if (document.myform2.elements[xx].type == 'text')
                {
                document.myform2.elements[xx].value = 0;
                }
           }
}

// -->


