/*
	
	Website: Fliesen-Zentrum
	BOB Design http://www.bob-design.de/
	Imagion AG http://www.imagion.de/
	Javascript Datei
	08.07.2009 Daan Meskers
	$last_change: 08.07.2009 Daan Meskers
*/

window.addEvent('domready', function(){
   myNiederlassungen.init()
});

var myHideElementTimeOut, myShowElementTimeOut  ;
var myNiederlassungen = {
   init: function() {
      $$('div.Zweigstellen div.Niederlassung div').each( function( elm ) {
          elm.setStyle('opacity', 0.01)
      });      
      $$('div.Zweigstellen div.Niederlassung A.dot').each( function( elm ) {
          elm.onmouseover = function() { myNiederlassungen.show( this ) }
          //elm.parentNode.onmouseout = function() { myNiederlassungen.hide( this ) }
          elm.onmouseout = function() { myNiederlassungen.hide( this.parentNode ) }
      
      });      
   },
   show: function( elm ) {
      if ( this.hideElm && this.hideElm.id == elm.parentNode.id ) {
         clearTimeout( myHideElementTimeOut )
      }
      var circleFX = new Fx.Morph( elm.parentNode, {duration:500} );
          circleFX.start({'height': 150})
      var elms = elm.parentNode.getChildren( "div" )
      var lineFX = new Fx.Morph( elms[0], {duration:750} );
          lineFX.start({'opacity': 0.8})
      var boxFX = new Fx.Morph( elms[1], {duration:750} );
          boxFX.start({'opacity': 0.8})

   },
   hide: function( elm ) {
      if ( this.hideElm && this.hideElm.id != elm.id ) {
         myNiederlassungen.hideTimeout()
      }
      this.hideElm = elm
      myHideElementTimeOut = setTimeout( "myNiederlassungen.hideTimeout()", 250 )
   },
   hideTimeout:  function( elm ) {
      var elm = this.hideElm ;
      var circleFX = new Fx.Morph( elm, {duration:400} );
          circleFX.start({'height': 1})
      var elms = elm.getChildren( "div" )
      var lineFX = new Fx.Morph( elms[0], {duration:550} );
          lineFX.start({'opacity': 0.01})
      var boxFX = new Fx.Morph( elms[1], {duration:550} );
          boxFX.start({'opacity': 0.01})

   }
   
}