function printSBM( path , doLink , doActiveClick)
{
    var thisurl = location.href;//document.URL;
    var thisurldir = "";
    var targetPath = "";

    if (doLink == undefined){
	doLink = true;
    }


    //local 用セッティング(localURLの場合、インターネット用に置き換える)
    if (thisurl.indexOf("http") == -1 ){
	thisurl = thisurl.replace(/\\/g,'/');
    }


    //local 用セッティング(localURLの場合、インターネット用に置き換える)
    if(thisurl.indexOf("ocn/public_html") >= 0){
	n=thisurl.indexOf("ocn/public_html") + "ocn/public_html/".length;
	thisurl="http://www2.ocn.ne.jp/~cheerful/"+thisurl.substring(n);
    }
    if(thisurl.indexOf("homepage/edutaiment") >= 0){
	n=thisurl.indexOf("homepage/edutaiment")+ "homepage/edutaiment/".length;
	thisurl="http://edutainment-fun.com/"+thisurl.substring(n);
    }

    if (path.indexOf("http") == -1 ){
	var n = 0;

	//pathが指定されていたら、ディレクトリパスにする。
	if (path.length != 0){
	    n =thisurl.lastIndexOf("/");
	    thisurldir = thisurl.substring(0,n + 1);
	}else{
	    thisurldir = thisurl;
	}

	targetPath = thisurldir + path;
	//alert("base:"+thisurl + "\n dir:"+ thisurldir + "\n target:"+targetPath);
    }else{
	//pathが絶対指定の場合は、その値を使う
	targetPath = path;
    }


    //他サイトから使用されることによるサーバ負荷低減
    if(thisurl.indexOf("//www2.ocn.ne.jp/~cheerful/") == -1 &&  thisurl.indexOf("//edutainment-fun.com/") == -1){
	alert("you are not permissioned."+"\nbase:"+thisurl + "\n dir:"+ thisurldir + "\n target:"+targetPath + "\n path:"+path);
	return;
    }


    //printSMBButton(targetPath,path,doLink);
    //printSNSButton(targetPath,path,doLink);
}


