// JavaScript Document
var topNormal = 149, topFull = 0;
var duracion = 400;
var transUp = Fx.Transitions.Cubic.easeOut;
var transDown = Fx.Transitions.Cubic.easeOut;

var fx = new Fx.Elements($('content'), {wait:false, duration:duracion, transition: transUp});
var fxs = {};	
window.addEvent("domready",function(){
	var subir = function(e) {
		e = new Event(e);	var a = e.target;	a = $(a);
		while(a.getTag()!="div" || !a.hasClass("port_item"))
			a=$(a.getParent());
		if(a.hasClass("port_item")) {
			var b = a.getElement('div[class=port_desc]');
			b=$(b);		
			if(b) { 
				if(b.getProperty("moving") > 0) {
					fxs[b.getProperty("moving")].stop();
					b.setProperty("moving",0);
				}

				fx = new Fx.Elements(b, {wait:false, duration:(b.getStyle("top").toInt()/topNormal)*duracion, transition: transUp});
				var o = {};   o[0]={ 'top': [topFull]};					   
				var ran = $random(0,100000);
				fxs[ran]=fx;
				b.setProperty("moving",ran);
				fx.start(o);
			}
		} 
	}

	var bajar = function(e) {
		e = new Event(e); 	var a = e.target;	a = $(a);
		while(a.getTag()!="div" || !a.hasClass("port_item"))
			a=$(a.getParent());
		if(a.hasClass("port_item")) {
			var b = a.getElement('div[class=port_desc]');
			b=$(b);
			if(b) { 	
			    if( b.getProperty("moving") > 0) {
					fxs[b.getProperty("moving")].stop();
					b.setProperty("moving",0);						}

				fx = new Fx.Elements(b, {wait:false, duration:((topNormal-b.getStyle("top").toInt())/topNormal)*duracion, transition: transDown});
			    var o = {};	o[0]={ 'top': [topNormal]};
				b.setProperty("moving",1);
			    var ran = $random(0,100000);
			    fxs[ran]=fx;
			    b.setProperty("moving",ran);						
			    fx.start(o);
			}
		};
	};

		$$('.port_img').addEvent("mouseenter",subir);		
		$$('.port_img').addEvent("mouseleave",bajar);
})
