//-- ----------------------------------------------------
//-- Syboos.com add_social Module
//-- Copyright 2007 Syboos.com, All Rights Reserved.
//-- Syboos.com
//-- Syboos.jp
//-- LifevV.COM
//-- ----------------------------------------------------

//#start define js

var syboos_social_base_url = "http://www.syboos.jp";	//.
var syboos_social_enable_text = false;
var syboos_social_direction = "h";	//h: horizon; v: vertical

var syboos_social_delicious = "delicious";
var syboos_social_hatena = "hatena";
var syboos_social_yahoo = "yahoo";
var syboos_social_livedoor = "livedoor";
var syboos_social_google = "google";
var syboos_social_technorati = "technorati";
var syboos_social_buzzurl = "buzzurl";
var syboos_social_bloglines = "bloglines";
var syboos_social_drecom = "drecom";
var syboos_social_nifty = "nifty";
var syboos_social_pookmark = "pookmark";
var syboos_social_pingking = "pingking";
var syboos_social_choix = "choix";

var syboos_social_box = new Array();

var syboos_social_img_tmpl = "<img src=\"xxxxImage\" border=\"0\" alt=\"xxxxAlt\" />";

var syboos_social_img_box = new Array();
function syboos_social_init_img_box() {

	syboos_social_img_box["delicious"] = syboos_social_getImageSource("/social/images/add_delicious.gif", "");
	syboos_social_img_box["hatena"] = syboos_social_getImageSource("/social/images/add_hatena.gif", "");
	syboos_social_img_box["yahoo"] = syboos_social_getImageSource("/social/images/add_yahoo.gif", "");
	syboos_social_img_box["livedoor"] = syboos_social_getImageSource("/social/images/add_livedoor_clip.gif", "");
	syboos_social_img_box["google"] = syboos_social_getImageSource("/social/images/add_google.gif", "");
	syboos_social_img_box["technorati"] = syboos_social_getImageSource("/social/images/add_technorati.gif", "");
	syboos_social_img_box["buzzurl"] = syboos_social_getImageSource("/social/images/add_buzzurl.gif", "");
	syboos_social_img_box["bloglines"] = syboos_social_getImageSource("/social/images/add_bloglines.gif", "");
	syboos_social_img_box["drecom"] = syboos_social_getImageSource("/social/images/add_drecom.gif", "");
	syboos_social_img_box["nifty"] = syboos_social_getImageSource("/social/images/add_nifty.gif", "");
	syboos_social_img_box["pookmark"] = syboos_social_getImageSource("/social/images/add_pookmark.gif", "");
	syboos_social_img_box["pingking"] = syboos_social_getImageSource("/social/images/add_pingking.gif", "");
	syboos_social_img_box["choix"] = syboos_social_getImageSource("/social/images/add_choix.gif", "");
}

var syboos_social_tmpl_box = new Array();