function printSMBButton(targetPath,path,doLink){
    //baseURL;
    //alert(""+thisurldir);

    //0.hatena 1.yahoo 2.livedoor  3.buzzurl  4.tweet  5.delicious  6.fc2
    var dataNames="hatena,yahoo,livedoor,buzzurl,twitter"
	var dataNums="http://b.hatena.ne.jp/entry/image/small/{URL}<@@@>http://num.bookmarks.yahoo.co.jp/image/small/{URL}<@@@>http://image.clip.livedoor.com/counter/small/{URL}<@@@>http://api.buzzurl.jp/api/counter/{URL}<@@@>http://twitter-badges.s3.amazonaws.com/t_mini-a.png<@@@>http://sasata299.com/delicious/[URL]<@@@>http://bookmark.fc2.com/image/users/{encode(URL)}";
    var dataHrefs="http://b.hatena.ne.jp/entry/{URL}<@@@>http://bookmarks.yahoo.co.jp/url?url={encode(URL)}<@@@>http://clip.livedoor.com/page/{URL}<@@@>http://api.buzzurl.jp/entry/{URL}<@@@>http://twitter.com/home?status=RT {encode(TITLE)} {encode(URL)}<@@@>http://del.icio.us/delicious/post?url={encode(URL)}<@@@>";
    var dataImageTitles="hatena,yahoo,livedoor,buzzurl,この記事についてTwitterでつぶやく";

    //<@@@><g:plusone size='small'></g:plusone><script type='text/javascript'> window.___gcfg = {lang: 'ja'};  (function() {var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;    po.src = 'https://apis.google.com/js/plusone.js';    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);  })();</script>
    //hatena http://b.hatena.ne.jp/entry/image/small/{URL}  or http://b.hatena.ne.jp/bc/ 全体
    //http://bookmarks.yahoo.co.jp/bookmarklet/showpopup?t={encode(URL)} or  http://bookmarks.yahoo.co.jp/url?url=
    //FC2、2011年2月16日をもち、サービス提供を終
    //delicious <img src='http://del.icio.us/feeds/img/savedcount/{URLのMD5ハッシュ}?aggregate' alt='ブックマーク数' />


    var bmNames = dataNames.split(",");
    var bmPaths = dataNums.split("<@@@>");
    var bmPathHrefs = dataHrefs.split("<@@@>");
    var bmImageTitles = dataImageTitles.split(",");
    var i = 0;
    var max = bmPaths.length;
    max = max-1;
    var sbm ="none";
    var sbmHref ="none";

    if (path.indexOf("http") >= 0){
	bmPaths[0]="http://b.hatena.ne.jp/bc/{URL}";
    }

    
    //for
    for (i = 0; i < max; i++) {
	//deliciousを除く？
	if (i >= 5){
	    continue;
	}

	//replace
	sbm = bmPaths[i].replace(/\{URL\}/, targetPath);
	sbm =sbm.replace(/#/g,'%23');
	sbm = sbm.replace(/\{encode\(URL\)\}/, encodeURIComponent(targetPath));
	//sbm = sbm.replace(/\{md5\(URL\)\}/, CybozuLabs.MD5.calc(targetPath));

	sbmHref = bmPathHrefs[i].replace(/\{URL\}/, targetPath);
	sbmHref = sbmHref.replace(/#/g,'%23');
	sbmHref = sbmHref.replace(/\{encode\(URL\)\}/, encodeURIComponent(targetPath));
	if (path.length == 0){
	    sbmHref = sbmHref.replace(/\{encode\(TITLE\)\}/, encodeURIComponent(""));
	}else{
	    sbmHref = sbmHref.replace(/\{encode\(TITLE\)\}/, encodeURIComponent(document.title));
	}
	    

	if(bmNames[i].indexOf("twitter") >= 0 && path.length > 0){
	}else{
	    if (sbmHref.length > 3 && doLink == true){
		//alert ("sbmHref:"+sbmHref+"  :"+doLink)
		document.write("<a href='"+sbmHref+"'><img src='"+sbm+"' title='"+bmImageTitles[i]+"'/></a>");
	    }else{
		document.write("<img src='"+sbm+"' alt='"+bmNames[i]+"'/>");
		//document.write(""+i+":"+sbm+" , ");
	    }
	}

    }
    //document.write(targetPath);

}



function printSNSButton(targetPath, path, doLink){
    /*
<td class="text-title" align="left" width=""valign="top">

    hatena
<a href="http://b.hatena.ne.jp/entry/{URL}" class="hatena-bookmark-button" data-hatena-bookmark-title="{TITLE}" data-hatena-bookmark-layout="standard" title="このエントリーをはてなブックマークに追加"><img src="http://b.st-hatena.com/images/entry-button/button-only.gif" alt="このエントリーをはてなブックマークに追加" width="20" height="20" style="border: none;" /></a><script type="text/javascript" src="http://b.st-hatena.com/js/bookmark_button.js" charset="utf-8" async="async"></script>

facebook
<iframe src="http://www.facebook.com/plugins/like.php?{URL}&amp;layout=button_count&amp;show_faces=false&amp;width=120&amp;action=like&amp;font&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:120px; height:21px;" allowTransparency="true"></iframe>


twitter
<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" data-via="venture_now" data-lang="ja">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
*/

    var snssign ="";
    var i = 0;
    var n = 0;
    var sns = new Array(1);

    if (path.length == 0){
	sns[i] = "<iframe src=\"http://www.facebook.com/plugins/like.php?href={encode(URL)}&amp;layout=button_count&amp;show_faces=true&width=120&action=like&amp;font&colorscheme=light&height=21\" scrolling=\"no\" frameborder=\"0\" style=\"border:none; overflow:hidden; width:100px; height:21px;\" allowTransparency=\"true\"></iframe>";
	i = i+1;
	n = n + 1;

	/* mixi */
	/*
	sns[i] = "<a href=\"http://mixi.jp/share.pl\" class=\"mixi-check-button\" data-key=\"チェックキー\" data-button=\"button-1\">Check</a>
<script type=\"text/javascript\" src=\"http://static.mixi.jp/js/share.js\"></script>";
	i = i+1;
	n = n + 1;
*/
	/* gree */
	/*
	sns[i] = "<iframe src=\"http://share.gree.jp/share?url={encode(URL)}&type=0&height=20\" scrolling=\"no\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" style=\"border:none; overflow:hidden; width:100px; height:20px;\" allowTransparency=\"true\"></iframe>";
	i = i+1;
	n = n + 1;
	*/

	/* evernote */
	sns[i] = "<script type=\"text/javascript\" src=\"http://static.evernote.com/noteit.js\"></script><a href=\"#\" onclick=\"Evernote.doClip({}); return false;\"><img src=\"http://static.evernote.com/article-clipper.png\" alt=\"Clip to Evernote\" /></a>";
	i = i+1;
	n = n + 1;

	/* あとで */
	sns[i] = "<a href='http://atode.cc/' onclick='javascript:(function(){var s=document.createElement(\"scr\"+\"ipt\");s.charset=\"UTF-8\";s.language=\"javascr\"+\"ipt\";s.type=\"text/javascr\"+\"ipt\";var d=new Date;s.src=\"http://atode.cc/bjs.php?d=\"+d.getMilliseconds();document.body.appendChild(s)})();return false;'><img src=\"http://atode.cc/img/iconsja.gif\" alt=\"あとで読む\" border=\"0\" align=\"absmiddle\" width=\"16\" height=\"16\"></a>";
	i = i+1;
	n = n + 1;
    }

    for (i = 0 ; i < n ; i++){

	snssign = sns[i].replace(/\{URL\}/, targetPath);
	snssign = snssign.replace(/#/g,'%23');
	snssign = snssign.replace(/\{encode\(URL\)\}/, encodeURIComponent(targetPath));
	if (path.length == 0){
	    snssign = snssign.replace(/\{encode\(TITLE\)\}/, encodeURIComponent(""));
	}else{
	    snssign = snssign.replace(/\{encode\(TITLE\)\}/, encodeURIComponent(document.title));
	}

	document.write(snssign);
    }



}


