<!--

// Shell Prices


///////////  Edit these variables  /////////////////////////////////////////////////////\\\\\\////

var boats_in_list = 6; 
var steelwork = new Array(boats_in_list-1);
steelwork[0] = new boatobj('Thomas 50ft DB',51215);
steelwork[1] = new boatobj('Katherine 55ft DB',51385);
steelwork[2] = new boatobj('Katrina 66ft DB',71272);
steelwork[3] = new boatobj('Coaster 49',64419);
steelwork[4] = new boatobj('Emily DB 43/45',39445);


var blast_price = 950; // grit blast cost
var power_unit = 50000; // engine kit
var sailaway = 10000; // sailaway
var fullfit = 60000; // fullfit

//////////////////////////////////////////////////////////////////////////////////////////////////
    function boatobj(name,price) {
        this.name = name;
        this.price = price;
    }

// Calculate Shell
function calculateShell(value,qty,sub) {
 value = (value * qty);
 value = CurrencyFormat(value) 
 document.calcform.elements[sub].value=value;
 total();
}


// calculate 
function calculate(id,value,qty,sub) {
 
 value = (value * qty);
 value = CurrencyFormat(value);

//alert(id+" "+value);

if (document.calcform.elements[id].checked==true) {
 document.calcform.elements[sub].value=value;
}
  else {
 document.calcform.elements[sub].value="";
}
 total();
}

// calculate total cost

function total() {
var tot = 0;
var grandTotal = 0;

tot += (1 * document.calcform.tot1.value);
tot += (1 * document.calcform.tot2.value);
tot += (1 * document.calcform.tot3.value);
tot += (1 * document.calcform.tot4.value);
tot += (1 * document.calcform.tot5.value);

grandTotal = CurrencyFormat(tot);
document.calcform.totalcost.value = grandTotal;



var vat = 0;
vat = ((grandTotal / 100) * 17.5);
vat = CurrencyFormat(vat);
document.calcform.vat.value = vat;

var incvat = 0;
incvat = ((grandTotal / 100) * 117.5);
incvat = CurrencyFormat(incvat);
document.calcform.incvat.value = incvat;


}

function CurrencyFormat(total) {

total= (total*10000);
 total= Math.round(total);
  total= (total/10000);

if(total==Math.floor(total)) {
    total = total+".00";
  } 
    else if (10*total==Math.floor(10*total)) {
    total = total+"0";
  }
    total= (total*100);
     total= Math.floor(total);
      total= (total/100);

if(total==Math.floor(total)) {
    total = total+".00";
  } 
    else if (10*total==Math.floor(10*total)) {
    total = total+"0";
  }
  
  return total;
}

//-->