function syboos_social_init_tmpl_box() {
	syboos_social_tmpl_box["delicious"] = "<a href='javascript:location.href=\"http://del.icio.us/post?url=\"%2bencodeURIComponent(location.href)%2b\"&amp;title=\"%2bencodeURIComponent(document.title);' style=\"margin:2px;\">" + syboos_social_img_box["delicious"] + syboos_social_getSingleSocialText(syboos_social_delicious) + "</a>";
	syboos_social_tmpl_box["hatena"] = "<a href='javascript:location.href=\"http://b.hatena.ne.jp/add?mode=confirm&amp;url=\"%2bencodeURIComponent(location.href)%2b\"&amp;title=\"%2bencodeURIComponent(document.title);' style=\"margin:2px;\">" + syboos_social_img_box["hatena"] + syboos_social_getSingleSocialText(syboos_social_hatena) + "</a>";
	syboos_social_tmpl_box["yahoo"] = "<a href='javascript:location.href=\"http://bookmarks.yahoo.co.jp/bookmarklet/showpopup?ei=UTF-8&amp;u=\"%2bencodeURIComponent(location.href)%2b\"&amp;t=\"%2bencodeURIComponent(document.title);' style=\"margin:2px;\">" + syboos_social_img_box["yahoo"] + syboos_social_getSingleSocialText(syboos_social_yahoo) + "</a>";
	syboos_social_tmpl_box["livedoor"] = "<a href='javascript:location.href=\"http://clip.livedoor.com/redirect?link=\"%2bencodeURIComponent(location.href)%2b\"&amp;title=\"%2bencodeURIComponent(document.title);' style=\"margin:2px;\">" + syboos_social_img_box["livedoor"] + syboos_social_getSingleSocialText(syboos_social_livedoor) + "</a>";
	syboos_social_tmpl_box["google"] = "<a href='javascript:location.href=\"http://www.google.com/bookmarks/mark?op=add&amp;bkmk=\"%2bencodeURIComponent(location.href)%2b\"&amp;title=\"%2bencodeURIComponent(document.title);' style=\"margin:2px;\">" + syboos_social_img_box["google"] + syboos_social_getSingleSocialText(syboos_social_google) + "</a>";
	syboos_social_tmpl_box["technorati"] = "<a href='javascript:location.href=\"http://www.technorati.com/faves?add=\"%2bencodeURIComponent(location.href)%2b\"&amp;title=\"%2bencodeURIComponent(document.title);' style=\"margin:2px;\">" + syboos_social_img_box["technorati"] + syboos_social_getSingleSocialText(syboos_social_technorati) + "</a>";
	syboos_social_tmpl_box["buzzurl"] = "<a href='javascript:location.href=\"http://buzzurl.jp/config/add/confirm?url=\"%2bencodeURIComponent(location.href)%2b\"&amp;title=\"%2bencodeURIComponent(document.title);' style=\"margin:2px;\">" + syboos_social_img_box["buzzurl"] + syboos_social_getSingleSocialText(syboos_social_buzzurl) + "</a>";
	syboos_social_tmpl_box["bloglines"] = "<a href='javascript:location.href=\"http://www.bloglines.com/sub?url=\"%2bencodeURIComponent(location.href)%2b\"&amp;title=\"%2bencodeURIComponent(document.title);' style=\"margin:2px;\">" + syboos_social_img_box["bloglines"] + syboos_social_getSingleSocialText(syboos_social_bloglines) + "</a>";
	syboos_social_tmpl_box["drecom"] = "<a href='javascript:location.href=\"http://rss.drecom.jp/shortcut/add_clip?url=\"%2bencodeURIComponent(location.href)%2b\"&amp;title=\"%2bencodeURIComponent(document.title);' style=\"margin:2px;\">" + syboos_social_img_box["drecom"] + syboos_social_getSingleSocialText(syboos_social_drecom) + "</a>";
	syboos_social_tmpl_box["nifty"] = "<a href='javascript:location.href=\"http://clip.nifty.com/create?url=\"%2bencodeURIComponent(location.href)%2b\"&amp;title=\"%2bencodeURIComponent(document.title);' style=\"margin:2px;\">" + syboos_social_img_box["nifty"] + syboos_social_getSingleSocialText(syboos_social_nifty) + "</a>";
	syboos_social_tmpl_box["pookmark"] = "<a href='javascript:location.href=\"http://pookmark.jp/post?url=\"%2bencodeURIComponent(location.href)%2b\"&amp;title=\"%2bencodeURIComponent(document.title);' style=\"margin:2px;\">" + syboos_social_img_box["pookmark"] + syboos_social_getSingleSocialText(syboos_social_pookmark) + "</a>";
	syboos_social_tmpl_box["pingking"] = "<a href='javascript:location.href=\"http://pingking.jp/bookmark/create?url=\"%2bencodeURIComponent(location.href)%2b\"&amp;title=\"%2bencodeURIComponent(document.title);' style=\"margin:2px;\">" + syboos_social_img_box["pingking"] + syboos_social_getSingleSocialText(syboos_social_pingking) + "</a>";
	syboos_social_tmpl_box["choix"] = "<a href='javascript:location.href=\"http://www.choix.jp/submit?bookurl=\"%2bencodeURIComponent(location.href)%2b\"&amp;title=\"%2bencodeURIComponent(document.title);' style=\"margin:2px;\">" + syboos_social_img_box["choix"] + syboos_social_getSingleSocialText(syboos_social_choix) + "</a>";
}

//call me after initialized
function syboos_social_setup() {
	syboos_social_init_img_box();
	syboos_social_init_tmpl_box();
	if (typeof(syboos_social_label) != 'undefined') {
	  document.write(syboos_social_label);
	}

	if (typeof(syboos_social_box) != 'undefined') {
	 for (i = 0; i < syboos_social_box.length; i++) {
	    syboos_social_writeOut(syboos_social_box[i]);
	 }
	}

//	writeCopyright();
}

function syboos_social_writeOut(socialName) {
	if (syboos_social_tmpl_box[socialName] != 'undefined') {
		if (syboos_social_direction == 'v') {
			document.write("<div>" + syboos_social_tmpl_box[socialName] + "</div>");
		} else {
			document.write(syboos_social_tmpl_box[socialName]);
		}
	}
}

function syboos_social_getFullUrl(url) {
//	alert(syboos_social_base_url + url);
	return syboos_social_base_url + url;
}

function syboos_social_getImageSource(imgSrc, imgAlt) {
	imgSrc = syboos_social_getFullUrl(imgSrc);
	imgTmp = syboos_social_img_tmpl;
	imgTmp = imgTmp.replace("xxxxImage", imgSrc);
	imgTmp = imgTmp.replace("xxxxAlt", imgAlt);
	return imgTmp;
}


function syboos_social_getSingleSocialText(text) {
	if (syboos_social_enable_text) {
		return "&nbsp;" + text;
	}

	return "";
}

function writeCopyright() {
	document.write("Powered by syboos.jp");
}
//#end js

