function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

function set_body () {
  rechts = document.getElementById('right');
  inhalt = document.getElementById('content');
  body = document.getElementsByTagName('body')[0];

  if (rechts && rechts.childNodes && rechts.childNodes.length != 0 && !(rechts.childNodes.length == 2 && rechts.firstChild.nodeName == "#comment")) {
    body.setAttribute("class", "box");
    if (window.navigator.systemLanguage && !window.navigator.language){ // zus?tzlich fuer den IE
      body.style.backgroundImage = "url(\""+to_root+"css/grafik/bg_content_box.gif\")";
      rechts.style.display = "block";
      rechts.style.cssFloat = "right";
      rechts.style.width = "160px";
      rechts.style.margin = "0";
      inhalt.style.width = "585px";
    }
  }
}


function QFormCheck () {

    // Parameter
    var missing_css_class = "fehlt"; // Die CSS-Klasse bei Fehlermeldung.
    var missing_message = "Erforderlich!"; // Die Fehlermeldung bei leeren Feldern.
    var invalid_email = "Ungültige Email!"; // Die Fehlermeldung bei ung?ltiger Email.
    var id_required = "_fehlt"; // Der Zusatz der ID
    var email_field = "email"; // Die ID des Emailfeldes

    var form_ok = true;

    // Objekte, die in der Funktion verwendet werden.
    var d = document;
    var all_forms = d.getElementsByTagName("form");
    var all_fields = new Array();

    for (i in all_forms) {
      if ( all_forms[i].className == "to_check" ) all_fields.push(all_forms[i].elements);
    }

//    var all_fields = d.getElementById("formular").elements;

    function check_email (email) {
      reg_ex_email=/^\w[\w|\.|\-]+@\w[\w|\.|\-]+\.[a-zA-Z]{2,4}$/;
      return reg_ex_email.test(email);
    }

    for (field in all_fields) {
      if (o_req = d.getElementById(all_fields[field].name + id_required)) {
	      o_field = d.getElementsByName(all_fields[field].name)[0];
	      // Wenn das Feld leer ist, setze CSS-Klasse und "Fehlt"-Meldung.
	      if (!o_field.value || o_field.value.length == 0) {
	        o_field.className = missing_css_class;
	        if (o_req.firstChild)
	          o_req.replaceChild(d.createTextNode(missing_message), o_req.firstChild);
	        else 
	          o_req.appendChild(d.createTextNode(missing_message));
	        o_field.focus();
	        form_ok = false;
	      // Wenn das Feld nicht leer ist, l?sche CSS-Klasse und "Fehlt"-Meldung.
	      } else {
	        o_field.className = '';
	        if (o_req.firstChild)
	          o_req.removeChild(o_req.firstChild);
	      }
      }
    }
  
    o_email_field = d.getElementsByName(email_field)[0];
    if (o_missing_email = d.getElementById(email_field + id_required)) {
      if (check_email(o_email_field.value)) {
        o_email_field.className = '';
        if (o_missing_email.firstChild)
          o_missing_email.removeChild(o_missing_email.firstChild);
      } else {
        form_ok = false;
        o_email_field.className = missing_css_class;
        if (!o_missing_email.firstChild)
          o_missing_email.appendChild(d.createTextNode(invalid_email));
        o_email_field.focus();
      }
    }

    return form_ok;

}


