function initAboutNav() {
	var items = $A(document.getElementsByClassName('col'));
	items.each(function(item,i) {
		Element.setStyle(item,{top: '200px'});
		Event.observe(item, 'mouseover',function() {
			//close all others first
			/*for(var x = 0; x < items.length; x++) {
				RollIt.RollDown(this);
			}*/
			RollIt.RollUp(item);
		});
		Event.observe(item, 'mouseout',function() {
			RollIt.RollDown(item);
		});
	});
}

var toY = new Array();

var RollIt = {
	timeout : new Array(),

	RollUp : function(obj) {
		if($(obj)) {
			if(this.timeout[obj.id]) {
	    		clearTimeout(this.timeout[obj.id]);				
			}
		    if(obj.style.top == '200px'){
		        this.timeout[obj.id] = setTimeout(function(){
					toY[obj.id] = (parseFloat(obj.offsetHeight) * -1) + 240;
					new Effect.Move(obj,{
						y: this.toY[obj.id], 
						mode: 'absolute', 
						transition: Effect.Transitions.slowstop, 
						duration: 1, 
						beforeStart: function() {
							Element.addClassName(obj,'active');
						}
					});
				},200);
			}			
		}
	},
	RollDown : function(obj) {
		if($(obj)) {
		    if(parseFloat(obj.style.top) != toY[obj.id]){
				if(this.timeout[obj.id])
		        	clearTimeout(this.timeout[obj.id]);
		    }else{
		        this.timeout[obj.id] = setTimeout(function(){
					new Effect.Move(obj,{
						y:200, 
						mode: 'absolute', 
						transition: Effect.Transitions.slowstop, 
						duration: 1,
						beforeStart: function() {
							Element.removeClassName(obj,'active');
						}
					});
				},500);
		    }	
		}
	}
}

//if(!navigator.appVersion.match(/\bMSIE\b/))	

Event.observe(window, 'load', initAboutNav);

Event.observe(window, 'load', initBooksList);


function initBooksList() {
	
	if($('books')) {
		var list = $A($$('.purchase'));

		list.each(function (item, index) {
			//find the imagem get the width
			var box = item.parentNode;
			var image = box.getElementsByTagName('IMG')[0];

			var width = image.offsetWidth;

			var purchaseWidth = 17 + width;

			item.style.left = purchaseWidth + 'px';
		});		
	}
}

