<? global $vis_language; ?>
<? if(!$criteria): ?>
<section class="vbox fadeInRight">
	<section class="scrollable">
		<form class="input-s-lg m-t-md m-b-xs clearfix center-block" role="search">
		<div class="form-group m-t-xs m-b-md">
			<input class="form-control input-sm" type="text" placeholder="<?php echo $vis_language['TXTSEARCHSTAFF']."..."; ?>" id="search_staff" onkeyup="display_staff();"> 
		</div>
		</form>
<? endif; ?>	
	<? if($staff!=-1 && $staff[0]!=''): ?>	
		<div id="staff_list">
			<ul class="list-group auto no-radius m-b-none m-t-n-xxs list-group-lg">
			<? for($i=0;$i<count($staff);$i++){ ?>
			<li class="list-group-item">
    <a href="#/blabber/view_staff_blab/<? echo $staff[$i]['first_name'].' '.$staff[$i]['last_name'].'/'.$staff[$i]['staff_id']?>">
   <? if($staff[$i]['image_name']=='' || $staff[$i]['image_name']=='default.jpg'){?>
   <div class="l-avatar pull-left m-r-sm">
   <? if($staff[$i]['first_name']!=''){
				$firstname=preg_split('//u', $staff[$i]['first_name'], -1, PREG_SPLIT_NO_EMPTY);
$lastname=preg_split('//u', $staff[$i]['last_name'], -1, PREG_SPLIT_NO_EMPTY);
				?>
   <div class="sm"><? echo ucfirst($firstname[0]).ucfirst($lastname[0]);?></div>
    <? }else{ ?>
    <img width="36" class="img-circle sm" src="<?= VIS_PATH_PROFILE.'default.jpg';?>">
    <? }?>
    
		    </div>
      <? }else{?>
			<div class="l-avatar pull-left m-r-sm">
									<img src="<? echo VIS_PATH_PROFILE.$staff[$i]['image_name']; ?>" title="<? echo $staff[$i]['first_name'].' '.$staff[$i]['last_name'];?>" width="36" class="img-circle sm"/>
		    </div>
      
      <? }?>
      </a>
				<!--<a href="#/blabber/view_staff_blab/<? //echo $staff[$i]['first_name'].' '.$staff[$i]['last_name'].'/'.$staff[$i]['staff_id']?>" class="thumb-sm pull-left m-r-sm">	
					<img src="<? //echo VIS_PATH_PROFILE.($staff[$i]['image_name']==''?'default.jpg':$staff[$i]['image_name']); ?>" title="<? //echo $staff[$i]['first_name'].' '.$staff[$i]['last_name'];?>" width="36" class="img-circle"/>
				</a>-->
				<a href="#/blabber/view_staff_blab/<? echo $staff[$i]['first_name'].' '.$staff[$i]['last_name'].'/'.$staff[$i]['staff_id']?>" class="clear text-ellipsis">
					<strong class="block"><? echo $staff[$i]['first_name'].' '.$staff[$i]['last_name']; ?></strong>
					<small><? if($staff[$i]['job_title']) { echo $staff[$i]['job_title']; if($staff[$i]['job_title']!='' && $staff[$i]['office_name']!='') echo ', '; echo $staff[$i]['office_name']; } else{ echo '<br>'; }?></small>
				</a>
			</li>								
			<? }?>
			</ul>
		</div>
	<? else: ?>
	<? echo "<div class='m'>".$vis_language['TXTNOMATCHFOUND']."</div>"; ?>
	<? endif; ?>
	<? if(!$criteria): ?>
	</section>
	</section>
	<? endif; ?>
<script>
	function display_staff()
	{
		if($('#search_staff'))
		{
			var staff = $('#search_staff').val();
			$('#staff_list').visExecution('load_area', {'vis_module':'blabber', 'vis_operation':'add_staff', 'vis_action':'no_load','criteria':staff});
		}
	}
</script>	