$(function(){
    //Get our elements for faster access and set overlay width
    var div = $('div.sc_menu'),
                 ul = $('ul.sc_menu'),
                 // unordered list's left margin
                 ulPadding = 15;

    //Get menu width
    var divWidth = div.width();

    //Remove scrollbars
    div.css({overflow: 'hidden'});

    //Find last image container
    var lastLi = ul.find('li:last-child');

    //When user move mouse over menu
    div.mousemove(function(e){

      //As images are loaded ul width increases,
      //so we recalculate it each time
      var ulWidth = lastLi[0].offsetLeft + lastLi.outerWidth() + ulPadding;

      var left = (e.pageX - div.offset().left) * (ulWidth-divWidth) / divWidth;
      div.scrollLeft(left);
    });
});
/*Revolving wheel HTML5 javascript
var surface;
var wheel;
var angle=0;


function init() {
	surface=document.getElementById("myCanvas");
	if (surface.getContext) {
		wheel= new Image();
		wheel.onload=loadingComplete;
		wheel.src="wheel.png";
	}
}

function loadingComplete() {
	var int=window.setInterval("loop()",60);/*setInterval(loop, 60);
	setTimeout("endLoop()", 2000);
}

function loop() {
		var surfaceContext=surface.getContext('2d');
	 	surfaceContext.fillStyle = "rgb(255,255,255)";
	    surfaceContext.fillRect(0, 0, surface.width, surface.height);
	    // Save the current context
	    surfaceContext.save();
	    // Translate to the center point of our image
	    surfaceContext.translate(wheel.width * 0.5, wheel.height * 0.5);
	    // Perform the rotation
	    surfaceContext.rotate(DegToRad(angle));
	    // Translate back to the top left of our image
	    surfaceContext.translate(-wheel.width * 0.5, -wheel.height * 0.5);
	    // Finally we draw the image
	    surfaceContext.drawImage(wheel, 0, 0);
	    // And restore the context ready for the next loop
	    surfaceContext.restore();
		
	    // Increment our rotation angle
	    angle++;
}

function DegToRad(d) {
	    // Converts degrees to radians
	    return d * 0.0174532925199432957;
}
function endLoop() {
	window.clearInterval(int);
}*/
