/* 文字コードはUTF-8 */
sbm = function(order){
	this.mixi_check_key = '2828d378918a974deb4cb9fcb89d2e432f98ac19';
	this.order = order;
	this.title = (typeof(arguments[1]) != 'undefined' && arguments[1] ? arguments[1] : document.title);
	this.link = (typeof(arguments[2]) != 'undefined' && arguments[2] ? arguments[2] : document.URL.replace(/\-[0-9]+\.html/, '.html').replace(/\/i\//, '/'));

	this.items = new Array();
	this.items['twitter'] = '<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script><a href="http://twitter.com/share" class="twitter-share-button" data-url="' + this.link + '" data-text="' + this.title + '" data-count="horizontal" data-lang="ja">Tweet</a>';
	this.items['facebook'] = '<div class="fb-like" data-href="' + encodeURIComponent(this.link) + '" data-send="false" data-layout="button_count" data-width="100" data-show-faces="false"></div>';
	this.items['facebookshare'] = '<a name="fb_share" type="button" href="http://www.facebook.com/sharer.php?u=' + encodeURIComponent(this.link) + '&t=' + encodeURIComponent(this.title) + '">シェア</a><script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script>';
	this.items['evernoteclip'] = '<script type="text/javascript" src="http://static.evernote.com/noteit.js"></script><a href="#" onclick="Evernote.doClip({styling:\'full\',url:\'' + this.link + '\',title:\'' + this.title + '\',header: \'<h1>' + this.title + '</h1>\',contentId:\'evernoteclip\'}); return false;"><img src="http://static.evernote.com/article-clipper-jp.png" alt="Clip to Evernote" /></a>';
	this.items['mixicheck'] = '<a href="http://mixi.jp/share.pl" class="mixi-check-button" data-key="' + this.mixi_check_key + '" data-url="' + this.link + '" data-button="button-1">Check</a><script type="text/javascript" src="http://static.mixi.jp/js/share.js"></script>';
	this.items['mixilike'] = '<iframe src="http://plugins.mixi.jp/favorite.pl?href=' + encodeURIComponent(this.link) + '&service_key=' + this.mixi_check_key + '&show_faces=false&width=100" scrolling="no" frameborder="0" allowTransparency="true" style="border:0; overflow:hidden; width:80px; height:21px;"></iframe>';
	this.items['googleplusone'] = '<g:plusone size="medium"></g:plusone>';
	this.items['hatenabookmark'] = '<a href="http://b.hatena.ne.jp/entry/' + encodeURIComponent(this.link) + '" 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;" /></a><script type="text/javascript" src="http://b.st-hatena.com/js/bookmark_button.js" charset="utf-8" async="async"></script>';
	this.items['greelike'] = '<iframe src="http://share.gree.jp/share?url=' + encodeURIComponent(this.link) + '&type=0&height=20" scrolling="no" frameborder="0" marginwidth="0" marginheight="0" style="border:none; overflow:hidden; width:80px; height:20px;" allowTransparency="true"></iframe>';

	this._getLinks = function(){
		var html = '<ul class="sbm_list clearfix">';
		for(var i = 0; i < this.order.length; i++){
			var id = this.order[i];
			if(typeof(this.items[id]) != 'undefined'){
				var item = this.items[id];
				html += '<li class="' + id + '">' + item + '</li>';
			}
		}
		html += '</ul>';
		return html;
	}
	this.outputLinks = function(){
		document.write(this.getLinks());
	}

	this.getLinks = (typeof(arguments[3]) == 'function' ? arguments[3] : this._getLinks);
}

