﻿
function makeScrollbarB(content,scrollbar,handle,horizontal,ignoreMouse){

if ( content.getScrollSize().y-content.getSize().y > 0){
		var slider = new Slider(scrollbar, handle, {
		steps: 100,
		mode: (horizontal?'horizontal':'vertical'),
			onChange: function(step){
			// Scrolls the content element in x or y direction.
				var x = (horizontal?(((content.getScrollSize().x-content.getSize().x)/100)*step):0);
				var y = (horizontal?0:(((content.getScrollSize().y-content.getSize().y)/100)*step));
				content.scrollTo(x,y);
			}
		}).set(0);
		
		if( !(ignoreMouse) ){
		// Scroll the content element when the mousewheel is used within the
		// content or the scrollbar element.
				$$(content, scrollbar).addEvent('mousewheel', function(e){
					e = new Event(e).stop();
					var step = slider.step - e.wheel * 2;
					slider.set(step);
				});
		}
		
		// Stops the handle dragging process when the mouse leaves the document body.
		$(document.body).addEvent('mouseleave',function(){slider.drag.stop()});
}else {

	scrollbar.fade(0);

}
}
	
	window.addEvent('domready',function(){
										
										
	var customTips = $$('.tooltip');

var toolTips = new Tips(customTips, {
	//this will set how long before 
	//the tooltip will wait to show up
	//when you mouseover the element
	//in milliseconds
	showDelay: 50,    //default is 100
	
	//this is how long the tooltip
	//will delay bofore hiding
	//when you leave
	hideDelay: 50,   //default is 100
	
	//this will add a wrapper div 
	//with the following class to your tooltips
	//this lets you have different styles of tooltips
	//on the same page
	className: 'bocata', //default is null
	
	//this sets the x and y offets
	offsets: {
		'x': 16,       //default is 16
		'y': 16        //default is 16
	},
	
	//this determines whether the tooltip
	//remains staitionary or follows your cursor
	//true makes it stationary
 	fixed: false,      //default is false
	
	//if you call the functions outside of the options
	//then it may "flash" a bit on transitions
	//much smoother if you leave them in here
	onShow: function(toolTipElement){
	    //passes the tooltip element
		//you can fade in to full opacity
		//or leave them a little transparent
    	toolTipElement.fade(.9);
		$('show').highlight('#FFF504');
	},
	onHide: function(toolTipElement){
    	toolTipElement.fade(0);
		$('hide').highlight('#FFF504');
	}
});
										
										
	

		if ($('carruselcontenido')) {
		// PESTAÑAS PRINCIPALES
			var Videos = new noobSlide({
				box: $('carruselcontenido'),
				items: $$('#carruselcontenido div'),
				size: 723,
				handles: $$('#menuprincipal li a'),
				onWalk: function(currentItem,currentHandle){
				//	$('info4').set('html',currentItem.getFirst().innerHTML);
					this.handles.removeClass('opcionactiva');
					currentHandle.addClass('opcionactiva');
				}
			});
		}


		
		


	if ($('noticiasscroll1')) {
		// SCROLLBAR
		
		// -- first example, vertical scrollbar --
				makeScrollbarB( $('noticiasscroll1'), $('scrollbar1'), $('handle1') );
				makeScrollbarB( $('noticiasscroll2'), $('scrollbar2'), $('handle2') );
				makeScrollbarB( $('noticiasscroll3'), $('scrollbar3'), $('handle3') );
				makeScrollbarB( $('noticiasscroll4'), $('scrollbar4'), $('handle4') );
				// -- second example, horizontal scrollbar --
				//makeScrollbar( $('content2'), $('scrollbar2'), $('handle2'), true );
				// -- third example, horizontal and vertical scrollbars
				//makeScrollbar( $('content3'), $('scrollbar3'), $('handle3'), false );
				//makeScrollbar( $('content3'), $('scrollbar4'), $('handle4'), true, true );
	};
	

	});
	
	
	
			
	
	
	
	
	
