altered javascript auto query