<? global $vis_language;?>
<header class="header b-b b-light bg-w m-t-xxs clearfix">
<section class="row">
	<div class="col-md-12 m-b-n-xs">
	<div class="pull-left">
		<h3 class="m-b-none m-l-xs m-t-md text-black"><? echo $vis_language['TXTBLABS'];?></h3>
		<ul class="breadcrumb bg-empty no-border m-l-n-xs m-b-xxs">
			<li><a class="link" href="#/home/quick_view/<? echo $vis_language['TXTHOME']; ?>"><?echo $vis_language['TXTHOME'];?></a></li>
			<li><a class="link" href="#/blabber/view_blabs/<?echo $vis_language['TXTBLABS'];?>"><?echo $vis_language['TXTBLABS'];?></a></li>
			<?php if(isset($staffView)): ?>
			<li class="active"><? echo $staffView[0]['initials']." ".$staffView[0]['first_name']." ".$staffView[0]['last_name']; ?></li>
			<?php else: ?>
			<li class="active"><? echo $searchFor; ?></li>
			<?php endif; ?>
		</ul>
	</div>
	<div class="m-t-md col-xs-6 pull-right">
		<a class="btn btn-sm btn-primary btn-rounded pull-right m-l" href="javascript:void(0)"  data-toggle="ajaxModal" data-modal-arguments="vis_module=blabber&vis_operation=add_new_blab&cache=true"><i class="vh vh-plus"></i><? echo " ".$vis_language['TXTADD']; ?></a> 	<div class="input-group b-a b-2x rounded">
			<input class="form-control rounded input-sm no-border" type="text" placeholder="<?php echo $vis_language['TXTSEARCHBLABS']."...";?>" id="search_blab">
			<span class="input-group-btn rounded b-l b-3x">
			<button class="btn btn-sm btn-rounded bg-white b-white btn-icon" type="submit" onclick="display_blabs();">
			<i class="vh vh-search"></i>
			</button>
			</span>
		</div>
	</div>
	</div>
</section>
</header>
<?php if($trends!=-1): ?>
<div class="wrapper pull-right m-r-n">
	<dl class="dl-horizontal text-primary">
		<dt class="h5 font-bold l-h text-muted"><? echo $vis_language['TXTTRENDS']; ?></dt>
		<dd class="m-r-xs l-h">
			<em>
			<? for($i=0;$i<count($trends);$i++) {
                echo '<a href="#/blabber/view_trend_blab/'.$trends[$i]['trend'].'"><span class="m-r-xs link" onclick="$(\'#vis_blabber_container\').visExecution(\'load_module\', \''.trim($trends[$i]['trend']).'\', {\'vis_module\':\'blabber\', \'vis_operation\':\'view_trend_blab\', \'vis_trend\':\''.trim($trends[$i]['trend']).'\', \'vis_action\':\'load\'})" style="cursor:pointer;">'.trim($trends[$i]['trend']).'</span> </a>';
            } ?>
			</em>
		</dd>
	</dl>
</div>
<?php endif; ?>
<? if($blabs!=-1) { ?>
<section class="wrapper">
<section class="chat-list">
	 <div id="<?= $area ?>"> <?
		include(VIS_PATH_TEMPLATE.'blab_list.php'); ?>
	</div>
</section>
</section>
<? } else { echo '<section class="wrapper fullFrame b-light"><div class="fullMiddle">'.$vis_language['TXTNOTHINGTODISPLAY'].'</div></section>';}?>
<script>
	$('#search_blab').keyup(function(e){
    if(e.keyCode == 13)
    {
        var search_string = $("#search_blab").val();
		if(search_string.length < 3)
				$("#vis_global_msg_div").visInterface("load_global_message", "<? echo $vis_language['TXTGLOBALSEARCHERROR'];?>");
		else
        $.post("index.php?vis_module=blabber&vis_operation=view_blabs&vis_tmpst="+new Date().getTime(), { 'vis_action':'no_load','criteria': search_string }, function(data) {
            $("#search_blab").parent().addClass('open');
            $('#<?= $area ?>').show().html(data);
        });
    }
});
	function display_blabs()
    {
		var blab = $('#search_blab').val();
		if(blab.length < 3)
				$("#vis_global_msg_div").visInterface("load_global_message", "<? echo $vis_language['TXTGLOBALSEARCHERROR'];?>");
		else
		$('#<?= $area ?>').visExecution('load_module',blab, {'vis_module':'blabber', 'vis_operation':'view_blabs', 'vis_action':'no_load','criteria':blab});
	}
</script>
