﻿var sbm_url = location.href;
var sbm_title = document.title;
var sbm_ua = navigator.userAgent;

function putSBM (lang) {
	if(sbm_ua.match(/MSIE/) || sbm_ua.match(/Firefox/)){
		document.write('<li class="bookmark"><a href="#" onClick="addFavorite(\'' + lang + '\'); return false;" title="Bookmark This page">Bookmark This page</a></li>');
	}else{
		document.write('<li class="bookmark"><span>Bookmark</span></li>');
	}
	
	if(lang == "jp"){
		// はてブ
		document.write('<li class="hatena"><a href="http://b.hatena.ne.jp/append?' + encodeURIComponent(sbm_url) + '" target="_blank" title="はてなブックマーク に追加">はてなブックマーク に追加</a></li>');
		// Google Bookmarks
		document.write('<li class="google"><a href="http://www.google.com/bookmarks/mark?op=edit&bkmk=' + encodeURIComponent(sbm_url) + '&title=' + encodeURIComponent(sbm_title) + '" target="_blank" title="Google Bookmarksに追加">Google Bookmarksに追加</a></li>');
		// Yahoo!ブックマーク
		document.write('<li class="yahoo"><a href="http://bookmarks.yahoo.co.jp/bookmarklet/showpopup?t=' + encodeURIComponent(sbm_title) + '&u=' + encodeURIComponent(sbm_url) + '&opener=bm&ei=UTF-8" target="_blank" title="Yahoo!ブックマークに登録">Yahoo!ブックマークに登録</a></li>');
		// livedoorクリップ
		document.write('<li class="livedoor"><a href="http://clip.livedoor.com/clip/add?link=' + encodeURIComponent(sbm_url) + '&title=' + encodeURIComponent(sbm_title) + '" target="_blank" title="livedoorクリップに追加">livedoorクリップに追加</a></li>');
		// FC2
		//document.write('<li><a href="http://bookmark.fc2.com/user/post?url=' + encodeURIComponent(sbm_url) + '&title=' + encodeURIComponent(sbm_title) + '" target="_blank" class="fc2" title="FC2 Bookmarkに追加">FC2 Bookmarkに追加</a></li>');
		// del.icio.us
		document.write('<li class="delicious"><a href="http://del.icio.us/post?url=' + encodeURIComponent(sbm_url) + '&title=' + encodeURIComponent(sbm_title) + '" target="_blank" title="delicious に追加">delicious に追加</a></li>');
		
		// facebook
		document.write('<li class="facebook"><a href="http://www.facebook.com/share.php?u=' + encodeURIComponent(sbm_url) + '&t=' + encodeURIComponent(sbm_title) + '" target="_blank" title="facebook に投稿">facebook に投稿</a></li>');
		
		// Google +1
		if(!sbm_ua.match(/Firefox/))	document.write('<li class="plusone"><span id="plusone"></span></li>');
		else	document.write('<li class="plusone" style="margin-top:2px;"><span id="plusone"></span></li>');
		gapi.plusone.render(document.getElementById('plusone'),{'size':'small','count':'false'});
		
		// twitter
		//document.write('<li><a href="http://twitter.com/home?status=' + encodeURIComponent(sbm_title) + '%20' + encodeURIComponent(sbm_url) + '" target="_blank" class="twitter" title="twitterでつぶやく">twitterでつぶやく</a></li>');
		document.write('<li class="twitter"><a href="http://twitter.com/share?url=' + encodeURIComponent(sbm_url) + '&text=' + encodeURIComponent(sbm_title) + '&via=cave_world" target="_blank" title="twitterでつぶやく">twitterでつぶやく</a></li>');
		
	
	}else{
		// Google Bookmarks
		document.write('<li class="google"><a href="http://www.google.com/bookmarks/mark?op=edit&bkmk=' + encodeURIComponent(sbm_url) + '&title=' + encodeURIComponent(sbm_title) + '" target="_blank" title="Google Bookmarks">Google Bookmarks</a></li>');
		// del.icio.us
		document.write('<li class="delicious"><a href="http://del.icio.us/post?url=' + encodeURIComponent(sbm_url) + '&title=' + encodeURIComponent(sbm_title) + '" target="_blank" title="delicious">delicious</a></li>');
		
		// digg
		document.write('<li class="digg"><a href="http://digg.com/submit?phase=2&url=' + encodeURIComponent(sbm_url) + '&title=' + encodeURIComponent(sbm_title) + '" target="_blank" title="digg">digg</a></li>');
		
		// facebook
		document.write('<li class="facebook"><a href="http://www.facebook.com/share.php?u=' + encodeURIComponent(sbm_url) + '&t=' + encodeURIComponent(sbm_title) + '" target="_blank" title="facebook">facebook</a></li>');
		
		// Google +1
		if(!sbm_ua.match(/Firefox/))	document.write('<li class="plusone"><span id="plusone"></span></li>');
		else	document.write('<li class="plusone" style="margin-top:2px;"><span id="plusone"></span></li>');
		gapi.plusone.render(document.getElementById('plusone'),{'size':'small','count':'false'});
		
		// twitter
		//document.write('<li><a href="http://twitter.com/home?status=' + encodeURIComponent(sbm_title) + '%20' + encodeURIComponent(sbm_url) + '" target="_blank" class="twitter" title="twitter">twitter</a></li>');
		document.write('<li class="twitter"><a href="http://twitter.com/share?url=' + encodeURIComponent(sbm_url) + '&text=' + encodeURIComponent(sbm_title) + '&via=cave_world_en" target="_blank" title="Tweet">Tweet</a></li>');
	}
	
	
}


