$consulta=str_replace("{condicion}","id_tipo_instancia='3'",$sql);
				$chats=buscarcontactos("contar",$consulta,0);
				if($mayorchat<$chats){
					$mayorchat=$chats;
					$mayorchat1=$ids[$x];
				}
				
				$consulta=str_replace("{condicion}","id_tipo_instancia='2'",$sql);
				$mails=buscarcontactos("contar",$consulta,0);
				if($mayormail<$mails){
					$mayormail=$mails;
					$mayormail1=$ids[$x];
				}
				
				$consulta=str_replace("{condicion}","id_tipo_instancia='1'",$sql);
				$calls=buscarcontactos("contar",$consulta,0);
				if($mayorcall<$calls){
					$mayorcall=$calls;
					$mayorcall1=$ids[$x];
				}
				
				/*$consulta=str_replace("{condicion}","id_type='19'",$sql);
				$consulta=str_replace("id_tipo_instancia","id_type",$consulta);
				$refunds=buscarcontactos("contar",$consulta,0);
				
				if($mayorrefund<$refunds){
					$mayorrefund=$refunds;
					$mayorrefund1=$ids[$x];
				}*/
				
				$total=$chats+$mails+$calls;
                    <br><br>Email: <input type="radio" name="buscarpor" value="mail"><input type="text" name="email">
                    
                    
                    <br><br>
                    Agent: <input type="radio" name="buscarpor" value="agent">
                    <select name="agents"> 
					<?php
                    	buscarcontactos("agents","SELECT id_usuario AS id, nombre AS nombre FROM usuario WHERE estado='1'",0);
					?> 
                    </select>
                    
                    <br><br>
                    Team: <input type="radio" name="buscarpor" value="team">
                    <select name="teams"> 
					<?php
                    	buscarcontactos("teams","SELECT id_team AS id, team AS nombre FROM teams ",0);
					?> 
                    </select>
                    
                    <br><br>
                    All reports: <input type="radio" name="buscarpor" value="todos" checked="checked"a>
                    
                    <br><input type="submit" value="     Buscar     ">
                    </form>
                    
	</td>
	</tr>
</table>
                        </td>
                        
                        <!--tercer columna xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -->