jQuery(document).ready(function() {
  function filterPath(string) {
  return string
 .replace(/^\//,'')
 .replace(/(index|default).[a-zA-Z]{3,4}jQuery/,'')
 .replace(/\/jQuery/,'');
  }
  var locationPath = filterPath(location.pathname);
  var scrollElem = scrollableElement('html', 'body');
  jQuery('a[href*=#],area[href*=#]:not([href*=#tab01]):not([href*=#tab02]):not([href*=#tab03]):not([href*=#tab04]):not([href*=#tab05])').each(function() {
 var thisPath = filterPath(this.pathname) || locationPath;
 if (  locationPath == thisPath
 && (location.hostname == this.hostname || !this.hostname)
 && this.hash.replace(/#/,'') ) {
   var jQuerytarget = jQuery(this.hash), target = this.hash;
   if (target) {
  var targetOffset = jQuerytarget.offset().top;
  jQuery(this).click(function(event) {
    event.preventDefault();
    jQuery(scrollElem).animate({scrollTop: targetOffset}, 400, function() {
   location.hash = target;
    });
  });
   }
 }
  });
  // use the first element that is "scrollable"
  function scrollableElement(els) {
 for (var i = 0, argLength = arguments.length; i <argLength; i++) {
   var el = arguments[i],
    jQueryscrollElement = jQuery(el);
   if (jQueryscrollElement.scrollTop()> 0) {
  return el;
   } else {
  jQueryscrollElement.scrollTop(1);
  var isScrollable = jQueryscrollElement.scrollTop()> 0;
  jQueryscrollElement.scrollTop(0);
  if (isScrollable) {
    return el;
  }
   }
 }
 return [];
  }
});
