Ok so I'm about as green as they come when it comes to JavaScript so pardon my ignorance. I've searched on this for a couple weeks trying to figure it out on my own with no success so I'm seeking some assistance here.
I have a form that has multiple input fields that I need to total up. Here is the form, http://jemtechnv.com/portal/beta/finish_ticket.php I know it looks jacked up but I'm working on it, so looking at the form you see I have a field named Qty and a field named Price. I need to multiply those together and populate the Ext field I then need to total up the Ext field and populate the Material Total field, I can total the Ext field currently as you can see if you enter a number in each box of the Ext field you will see the sum total in the Material Total box. My issue is not being able to get the Qty and the Price fields to total up and populate the Ext box. This is the code I'm using to sum up the Ext fields that is working:

Code:
function summate() {
        	var material_total=0
        	for (var i=1; i <= 5; i++) {
        		var id = "extended"+i;
        	    material_total = material_total + document.getElementById(id).value*1;
        	}
        	document.getElementById("material_total").value = material_total;
        }
my only problem with this is if I have more than 5 fields it wont work unless I change < =5; to the number of fields.

I also need to be able to multiply the rate by the hours and populate the total fields as well and you guessed it total all those up for the grand total as well. I'm not looking for someone to write an entire script for me I just need some assistance on finding a script to do what I need or some help with tweaking what I'm using. Thanks in advance!