
function SocialShare() {}

SocialShare.prototype = {
    FACEBOOK: 1,
    TWITTER: 2,
    FRIENDFEED: 3,
    YAHOO: 4,
    GOOGLE: 5,
    DELICIOUS: 6,
    LIVE: 7,
    MYSPACE: 8,
    BLOGGER: 9,

    setURL: function(url) {
        this._url = url;
    },
    getURL: function() {
        return escape(this._url);
    },
    setTitle: function(title) {
        this._title = title;
    },
    getTitle: function(){
        return encodeURI(this._title);
    },
    share: function(o) {
        var socialURL;
        switch (o) {
            case this.FACEBOOK:
                socialURL = "http://www.facebook.com/sharer.php?u=" + this.getURL() + "&title=" + this.getTitle();
                break;
            case this.TWITTER:
                socialURL = "http://twitter.com/home?status=" + this.getTitle() + "+" + this.getURL();
                break;
            case this.FRIENDFEED:
                socialURL = "http://friendfeed.com/?url=" + this.getTitle() + " - " + this.getURL();
                break;
            case this.YAHOO:
                socialURL = "http://myweb2.search.yahoo.com/myresults/bookmarklet?u=" + this.getURL() + "&t=" + this.getTitle();
                break;
            case this.GOOGLE:
                socialURL = "http://www.google.com/bookmarks/mark?op=edit&bkmk=" + this.getURL() + "&title=" + this.getTitle();
                break;
            case this.DELICIOUS:
                socialURL = "http://del.icio.us/post?url=" + this.getURL() + "&title=" + this.getTitle();
                break;
            case this.LIVE:
                socialURL = "https://favorites.live.com/quickadd.aspx?marklet=1&mkt=tr-tr&top=1&url=" + this.getURL() + "&title=" + this.getTitle();
                break;
            case this.MYSPACE:
                socialURL = "http://www.myspace.com/Modules/PostTo/Pages/?u=" + this.getURL() + "&title=" + this.getTitle();
                break;
            case this.BLOGGER:
                socialURL = "http://www.blogger.com/blog_this.pyra?t&u=" + this.getURL() + "&title=" + this.getTitle();
                break;
        }
        window.open(socialURL, "_blank");
    }
};

flashShare.FACEBOOK = 1;
flashShare.TWITTER = 2;
flashShare.FRIENDFEED = 3;
flashShare.YAHOO = 4;
flashShare.GOOGLE = 5;
flashShare.DELICIOUS = 6;
flashShare.LIVE = 7;
flashShare.MYSPACE = 8;
flashShare.BLOGGER = 9;

function flashShare(url, title, network) {
    var sh = new SocialShare();
    sh.setURL(url);
    sh.setTitle(title);
    sh.share(network);
    sh = null;
}
