var growth     = 0;
var culture    = 0;
var science    = 0;
var produktion = 0;
var attack     = 0;
var defense    = 0;
var speed      = 0;
var options    = 0;

function display(id, num){
  element = document.getElementById(id);

  if(element.checked)
    options += num;
  else
    options -= num;

  update();
}

function update(){
  var num  = document.getElementById('num');
  var num2 = document.getElementById('num2');
  var num3 = document.getElementById('num3');
  var num4 = document.getElementById('num4');
  var sbmt = document.getElementById('mysubmitbutton');
  
  num.value  = growth + culture + produktion + science + attack + defense + speed + options;
  num2.value = (12 + attack + defense + speed) / 10;
  num4.value = num3.value * (1 + num2.value / 100);

  if(num.value == 0)
    sbmt.disabled = false;
  else
    sbmt.disabled = true;
}

function updategrowth(value){
  growth = value/1;
  update();
}

function updatescience(value){
  science = value/1;
  update();
}

function updateproduktion(value){
  produktion = value/1;
  update();
}

function updateculture(value){
  culture = value/1;
  update();
}

function updateattack(value){
  attack = value/1;
  update();
}

function updatedefense(value){
  defense = value/1;
  update();
}

function updatespeed(value){
  speed = value/1;
  update();
}
