

/*
**
** THEMA: Frubiase_Lexikon
**
*/

var Topic = {
	gebietsheads : null,
  gebiete : null,
  hoehen : Array,
  bezeichner : '',

  specialIE6 : function() {
     var mainEL = YAHOO.util.Dom.get('main');
     YAHOO.util.Dom.setStyle( 'vertikaler_abschluss', 'top',  mainEL.offsetHeight + 'px' );
     var schatten = new Array( 'schatten_links', 'schatten_verlauf_links', 'schatten_rechts', 'schatten_verlauf_rechts' );
     YAHOO.util.Dom.setStyle( schatten, 'height',  mainEL.offsetHeight + 'px' );
  },


  slideoutGebiet : function(e) {
    Topic.bezeichner = this.id.substring( 1, this.id.length );
    var gebiet = document.getElementById( 'g' + Topic.bezeichner );
    var gKopf = document.getElementById( 'h' + Topic.bezeichner );

   	var koepfe = YAHOO.util.Dom.getElementsByClassName( 'gebiet', 'h3', 'maincontent' );
  	for ( k = 0; k < koepfe.length; k++ ) {
      YAHOO.util.Dom.removeClass( koepfe[k], 'plus' );
      YAHOO.util.Dom.addClass( koepfe[k], 'minus' );
  	}

  	for ( k = 0; k < Topic.gebiete.length; k++ ) {
      if ( Topic.gebiete[k].id != 'g' + Topic.bezeichner ) {
        if ( Topic.gebiete[k].offsetHeight > 0 ) {
          var anim = new YAHOO.util.Anim(  Topic.gebiete[k], { height: { to: 0 } }, 1, YAHOO.util.Easing.easeOut );
          anim.animate();
        }
      } else {

        if ( gebiet.offsetHeight == 0 ) {
          YAHOO.util.Dom.removeClass( gKopf, 'minus' );
          YAHOO.util.Dom.addClass( gKopf, 'plus' );
          var anim = new YAHOO.util.Anim(  gebiet, { height: { to: Topic.hoehen[Topic.bezeichner] } }, 1, YAHOO.util.Easing.easeOut );
          if ( window.attachEvent && ( navigator.appName == "Microsoft Internet Explorer"  ) ) { // IE
            if ( typeof document.body.style.maxHeight == "undefined" ) anim.onComplete.subscribe( Topic.specialIE6 ); // IE 6-
          }
          anim.animate();
        } else {
          YAHOO.util.Dom.removeClass( gKopf, 'plus' );
          YAHOO.util.Dom.addClass( gKopf, 'minus' );
          var anim = new YAHOO.util.Anim(  gebiet, { height: { to: 0 } }, 1, YAHOO.util.Easing.easeOut );
          if ( window.attachEvent && ( navigator.appName == "Microsoft Internet Explorer"  ) ) { // IE
            if ( typeof document.body.style.maxHeight == "undefined" ) anim.onComplete.subscribe( Topic.specialIE6 ); // IE 6-
          }
          anim.animate();
        }
      }
  	}

  },

  init : function() {
    if ( window.location.search.indexOf( 'print=1' ) < 0 ) {

    	this.gebiete = YAHOO.util.Dom.getElementsByClassName( 'gebiet', 'div', 'maincontent' );

    	for ( k = 0; k < this.gebiete.length; k++ ) {
        this.bezeichner = this.gebiete[k].id.substring( 1, this.gebiete[k].id.length );
        this.hoehen[this.bezeichner] = this.gebiete[k].offsetHeight;
    	}
      var anim = new YAHOO.util.Anim(  this.gebiete, { height: { to: 0 } }, 1, YAHOO.util.Easing.easeOut );
      if ( window.attachEvent && ( navigator.appName == "Microsoft Internet Explorer"  ) ) { // IE
        if ( typeof document.body.style.maxHeight == "undefined" ) anim.onComplete.subscribe( Topic.specialIE6 ); // IE 6-
      }
      anim.animate();

    	this.gebietsheads = YAHOO.util.Dom.getElementsByClassName( 'gebiet', 'h3', 'maincontent' );
      YAHOO.util.Event.addListener( this.gebietsheads, 'click', this.slideoutGebiet );
      YAHOO.util.Dom.addClass( this.gebietsheads, 'minus' );


    } else window.print();
  }

}

var TopicStarter = {
  init : function() {
    Topic.init();
  }
}

// YAHOO.util.Event.onDOMReady( TopicStarter.init );



