get index of the next existing array element
tag - tag of array (AR_LONG or AR_STR)
id - array id
idx - index of the current element
returns: -1 - no more array elements
otherwise returns index of the next array element
long get_next_index(long tag, long id, long idx);