array_push($USER->Browsers, new VisitorChat($USER->UserId, $USER->UserId . "_OVL"));
array_push($USER->Browsers, $BROWSER);
$GroupBuilder = new GroupBuilder($INTERNAL, $GROUPS, $CONFIG, $USER->Browsers[0]->DesiredChatGroup, $USER->Browsers[0]->DesiredChatPartner, false);
$GroupBuilder->Generate(null, true);
$USER->Browsers[0]->Overlay = true;
$USER->Browsers[0]->Load();
if ($USER->Browsers[0]->FirstCall) {
    $USER->AddFunctionCall("lz_chat_init_data_change(null,null);", false);
}
if (IS_FILTERED) {
    $USER->Browsers[0]->CloseChat();
    $USER->Browsers[0]->Destroy();
    $USER->AddFunctionCall("lz_tracking_remove_overlay_chat();", true);
}
$USER->Browsers[0]->LoadForward(false);
$USER->LoadChatRequests();
if (!empty($USER->Browsers[0]->Forward) && (!$GROUPS[$USER->Browsers[0]->Forward->TargetGroupId]->IsHumanAvailable(true, true) || !empty($USER->Browsers[0]->Forward->TargetSessId) && @$INTERNAL[$USER->Browsers[0]->Forward->TargetSessId]->UserStatus >= USER_STATUS_OFFLINE)) {
    $USER->Browsers[0]->Forward->Destroy();
    $USER->Browsers[0]->Forward = null;
    $USER->Browsers[0]->ExternalClose();
    $USER->Browsers[0]->Save();
    $USER->Browsers[0]->Load();
}
if (!empty($_GET["tth"]) || $USER->IsInChat(true, $USER->Browsers[0]) || $openChatExternal) {
    define("IGNORE_WM", true);
}
if (defined("IGNORE_WM") && !empty($USER->Browsers[0]->DesiredChatPartner) && $INTERNAL[$USER->Browsers[0]->DesiredChatPartner]->IsBot) {
    $USER->Browsers[0]->DesiredChatPartner = "";
}
if (!empty($USER->Browsers[1]->ChatRequest) && $USER->Browsers[1]->ChatRequest->Closed && !$USER->Browsers[1]->ChatRequest->Accepted && @$INTERNAL[$USER->Browsers[1]->ChatRequest->SenderSystemId]->UserStatus < USER_STATUS_OFFLINE && $INTERNAL[$USER->Browsers[1]->ChatRequest->SenderSystemId]->IsExternal($GROUPS, null, array($USER->Browsers[1]->ChatRequest->SenderGroupId), true)) {
    $USER->Browsers[0]->DesiredChatPartner = $USER->Browsers[1]->ChatRequest->SenderSystemId;