Custom JQuery Calculation

Custom JQuery Calculation

I use JQuery Plugin from : http://www.pengoworks.com/workshop/jquery/calculation/calculation.plugin.htm
to Calculate average of my input.

here my code :
  1.  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
        <title>jQuery Calculation Plug-in</title>

        <!--// load jQuery Plug-ins //-->
        <script type="text/javascript" src="jquery.min.js"></script>
        <script type="text/javascript" src="jquery.calculation.js"></script>
        <script type="text/javascript" src="jquery.calculation.min.js"></script>

        <script type="text/javascript">
        var bIsFirebugReady = (!!window.console && !!window.console.log);

        $(document).ready(
            function (){
                // automatically update the "#totalAvg" field every time
                // the values are changes via the keyup event
                $("input[name^=avg]").avg("keyup","#totalAvg");

            }
        );

        </script>
    </head>
    <body>
    <form action="" method="post" id="frmCreateCheckboxRange" onsubmit="return false;">
        <fieldset>
            <legend>Calculation Examples</legend>
            <div id="formContent">

                <p id="ex-avg">
                    Numbers:
                    <input type="text" name="avg" value="25" size="2" />
                    <input type="text" name="avg" value="12" size="2" />
                    <input type="text" name="avg" value="6" size="2" />
                    <input type="text" name="avg_alt" value="33" size="2" />
                    &nbsp;&nbsp;
                    Average:
                    <input type="text" name="totalAvg" id="totalAvg" value="" size="2" readonly="readonly" />
                    (Change the values for dynamic calculations.)
                </p>
                
            </div>
        </fieldset>
    </form>

    </body>
    </html>



















































 i want my program like this :

if i input 2 item , the average will be :  (item1 + item2 ) / 2   ,  though i have 4 item tobe input.
if i input 3 item , the average will be :  (item1 + item2 + item3) / 3   , though  i have 4 item tobe input.