// JavaScript Document
function linkthis(action) {
	var l = "";
	var u = encodeURIComponent(location.href);
	var c = encodeURIComponent(location.href);
	var t = encodeURIComponent(document.title);
	
	switch(action) {
		case "bebo":
			window.open('http://www.bebo.com/c/share?Url='+u+'&t='+t,'sharer','toolbar=0,status=0,width=626,height=436');
		break;
		case "blinklist":
			window.open('http://www.blinklist.com/index.php?Action=Blink/addblink.php&Description='+t+'&Url='+u+'&Title='+t+'&Tag='+t,'blinkster');
		break;
		case "delicious":
			window.open('http://delicious.com/save?v=5&amp;noui&amp;jump=close&amp;url='+u+'&amp;title='+t, 'delicious','toolbar=no,width=550,height=550');
		break;
		case "digg":
			window.open('http://digg.com/submit?phase=2&url='+u+'&title='+t,'digg');
		case "facebook":
			l = "en-us";
			if(l.indexOf('lang') != -1 || l == '') {l = 'www';}
        	window.open('http://' + l + '.facebook.com/sharer.php?u=' + u + '&t=' + t, 'sharer', 'toolbar=0,status=0,width=626,height=436');
        break;
		case "furl":
			window.open('http://www.furl.net/items/new?t='+t+'&u='+u+'&r='+u+'&c=&groups=&v=1','furl');
		break;
		case "google":
			l = "en";
			window.open('http://www.google.com/bookmarks/mark?op=edit&hl='+l+'&bkmk='+u+'&title='+t,'google');
		break;
		case "myspace":
			l = "3";
        	window.open('http://www.myspace.com/index.cfm?fuseaction=postto&t='+t+'&c='+c+'&u='+u+'&l='+l,'myspace');
		break;
		case "stumbleupon":
			window.open('http://www.stumbleupon.com/submit?url='+u,'stumbleupon');
		break;
		case "twitter":
			window.open('http://twitter.com/home?status='+t+'+'+u);
		break;
		case "yahoo":
			window.open('http://bookmarks.yahoo.com/toolbar/savebm?opener=tb&.intl='+l+'&u='+u+'&t='+t,'yahoo');
		break;
		case "linkedin":
        	window.open('http://www.linkedin.com/shareArticle?mini=true&url=' + u + '&title=' + t,'linkedin');
		break;
	}
	return false;
}
function sendthis(subject,msg) {
	var u = encodeURIComponent(location.href);
	var t = encodeURIComponent(document.title);
	if (msg) {
		msg += '%0D%0D';
	}
	document.location = 'mailto:?Subject='+subject+'&Body='+msg+t+"%0D"+u;
}

//Default media list. To update the list, you can call this list before calling the showmedias function.
var medias = "bebo:Bebo,blinklist:Blinklist,delicious:Delicious,digg:Digg,facebook:Facebook,furl:Furl,google:Google,linkedin:LinkedIn,stumbleupon:Stumble Upon,twitter:Twitter,yahoo:Yahoo";  //shared links to display

function showlinks () {
	
	if (medias != "") {
		var arr_medias = medias.split(",");
		for (var i=0;i<arr_medias.length;i++) {
			media = arr_medias[i].split(":");
			document.write("<a href=\"#\" onclick=\"return linkthis('" + media[0] + "');\" id=\"" + media[0] + "\">" + media[1] + "</a>");
			//alert();
		}
	}
}
	
