$(document).ready(function() {
  $('#categorysubmenu').css('display','none');
  $('.categorymenu .linkcolor').click(function(){
	  $('#categorysubmenu').slideToggle();
	  return false;
  });
  // Notice the use of the each() method to acquire access to each elements attributes
  $('.tooltip').each( function() {
	  $(this).qtip({
          content: $(this).attr('alt'),
          position: {
              corner: {
                 target: 'bottomMiddle',
                 tooltip: 'topMiddle'
              },
              adjust: {
            	 y: 5
              }
           },
          style: {
	          textAlign: 'center',
	          tip: 'topMiddle', // Give it a speech bubble tip with automatic corner detection
	          name: 'dark' // Style it according to the preset 'cream' style
	       }

	  });
  });
  $('.tooltipshare').each( function() {
	  $(this).qtip({
          content: $(this).attr('alt'),
          position: {
              corner: {
                 target: 'rightMiddle',
                 tooltip: 'leftMiddle'
              },
              adjust: {
            	 y: 5
              }
           },
          style: {
	          textAlign: 'center',
	          tip: 'leftMiddle', // Give it a speech bubble tip with automatic corner detection
	          name: 'dark' // Style it according to the preset 'cream' style
	       }

	  });
  });
    $(function(){

        $('a[href*=#]').click(function() {

        if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
            && location.hostname == this.hostname) {

                var $target = $(this.hash);

                $target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');

                if ($target.length) {

                    var targetOffset = $target.offset().top;

                    $('html,body').animate({scrollTop: targetOffset}, 1000);

                    return false;

                }

            }

        });

    });
});
