function get_popup($href, $message, $title, $wndName, $options, $realHref = false)
{
    $title_string = !empty($title) ? "title=\"{$title}\" " : "";
    $popup = get_popup_onclick($href, $wndName, $options);
    $linkHref = $realHref ? $href : '#';
    return "<a href=\"{$linkHref}\" target=\"_blank\" {$title_string} onclick=\"{$popup}\">{$message}</a>";
}
	
	
	 
    
	if(!session_id()) {
		session_start();
	}
	
	$theme = verify_param("theme", "/^\w+$/", "default");
	$isSecure = verify_param("issecure", "/^\d+$/", 0) == 1;
	$location = get_app_location(true, $isSecure);
	
	$lang = Resources::getCurrentLocale();
	
	$link = $location."/client.php?theme=$theme".(!empty($lang) ? "&lang=".$lang : "");
	$temp = get_popup_onclick($link, "webim_".getWindowNameSuffix(), "toolbar=0, scrollbars=0, location=0, menubar=0, width=528, height=456, resizable=1", true);
	// папка online в мэмкэш --------------------
	//$operators = Operator::getInstance()->getOnlineOperatorsFromFiles();
	$operators = Operator::getInstance()->getOnlineOperatorsFromMemBuff();
	$operators_count = count($operators);
	
	$no_operators = false;
	if($operators_count == 0) {
	  $no_operators = true;
	}
	
	if(!isset($_COOKIE[WEBIM_COOKIE_VISITOR_IN_CHAT])) {
	   $visitor = GetVisitorFromRequestAndSetCookie();
       $thread = MapperFactory::getMapper("Thread")->getActiveThreadForVisitor($visitor['id']);
       if(!empty($thread)) {
         $res = true;