// JavaScript Document function total_price(qty,price,name) { var qty_total=qty*price; var gtotal; document.getElementById(name+'_sub').value=qty_total; document.f1.sub_total.value=subtotal().toFixed(2); document.f1.sub_total.readOnly=true; gtotal=(parseFloat(document.f1.postage.value)+parseFloat(document.f1.sub_total.value)); document.f1.totalamount.value=gtotal; document.f1.totalamount.readOnly=true; //grand_total(); } //by onblur calls total_price function and gives us the subtotal value ; function subtotal() { //palmetto_sub.sapphire_sub,wintergreen_sub,santana_sub,tall_sub,kikuyu_sub if(document.f1.palmetto_sub.value==''){ var a=0;} else if(document.f1.palmetto_sub.value!=''){ var a=parseFloat(document.f1.palmetto_sub.value);} if(document.f1.sapphire_sub.value==''){ var b=0;} else if(document.f1.sapphire_sub.value!=''){ var b=parseFloat(document.f1.sapphire_sub.value);} if(document.f1.wintergreen_sub.value==''){ var c=0;} else if(document.f1.wintergreen_sub.value!=''){ var c=parseFloat(document.f1.wintergreen_sub.value);} if(document.f1.tall_sub.value==''){ var d=0;} else if(document.f1.tall_sub.value!=''){ var d=parseFloat(document.f1.tall_sub.value);} if(document.f1.santana_sub.value==''){ var e=0;} else if(document.f1.santana_sub.value!=''){ var e=parseFloat(document.f1.santana_sub.value);} if(document.f1.kikuyu_sub.value==''){ var f=0;} else if(document.f1.kikuyu_sub.value!=''){ var f=parseFloat(document.f1.kikuyu_sub.value);} // alert (e) var sub_total=a+b+c+d+e+f; return Math.abs(sub_total); } //this fun /*uncomment this function when the membership activated. function grand_total(post) { //alert(num); var x=parseFloat(document.f1.sub_total.value); var y=parseFloat(post); if (post=='') { alert("Select your postage"); document.f1.postage.focus(); return false ; } else if(y!=0){ //want to check weather the member ship checed or not if(document.f1.member.checked== true) { document.f1.totalamount.value=(y+x+44).toFixed(2); document.f1.totalamount.readOnly=true; } else if (document.f1.member.checked== false) { document.f1.totalamount.value=(y+x).toFixed(2); document.f1.totalamount.readOnly=true; } } }*/ function grand_total(post) { //alert(num); var x=parseFloat(document.f1.sub_total.value); var y=parseFloat(post); if (post==0) { alert("Select your postage"); document.f1.postage.focus(); return false ; } else if(y!=0){ //have to add the subtotal with the total; document.f1.totalamount.value=(y+x).toFixed(2); document.f1.totalamount.readOnly=true; } } //to subscribe as a members function subscribe() { if(document.f1.member.checked== true) { var tot_mem=parseFloat(document.f1.totalamount.value)+44; document.f1.totalamount.value=tot_mem.toFixed(2); document.f1.totalamount.readOnly=true; } else if (document.f1.member.checked== false) { var tot_mem=parseFloat(document.f1.totalamount.value)-44; document.f1.totalamount.value=tot_mem.toFixed(2); document.f1.totalamount.readOnly=true; } }