function putLIKE (s) {
	if(s == "jp"){
		document.write('<iframe src="http://www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2FCAVECoLtdJP&amp;width=908&amp;connections=0&amp;stream=false&amp;header=false&amp;height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:908px; height:80px;background:#ffffff;-webkit-border-radius:2px;border:1px solid #AAAAAA;border-top:1px solid #315C99;" allowTransparency="true"></iframe>');
	}else{
		if(!s){
			document.write('<iframe src="http://www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2FCAVECoLtd&amp;width=910&amp;connections=12&amp;stream=false&amp;header=false&amp;height=200" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:910px; height:200px;background:#ffffff;-webkit-border-radius:2px;" allowTransparency="true"></iframe>');
		}else if(s == "top"){
			document.write('<iframe src="http://www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2FCAVECoLtd&amp;width=912&amp;connections=12&amp;stream=false&amp;header=false&amp;height=200" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:912px; height:200px;background:#ffffff;-webkit-border-radius:2px;" allowTransparency="true"></iframe>');
		}
	}
}

function putLIKE2 (s) {
	if(!s){
		document.write('<iframe src="http://www.facebook.com/plugins/like.php?href=' + encodeURIComponent(sbm_url) + '&amp;layout=standard&amp;show_faces=false&amp;width=380&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:380px; height:35px;" allowTransparency="true"></iframe>');
	}else if(s == "top"){
		document.write('<iframe src="http://www.facebook.com/plugins/like.php?href=' + encodeURIComponent(sbm_url) + '&amp;layout=standard&amp;show_faces=false&amp;width=400&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:400px; height:35px;" allowTransparency="true"></iframe>');
	}else{
		document.write('<iframe src="http://www.facebook.com/plugins/like.php?href=' + encodeURIComponent(sbm_url) + '&amp;layout=button_count&amp;show_faces=false&amp;width=100&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100px; height:21px;" allowTransparency="true"></iframe>');
	}
}

function addFavorite(lang) {
	if(lang == "jp"){
		if(sbm_ua.indexOf("MSIE") > -1){
			window.external.addFavorite(sbm_url,sbm_title);
		}else if(sbm_ua.indexOf("Firefox") > -1){
			window.sidebar.addPanel(sbm_title,sbm_url,"");
		}
	}else{
		if(sbm_ua.indexOf("MSIE") > -1){
			window.external.addFavorite(sbm_url,sbm_title);
		}else if(sbm_ua.indexOf("Firefox") > -1){
			window.sidebar.addPanel(sbm_title,sbm_url,"");
		}
	}
}


