﻿var SBMUtil = {};
SBMUtil.addBookmark = function(type){
 var base = null;
 var snippet = null;
 var option = null;
 var title = encodeURIComponent(document.title);
 var url = encodeURIComponent(location.href);

 switch (type) {
 case 'hatena':
 base = "http://b.hatena.ne.jp/add";
 snippet = "?mode=confirm&is_bm=1&title=" + title + "&url=" + url;
 option = "toolbar=no,width=700,height=400";
 break;

 case 'delicious':
 base = "http://del.icio.us/post";
 snippet = "?v=4&noui&jump=close&title=" + title + "&url=" + url;
 option = "toolbar=no,width=700,height=400";
 break;

 case 'buzzurl':
 base = "http://buzzurl.jp/entry/";
 snippet = location.href;
 option = "scrollbars=yes,toolbar=yes,resizable=yes";
 break;

 case 'nifty':
 base = "http://clip.nifty.com/create";
 snippet = "?title=" + title + "&url=" + url;
 option = "scrollbars=yes,toolbar=yes,resizable=yes";
 break;

 case 'livedoor':
 base = "http://clip.livedoor.com/clip/add";
 snippet = "?jump=ref&title=" + title + "&link=" + url;
 option = "scrollbars=yes,toolbar=yes,resizable=yes";
 break;

 case 'technorati':
 base = "http://www.technorati.jp/faves";
 snippet = "?add=" + url;
 option = "scrollbars=yes,toolbar=yes,resizable=yes";
 break;

 case 'yahoo':
 base = "http://bookmarks.yahoo.co.jp/bookmarklet/showpopup";
 snippet = "?t=" + title + "&u=" + url + "&opener=bm&ei=UTF-8";
 option = "width=550px,height=480px,status=1,location=0,resizable=1,scrollbars=0,left=100,top=50";
 break;

 default:
 return;
 }
 window.open(base + snippet, type, option);
};
