 var $j = jQuery.noConflict();
    $j(function () {
        var dials = $j(".dialNo");
        var index;
        var number = $j(".divDialDigits");
        var total;
        dials.click(function () {
            if ($j(this).hasClass("dialCall")) {
                if (number.html().length == 11) {
                    callNumber();
                }
            } else if ($j(this).hasClass("dialClear")) {
                total = number.text();
                total = total.slice(0, -1);
                number.empty().append(total);
            } else {
                index = $j(this).html();
                if (number.html().length < 11) {
                    number.append(index);
                }
            }

        });
        $j(document).keydown(function (e) {
            if (number.html().length < 11) {
                switch (e.which) {
                    case 96:
                        number.append("0");
                        break;
                    case 97:
                        number.append("1");
                        break;
                    case 98:
                        number.append("2");
                        break;
                    case 99:
                        number.append("3");
                        break;
                    case 100:
                        number.append("4");
                        break;
                    case 101:
                        number.append("5");
                        break;
                    case 102:
                        number.append("6");
                        break;
                    case 103:
                        number.append("7");
                        break;
                    case 104:
                        number.append("8");
                        break;
                    case 105:
                        number.append("9");
                        break;
                    case 8:
                        total = number.text();
                        total = total.slice(0, -1);
                        number.empty().append(total);
                        break;
                    case 27:
                        number.empty();
                        break;
                    case 106:
                        number.append("*");
                        break;
                    case 35:
                        number.append("#");
                        break;
                    case 13:
                        $('.pad-action').click();
                        break;
                    default:
                        return;
                }
            } else {
                return;
            }
            e.preventDefault();
        });
    });
    function callNumber() {
        if ($j(".number").length < 11) {
            $j.ajax({
                type: "POST",
                url: "/wp-admin/admin-ajax.php",
                data: {action: 'avanak_dillerAction', mobile: $j('.divDialDigits').html()},
                success: function (d) {
                    console.log(d);
                    if (d == 'ok') {
                        $j(".divDialDigits").html('ارسال موفق');
                    } else {
                        $j(".divDialDigits").html(d);
                    }
                }
            });
        }
    }