﻿var finish = function () {
    window.location.href = location.href;
};
function Loginout() {
    $.post('/API/User.ashx?Action=Loginout', function () {
        document.location.reload();
    });
}
function Sw(id) {
    $.post('/API/sw.ashx', { ID: id }, function (result) {
        if (result == "ok") {
            window.location.reload();
        }
    });

}
function Bind(siteid) {
    $("a[name='bind']").attr("disabled", "disabled");
    $.post('/API/Bind.ashx?Action=Bind', { siteid: siteid }, function (result) {
        $("a[name='bind']").attr("disabled", "");
        eval(result)
    });

}
function SetActive(obj) {

    $(obj).addClass("active");
}
function DecSpread() {
    var spreader = "";
    var referrer = "";
    var i = document.URL.indexOf("?");

    if (i > 0) {
        spreader = document.URL.substring(i + 1, document.URL.length);
        referrer = document.referrer;
        $.post("/API/User.ashx?action=WriteSpreader", { "Spreader": spreader, "Referrer": referrer }, function () {
            window.location.href = document.URL.substring(0, i);
        });
    }


}
