First of all o this
<asp:textbox id="txtAmount4" xmlns:asp="#unknown" onkeyup="calc() ;"
runat="server" Width="56px" Height="13px">
then replace every line of
a1=document.getElementById(<%='txtAmount1'%>).value;<br />
with
a1=document.getElementById("<=txtAmount1.ClientID>").value;<br />
enjoy it