function putSbmJpX() {
	document.write('<table cellpadding="3" cellspacing="0" height="25" border="0"><tr><td>このページを共有</td>');
	document.write('<td><a href="http://b.hatena.ne.jp/entry/' + sbm_url + '" class="hatena-bookmark-button" data-hatena-bookmark-title="' + sbm_title + '" data-hatena-bookmark-layout="simple" 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></td>');
	document.write('<td><a href="http://twitter.com/share" class="twitter-share-button" data-url="' + sbm_url + '" data-text="' + sbm_title + '" data-count="none" data-lang="ja">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></td>');
	document.write('<td><a name="fb_share" type="button">シェア</a><script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script></td>');
	document.write('<td><a href="http://mixi.jp/share.pl" class="mixi-check-button" data-url="' + sbm_url + '" data-key="62d422b469df40153d5e3b312d4ab92e6e67bd80" data-button="button-5">Check</a><script type="text/javascript" src="http://static.mixi.jp/js/share.js"></script></td>');
	document.write('<td><iframe src="http://share.gree.jp/share?url=' + encodeURIComponent(sbm_url) + '&type=0&height=23" scrolling="no" frameborder="0" marginwidth="0" marginheight="0" style="border:none; overflow:hidden; width:76px; height:23px;" allowTransparency="true"></iframe></td>');
	document.write('</tr></table>');			
}

function putSbmJpX2() {
	$("#share").html("<div class=\"share\">"+
	"<table cellpadding=\"3\" cellspacing=\"0\" height=\"25\" border=\"0\"><tr>"+
	"<td>このページを共有</td>"+
	"<td><a href=\"http://b.hatena.ne.jp/entry/" + encodeURIComponent(sbm_url) + "\" class=\"hatena-bookmark-button\" data-hatena-bookmark-title=\"" + sbm_title + "\" data-hatena-bookmark-layout=\"simple\" 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></td>"+
	"<td><a href=\"http://twitter.com/share\" class=\"twitter-share-button\" data-count=\"none\" data-lang=\"ja\">Tweet</a><script type=\"text/javascript\" src=\"http://platform.twitter.com/widgets.js\"></script></td>"+
	"<td><a name=\"fb_share\" type=\"button\">シェア</a><script src=\"http://static.ak.fbcdn.net/connect.php/js/FB.Share\" type=\"text/javascript\"></script></td>"+
	"<td><a href=\"http://mixi.jp/share.pl\" class=\"mixi-check-button\" data-url=\"" + sbm_url + "\" data-key=\"62d422b469df40153d5e3b312d4ab92e6e67bd80\" data-button=\"button-5\">Check</a><script type=\"text/javascript\" src=\"http://static.mixi.jp/js/share.js\"></script></td><td><iframe src=\"http://share.gree.jp/share?url=" + encodeURIComponent(sbm_url) + "&type=0&height=23\" scrolling=\"no\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" style=\"border:none; overflow:hidden; width:80px; height:23px;\" allowTransparency=\"true\"></iframe></td>"+
	"<td><div id=\"plusone\"></div><script>gapi.plusone.render(document.getElementById('plusone'),{'size':'medium','count':'false'});</script></td>"+
	"</tr></table></div><div class=\"clear\"></div>");
}



