<!---
//*******************************************************************************
//*                                                                             *
//* calculator for seald boxes
//*
//*******************************************************************************
//* Sinn und Zweck:
//* Throw in basic data of your subwoofer and get a proposal for a sealed box
//*
//* Version 2007
//* Update: 2007-08-22
//*
//*******************************************************************************
//*
//* copyright by ROWEX
//* author: Rothschopf Werner, Egidiweg 244, A 5582 St. Michael
//* email: noiasca@yahoo.com
//*
//* Lizenzbestimmungen:
//*
//* this source must not be coppied or provided without permission of the author.
//* removing this disclaimer is not allowed.
//*
//*******************************************************************************
//* functionality
//*
//* + vice versa cacuclating of power / WRMS per amplifer
//* + calculation of main (possible) wire diameter
//* + calculation of main fuse size
//* + calculation of 
//*
//* missing so far
//* - "small" diameters are not kicked out
//* - print function
//* - layout
//* - grafical diagram
//* 
//*
//*******************************************************************************


function ausfuellen()
{
// the crazy main programm ... 

   document.frm_rowex.vb.value=calc_vb();
   document.frm_rowex.fc.value=calc_fc();
   document.frm_rowex.netto.value=calc_netto();
   
   document.frm_rowex.mid.value=calc_box_mid();
//   document.frm_rowex.bottom.value=calc_box_bottom();
}

function calc_vb()
{
//      calculate vb out from VAS/((QTC^2/QTS^2)-1)
  vas=document.frm_rowex.vas.value ;
  qtc=document.frm_rowex.qtc.value ;
  qts=document.frm_rowex.qts.value ;
  
  helpme= vas /(( (qtc * qtc) / (qts * qts)) -1 );
  helpme=round(helpme);
  return helpme;    
}

function calc_fc()
{
// calculate fc=sqr(fs^2*(VAS/Vb+1))
  fs=  document.frm_rowex.fs.value ;
  vas= document.frm_rowex.vas.value ;
  vb=  document.frm_rowex.vb.value ;
  
  fc= Math.sqrt (fs*fs*(vas/vb+1));
  fc= round (fc);
  return fc;
}

function calc_netto()
{
//      
  vb=  document.frm_rowex.vb.value ;
  damping    = document.frm_rowex.option_damping.value ;
  vol_driver = 1 * document.frm_rowex.vol_driver.value ;
  netto = vb / damping + vol_driver;

  netto = round (netto);
  return netto;    
}

function calc_box_mid()
{
//      
  netto  =  document.frm_rowex.netto.value ;
  broad  =  document.frm_rowex.broad.value ;
  height =  document.frm_rowex.height.value ;
  mid = netto / broad / height * 1000 ;
  mid = round (mid);
  return mid;    
}

function calc_box_bottom()
{
//      
  mid    =  document.frm_rowex.mid.value ;
  top    =  document.frm_rowex.top.value ;

  if (undefined == top){ 
      top = mid - 2;
      document.frm_rowex.top.value = top 
      };
  bottom = 2 * mid - top;
  bottom = round (bottom);
  return bottom;    
}

function round(rowex) {
//   classical rounding or ;-) 
	 rowex = rowex + 0.05;
     rowex = Math.floor(rowex*10);
     rowex = rowex/10;
     return rowex;	
}

function check_qts (qts) {
// calculates the max fuse for a given diameter
  if (diameter<=50){ return "200"};   
  if (diameter<=70){ return "250"};   
  if (diameter<=95){ return "300"};
  if (diameter>95){ return "not mentioned by EMMA"};
  if (diameter=="a copper bar"){ return "not mentioned by EMMA"};
}

// actions, if something is changed in form

function change_woofer(){
// if wooferparameters were changed, recalculate  
  if (document.frm_rowex.option_autoproof.checked){ausfuellen();}	
}

function change_box(){
// if box/enclosure was changed, recalculate  
//  if (document.frm_rowex.option_autoproof.checked){ausfuellen();}	
}



// --->



