/* 文字コードはUTF-8 */
sbm = function(order){
	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'));

	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['googleplusone'] = '<g:plusone size="medium"></g:plusone>';
	this.items['hatenabookmark'] = '<a href="http://b.hatena.ne.jp/entry/' + this.link + '" class="hatena-bookmark-button" data-hatena-bookmark-title="' + this.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>';
	this.items['facebook'] = '<iframe src="http://www.facebook.com/plugins/like.php?href=' + encodeURIComponent(this.link) + '&amp;layout=button_count&amp;show_faces=true&amp;width=100&amp;action=like&amp;font&amp;colorscheme=light&amp;height=25" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100px; height:21px;" allowTransparency="true"></iframe>';
	this.items['mixicheck'] = '<a href="http://mixi.jp/share.pl" class="mixi-check-button" data-key="82e68c86f0f7194d92e48e693f5ef90f8a76ba72" data-url="' + this.link + '" data-button="button-1">Check</a><script type="text/javascript" src="http://static.mixi.jp/js/share.js"></script>';

	this._getLinks = function(){
		var html = '<ul class="sbm_list">';
		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);
}
