// Easingの追加
jQuery.easing.quart = function (x, t, b, c, d) {
	return -c * ((t=t/d-1)*t*t*t - 1) + b;
};

/*-------------------------------------
 ページ読み込み中
-------------------------------------*/
jQuery(document).ready(function(){
	//
	// <a href="#***">の場合、スクロール処理を追加
	//
	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;
				jQuery('html,body').animate({ scrollTop: targetOffset }, 1200, 'quart');
				return false;
			}
		}
	});

	//
	// <a rel="blank">の時は別ウィンドウで表示させる
	//
	jQuery("a").each(function(){
		if(jQuery(this).attr("rel") == "blank") {
			jQuery(this).attr("target", "_blank");
		}
	});

	//
	// id = trackbackurl に処理を追加
	//
	jQuery("#trackbackurl").bind("click", function(){
  	jQuery(this).get(0).select();
	});

});


//
// 顔文字挿入Script作成
//
function output_script() {
var w = 400;
var id = "";
if(jQuery("#parts-w").val().length > 0) w = parseInt(jQuery("#parts-w").val());
if(jQuery("#parts-id").val().length > 0) id = jQuery("#parts-id").val();

if(w.length == 0 || w == 0) w = 400;
if(id.length == 0) id = "comment";

var sc = '<div id="tico-kaomoji-frame"></div><span id="ruler" style="position: absolute; visibility: hidden;"></span><script type="text/javascript" src="http://tico-jpn.com/kaomoji_edit/tico-kaomoji-edit.js?w=' + w + '&cm=' + id + '"></script>';
jQuery("#parts-script").text(sc);
}