function putSbmJp() {
$("#share").html("<div class=\"share\">"+
"<table cellpadding=\"3\" cellspacing=\"0\" height=\"25\" border=\"0\"><tr>"+
"<td>このページを共有</td>"+

"<td><a href=\"http://b.hatena.ne.jp/entry/" + encodeURIComponent(sbm_url) + "\" class=\"hatena-bookmark-button\" 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;\" />"+
"<script type=\"text/javascript\" src=\"http://b.st-hatena.com/js/bookmark_button.js\" charset=\"utf-8\" async=\"async\"></script></td>"+

"<td><a name=\"fb_share\" type=\"button\" share_url=\"" + encodeURIComponent(sbm_url) + "\">シェア</a>"+
"<script src=\"http://static.ak.fbcdn.net/connect.php/js/FB.Share\" type=\"text/javascript\"></script></td>"+

"<td><iframe src=\"//www.facebook.com/plugins/like.php?locale=ja_JP&href=" + encodeURIComponent(sbm_url) + "&amp;send=false&amp;layout=button_count&amp;width=120&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font=arial&amp;height=21\" scrolling=\"no\" frameborder=\"0\" style=\"border:none; overflow:hidden; width:120px; height:21px;\" allowTransparency=\"true\"></iframe></td>"+

"<td><div data-plugins-type=\"mixi-favorite\" data-service-key=\"62d422b469df40153d5e3b312d4ab92e6e67bd80\" data-show-comment=\"true\" data-show-count=\"true\" data-show-faces=\"false\" data-size=\"medium\" data-width=\"120\"></div>"+
"<script type=\"text/javascript\">(function(d) {var s = d.createElement('script'); s.type = 'text/javascript'; s.async = true;s.src = '//static.mixi.jp/js/plugins.js#lang=ja';d.getElementsByTagName('head')[0].appendChild(s);})(document);</script></td>"+

"<td><a href=\"https://twitter.com/share\" class=\"twitter-share-button\" data-via=\"cave_world\" data-lang=\"ja\">ツイート</a>"+
"<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=\"//platform.twitter.com/widgets.js\";fjs.parentNode.insertBefore(js,fjs);}}(document,\"script\",\"twitter-wjs\");</script></td>"+

"<td><div class=\"g-plusone\" data-size=\"medium\"></div>"+
"<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></td>"+
"</tr></table></div><div class=\"clear\"></div>");
}

function putSbmEnX() {
	$("#share").html("<div class=\"share\">"+
	"<table cellpadding=\"3\" cellspacing=\"0\" height=\"25\" border=\"0\"><tr>"+
	"<td>SHARE</td>"+
	"<td><a href=\"http://twitter.com/share\" class=\"twitter-share-button\" data-count=\"none\" data-lang=\"en\">Tweet</a><script type=\"text/javascript\" src=\"http://platform.twitter.com/widgets.js\"></script></td>"+
	"<td><a name=\"fb_share\" type=\"button\">SHARE</a><script src=\"http://static.ak.fbcdn.net/connect.php/js/FB.Share\" type=\"text/javascript\"></script></td>"+
	"<td><div id=\"plusone\"></div><script>gapi.plusone.render(document.getElementById('plusone'),{'size':'medium','count':'false'});</script></td>"+
	"</tr></table></div><div class=\"clear\"></div>");
}


function putSbmEn() {
$("#share").html("<div class=\"share\">"+
"<table cellpadding=\"3\" cellspacing=\"0\" height=\"25\" border=\"0\"><tr>"+
"<td>SHARE</td>"+

"<td><a name=\"fb_share\" type=\"button\" share_url=\"" + encodeURIComponent(sbm_url) + "\">SHARE</a>"+
"<script src=\"http://static.ak.fbcdn.net/connect.php/js/FB.Share\" type=\"text/javascript\"></script></td>"+

"<td><iframe src=\"//www.facebook.com/plugins/like.php?locale=en_US&href=" + encodeURIComponent(sbm_url) + "&amp;send=false&amp;layout=button_count&amp;width=100&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font=arial&amp;height=21\" scrolling=\"no\" frameborder=\"0\" style=\"border:none; overflow:hidden; width:100px; height:21px;\" allowTransparency=\"true\"></iframe></td>"+

"<td><a href=\"https://twitter.com/share\" class=\"twitter-share-button\" data-via=\"cave_world_en\">Tweet</a>"+
"<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=\"//platform.twitter.com/widgets.js\";fjs.parentNode.insertBefore(js,fjs);}}(document,\"script\",\"twitter-wjs\");</script></td>"+

"<td><div class=\"g-plusone\" data-size=\"medium\"></div>"+
"<script type=\"text/javascript\">(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></td>"+

"</tr></table></div><div class=\"clear\"></div>");
}




