var opacity = 0;
var opacity2 = 100;

function getStyle(oElm, strCssRule){
  var strValue = "";
  if(document.defaultView && document.defaultView.getComputedStyle){
    strValue = document.defaultView.getComputedStyle(oElm, "").getPropertyValue(strCssRule);
  }
  else if(oElm.currentStyle){
    strCssRule = strCssRule.replace(/\-(\w)/g, function (strMatch, p1){
      return p1.toUpperCase();
    });
    strValue = oElm.currentStyle[strCssRule];
  }
  return strValue;
}

function hide_block(name){
  block = document.getElementById(name);
  status = getStyle(block, "display");
  if(status == "none"){
  	block.style.display = "block";
  	fadein(block);
  }else{
  	fadeout(block);
  }
}

function fadein(block){
  if(opacity < 100){
  	opacity = opacity+2;
	block.style.opacity = opacity/100;
    setTimeout("fadein(block)", 0);
  }else{
  	opacity = 0;
	return opacity;
  }
}

function fadeout(block){
  if(opacity2 > 0){
  	opacity2 = opacity2-2;
	block.style.opacity = opacity2/100;
	setTimeout("fadeout(block)", 0);
  }else{
  	opacity2 = 100;
	block.style.display = "none";
	return opacity2;
  }
}

function confirmation(type){
  if(type == "delete"){
  	return confirm("Wirklich löschen? Diese Aktion kann nicht rückgängig gemacht werden!")
  }else if(type == "reset"){
  	return confirm("Sollen alle gemachten Änderungen wirklich verworfen werden?");
  }else{
  	return false;
  }
}
