var iconsUrlPrefix = "http://startups.s3.amazonaws.com/sharebar/";

blinklist = new Array("blinklist.png","http://www.blinklist.com/index.php?Action=Blink/addblink.php&amp;Url=PERMALINK&amp;Title=TITLE","Bookmark this post in Blinklist");
digg = new Array("digg.png","http://digg.com/submit?phase=2&amp;url=PERMALINK&amp;title=TITLE&amp;bodytext=EXCERPT","Digg this post");
facebook = new Array("facebook.png","http://www.facebook.com/share.php?u=PERMALINK&amp;t=TITLE","Bookmark this post in Facebook");
email = new Array("email.png","mailto:?subject=TITLE&amp;body=Hello%2C%0A%0AI%20read%20this%20post%20and%20I%20think%20you'd%20like%20it%20too%3A%20TITLE%20-%20PERMALINK%0D%0A%0D%0AEmail%20sent%20using%20BlogPlay.com%20-%20Let%20your%20readers%20easily%20share%20your%20blog%20content%20http%3A%2F%2Fblogplay.com%20","Mail this post");
stumbleupon = new Array("stumbleupon.png","http://www.stumbleupon.com/submit?url=PERMALINK&amp;title=TITLE","Bookmark this post in Stumbleupon");
google = new Array("google.png","http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=PERMALINK&amp;title=TITLE&amp;annotation=EXCERPT","Bookmark this post in Google Bookmarks");
//twitter = new Array("twitter.png","http://twitter.com/home?status=TITLE%20-%20PERMALINK","Tweet this post");
twitter = new Array("twitter.png","http://tb.startups.com/tbtwitter.php?text=TITLE%20%40startupscom&url=PERMALINK","Tweet this post");

var social_known_sites = new Array(facebook, twitter, digg, stumbleupon, blinklist, google, email);

function getElementsByClassName(classname, node) {
	if(!node) node = document.getElementsByTagName("body")[0];
	var a = [];
	var re = new RegExp('\\b' + classname + '\\b');
	var els = node.getElementsByTagName("*");
	for(var i=0,j=els.length; i<j; i++)
	{
		if(re.test(els[i].className))a.push(els[i]);
	}
	return a;
}

function getShareBar()
{
	var t =document.title;
	var t = t.match(/(.*) - Startups\.com \| Your Business\. Your Questions\./);
	if (t != null)
	{
		var t = t[1];
	}
	
	//t = escape(t)
	var u = document.URL;

	var customBar = getButtonBar(u,t,"");
	
	var e = getElementsByClassName("post-taglist");
	//alert(e);

	e = e[0];
	if (typeof(e) != "undefined")
	{
		e.innerHTML = e.innerHTML + customBar;
	}

}

function getButtonBar(varPermalink, varTitle, varExcerpt)
{
	varPrint = '<div>';
	for (i=0; i<social_known_sites.length;i++)
	{
		varSocialSite = social_known_sites[i];
		varIcon = iconsUrlPrefix + varSocialSite[0];
		varStr = varSocialSite[1];
		varStr = varStr.replace(/TITLE/g, varTitle);
		varStr = varStr.replace(/PERMALINK/, varPermalink);
		varStr = varStr.replace(/EXCERPT/, varExcerpt);
		varAlt = varSocialSite[2];
		varPrint += '<a rel="nofollow" href="' + varStr + '" target="_blank"><img src="' + varIcon + '" style="border:0;display:inline;padding-right:10px;" alt="' + varAlt + '" title="' + varAlt + '" /></a>';
	}
	//varPrint += moreButton(varPermalink, varTitle, varExcerpt);
	//varPrint = "<a href=\"http://blogplay.com\" target=\"_blank\">SHARE:</a>" + varPrint;
	
	varPrint += "</div>";

	return varPrint;
}


