﻿var social = {
    FACEBOOK: 1,
    TWITTER: 2,
    FRIENDFEED: 3,
    YAHOO: 4,
    GOOGLE: 5,
    DELICIOUS: 6,
    LIVE: 7,
    MYSPACE: 8,
    BLOGGER: 9,
    _url: "",
    _title: "",
    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() + "&amp;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?&amp;u=" + this.getURL() + "&amp;t=" + this.getTitle();
                break;
            case this.GOOGLE:
                socialURL = "http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=" + this.getURL() + "&amp;title=" + this.getTitle();
                break;
            case this.DELICIOUS:
                socialURL = "http://del.icio.us/post?url=" + this.getURL() + "&amp;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 = "https://www.google.com/accounts/ServiceLogin?service=blogger&continue=https%3A%2F%2Fwww.blogger.com%2Floginz%3Fd%3Dhttp%253A%252F%252Fwww.blogger.com%252Fblog_this.pyra%253Ft%2526u%253D" + this.getURL() + "&title=" + this.getTitle();
                break;
        }
        window.open(socialURL, "_blank");
    }
};
$(document).ready(function(){
//social.setTitle('ClubFinans + $(this).find("h1").text())';

social.setTitle($("h1").text());

//    social.setTitle("ClubFinans - Keyifli anlarda bir adım önde...");
    social.setURL(document.location);
});