function wplc_admin_menu_layout_display()
{
    if (current_user_can('wplc_ma_agent') || current_user_can('manage_options')) {
        wplc_stats("chat_dashboard");
        global $wplc_basic_plugin_url;
        if (!isset($_GET['action'])) {
            ?>
        <style>
                #wplc-support-tabs a.wplc-support-link {
            background: url('<?php 
            echo $wplc_basic_plugin_url;
            ?>
/images/support.png');
            right: 0px;
            top: 250px;
            height: 108px;
            width: 45px;
            margin: 0;
            padding: 0;
            position: fixed;
            z-index: 9999;
            display:block;
        }
        </style>

            <div id="wplc-support-tabs">
                <a class="wplc-support-link wplc-rotate" href="?page=wplivechat-menu-support-page"></a>
            </div>
            <div class='wplc_page_title'>
                <h1><?php 
            _e("Chat Dashboard", "wplivechat");
            ?>
</h1>
                <?php 
            wplc_first_time_tutorial();
            ?>

                <p><?php 
            _e("Please note: This window must be open in order to receive new chat notifications.", "wplivechat");
            ?>
</p>
            </div>
            
            <div id="wplc_sound"></div>

            <div id="wplc_admin_chat_holder">
                <div id='wplc_admin_chat_info_new'>
                    <div class='wplc_chat_vis_count_box'>
                        <span class='wplc_vis_online'>0</span>
                        <span style='text-transform:uppercase;'>
                            <?php 
            _e("Visitors online", "wplivechat");
            ?>
                        </span>
                        <hr />
                        <p class='wplc-agent-info' id='wplc-agent-info'>
                            <span class='wplc_agents_online'>1</span>
                            <a href='javascript:void(0);'><?php 
            _e("Agent(s) online", "wplivechat");
            ?>
</a>
                        </p>
                        
                    </div>
                    
                </div>
                
                <div id="wplc_admin_chat_area_new">
                    <div style="display:block;padding:10px;">
                    <ul class='wplc_chat_ul_header'>
                        <li><span class='wplc_header_vh wplc_headerspan_v'><?php 
            _e("Visitor", "wplivechat");
            ?>
</span></li>
                        <li><span class='wplc_header_vh wplc_headerspan_t'><?php 
            _e("Time", "wplivechat");
            ?>
</span></li>
                        <li><span class='wplc_header_vh wplc_headerspan_nr'><?php 
            _e("Type", "wplivechat");
            ?>
</span></li>
                        <li><span class='wplc_header_vh wplc_headerspan_d'><?php 
            _e("Data", "wplivechat");
            ?>
</span></li>
                        <li><span class='wplc_header_vh wplc_headerspan_s'><?php 
            _e("Status", "wplivechat");
            ?>
</span></li>
                        <li><span class='wplc_header_vh wplc_headerspan_a'><?php 
            _e("Action", "wplivechat");
            ?>
</span></li>
                    </ul>
                    <ul id='wplc_chat_ul'>


                    </ul>
                        <p>
            <?php 
            _e("With the Pro add-on of WP Live Chat Support, you can", "wplivechat");
            ?>
 
            <a href="http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=initiate1" title="<?php 
            _e("see who's online and initiate chats", "wplivechat");
            ?>
" target=\"_BLANK\">
               <?php 
            _e("initiate chats", "wplivechat");
            ?>
            </a> <?php 
            _e("with your online visitors with the click of a button.", "wplivechat");
            ?>
 
            <a href="http://www.wp-livechat.com/purchase-pro/?utm_source=plugin&utm_medium=link&utm_campaign=initiate2" title="<?php 
            _e("Buy the Pro add-on now.", "wplivechat");
            ?>
" target=\"_BLANK\">
               <strong>
                   <?php 
            _e("Buy the Pro add-on now.", "wplivechat");
            ?>
               </strong>
            </a>
            </p>
                    </div>

                </div>
                
            </div>
            
            
          

            <?php 
        } else {
            if ($_GET['action'] == 'ac') {
                wplc_change_chat_status(sanitize_text_field($_GET['cid']), 3);
                if (function_exists('wplc_ma_register')) {
                    wplc_ma_update_agent_id(sanitize_text_field($_GET['cid']), sanitize_text_field($_GET['agent_id']));
                }
                if (function_exists("wplc_register_pro_version")) {
                    wplc_pro_draw_chat_area(sanitize_text_field($_GET['cid']));
                } else {
                    wplc_draw_chat_area(sanitize_text_field($_GET['cid']));
                }
            }
        }
    }
}
function wplc_admin_menu_layout_display()
{
    $wplc_current_user = get_current_user_id();
    if (get_user_meta($wplc_current_user, 'wplc_ma_agent', true)) {
        /*
         -- modified in in 6.0.04 --
        
         if(current_user_can('wplc_ma_agent') || current_user_can('manage_options')){   
        */
        do_action("wplc_hook_admin_menu_layout_display_top");
        wplc_stats("chat_dashboard");
        global $wplc_basic_plugin_url;
        if (!isset($_GET['action'])) {
            ?>
        <style>
          #wplc-support-tabs a.wplc-support-link {
            background: url('<?php 
            echo $wplc_basic_plugin_url;
            ?>
/images/support.png');
            right: 0px;
            top: 250px;
            height: 108px;
            width: 45px;
            margin: 0;
            padding: 0;
            position: fixed;
            z-index: 9999;
            display:block;
          }
        </style>

            <div id="wplc-support-tabs">
                <a class="wplc-support-link wplc-rotate" href="?page=wplivechat-menu-support-page"></a>
            </div>
            <div class='wplc_page_title'>
                <h1><?php 
            _e("Chat Dashboard", "wplivechat");
            ?>
</h1>
                <?php 
            wplc_first_time_tutorial();
            ?>

                <p><?php 
            _e("Please note: This window must be open in order to receive new chat notifications.", "wplivechat");
            ?>
</p>
            </div>
            
            <div id="wplc_sound"></div>
            <?php 
            do_action("wplc_hook_chat_dashboard_above");
            ?>

            <div id="wplc_admin_chat_holder">
                <div id='wplc_admin_chat_info_new'>
                    <div class='wplc_chat_vis_count_box'>
                        <?php 
            do_action("wplc_hook_chat_dahsboard_visitors_online_top");
            ?>
                        <span class='wplc_vis_online'>0</span>
                        <span style='text-transform:uppercase;'>
                            <?php 
            _e("Visitors online", "wplivechat");
            ?>
                        </span>
                        <?php 
            echo apply_filters("wplc_filter_chat_dahsboard_visitors_online_bottom", "");
            ?>

                        
                    </div>
                    
                </div>
                
                <div id="wplc_admin_chat_area_new">
                    <div style="display:block;padding:10px;">
                    <ul class='wplc_chat_ul_header'>
                        <li><span class='wplc_header_vh wplc_headerspan_v'><?php 
            _e("Visitor", "wplivechat");
            ?>
</span></li>
                        <li><span class='wplc_header_vh wplc_headerspan_t'><?php 
            _e("Time", "wplivechat");
            ?>
</span></li>
                        <li><span class='wplc_header_vh wplc_headerspan_nr'><?php 
            _e("Type", "wplivechat");
            ?>
</span></li>
                        <li><span class='wplc_header_vh wplc_headerspan_d'><?php 
            _e("Data", "wplivechat");
            ?>
</span></li>
                        <li><span class='wplc_header_vh wplc_headerspan_s'><?php 
            _e("Status", "wplivechat");
            ?>
</span></li>
                        <li><span class='wplc_header_vh wplc_headerspan_a'><?php 
            _e("Action", "wplivechat");
            ?>
</span></li>
                    </ul>
                    <ul id='wplc_chat_ul'>
                    </ul>
                    <br />
                    <hr />
                    <?php 
            do_action("wplc_hook_chat_dashboard_bottom");
            ?>
    
                    </div>

                </div>
                
            </div>
            
            
          

            <?php 
        } else {
            if (isset($_GET['aid'])) {
                $aid = $_GET['aid'];
            } else {
                $aid = null;
            }
            do_action("wplc_hook_admin_menu_layout_display_1", $_GET['action'], $_GET['cid'], $aid);
            if (!is_null($aid)) {
                do_action("wplc_hook_update_agent_id", $_GET['cid'], $aid);
            }
            do_action("wplc_hook_admin_menu_layout_display_1", $_GET['action'], $_GET['cid'], $aid);
            if ($_GET['action'] == 'ac') {
                do_action('wplc_hook_accept_chat', $_GET, $aid);
            }
            do_action("wplc_hook_admin_menu_layout_display", $_GET['action'], $_GET['cid'], $aid);
        }
    } else {
        ?>

      <h1><?php 
        _e("Chat Dashboard", "wplivechat");
        ?>
</h1>
      <div id="welcome-panel" class="welcome-panel">
        <div class="welcome-panel-content">
          <h2><?php 
        _e("Oh no!", "wplivechat");
        ?>
</h2>
          <p class="about-description">
            <?php 
        _e("You do not have access to this page as <strong>you are not a chat agent</strong>.", "wplivechat");
        ?>
          </p>
          <p>Users with access to this page are as follows:</p>
          <p>
            <?php 
        $user_array = get_users(array('meta_key' => 'wplc_ma_agent'));
        echo "<ol>";
        if ($user_array) {
            foreach ($user_array as $user) {
                echo "<li> " . $user->display_name . " (ID: " . $user->ID . ")</li>";
            }
        }
        echo "</ol>";
        ?>
          </p>
        </div>
      </div>
      <?php 
    }
}