calculate sub total based on calculations
<p>I am trying to calculate the "sub_total" field based on: 
"total_full" + "total_half".   however the javascript which i tried is not working.  the result of sub_total is displaying as "0". 
How can I improve my javascript "calculate sub total" to allow me to add "total_full" and "total_half" together?  ( I will then also implement the sub_total calculation to include "total_single", "total_double", and "total_projector" as well when I can get the calculation right. </p>

<p>HTML</p>

<pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
&lt;title&gt;Conference Form&lt;/title&gt;

&lt;script type="text/javascript" src="js/jquery.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript" src="js/jqueryui.js"&gt;&lt;/script&gt;
&lt;link href="style.css" rel="stylesheet" type="text/css"/&gt;
&lt;link href="css/jqueryui.css" rel="stylesheet" type="text/css" /&gt;

&lt;body&gt;

&lt;div id="wrapper"&gt;
&lt;div id="header"&gt;&lt;/div&gt;

&lt;table width="899" border="1" align="left" cellpadding="1"&gt;
  &lt;form action="" method="get" name="myform"&gt;

  &lt;tr&gt;
    &lt;td width="258"&gt;&lt;label&gt;Company Name&lt;/label&gt;&lt;/td&gt;
    &lt;td width="249"&gt;&lt;input type="text" name="companyname" id="companyname" /&gt;&lt;/td&gt;
    &lt;td width="27"&gt;&amp;nbsp;&lt;/td&gt;
    &lt;td width="186"&gt;Enquiry Date&lt;/td&gt;
    &lt;td width="145"&gt;&lt;input type="text" name="enquiry_date" id="enquiry_date" class="datepicker" /&gt;&lt;/td&gt;
  &lt;/tr&gt;

  &lt;tr&gt;
    &lt;td&gt;Conference Date In&lt;/td&gt;
    &lt;td&gt;&lt;input type="text" name="conference_date_in" id="conference_date_in" class="datepicker" /&gt;&lt;/td&gt;
    &lt;td&gt;&amp;nbsp;&lt;/td&gt;
    &lt;td&gt;Conference Date Out&lt;/td&gt;
    &lt;td&gt;&lt;input type="text" name="conference_date_out" id="conference_date_out" class="datepicker" /&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;Total Days&lt;/td&gt;
    &lt;td&gt;&lt;input type="text" name="total_days" id="total_days" /&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;Number of Delegates&lt;/td&gt;
    &lt;td&gt;&lt;input type="text" name="no_of_delegates" id="no_of_delegates" /&gt;&lt;/td&gt;
    &lt;/tr&gt;
   &lt;tr&gt;
    &lt;td&gt;Accommodation:&lt;/td&gt;
    &lt;tr&gt;
    &lt;td&gt;&lt;p&gt;Check in Date&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;input type="text" name="check_in_date" id="check_in_date" class="datepicker" /&gt;&lt;/td&gt;

    &lt;td&gt;&lt;p&gt;Check out Date&lt;/p&gt;&lt;/td&gt;
    &lt;td&gt;&lt;p&gt;
      &lt;input type="text" name="check_out_date" id="check_out_date" class="datepicker" /&gt;
        &lt;/p&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;Total Days Accommodation&lt;/td&gt;
    &lt;td&gt;&lt;input type="text" name="total_days_acc" id="total_days_acc" /&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;strong&gt;Contact Details&lt;/strong&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;Contact Person&lt;/td&gt;
    &lt;td&gt;&lt;input type="text" name="contact_person" id="contact_person" /&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;Telephone Number&lt;/td&gt;
    &lt;td&gt;&lt;input type="text" name="tel_no" id="tel_no" /&gt;&lt;/td&gt;
    &lt;td&gt;&amp;nbsp;&lt;/td&gt;
    &lt;td&gt;Fax Number&lt;/td&gt;
    &lt;td&gt;&lt;input type="text" name="fax_no" id="fax_no" /&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;Cell Number&lt;/td&gt;
    &lt;td&gt;&lt;input type="text" name="cell_no" id="cell_no" /&gt;&lt;/td&gt;
    &lt;td&gt;&amp;nbsp;&lt;/td&gt;
    &lt;td&gt;Email&lt;/td&gt;
    &lt;td&gt;&lt;input type="text" name="email" id="email" /&gt;&lt;/td&gt;
  &lt;/tr&gt;

  &lt;tr&gt;
    &lt;td&gt;Full Day Conference @ R260 p/p&lt;/td&gt;
    &lt;td&gt;&lt;input type="text" name="full_day" id="full_day" /&gt;
    Full Days&lt;/td&gt;
    &lt;td&gt;&amp;nbsp;&lt;/td&gt;
    &lt;td&gt;Total Cost Full Day&lt;/td&gt;
    &lt;td&gt;&lt;input type="text" name="total_full" id="total_full" readonly="readonly" /&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;Half Day Conference @ R240 p/p&lt;/td&gt;
    &lt;td&gt;&lt;input type="text" name="half_day" id="half_day" /&gt;
    Half Days&lt;/td&gt;
    &lt;td&gt;&amp;nbsp;&lt;/td&gt;
    &lt;td&gt;Total Cost Half Day&lt;/td&gt;
    &lt;td&gt;&lt;input type="text" name="total_half" id="total_half" readonly="readonly" /&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;Single Rooms @ R480 p/p&lt;/td&gt;
    &lt;td&gt;&lt;input type="text" name="single_rooms" id="single_rooms" /&gt;
    Guests&lt;/td&gt;
    &lt;td&gt;&amp;nbsp;&lt;/td&gt;
    &lt;td&gt;Total Cost Single Rooms&lt;/td&gt;
    &lt;td&gt;&lt;input name="total_single" type="text" id="total_single" readonly="readonly" /&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;Double / Twin Rooms @ R360 p/p/s&lt;/td&gt;
    &lt;td&gt;&lt;input type="text" name="double_rooms" id="double_rooms" /&gt; 
    Guests&lt;/td&gt;
    &lt;td&gt;&amp;nbsp;&lt;/td&gt;
    &lt;td&gt;Total Cost Double / Twin&lt;/td&gt;
    &lt;td&gt;&lt;input name="total_double" type="text" id="total_double" readonly="readonly" /&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;Data Projector @ R400 rental p/day&lt;/td&gt;
    &lt;td&gt;&lt;input type="text" name="data_projector" id="data_projector" /&gt; 
      Days&lt;/td&gt;
    &lt;td&gt;&amp;nbsp;&lt;/td&gt;
    &lt;td&gt;Total Cost Projector Rental&lt;/td&gt;
    &lt;td&gt;&lt;input name="total_projector" type="text" id="total_projector" readonly="readonly" /&gt;&lt;/td&gt;
  &lt;/tr&gt;
   &lt;tr&gt;
    &lt;td&gt;Sub Total&lt;/td&gt;
    &lt;td&gt;&lt;input name="sub_total" type="text" id="sub_total" readonly="readonly" /&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td height="23"&gt;&amp;nbsp;&lt;/td&gt;
    &lt;/tr&gt;

  &lt;/form&gt;
&lt;/table&gt;

&lt;/div&gt;

&lt;div id="hideme"&gt;
Hello Hideme
&lt;/div&gt;

&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>JAVASCRIPT</p>

<pre><code>&lt;script type="text/javascript"&gt;
//Datepicker
$(function() {
    $(".datepicker").datepicker({ minDate: -0, maxDate: "+100M +10D",dateFormat: 'dd-mm-yy'})
    ({
        changeMonth: true,
        changeYear: true,
    });
        });

//Datepicker Enquiry Date Set to Today
var enquiry_date = $.datepicker.formatDate('dd-mm-yy', new Date());
document.getElementById('enquiry_date').value = enquiry_date;


//Datepicker Conference in / out
var calcDate = function() {
    var start = $('#conference_date_in').datepicker('getDate');
    var end = $('#conference_date_out').datepicker('getDate');
    var days = (end - start) / 1000 / 60 / 60 / 24 + 1;

    if(days==0) {days=1
    }
    if( days &gt;= 0 ) {
    document.getElementById('total_days').value = days;
    } 
        }


$('#conference_date_out').change(calcDate);
$('#conference_date_in').change(calcDate);




//Datepicker Check in  / Out Accommodation
var calcDateAcc = function() {
    var startacc = $('#check_in_date').datepicker('getDate');
    var endacc = $('#check_out_date').datepicker('getDate');
    var daysacc = (endacc - startacc) / 1000 / 60 / 60 / 24;


    if(daysacc==0) daysacc=1
    if( daysacc &gt;= 0 ) {
    document.getElementById('total_days_acc').value = daysacc;
    } 
        }


$('#check_in_date').change(calcDateAcc);
$('#check_out_date').change(calcDateAcc);



//Calculate Total Cost FullDay Conference
function calculateFull()
{
    var fulldays = parseInt(document.getElementById("full_day").value);

    var no_of_delegates = parseInt(document.getElementById("no_of_delegates").value);

    var fullprice = 260;

    var resultfull =  fulldays * no_of_delegates * fullprice;

    document.getElementById("total_full").value = resultfull;
    }

    $('#full_day').change(calculateFull).keyup(calculateFull);



//Calculate Half Day conference total   

    function calculateHalf()
{
    var halfdays = parseInt(document.getElementById("half_day").value);

    var no_of_delegates = parseInt(document.getElementById("no_of_delegates").value);

    var halfprice = 240;

    var resulthalf =  halfdays * no_of_delegates * halfprice;

    document.getElementById("total_half").value = resulthalf;
    }

    $('#half_day').change(calculateHalf).keyup(calculateHalf);



//Calculate Total Cost Single Rooms
    function calculateSingle()
{
    var single_rooms = parseInt(document.getElementById("single_rooms").value);

    var total_days_acc = parseInt(document.getElementById("total_days_acc").value);

    var single_rooms_price = 480;

    var resultsingle =  single_rooms * total_days_acc * single_rooms_price;

    document.getElementById("total_single").value = isNaN(resultsingle) ? 0 : resultsingle;
    }



    $('#single_rooms').change(calculateSingle).keyup(calculateSingle);
    $('#check_in_date').change(calculateSingle);
    $('#check_out_date').change(calculateSingle);





//Calculate Total Cost Double / Twin Rooms
    function calculateDouble()
{
    var double_rooms = parseInt(document.getElementById("double_rooms").value);

    var total_days_acc = parseInt(document.getElementById("total_days_acc").value);

    var double_rooms_price = 360;

    var resultdouble =  double_rooms * total_days_acc * double_rooms_price;

    document.getElementById("total_double").value = isNaN(resultdouble) ? 0 : resultdouble;
    }



    $('#double_rooms').change(calculateDouble).keyup(calculateDouble);
    $('#check_in_date').change(calculateDouble);
    $('#check_out_date').change(calculateDouble);




//Calculate Total Cost Date Projector
    function calculateProjector()
{
    var data_projector = parseInt(document.getElementById("data_projector").value);


    var data_projector_price = 400;

    var resultdata =  data_projector *  data_projector_price;

    document.getElementById("total_projector").value = isNaN(resultdata) ? 0 : resultdata;
    }



    $('#data_projector').change(calculateProjector).keyup(calculateProjector);





//Calculate Sub Total
    function calculateSubTotal()
{

    var SubTotal =  total_full +  total_half;

    document.getElementById("sub_total").value = isNaN(SubTotal) ? 0 : SubTotal;
    }


    $('#data_projector').change(calculateSubTotal).keyup(calculateSubTotal);







//Hide me Testing   
$("#full_day").keyup(function(){

        if ($('#full_day').val() == "1") {   
            $("#hideme").show("fast"); //Slide Down Effect
        }
        else {
            $("#hideme").hide("fast");    //Slide Up Effect
        }
    });
&lt;/script&gt;
</code></pre>
