﻿$(document).ready(function () {
    $(".tabs a").click(function () {
        $(".tabs a").attr("class", "tab");
        $(this).attr("class", "tab_sel");

        $(".group_block .tab_").hide();
        $(".group_block #tab_" + $(this).attr("tbid")).fadeIn("fast");
    });

    $("#req_bl h3").click(function () {
        $(this).parent().animate({ bottom: '0px' });
    });

    $("#req_bl #btn_send").click(function () {
        $.post("/Modules/UM/handlres/reg.ashx", { cmd: 'forhelp', val: $("#req_bl #req").val() });
        $("#req_bl").html("<div><h1>Спасибо!!!</h1></div>").delay(1000).fadeOut("slow");
    });

    $("#req_bl #btn_close").click(function () {
        $("#req_bl").animate({ bottom: '-108px' });
    });
});

function _hide(sender) {
    $(sender).remove();
}

function inputNotice(nType, cont, target) {
    var targetWidth = (nType != 'Top') ? $(target).width() + 30 : 0;
    var ttop = (nType != 'Top') ? 0 : 40;
    $(target).before('<div class="notice' + nType + '" style="margin-left: ' + targetWidth + 'px; margin-top: ' + ttop + 'px" onclick="_hide(this);"><div class="arr"></div><div class="txt">' + cont + '</div>');
}

function closeFloatPanel() {
    $("#float_panel").animate({ top: '-300px' }, function () { $("#float_panel").remove(); });
}

function renderFloatPanel(width, height, html) {
    $("#float_panel").remove();
    $('body').append("<div id=\"float_panel\" style=\"width: " + width + "px; height: " + height + "px; top: -" + height + "px; margin-left: -" + ((width / 2) + 10) + "px;\"><div class=\"body\">" + html + "</div></div>");
    $("#float_panel").animate({ top: '44px' });
}

function inputLoader(target) {
    target.html("<div id='loader_bl'><img align='absmiddle' src='/App_Themes/main/img/el/loader.gif'/></div>");
}

function inputsmalLoader(target) {
    target.html("<img align='absmiddle' src='/App_Themes/main/img/el/loader.gif'/>");
}

function getCookie(name) {
    var cookie = " " + document.cookie;
    var search = " " + name + "=";
    var setStr = null;
    var offset = 0;
    var end = 0;
    if (cookie.length > 0) {
        offset = cookie.indexOf(search);
        if (offset != -1) {
            offset += search.length;
            end = cookie.indexOf(";", offset)
            if (end == -1) {
                end = cookie.length;
            }
            setStr = unescape(cookie.substring(offset, end));
        }
    }
    return (setStr);
}

