 $(document).ready(function(){
 
	$("a.scrollBtn").click(function() { 
		//find location by the last class of the button
		var c = $(this).attr('class').split(' ').slice(-1); 
		//Set window location
		window.location.hash = "#"+c;
		//reScroll to window location
		reScroll();
	});
	
	//Scroll on page load if bookmarklet exists
	reScroll();

});

function reScroll()
{
var hash = window.location.hash;
	if(hash != ""){
		var item = "";
		if(hash ==  "#top" )
		{
			item = "0px";
		}
		else if(hash ==  "#bottom" )
		{
			item = "max";
		}
		else
		{
			item = $('div.'+hash.replace("#",""));
		}
		if(item != null)
		{
			$.scrollTo(item,1000, {axis:'y',easing:'swing'});		
		}
	}
}

    function initMenu() {
    $('#menu ul').hide();
    $('#menu ul:first').show();
    $('#menu li a').click(
    function() {
    var checkElement = $(this).next();
    if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
    return false;
    }
   if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
$('#menu ul:visible').slideUp('medium');
checkElement.slideDown('medium');
  return false;
  }
   }
   );
  }
   $(document).ready(function() {initMenu();});



