}
    }
}
require "../../init.php";
session_start();
if (!isset($chat_settings)) {
    $result2 = mysql_query("SELECT * FROM `chat_settings`");
    while ($row = mysql_fetch_array($result2)) {
        $chat_settings[$row[0]] = $row[1];
    }
}
require "chatSession.php";
$chat_session = new chatSession();
$chat_session->useSession($_POST["session"]);
$departments = $chat_session->getDepartments();
$env = $chat_session->getEnvironment();
$chat_session->setActive("2");
if (!empty($_SESSION["uid"])) {
    $uid = $_SESSION["uid"];
    $utype = 1;
} else {
    $uid = 0;
    $utype = 0;
}
$result = mysql_query("SELECT * FROM `chat_conversations` WHERE `session`='" . mysql_real_escape_string($_POST["session"]) . "' ORDER BY `order`, `timestamp` ASC;");
$run = false;
while ($row = mysql_fetch_array($result)) {
    $run = true;
    $lastCount = $row["order"];
}
if ($run) {