

function copy_properties() { }; //dummy function to suppress IE error message!
var gpType;
var gpSize;
var fbIsDikey;
var twIsDikey;
var pageIsBlockedForGPlus = false;
var hurShareLib = {
    hasInitForFacebook: false,
    hasInitForTwitter: false,
    hasInitForGplus: false,
    createNameForGPlus: function () {
        var rndName = "Gp1_" + parseInt(Math.random() * 1000000000);
        if (document.getElementById(rndName) != null)
            rndName = this.createNameForGPlus();
        return rndName;
    },
    renderGPlus: function (container, type, countEnable) {
        try {
            //alert(typeof(gapi));
            if (typeof (gapi) == "undefined")
                setTimeout("hurShareLib.renderGPlus('" + container + "','" + type + "'," + countEnable + ")", 1000);
            gapi.plusone.render(container, { "size": type, "count": countEnable, "href": hurShareLib.mainLib.getUrl() });
        }
        catch (err) {

        }
    },
    initForPlugin: function (shareType, pageDiv, hurDiv) {
        if (shareType == "fb") {
            if (this.hasInitForFacebook) return;
            try {
                //$.getScript("http://www.facebook.com/rsrc.php/z5U08/hash/3amdinr3.js?v="+ parseInt(Math.random() * 1000000000), function() {
                //$.getScript("http://static.ak.fbcdn.net/rsrc.php/v1/yf/r/yXt6v9Cle6q.js?v="+ parseInt(Math.random() * 1000000000), function() {

                hurShareLib.fb.recommendPage(pageDiv, fbIsDikey);
                //hurShareLib.fb.recommendHurriyet(hurDiv);

                //});
            } catch (err) {

            }
            this.hasInitForFacebook = true;
        }
        else if (shareType == "tw") {
            if (this.hasInitForTwitter) return;
            try {
                $(hurDiv).css("display", "none");
                $(pageDiv).css("display", "none");
                hurShareLib.tw.tweetPage(pageDiv, twIsDikey);
                hurShareLib.tw.tweetHur(hurDiv);

                $.getScript("http://platform.twitter.com/widgets.js?v=" + parseInt(Math.random() * 1000000000), function () {
                    $(hurDiv).css("display", "block");
                    $(pageDiv).css("display", "block");
                });


            } catch (err) {

            }
            this.hasInitForTwitter = true;

        } else if (shareType = "gp") {
            if (this.hasInitForGplus) return;
            try {
                if (typeof (navigator) != 'undefined' && navigator.userAgent && /iPad|iPhone|Android/.test(navigator.userAgent)) { $(pageDiv).remove(); } else {
                    $.getScript("https://apis.google.com/js/plusone.js?lang=tr&v=" + parseInt(Math.random() * 1000000000), function () {
                        hurShareLib.gp.plusPage(pageDiv, gpSize, gpType);
                    });
                }
            }
            catch (err) {

            }
            this.hasInitForGplus = true;
        }
    },

    fb: function (pageDiv, hurDiv) { hurShareLib.initForPlugin("fb", pageDiv, hurDiv); },
    tw: function (pageDiv, hurDiv) { hurShareLib.initForPlugin("tw", pageDiv, hurDiv); },
    gp: function (pageDiv) { hurShareLib.initForPlugin("gp", pageDiv, null); },
    initAllShare: function (pageDivFb, hurDivFb, pageDivTw, hurDivTw, pageDivGp) { this.fb(pageDivFb, hurDivFb); this.tw(pageDivTw, hurDivTw); this.gp(pageDivGp); },
    mainLib: function () { }
};
hurShareLib.mainLib.getUrl = function () {
    var url = document.location.toString();
    if (typeof (shareUrl) != "undefined")
        url = shareUrl;
    return url;
};
hurShareLib.fb.recommendPage = function (senderElementName, isDikey) {
    if (isDikey)
        $("<iframe src=\"http://www.facebook.com/plugins/like.php?href=" + encodeURIComponent(hurShareLib.mainLib.getUrl()) + "&amp;send=false&amp;locale=tr_TR&amp;layout=box_count&amp;width=90&amp;show_faces=false&amp;action=recommend&amp;colorscheme=light&amp;font&amp;height=90\" scrolling=\"no\" frameborder=\"0\" style=\"border:none; overflow:hidden; width:90px; height:90px;\" allowTransparency=\"true\"></iframe>").appendTo($(senderElementName));
    else
        $("<iframe src=\"http://www.facebook.com/plugins/like.php?href=" + encodeURIComponent(hurShareLib.mainLib.getUrl()) + "&amp;locale=tr_TR&amp;layout=button_count&amp;show_faces=false&amp;width=120&amp;height=21&amp;action=recommend&amp;font=trebuchet+ms&amp;colorscheme=light\" scrolling=\"no\" allowTransparency=\"true\" frameborder=\"0\" style=\"background-color:#ffffff; border:none; overflow:hidden; width:120px; height:23px; padding-top:1px; padding-bottom:1px;\"></iframe>").appendTo($(senderElementName));
};
hurShareLib.tw.tweetHur = function (senderElementName) { $("<a href=\"http://twitter.com/Hurriyet\" class=\"twitter-follow-button\" data-show-count=\"false\" data-lang=\"tr\" data-show-screen-name=\"false\">Tweet</a>").appendTo($(senderElementName)); };
hurShareLib.tw.tweetPage = function (senderElementName, isDikey) {
    if (isDikey)
        $("<a href=\"http://twitter.com/share\" class=\"twitter-share-button\" data-url=\"" + hurShareLib.mainLib.getUrl() + "\" data-count=\"vertical\" data-lang=\"tr\" data-via=\"hurriyet\">Tweet</a>").appendTo($(senderElementName));
    else
        $("<a href=\"http://twitter.com/share\" class=\"twitter-share-button\" data-url=\"" + hurShareLib.mainLib.getUrl() + "\" data-count=\"horizontal\" data-lang=\"tr\" data-via=\"hurriyet\">Tweet</a>").appendTo($(senderElementName));
};
hurShareLib.gp.plusPage = function (senderElementName, type, countEnable) {

    var c = countEnable == 0 ? "false" : "true";
    var rndName = hurShareLib.createNameForGPlus();
    var divHtm = "<div id=\"" + rndName + "\"></div>";
    $(divHtm).appendTo($(senderElementName));
    hurShareLib.renderGPlus(rndName, type, countEnable);
};
hurShareLib.fb.recommendHurriyet = function (senderElementName) {
    $("<iframe src=\"http://www.facebook.com/plugins/like.php?href=http://www.facebook.com/hurriyet&amp;layout=button_count&amp;show_faces=false&amp;width=108&amp;height=21&amp;action=like&amp;font=trebuchet+ms&amp;colorscheme=light\" scrolling=\"no\" allowTransparency=\"true\" frameborder=\"0\" style=\"border:none; overflow:hidden; width:108px; height:23px; margin-top:6px; padding-left:5px; padding-bottom:1px;background:transparent'\"></iframe>").appendTo($(senderElementName));
};


