Event.observe(window,"load",function(){ jsPestanas = new JSPestanas(); });

var JSPestanas = Class.create();

JSPestanas.prototype = { 
	initialize : function() {
		$$('a.linkPestanya').each(function(item){
			Event.observe(item, "mouseover", this.over.bind(this));
			Event.observe(item, "mouseout", this.out.bind(this));
		}.bind(this));
	},
	
	over : function(evt){
		elemento = Event.element(evt);
		this.resaltar(elemento);
	},
	
	out : function(evt){
		elemento = Event.element(evt);
		this.esconder(elemento);
	},
	
	resaltar : function(elemento){
		posX = parseInt(elemento.style.left);
		if(parseInt(elemento.style.top) > 0){
			new Effect.Move(elemento, { x: posX, y: 0, mode: 'absolute', duration: 0.2});
			elemento.setAttribute("esconder", "true");
		}		
	},
	
	esconder : function(elemento){
		posX = parseInt(elemento.style.left);
		if(elemento.getAttribute("esconder") == "true"){
			new Effect.Move(elemento, { x: posX, y: 17, mode: 'absolute', duration: 0.5});
		}
	}
}