	function mainmenu(){
	$("#nav ul").css({display: "none"}); // Opera Fix
	$("#nav li").hover(function(){
	$(this).find('ul:first:hidden').slideDown(200);
	},function(){
	$(this).find('ul:first').slideUp(200);
	});
	}

	$(document).ready(function(){
		mainmenu();
		var arr = window.location.href.split('#');
		hash = arr[1];
		if (hash!="") {	goto("."+hash);	}
	});

function scrollme(divid) {
$(function(){
    //Get our elements for faster access and set overlay width
	var mydiv = 'div.' + divid;
	var myul = 'ul.' + divid
    var div = $(mydiv),
                 ul = $(myul),
                 // unordered list's left margin
                 ulPadding = 40;

    //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);
    });
});
}

function goto (pageid) {
  $(".gal_menu").slideUp('slow');
  $(pageid).slideDown('slow');
  scrollme (pageid);
}

function closeall () {
  $(".gal_menu").slideUp('slow');
}
