﻿function contentShare(siteName, contentUrl, contentTitle, contentDescription)
{
    contentUrl = encodeURIComponent(contentUrl);
    contentTitle = encodeURIComponent(contentTitle);
    contentDescription = encodeURIComponent(contentDescription);

    switch (siteName)
	{
        case "facebook":
            postPopUp('http://www.facebook.com/sharer.php?u=' + contentUrl + '&t=' + contentTitle, siteName, 'toolbar=0,status=0,height=436,width=646,scrollbars=yes,resizable=yes');
            break;
			
        case "twitter":
            postPopUp('http://twitter.com/home?status=Currently reading ' + contentUrl , 'toolbar=0,status=0,height=436,width=646,scrollbars=yes,resizable=yes');
            break;
			
        case "myspace":
            //http://www.myspace.com/Modules/PostTo/Pages/?t=%E2%80%9CPost%20to%20MySpace%E2%80%9D%20Button%20Released%20for%20Easier%20Sharing&c=MySpace%20is%20now%20providing%20an%20easier%20way%20for%20publishers%20to%20help%20users%20spread%20their%20content%20virally.&u=http%3A%2F%2Fwww.techcrunch.com%2F2008%2F02%2F13%2Fpost-to-myspace-button-released-for-easier-sharing%2F&l=1
            postPopUp('http://www.myspace.com/index.cfm?fuseaction=postto&u=' + contentUrl + '&t=' + contentTitle + '&c=' + contentDescription + '&l=1', siteName, 'toolbar=0,status=0,height=436,width=646,scrollbars=yes,resizable=yes');
            break;
			
        case "digg":
            postPopUp('http://digg.com/submit?url=' + contentUrl + '&title=' + contentTitle + '&bodytext=' + contentDescription + '&media=MEDIA&topic=TOPIC' + contentUrl, "digg", 'toolbar=0,status=0,height=436,width=646,scrollbars=yes,resizable=yes');
            break;
			
        case "delicious":
            postPopUp('http://delicious.com/save?url=' + contentUrl + '&title=' + contentTitle + '&bodytext=' + contentDescription + '&media=MEDIA&topic=TOPIC' + contentUrl, "delicious", 'toolbar=0,status=0,height=436,width=646,scrollbars=yes,resizable=yes');
            break;
			
        case "stumble upon":
            postPopUp('http://www.stumbleupon.com/submit?url=' + contentUrl + '&title=' + contentTitle + '&bodytext=' + contentDescription + '&media=MEDIA&topic=TOPIC' + contentUrl, "stumble_upon", 'toolbar=0,status=0,height=436,width=646,scrollbars=yes,resizable=yes');
            break;
    }
}
function postPopUp(url, name, params)
{
    var win = window.open(url, name, params);
}
function postNewWindow(url, name, params)
{
    var win = window.open(url, name, params);
}