
function fadeIt(value, mode) {
   value = value.replace(/ item/i, '');
   $$('.worlds .' + value).set('tween', {duration: 3000}).tween('opacity', mode);
   return true;
}

function isIE() {
   if(navigator.appName == 'Microsoft Internet Explorer'){
      return true;
   }else{
      return false;
   }
}

function pulsate(item) {
   var mode = '0.0';
   for(i=0;i<50;i++)
   {
      var timeout = i * 3000;
      mode = mode == '0.8' ? '0.0': '0.8';
      window.setTimeout("fadeIt('" + item + "', '" + mode + "')", timeout);
      //console.debug(mode + ' @ ' + timeout + ' sec.');
   }
}

function backToBasic()
{
   //$$('.worlds .item .image').set('tween', {duration: 50});
   $$('.worlds .jamei .image').set('opacity', '0.2');
   $$('.worlds .provet .image').set('opacity', '0.3');
   $$('.worlds .beauty .image').set('opacity', '0.4');
   if(isIE()) {
      $$('.worlds .symbiontic img').set('src', 'tl_files/layout/img/worlds/symbiontic-off.png');
   }else{
      $$('.worlds .symbiontic .image').set('opacity', '0.5');
   }
   $$('.worlds .regulate .image').set('opacity', '0.6');
   $$('.worlds .niedermaier .image').set('opacity', '0.3');
   //if(isIE) $$('.worlds .symbiontic .image').set('opacity', '1');
}

pulsate('niedermaier .logo');

window.onload = function() {

   backToBasic();
   $$('.worlds .txt').set('opacity', '0.0');
   $$('.worlds .item .txt').set('tween', {duration: 100});

   //$$('.worlds .niedermaier .image, .worlds .niedermaier .txt').tween('opacity', '1.0');

   $$('.worlds .item .image').addEvent('mouseover', function() {
      $$('.worlds .item .image').set('tween', {duration: 100});
      //$$('.worlds .item .image').tween('opacity', '0.3');
      backToBasic();
      if(isIE()) {
	 $$('.worlds .item .txt').set('opacity', '0.0');
	 this.set('opacity', '1.0');
	 this.getNext().set('opacity', '1.0');
      }else{
	 $$('.worlds .item .txt').tween('opacity', '0.0');
	 this.tween('opacity', '1.0');
	 this.getNext().tween('opacity', '1.0');
      }
      // Symbiontic
      if(this.getParent('div').hasClass('symbiontic') === true) {
	 this.getChildren('img').set('src', 'tl_files/layout/img/worlds/symbiontic.png');
      }
   });

   $$('.worlds .item .image').addEvent('mouseout', function() {
      this.getNext().tween('opacity', '0.0');
      backToBasic();
   });

}
