var container;
	var pag;
	var container;
    var idInterno;
	var totIncrement;
    var increment;
	var totalPag;
	
function loadSlideGaleria(w,h,id,idInterno){
	if($(idInterno)){
	pag = 1;
	container = $(id);
    idInterno = $(idInterno);
	totIncrement		= 0;
    increment			= h;
	
	if($(id)){
		
		container.setStyles({
			overflow: 'hidden',
			width: w,
			height: h
			});

		}	
		
		if($$('.itenMenuGaleria')){
			total = 0;
			$$('.itenMenuGaleria').each(function(item, index){
					y = item.getHeight();
					ym =  item.getStyle('margin-bottom').toInt();
					total += (y+ym);
				});
			totalPag = (total/h).ceil();			
			}
			
			
			
			// "anterior"
			if($('MenuTop')){
			$('MenuTop').addEvents({
				'click' : function(event){ 	
	
					if(totIncrement<0){                	
						pag-- ;
						totIncrement = totIncrement+increment;						
						idInterno.set('tween', {transition: Fx.Transitions.Elastic.easeOut, duration:'long'});
						idInterno.tween('margin-top', totIncrement); 						
					}  
					checkBotVert();
				}
				
			});
			}
			// "proximo"
			if($('MenuBottom')){
			$('MenuBottom').addEvents({
				'click':function(event)
				{        	
					if(pag ==1)
					{
						totIncrement = 0
					} 									
					if(totalPag>pag)
					{        		        	
						pag++ ;                   
						totIncrement = totIncrement-increment;  
						idInterno.set('tween', {transition: Fx.Transitions.Elastic.easeOut, duration:'long'});
						idInterno.tween('margin-top', totIncrement); 
					} 
					checkBotVert();
				}
				
			});
			}
		if($('MenuBottom') || $('MenuTop')){		
			checkBotVert();
		}
	}	
			
}

function checkBotVert(){
		if(totIncrement<0){
			$('MenuTop').setStyle('display','block');
			}else{
			$('MenuTop').setStyle('display','none');	
		}
		
		
		
		if(totalPag>pag){
			$('MenuBottom').setStyle('display','block');
		}else{
			$('MenuBottom').setStyle('display','none');
			}
	}

window.addEvent('domready', function() {
	loadSlideGaleria(142,305,'containerVertical','galeriaVertical');
});
