/* Copyright 2008 Paul Bennett - http://paulicio.us
 * Scroller.js
 * Captures mouse wheel events and runs the ScrollSmoothly
 * function based on their output.
 * Aims to aid usability by allowing the user to scroll the 
 * page horizontally smoothly using only their mousewheel.
 * Mousewheel event capture by Adomas Paltanavičius at http://adomas.org/
 */
 
 /*
 * Edited to remove buggy 'smooth scroll' effect and simply scroll - so added 'justScroll' function instead
 * by Cameron Olivier
 */

function handle(delta) {
        if (delta <0) justScroll('right');
        else if (delta >0) justScroll('left');
        else ;
}
 
function wheel(event){
        var delta = 0;
        if (!event) 
				event = window.event;
        if (event.wheelDelta) {
                delta = event.wheelDelta/120;
                if (window.opera)
                        delta = -delta;
        } else if (event.detail) {
                delta = -event.detail/3;
        }
        if (delta)
                handle(delta);
        if (event.preventDefault)
                event.preventDefault();
	event.returnValue = false;
}

function justScroll(direction) {
	if(direction == 'right') 	
		window.scrollBy(120,0);
	else window.scrollBy(-120,0);
	return;
}

/* Initialization code. */
$wViewport = $(window).width();
$wDocument = $('#page').width();
if ($wDocument > $wViewport) {
if (window.addEventListener)
        window.addEventListener('DOMMouseScroll', wheel, false);
window.onmousewheel = document.onmousewheel = wheel;
}
 
