window.addEvent('domready', function(){
	/**********************************************************************
	* CODE FOR THE QUICK LINKS DROP DOWN
	***********************************************************************/
	$('quickLinksNav').addEvent('mouseover', function(ev){
		new Event(ev).stop();
		$('quickLinkDrop').setStyle('display', 'block');
	});
	$('quickLinksNav').addEvent('click', function(ev){
		new Event(ev).stop();
	});
	$('quickLinks').addEvent('mouseleave', function(ev){
			$('quickLinkDrop').setStyle('display', 'none');
	});
	
	/**********************************************************************
	* CODE TO PLACE BACK/FORWARD BUTTONS
	***********************************************************************/
	var h = $('contentContainer').getCoordinates()['height'];
	$('circleNav').setStyles({
		top: h - 40, 
		display: 'block'
	});
	
	/**********************************************************************
	* CODE FOR THE TABS
	***********************************************************************/
	var fader = new PageFader('mybook', {
		rotateOnStart: true,
		rotateSpeed: 6500,
		onPageChange: function(){
			$$('#tabs li a').each(function(el, i){
				// highlight the current tab by giving it the current class,
				// and remove the current class from all of the other tabs.
				(i != this.getCurrentPage()-1) ? el.removeClass('current') : el.addClass('current');
			}, this);
		}
	});
	
	// setup the next button.
	$('lnk_next').addEvent('click', function(ev){
		new Event(ev).stop();
		fader.gotoNext();
	});
	
	// setup the previous button
	$('lnk_prev').addEvent('click', function(ev){
		new Event(ev).stop();
		fader.gotoPrevious();
	});
	
	// set up the event on each tab to switch to the tab
	$$('#tabs li a').each(function(el, i){
		el.addEvent('click', function(ev){
			new Event(ev).stop();
			fader.gotoPage(i);
		});
	});
});

