<master>
<property name=title>Change Photo Sequence</property>
<h2>Change Photo Sequence</h2>
@context_bar@
<hr>

To move a photo in your folder, select its title and click the
Up or Down arrow.  When you're done, click <i>Save Changes</i>.

<script language=javascript>

function up() {
    with (document.f.photos) {
        if (selectedIndex > 0) {
            var sel = selectedIndex;
            var selectedText = options[sel].text;
            var selectedValue = options[sel].value;
            options[sel].text = options[sel-1].text;
            options[sel].value = options[sel-1].value;
            options[sel-1].text = selectedText;
            options[sel-1].value = selectedValue;
            --selectedIndex;
        }
    }
}

function down() {
    with (document.f.photos) {
        if (selectedIndex >= 0 && selectedIndex < length - 1) {
            var sel = selectedIndex;
            var selectedText = options[sel].text;
            var selectedValue = options[sel].value;
            options[sel].text = options[sel+1].text;
            options[sel].value = options[sel+1].value;
            options[sel+1].text = selectedText;
            options[sel+1].value = selectedValue;
            ++selectedIndex;
        }
    }
}

function done() {
    var query = '';

    with (document.f.photos) {
        var i;
        for (i = 0; i < length; ++i)
            query += '&photo_id_list=' + options[i].value;
    }
    if (document.f.rename) {
	query += '&rename=' + document.f.rename.checked;
    }
    location.href = 'photos-reorder-2?folder_id=@folder_id@' + query;
}
</script>

<center>

<p>
<form name=f>
<table>
<tr><td rowspan=2>
<select name=photos size=10>
<multiple name="photos">
<option value=@photos.photo_id@>@photos.client_filename@</option>
</multiple>
</select>
</td>
<td align=center valign=middle><a href="javascript:up()"><img src="pics/up.gif" border=0></a></td>
</tr>
<tr>
<td align=center valign=middle><a href="javascript:down()"><img src="pics/down.gif" border=0></a></td>
</tr>
<if @default_prefix@ not eq ""><tr><td align=center><input type=checkbox name=rename>&nbsp;Apply default names</d></tr></if>
<tr><td align=center><input type=button value="Save Changes" onClick="done()"></td></tr>

</table>
</form>
</center>