var createObj = function(d, s, h) {
	var a = document.createElement('a');
	a.href = h;
	a.id = d;
	a.target = '_blank';
	var img = new Image();
	img.src = s;
	//img.align = 'absmiddle';
	img.alt = '推文到'+d;
	img.title = img.alt;
	a.appendChild(img);
	return a;
}

function community(c,d,s,h){
	var el = createObj(d,s,h);
	c.appendChild(el);
}

var s = document.getElementById('adjustSmall');

if (s != null){
	var u = encodeURIComponent(location.href);
	var t = encodeURIComponent(document.title);
	s = s.parentNode;
	s.innerHTML = s.innerHTML + '∣<span id="community">分享：</span>';
	s = document.getElementById('community');

	community(s,'facebook',web+'/images/community/facebook.gif','http://www.facebook.com/sharer.php?u='+u+'&t='+t);
	community(s,'twitter',web+'/images/community/twitter.gif','http://twitter.com/home/?status='+t+' '+u);
	community(s,'plurk',web+'/images/community/plurk.png','http://www.plurk.com/?qualifier=shares&status='+u+' '+'('+t+')');
	//community(s,'funP',web+'/images/community/funp.gif','http://funp.com/push/submit/add.php?url='+u+'&via=tools');
	s.innerHTML = s.innerHTML + '<span><div class="g-plusone" data-size="small" data-annotation="none" style="display:inline"></div></span>';
	window.___gcfg = {lang: 'zh-TW'};
	var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
	po.src = 'https://apis.google.com/js/plusone.js';
	s.parentNode.insertBefore(po, s);
}
