Una observación:
Código PHP:
$(function() { //¿Porqué no le pones nombre a una función?//
<?php
while($intime= mysql_fetch_array($query5)) {
$n=$intime['nombre'];
$a=$intime['apellidos'];
$id=$intime['id'];
$quer=mysql_query("SELECT * FROM imagenes WHERE usuario = '$id' ORDER BY idfoto DESC");
$fetch=mysql_fetch_array($quer);
$img=$fetch["rutachat"];
$total= "$n $a";
$total.= "<input type=image src=\$img\>";
$elementos[]= '"'.$total.'"';
}
$arreglo= implode(", ", $elementos);//junta los valores del array en una sola cadena de texto
?>
var availableTags=new Array(<?php echo $arreglo; ?>);//imprime el arreglo dentro de un array de javascript
$( "#tags" ).autocomplete({
source: availableTags
});
});
<form action="recibe.php" method="post" class="style">
<input id="tags" name="tags" placeholder="Buscar" class="search" />
<input name="ir" type="submit" value="IR" id="ir" />
</form>