function openPopup(e) {
	if(!e) var e = window.event;
	var url = this.href;
	window.open(url, "Share", "toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=500,height=400");
	
	//e.cancelBubble is supported by IE - this will kill the bubbling process.
	e.cancelBubble = true;
	e.returnValue = false;
	
	//e.stopPropagation works only in Firefox.
	if (e.stopPropagation) {
		e.stopPropagation();
		e.preventDefault();
	}
}

window.onload = function() {
	document.getElementById("fbSharePopup").onclick=openPopup;
}

function getShareLink()
{
	var title = $(document).attr("title");
	var address = self.location.toString();
	
	var shareLink = "https://www.facebook.com/sharer.php?u=" + address + "&t=" + title;
	
	return shareLink;
}

function getTweetLink()
{
	var address = self.location.toString();
	var tweetLink = "http://twitter.com/home?status=" + address + " Enter status message here";
	
	return tweetLink;
}

$(document).ready(function () {
	$("a#fbSharePopup").attr("href", getShareLink());
	$("a#twitterLink").attr("href", getTweetLink());
});