function QcreateNodes () {
  var d = document;

  var src;
  var size;
  var href;
  var title;
  var css_;
  var class_;
  var id_;
  var name_;

  this.src = src;
  this.size = size;
  this.href = href;
  this.title = title;
  this.css_ = css_;
  this.class_ = class_;
  this.id_ = id_;
  this.name_ = name_;
  
  this.createLink = createLink;
  this.createImage = createImage;
  this.createImage2 = createImage2;
  this.createParagraph = createParagraph;
  this.createDiv = createDiv;

	function createLink (href, child, css, title) {
    var node = d.createElement("a");
    node.setAttribute("href", href);
    if (title && title != "") node.setAttribute("title", title);
    if (css && css != "") node.setAttribute("style", css);
    if (child) {
      if (child.nodeType == 1 || child.nodeType == 3) {
        node.appendChild(child);
      } else {
        node.appendChild(d.createTextNode(child));
      }
    }
	  return node;
	}

	function createImage (src, alt, class_, css, width, height, title) {
    if (window.navigator.systemLanguage && !window.navigator.language) { // f?r IE
      var html = "<img";
      if (src && src != "") html += ' src="' + src + '"';
      if (alt && alt != "") html += ' alt="' + alt + '"';
      if (css && css != "") html += ' style="' + css + '"';
      if (class_ && class_ != "") html += ' class="' + class_ + '"';
      if (width && width != "") html += ' width="' + width + '"';
      if (height && height != "") html += ' height="' + height + '"';
      if (title && title != "") html += ' title="' + title + '"';
      html += " />";
      var node = d.createElement(html);
    } else  {
      var node = d.createElement("img");
      node.setAttribute("src", src);
      if (css && css != "") node.setAttribute("style", css);
      if (alt && alt != "") node.setAttribute("alt", alt);
      if (class_ && class_ != "") node.setAttribute("class", class_);
      if (width && width != "") node.setAttribute("width", width);
      if (height && height != "") node.setAttribute("height", height);
      if (title && title != "") node.setAttribute("title", title);
    }
	  return node;
	}

	function createImage2 () {
	  var width = this.size.split("x")[0];
	  var height = this.size.split("x")[1];

    if (window.navigator.systemLanguage && !window.navigator.language) {
      var html = "<img";
      if (this.src && this.src != "") html += ' src="' + this.src + '"';
      if (width && width != "") html += ' width="' + width + '"';
      if (height && height != "") html += ' height="' + height + '"';
      if (this.id_ && this.id_ != "") html += ' id="' + this.id_ + '"';
      if (this.name_ && this.name_ != "") html += ' name="' + this.name_ + '"';
      if (this.class_ && this.class_ != "") html += ' class="' + this.class_ + '"';
      if (this.css_ && this.css_ != "") html += ' style="' + this.css_ + '"';
      html += " />";
      var node = d.createElement(html);
    } else  {
      var node = d.createElement("img");
      if (this.src && this.src != "") node.setAttribute("src", this.src);
      if (width && width != "") node.setAttribute("width", width);
      if (height && height != "") node.setAttribute("height", height);
      if (this.id_ && this.id_ != "") node.setAttribute("id", this.id_);
      if (this.name_ && this.name_ != "") node.setAttribute("name", this.name_);
      if (this.class_ && this.class_ != "") node.setAttribute("class", this.class_);
      if (this.css_ && this.css_ != "") node.setAttribute("style", this.css_);
    }
	  return node;
	}

	function createParagraph (text, css, strong) {
    var node = d.createElement("p");
    if (css && css != "") node.setAttribute("style", css);
    if (strong) {
      node.appendChild(d.createElement("strong"));
      node.firstChild.appendChild(document.createTextNode(text));
    } else {
      node.appendChild(d.createTextNode(text));
	  }
	  return node;
	}

	function createDiv (css, class_, id_, name_) {
    if (window.navigator.systemLanguage && !window.navigator.language) {
      var node = d.createElement('<div class="' + class_ + '" id="' + id_ + '" name="' + name_ + '">');
    } else {
      var node = d.createElement("div");
      if (class_ && class_ != "") node.setAttribute("class", class_);
      if (id_ && id_ != "") node.setAttribute("id", id_);
      if (css && css != "") node.setAttribute("style", css);
      if (name && name != "") node.setAttribute("name", name_);
    }
    return node;
	}

}

Q = new QcreateNodes();

function activate(obj) {
	if(obj.className == "active")
		obj.className = "";
	else {
		for(var i=0; i<obj.parentNode.childNodes.length; i++) {
			obj.parentNode.childNodes[i].className = "";
		}
		obj.className = "active";
	}
}
