function move_elem_to(a, i, j) {
    if (i == j) return;
    //alert("moving " + i + " to " + j);
    var src = a[i];
    if (i < j) {
        // move elems from i+1 to j-1 up one
        for (var k=i; k < j-1; k++) a[k] = a[k+1];
        a[j-1] = src;
    } else {
        // move elems from j to i-1 down one
        for (var k=i; k > j; k--) a[k] = a[k-1];
        a[j] = src;
    }
}
// j=num_choices then the element is put at the end.
j=num_choices then the element is put at the end.
j = num_choices then the element is put at the end .
function move_elem_to(a, i, j) {
    if (i == j) return;
    var src = a[i];
    if (i < j) {
        for (var k=i; k < j-1; k++) a[k] = a[k+1];
        a[j-1] = src;
    } else {
        for (var k=i; k > j; k--) a[k] = a[k-1];
        a[j] = src;
    }
}
function move_elem_to ( a , i , j ) { if ( i == j ) return ; var src = a [ i ] ; if ( i < j ) { for ( var k = i ; k < j - 1 ; k ++ ) a [ k ] = a [ k + 1 ] ; a [ j - 1 ] = src ; } else { for ( var k = i ; k > j ; k -- ) a [ k ] = a [ k - 1 ] ; a [ j ] = src ; } }
j=num_choices then the element is put at the end.
j = num_choices then the element is put at the end .
//alert("moving " + i + " to " + j); // move elems from i+1 to j-1 up one // move elems from j to i-1 down one