/* share link to facebook, twitter, digg */

//twitter
BitlyCB.shortenResponse = function(data) {
	var s = '';
	var first_result;
	// Results are keyed by longUrl, so we need to grab the first one.
	for (var r in data.results) {
		first_result = data.results[r]; 
		break;
	}

	// Now get the shortURL
	shortURL = first_result["shortUrl"];
	tweetmsg = 'cast your vote on ' + listTitle + ' at';
	windowOpenUrl = "http://www.twitter.com/home/?status=" + tweetmsg.replace(/ /g,"+") + "+" + shortURL;
	window.open(windowOpenUrl, 'new_window', 'width=600,height=400');
}

// facebook
function fbs_click(u,t) {
	//u=location.href;
	//t=document.title;
	window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');
	return false;
}

function digg_click(dtitle, dbody, durl) {
	dtitle = escape('cast your vote on ' + dtitle);
	dbody = escape(dbody);
	durl = encodeURIComponent(durl);
	windowOpenUrl = "http://digg.com/submit?url=" + durl + "&title=" + dtitle + "&bodytext=" + dbody + "&media=NEWS";
	window.open(windowOpenUrl, 'new_window', 'scrollbars=1,width=600,height=400');
}