/*  Prototype: an object-oriented Javascript library, version 1.2.0
 *  (c) 2005 Sam Stephenson <sam@conio.net>
 *
 *  THIS FILE IS AUTOMATICALLY GENERATED. When sending patches, please diff
 *  against the source tree, available from the Prototype darcs repository. 
 *
 *  Prototype is freely distributable under the terms of an MIT-style license.
 *
 *  For details, see the Prototype web site: http://prototype.conio.net/
 *
/*--------------------------------------------------------------------------*/
/* 
 *  PrototypeMenu: Javascript Menu Effects for the Prototype library
 *  (c) Sören Schlömer
 *
/*--------------------------------------------------------------------------*/


/*--------------------------------------------------------------------------*/


var Effect = new Object();

var timer = new Array();

Effect.Hideaway = Class.create();
Effect.Hideaway.prototype = {
  initialize: function(element,delay) {
	 this.orgElement = element;
	 this.element = $(element);
	
	 /* seconds */
    if(delay) {
    	this.delay  = delay;
    } else {
    	this.delay  = 2;
    }

    this.finish = 0;
    this.current = this.delay;
 
    this.hideaway();
  },
  
  /* eventloop */
  hideaway: function() {
    if (this.isFinished()) { 

    	if(navigator.appVersion.match(/Safari/)) {
    		this.element.style.display = 'none';
    	}
    	this.element.style.visibility = 'hidden';	

    	return;

    }
		
    if (timer[this.element.id]) {
    	clearTimeout(timer[this.element.id]);
    }

    this.current -= 1;

	 //timer[this.element.id] = setTimeout(this.hideaway.bind(this), 1000);
	 if(navigator.appVersion.match(/Safari/)) {
			timer[this.element.id] = setTimeout("var sCurrent = "+ this.current +"; var sElement = document.getElementById('" + this.element.id + "'); new Effect.Hideaway(sElement,sCurrent);", 1000);
	 } else {
			timer[this.element.id] = setTimeout(this.hideaway.bind(this), 1000);
	 }
	 

  },
  
  /* callback */
  isFinished: function() {
  	if(this.delay==1) {
  		return true;
  	}	else {
  		return this.current <= this.finish;	
  	}
	 
  }
    
}

Effect.Comeback = Class.create();
Effect.Comeback.prototype = {
  initialize: function(element) {
	 this.element = $(element);
	 this.historyObj;
    this.comeback();
  },
  
  comeback: function() {
	 if (timer[this.element.id]) {
		clearTimeout(timer[this.element.id]);
	 }
	 
	 this.historyObj = $(history);	
	 
	 for (var history in timer) {

 		/* enter a part of the css ids */
		if(history.indexOf("popup-navigation") != -1)
		{
			this.historyObj = $(history);
			if(navigator.appVersion.match(/Safari/)) {
				this.historyObj.style.display = 'none';	
			}
			this.historyObj.style.visibility = 'hidden';	
			
			clearTimeout(timer[history]);
		}
	 }


		if(navigator.appVersion.match(/Safari/)) {
			this.element.style.display = 'block';
		}
		this.element.style.visibility = 'visible';
	 
	 
	 /* debugging 
	 var temp = "";
	 for (x in Effect) {
		temp += x + ": " + Effect[x] + "\n";
	 }
	 //alert (temp);
	 document.write("<pre>" + temp + "</pre>");
	 /**/
	 
  }
}		

