 function slider(content,handle,context,paso,arriba,abajo){
	
	var slider = new Slider(content,handle,{
		steps: 100,	// There are 35 steps
		range: [0],	// Minimum value is 8
		wheel: true, 
		mode:"vertical",
		onChange: function(value){
			
			var position =0;
			var height = context.getCoordinates().height;
			
			position = -(context.getCoordinates().height*(value/100));
			
			
			context.setStyle('top',(position*0.98));
			
		}
	}).set(-context.getCoordinates().top);
	
	abajo.addEvent('click', function(e){
		e = new Event(e).stop();
		var step = slider.step + paso;
		slider.set(step);
	});
	arriba.addEvent('click', function(e){
		e = new Event(e).stop();
		var step = slider.step - paso;
		slider.set(step);
	});
}	
 function slider2(content,handle,context,paso,izq,der){
	
	var slider = new Slider(content,handle,{
		steps: 100,	// There are 35 steps
		range: [0],	// Minimum value is 8
		wheel: true, 
		onChange: function(value){
			
			var position =0;
			var left = context.getCoordinates().left;
			var width = context.getCoordinates().width;
			position = -(width*(value/100));
			context.setStyle('left',(position*0.98));
		}
	}).set(-context.getCoordinates().left);
	
	der.addEvent('click', function(e){
		e = new Event(e).stop();
		var step = slider.step + paso;
		slider.set(step);
	});
	izq.addEvent('click', function(e){
		e = new Event(e).stop();
		var step = slider.step - paso;
		slider.set(step);
	});
}	

function scroll2(content, context, paso, arriba, abajo){


	/*$('drag').addEvent('mouseup', function() {
		this.setStyle('cursor', 'url(/demos/Scroller/openhand.cur), move');
		scroll1.stop();
	});


	var scroll2 = new Scroller(context, {area: 80, velocity: 0.1});

	context.addEvent('mouseover', scroll2.start.bind(scroll2))
	abajo.addEvent('mousedown', function(event) {
		event = new Event(event).stop();
		alert(scroll2);
		scroll2.start.bind(scroll2);
	});
  //abajo.addEvent('mousedown', scroll2.start.bind(scroll2));
 //$('scrolldiv').addEvent('mousedown', scroll2.stop.bind(scroll2));


	
	/*
	var scroll = new Fx.Scroll(context, {
		wait: false,
		duration: 2500,
		offset: {'x': -200, 'y': -50},
		transition: Fx.Transitions.Quad.easeInOut
	});*/
	 
	 //abajo.addEvent('mouseenter', scroll.start.bind(scroll));
        //$('scrolldiv').addEvent('mouseleave', scroll.stop.bind(scroll)); 
	/*abajo.addEvent('click', function(event) {
		event = new Event(event).stop();
		alert('h');
		scroll.scrollTo(0,100);
	});*/


}

function scroll(content, context, paso, arriba, abajo){
var scrollv = false;	
var tip;
var position =0;
	var myFx = new Fx.Elements(context, { 
		duration: 700,
		onComplete: function(event){
			//event = new Event(event).stop();
				//alert(scrollv);
		       if (scrollv==false){
					switch (tip){
						case 0:
							var pos = context.getStyle('top').toInt();
							var height = content.getStyle('height').toInt();
							var bottom = pos +context.getStyle('height').toInt();
							if(bottom > height){
								desplazar =  context.getStyle('top').toInt() - paso;
								myFx.start({ '0': { 'top': desplazar} });
								scrollv = false;	
							}	  
						break;
						case 1:
							var pos = context.getStyle('top').toInt();
							var height = content.getStyle('height').toInt();
							var bottom = pos + context.getStyle('height').toInt();
							if(pos < 0){
								desplazar =  context.getStyle('top').toInt() + paso;
								myFx.start({ '0': { 'top': desplazar } });
								scrollv = false;
							}
						break;	
					}		
				}
		}
	});
	

	
	arriba.addEvent('mousedown', function(e){
		var pos = context.getStyle('top').toInt();
		var height = content.getStyle('height').toInt();
		var bottom = pos + context.getStyle('height').toInt();
		if(pos < 0){
			desplazar =  context.getStyle('top').toInt() + paso;
			tip=1;
			myFx.start({ '0': { 'top': desplazar } });
			scrollv = false;
		}
	});
	arriba.addEvent('mouseup', function(e){
		scrollv = true;
	});
		
	abajo.addEvent('mousedown', function(e){
		//alert('fd');
		var pos = context.getStyle('top').toInt();
		var height = content.getStyle('height').toInt();
		var bottom = pos +context.getStyle('height').toInt();
		if(bottom > height){
			tip=0;
			desplazar =  context.getStyle('top').toInt() - paso;
			myFx.start({ '0': { 'top': desplazar} });
			scrollv = false;	
		}
	});
	abajo.addEvent('mouseup', function(e){
		scrollv = true;
	});

}		
function abajo(){
	var pos = context.getStyle('top').toInt();
	var height = content.getStyle('height').toInt();
	var bottom = pos +context.getStyle('height').toInt();
	if(bottom > height){
		desplazar =  context.getStyle('top').toInt() - paso;
		myFx.start({ '0': { 'top': desplazar} });
		scrollv = false;	
	}
}
function arriba(){
	var pos = context.getStyle('top').toInt();
		var height = content.getStyle('height').toInt();
		var bottom = pos + context.getStyle('height').toInt();
		if(pos < 0){
			desplazar =  context.getStyle('top').toInt() + paso;
			myFx.start({ '0': { 'top': desplazar } });
			scrollv = false;
		}
}
				
