// JavaScript Document
var topYloc = null;

jQuery(window).scroll(function () { 
	var scrollTop = jQuery(document).scrollTop();
	scrollTop = parseInt(scrollTop);
	
	var offset = topYloc+scrollTop+"px";  
	jQuery("#menuVert").animate({top:offset},{duration:500,queue:false});
});

jQuery(document).ready(function(){
						   
	//back to top scroll function. Any link with a hash (#) will scroll to that id on the page
	jQuery('a[href*=#]').click(function() {
		if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
			var $target = jQuery(this.hash);
			$target = $target.length && $target || jQuery('[name=' + this.hash.slice(1) +']');
			if ($target.length) {
				var targetOffset = $target.offset().top;
				targetOffset = targetOffset - 35;
				jQuery('html,body').animate({scrollTop: targetOffset}, 500);
				return false;
			}
		}
	});
	
	topYloc = parseInt(jQuery("#menuVert").css("top").substring(0,jQuery("#menuVert").css("top").indexOf("px")));

});
