Effect.DockIcon = Class.create();
Object.extend(Object.extend(Effect.DockIcon.prototype, Effect.Base.prototype), {
  initialize: function(element) {
    this.element = $(element);
	this.fading = false;
	this.current = false;
	this.timer = "";
	if (!this.element.hasClassName("current")) {
		Element.setOpacity(this.element.id, 0.3);
		this.current = true;
	}
    this.element.observe('mousemove', this.showIcon.bind(this));
    this.element.observe('mouseout', this.hideIcon.bind(this));
  },
  hideIcons: function(){
	var links = $("thumbails").childElements();
	for(i=0;i<links.length;i++) {
		var link = links[i];
		if (!link.hasClassName("current")) Element.setOpacity(link.id, 0.3);
	}
  },
  showIcon: function(){
	if (this.current) {
		if (this.timer != "") {
			clearTimeout(this.timer);
			this.timer = "";
		} else {
			Element.setOpacity(this.element.id, 0.9);
			//new Effect.Opacity(this.element.id, {duration:0.1, from:0.3, to:1});
		}		
	}
  },
  hideIcon: function(){
	if (this.current) {
		this.timer = setTimeout("actuallyHideIcon('"+this.element.id+"')", 200);
	}
  }
});


function actuallyHideIcon(icon) {
	new Effect.Opacity(icon, {duration:0.3, from:1, to:0.3});
}

