function dom_init() {
	//Bestellung
	$('.threesome a').lightBox(); 
	// Datums-Auswahl
	$('input.date').datepick({dateFormat: 'dd.mm.yy'});
	// Textfelder Auto-Clear
	$('.autoclear').focus(function(){
	  cleartext = this.value;
	  this.value = "";
	});
	$('.autoclear').blur(function(){
	  if (this.value == "") {
	    this.value = cleartext;
	  }	  
	});
	// Archiv-Auswahl
	$('#archivchooser ul').hide();
	$('#archivchooser > li > a').click(function(){
	  var myUl = $(this).parent().find('ul');
	  $('#archivchooser ul').not(myUl).slideUp(400);
	  $(myUl).slideToggle(400);
	  return false;
	});
	
	// Symptom-Checker
  $('#symptome input').click(calcnow);
  $('#stage fieldset').not('#step1').hide();
  $('object').click(hideIntro);
}


function calcrow(row) {
  var mysum = 0;
  $(row).each(function(i){
    if (this.checked) {
      mysum += i;
    };
  });
  return mysum;
}

function calcnow() {
  var sum1 =  calcrow(document.symptome.step_01_01) + 
              calcrow(document.symptome.step_01_02) + 
              calcrow(document.symptome.step_01_03) + 
              calcrow(document.symptome.step_01_04);
              
  var sum2 =  calcrow(document.symptome.step_02_01) + 
              calcrow(document.symptome.step_02_02) + 
              calcrow(document.symptome.step_02_03) + 
              calcrow(document.symptome.step_02_04);

  var sum3 =  calcrow(document.symptome.step_03_01) + 
              calcrow(document.symptome.step_03_02) + 
              calcrow(document.symptome.step_03_03);

  var total = sum1 + sum2 + sum3;
  
  $('#total').text(total);
  
  $('#result p').hide();
  
  if (total < 5) {
    $('#result0').show();
  }
  if (total > 4 && total < 9) {
    $('#result1').show();
  }
  if (total > 8 && total < 17) {
    $('#result2').show();
  }
  if (total > 16) {
    $('#result3').show();
  }
  
}

function hideIntro() {
  window.location.href = 'http://www.galafem.de/start';
}

function formchange(target) {
  var mystep = "#step"+target;
  $(mystep).show();  
  target = (target-1) * -470;
  $('#stage').animate({left: target},400, function(){  
    $('fieldset').not(mystep).hide();      
  });  
  return false;
}
jQuery(dom_init);