﻿function addElement(num){
  el = addFile(num);
  $("items").appendChild(el);
  Effect.SlideDown("el" + num);
}

function addFile() {
  el = document.createElement("div");
  el.id = "el";
  el.innerHTML = '<input type="file" name="file[' + num + ']" size=50 class="MB_focusable" />';
  el.style.display="none";
  return el;
}

function insert_html(file_name, html) {
  if($("tr_" + file_name)) {
    $("tablebody").removeChild($("tr_" + file_name));
  }
  Element.insert("tablebody", { top: html});
}


function update_total(){
  symbol = $('#money_symbol').val();
  separator = $('#currency_separator').val();
  event_price = $('#event_price').val();
  total_registrations = $(".participant").size();
  discount = 0;

  value = event_price * total_registrations;

  if(total_registrations >= 5){
    discount = value/10;
  }

  total = value - discount; 
  
  $(".discount").html(symbol + " " + discount + separator + "00");
  $(".total_val").html(symbol + " " + value + separator + "00");
  $(".total_with_discount").html(symbol + " " + total + separator + "00");
}
