function submitShare(theService,optionalURL,optionalTitle,optionalBlurb) {
	// set the tracking prefix
	
	if (optionalURL != undefined) {
		shareLocation = optionalURL.replace("://starwars.com","://www.starwars.com");
	} else {
		shareLocation = shareLocation.replace("://starwars.com","://www.starwars.com");
	}
	
	if (optionalTitle != undefined) {
		shareTitle = optionalTitle;
	}

	if (optionalBlurb != undefined) {
		shareBlurb = optionalBlurb;
	}

	switch (theService) {
		case "twitter":
			var twitterShareLocation = shareLocation;
			// strip anchor for twitter only
			if (twitterShareLocation.indexOf("#") > -1) {
				twitterShareLocation = twitterShareLocation.substr(0,twitterShareLocation.lastIndexOf("#"));
			}
			swShareUrl = "http://twitter.com/home?status=" + encodeURIComponent("#StarWars | ") + (shareTitle.replace("StarWars.com%20%7C%20","")).replace("#","") + "%20" + twitterShareLocation;
			var gaFormattedUrl = "share_" + shareLocation;
			_gaq.push(['_trackEvent', 'starwars-share', 'share_twitter', gaFormattedUrl]);
			setTimeout('window.open(swShareUrl, "_blank")',200);
			break;
			
		case "facebook":
			swShareUrl = 'http://www.facebook.com/sharer.php?u=' + encodeURIComponent(shareLocation);
			var gaFormattedUrl = "share_" + shareLocation;
			_gaq.push(['_trackEvent', 'starwars-share', 'share_facebook', gaFormattedUrl]);
			setTimeout('window.open(swShareUrl, "_blank", "toolbar=0,status=0,width=700,height=440")',200);
			break;
	}
}

function popEmailWindow(shareUrl,shareTitle) {
	window.open("/email_this.jsp?url=" + shareUrl + "&title=" + encodeURIComponent(shareTitle),"_blank","width=577,height=400,toolbar=no,scrollbars=no,menubar=no,location=no");
}

