5   <input type="hidden" name="input_name" value="[% HTML.escape(input_name) %]">
 
   6   <input type="hidden" name="input_id" value="[% HTML.escape(input_id) %]">
 
  10     <th class="listtop">[% title %]</th>
 
  14    <tr><td>[% 'Please insert object dimensions below.' | $T8 %]</td></tr>
 
  20       <tr class="listheading">
 
  21        [% FOREACH col = HEADER %]
 
  22         <th nowrap class="listheading">[% col.column_title %]</a></th>
 
  26       [% FOREACH row = VARIABLES %]
 
  27        <tr class="listrow[% loop.count % 2 %]">
 
  28         <td>[% HTML.escape(row.description) %]:</td><td><input id="[% row.name %]" name="[% row.name %]" value=""></td>
 
  29         <td>[% HTML.escape(row.unit) %]</td>
 
  37  <button type="button" onclick="calculate_qty()">[% 'Calculate' | $T8 %]</button>
 
  40  <script type="text/javascript">
 
  41    function calculate_qty() {
 
  42 [%- FOREACH row = VARIABLES %]
 
  43      var [% row.name %] = parse_amount('[% myconfig.numberformat %]', document.getElementsByName("[% row.name %]")[0].value);
 
  45      var result = [% formel %];
 
  46      result = number_format(result, 2, '[% myconfig.numberformat %]');
 
  47      window.opener.document.getElementsByName(document.Form.input_name.value)[0].value = result;
 
  51    function parse_amount(numberformat, amount) {
 
  52      if (numberformat == '1.000,00' || numberformat == '1000,00')
 
  53        amount = amount.replace(/\./g, "").replace(/,/, ".");
 
  54      if (numberformat == "1'000.00")
 
  55        amount = amount.replace(/\'/g, '');
 
  56      return amount.replace(/,/g, '');
 
  59    function number_format(number, precision, numberformat) {
 
  60      number = Math.round( number * Math.pow(10, precision) ) / Math.pow(10, precision);
 
  61      var nf     = numberformat.replace(/\d/g, '').split('').reverse();
 
  65      str_number = number+"";
 
  66      arr_int = str_number.split(".");
 
  67      if(!arr_int[0]) arr_int[0] = "0";
 
  68      if(!arr_int[1]) arr_int[1] = "";
 
  69      if(arr_int[1].length < precision) {
 
  70        nachkomma = arr_int[1];
 
  71        for(i=arr_int[1].length+1; i <= precision; i++) {
 
  74        arr_int[1] = nachkomma;
 
  76      if(th_sep != "" && arr_int[0].length > 3) {
 
  77        raw_arr_int = arr_int[0];
 
  79        for(j = 3; j < raw_arr_int.length ; j+=3) {
 
  80          arr_int[0] = th_sep + raw_arr_int.slice(raw_arr_int.length - j, raw_arr_int.length - j + 3) +  arr_int[0] + "";
 
  82        str_first = raw_arr_int.substr(0, (raw_arr_int.length % 3 == 0) ? 3 : (raw_arr_int.length % 3));
 
  83        arr_int[0] = str_first + arr_int[0];
 
  85      return arr_int[0] + sep + arr_int[1];