$(document).ready(function() {
	$.fn.smoothScroll = function(config) {
		var target = this;
		
		config = jQuery.extend({
				hoge: "Default value 1",
				hoge2: "Default value 2"
			},config);

		target.each(function(){
			var href = $(this).attr("href");
			
			
			if(href=='#') {
				$(this).click(function() {
					return false;
				});
				return true;
			}
			
			var hrefAry = href.match(/^([^#]*)#([^#]+)$/,function(whole,$1){ return $1 });
			
			if(hrefAry) {
				var j = $( "#" + hrefAry[2] );
				if(j.size() > 0) {
					
					jQuery.data($(this).get(0), "pos", j.offset().top);
					
					$(this).click(function() {
						
						$('html,body').animate({scrollTop: jQuery.data($(this).get(0), "pos")}, 400);
						return false;
					});
				}
			}
		});
	};
});

$(document).ready(function() {
	$('a[href*=#]').filter(function(){
		return !$(this).parent().parent().parent().is(".cNavTabBox");
	}).smoothScroll();
});

