{include file="./index_top.tpl"}
<style>
input[type=button] {
    padding: 3px 10px;
}
</style>
<script>
    var phoneWindowID = Math.random();
    $.cookie('phoneWindowID', phoneWindowID);
    $.cookie('phoneWindowReload', 0);
    setInterval(function () {
        if ($.cookie('phoneWindowID') != phoneWindowID) window.close();
    }, 10);

    $(function () {
        if ($.cookie('outgoing_call')) {
            call_data = $.cookie('outgoing_call').split(',');
            module_asterisk_call(call_data[0], call_data[1], call_data[2], call_data[3]);
            $.cookie('outgoing_call', '');
        }
    });

    $(window).bind("beforeunload", function () {
        if ($.cookie('phoneWindowID') == phoneWindowID && $.cookie('phoneWindowReload') == 0) return "Внимание! В случае закрытия данного окна прием звонков в браузер будет невозможен.";
    });
</script>
<div align=center style="margin:50px 50px 80px">
    <b style="font-size:22px">{$lang.calls_window}</b>
    {if !$trial}
    <div style="margin:50px">
        <input type="text" id="phone_input" style="margin-left:20px; padding:1px; text-align:right;" />

        <img
          src="images/phone_icon1.png"
          title="{$lang.call}"
          style="cursor:pointer; margin: 0 0 -2px 2px;"
          onclick="{$calc_func}"
          width="16"
        />

        <br><br>
        {strip}
            <input type="button" value="1" onclick="document.getElementById('phone_input').value += this.value">
            <input type="button" value="2" onclick="document.getElementById('phone_input').value += this.value">
            <input type="button" value="3" onclick="document.getElementById('phone_input').value += this.value"><br>
            <input type="button" value="4" onclick="document.getElementById('phone_input').value += this.value">
            <input type="button" value="5" onclick="document.getElementById('phone_input').value += this.value">
            <input type="button" value="6" onclick="document.getElementById('phone_input').value += this.value"><br>
            <input type="button" value="7" onclick="document.getElementById('phone_input').value += this.value">
            <input type="button" value="8" onclick="document.getElementById('phone_input').value += this.value">
            <input type="button" value="9" onclick="document.getElementById('phone_input').value += this.value"><br>
            <input type="button" value="0" onclick="document.getElementById('phone_input').value += this.value">
        {/strip}
    </div>
    {/if}
    {if $records_table_link}
        <a href="fields.php?table={$records_table_link}" target="_blank" style="font-size:18px">{$lang.record_table}</a>
    {/if}
    <br><br><br><br>
    <span style="color:red; font-size:16px;">{$lang.correct_work_calls}</span>
</div>
