/*Sample: 
  initialization:
    <body onload="effect3001.start()">

  html:    
    <div id="EFFECT3001" hideTime="500" showTime="2000" pause="2000">
      <p>Hallo</p>
      <img src="Welt.jpg" highlight_link="welt"/>
    </div>
    <p id="welt">Welt</p>
  css:
    #EFFECT3001 {width:300px; height:300px; visibility:hidden;}
*/

var effect3001 = {
  PeriodicExec: null,
  current: null,
  hideTime: 1.0,
  showTime: 1.0,
  pause: 1.0,
  start: function() {
	  //homepage title
	  title_box = document.getElementById("EFFECT3001_TITLE");
	  if (title_box!=null) {
  	    new Effect.Opacity(title_box, {duration:0, to:0});
	    window.setTimeout('title_box.style.visibility="visible"',100);
	    new Effect.Appear(title_box, {duration:1.5, from:0.0, to:0.6});
	  }
      //pulsate
      if ($('target3001_pulsate'))   
      	new Effect.Pulsate('target3001_pulsate',{duration:10, pulses:8}); 
      //effect box
	  effect_box = document.getElementById("EFFECT3001");
	  if (effect_box==null)
	    return;
	  //attributes
	  attr = effect_box.getAttribute("hideTime");
	  if (attr!=null)
	    effect3001.hideTime = parseInt(attr)/1000;
	  attr = effect_box.getAttribute("showTime");  
	  if (attr!=null)
	    effect3001.showTime = parseInt(attr)/1000;
	  attr = effect_box.getAttribute("pause");  
	  if (attr!=null)
        effect3001.pause = parseInt(attr)/1000;
	  period = effect3001.hideTime+effect3001.showTime+effect3001.pause+0.1;
	  //period = Math.max(effect3001.hideTime,effect3001.showTime)+effect3001.pause+0.1;
	  //hide elems 2 3 ...
	  elem = effect_box.firstChild;
	  firstelem = true;
	  while (elem!=null) { 
	    if (elem.nodeType==1) {
	      if (firstelem)
	        firstelem=false;
	      else
	        new Effect.Opacity(elem,{to:0.0, duration:0.0});
	    }    
	    elem = elem.nextSibling;
	  }
	  window.setTimeout('effect_box.style.visibility="visible"',200);
	  //periodic
	  effect3001.current=effect_box.firstChild;
	  effect3001.next(true);
	  effect3001.restart();
  },
  restart: function() {
	  effect3001.PeriodicExec =new PeriodicalExecuter(effect3001.effect, period);  
  },
  stop: function() {
	  if (effect3001.PeriodicExec!=null) {
	    effect3001.PeriodicExec.stop();
	    effect3001.PeriodicExec=null;  
	  }  
  },
  effect: function() {
	  window.setTimeout(effect3001.go,effect3001.pause*1000);
  },
  go: function() {
	  new Effect.Fade(effect3001.current, {duration:effect3001.hideTime});
	  effect3001.next(false);
	  new Effect.Appear(effect3001.current, {duration:effect3001.showTime});
  },
  next: function(start) {
      if (start && effect3001.current.nodeType==1)
        return;
	  effect_box = effect3001.current.parentNode;
	  do
	    effect3001.current = effect3001.current.nextSibling;
	  while (effect3001.current!=null && effect3001.current.nodeType!=1);
	  if (effect3001.current==null) {
	    effect3001.current=effect_box.firstChild;
	    effect3001.next(true);
	    return;
	  }    
  }
}

      //var debug = document.getElementById("debug");
      //debug.innerHTML=;



