// JavaScript Document

// ---------- start of jQuery document.ready() ----------
var jQ = jQuery.noConflict();
  
jQ(document).ready(function() {   
  
  //anchors
  function filterPath(string) {
	return string
	  .replace(/^\//,'')
	  .replace(/(index|default).[a-zA-Z]{3,4}$/,'')
	  .replace(/\/$/,'');
  }
  
  jQ('a[href*=#]').each(function() {
	if ( filterPath(location.pathname) == filterPath(this.pathname)
	&& location.hostname == this.hostname
	&& this.hash.replace(/#/,'') ) {
	  var $targetId = jQ(this.hash), $targetAnchor = jQ('[name=' + this.hash.slice(1) +']');
	  var $target = $targetId.length ? $targetId : $targetAnchor.length ? $targetAnchor : false;
	   if ($target) {
		 var targetOffset = $target.offset().top;
		 jQ(this).click(function() {
		   jQ('html, body').animate({scrollTop: targetOffset}, 800);
		   return false;
		 });		 
	  }
	}
  });
  
  
});


// ---------- end of jQuery document.ready() ----------
