function dom_init() {

  // Sprachen
  $('.fr, .de, .ru, .en, .es, .kr, .tr, .pl, .ar').each(function(){
    var mylang = $(this).text();
    $(this).attr('title', mylang);
  });


  // Calculator Init und Switch

  $('#calcswitch a').click(function(){
    if ($(this).closest('#calcs').hasClass('open')) {
      $(this).closest('#calcs').css('bottom','125px').removeClass('open');
    } else {
      $(this).closest('#calcs').css('bottom','-140px').addClass('open');
    }
    return false;  
  });
  
  $('#calcnavi a').live('click', function(){
    $('#calcs div.calc').hide().find('.result').empty();
    $('#calcnavi li').removeClass('active');
    $('#calcs div#'+$(this).data('link')).show();
    $(this).parent().addClass('active');
    return false;
  }); 

  $('#calcs').each(function(){
    $(this).find('#calcswitch').after('<ul id="calcnavi"></ul>');
    $(this).find('h2').each(function(){
      $('#calcnavi').append('<li><a href="#" data-link="'+$(this).parent().attr('id')+'">'+$(this).text()+'</a></li>');
      $(this).remove();
    });
    $('#calcnavi li:first-child').addClass('active');
  });
  
  
  // CEV-Rechner
  
  $('#cev input[type=text]').blur(function(){
    var neu = this.value.replace(/\,/g, ".");
    this.value = neu;
  });
  
  $('#cev-go').click(function(){
    var C =  Number($('#cev').find('#cev-c')[0].value);
    var Mn = Number($('#cev').find('#cev-mn')[0].value);
    var Cr = Number($('#cev').find('#cev-cr')[0].value);
    var V =  Number($('#cev').find('#cev-v')[0].value);
    var Mo = Number($('#cev').find('#cev-mo')[0].value);
    var Cu = Number($('#cev').find('#cev-cu')[0].value);
    var Ni = Number($('#cev').find('#cev-ni')[0].value);
    var result;
    
    if (result = C + (Mn/6) + ((Cr + Mo + V)/5) + ((Ni + Cu)/15)) {
      $('#cev-result').empty().text("= "+Math.round(result*1000)/1000);
    } else {
      $('#cev-result').empty().text("= ???");
    }
    
    
    return false;
  });
  
  
  
  // PCM-Rechner
  
  $('#pcm input[type=text]').blur(function(){
    var neu = this.value.replace(/\,/g, ".");
    this.value = neu;
  });
  
  $('#pcm-go').click(function(){
    var C =  Number($('#pcm').find('#pcm-c')[0].value);
    var Si = Number($('#pcm').find('#pcm-si')[0].value);
    var Mn = Number($('#pcm').find('#pcm-mn')[0].value);
    var Cr = Number($('#pcm').find('#pcm-cr')[0].value);
    var V =  Number($('#pcm').find('#pcm-v')[0].value);
    var Mo = Number($('#pcm').find('#pcm-mo')[0].value);
    var Cu = Number($('#pcm').find('#pcm-cu')[0].value);
    var Ni = Number($('#pcm').find('#pcm-ni')[0].value);
    var B = Number($('#pcm').find('#pcm-b')[0].value);
    var result; 
    
    if (result = C+Si/30+Mn/20+Cu/20+Ni/60+Cr/20+Mo/15+V/10+5*B) {
      $('#pcm-result').empty().text("= "+Math.round(result*1000)/1000);
    } else {
      $('#pcm-result').empty().text("= ???");
    }
    
    return false;
  });
  
  
  
  

}
