﻿(function() {
    var _url = window.location.href;
    var _url = _url.replace(/((?:\?|&)?fbc_receiver=.+)?(?:#.*)?$/, "");
    var url = escape((typeof tweetmeme_url == "string") ? tweetmeme_url : ((typeof TWEETMEME_URL == "string") ? TWEETMEME_URL : _url)).replace(/\+/g, "%2b");
    var source = (typeof tweetmeme_source == "string") ? escape(tweetmeme_source) : ((typeof TWEETMEME_SOURCE == "string") ? escape(TWEETMEME_SOURCE) : false);
    var style = (typeof tweetmeme_style == "string") ? escape(tweetmeme_style) : ((typeof TWEETMEME_STYLE == "string") ? escape(TWEETMEME_STYLE) : "normal");
    var service = (typeof tweetmeme_service == "string") ? escape(tweetmeme_service) : ((typeof TWEETMEME_SERVICE == "string") ? escape(TWEETMEME_SERVICE) : false);
    var service_api = (typeof tweetmeme_service_api == "string") ? escape(tweetmeme_service_api) : ((typeof TWEETMEME_SERVICE_API == "string") ? escape(TWEETMEME_SERVICE_API) : false);
    var alias = (typeof tweetmeme_alias == "string") ? escape(tweetmeme_alias) : ((typeof TWEETMEME_ALIAS == "string") ? escape(TWEETMEME_ALIAS) : false);
    var src = "http://api.tweetmeme.com/button.js";
    switch (style) {
        case "compact":
            var h = 20;
            var w = 90;
            break;
        case "rednose":
            var h = 61;
            var w = 50;
            break;
        default:
            var h = 61;
            var w = 50;
            break
    }
    src += "?url=" + url;
    src += "&style=" + style;
    if (source != false) {
        src += "&source=" + source
    }
    if (service) {
        src += "&service=" + service
    }
    if (service_api) {
        src += "&service_api=" + service_api
    }
    if (alias) {
        src += "&alias=" + alias
    }
    document.write('<iframe src="' + src + '" height="' + h + '" width="' + w + '" frameborder="0" scrolling="no"></iframe>');
    tweetmeme_url = null;
    TWEETMEME_URL = null;
    tweetmeme_source = null;
    TWEETMEME_SOURCE = null;
    tweetmeme_service = null;
    TWEETMEME_SERVICE = null;
    tweetmeme_service_api = null;
    TWEETMEME_SERVICE_API = null;
    tweetmeme_style = null;
    TWEETMEME_STYLE = null
})();