<script type="text/javascript" src="{$relative_tpl}/js/jquery.album-0.1.js"></script>
<div id="content">
    <div class="left span-300">
    {include file='user_info.tpl'}
    </div>
    <div class="right span-650">
        <div id="upload_photo_form">
        <form name="uploadPhoto" id="uploadPhoto" method="post" action="{$relative}/album/edit/{$album.AID}">
        <div class="box">
            
            <div class="btitle"><h2>EDIT: {$album.name|upper|escape:'html'}</h2></div>
            <div class="blink">
                <div class="blinkr">
                      <a href="{$relative}/album/{$album.AID}/">Back to {$album.name|escape:'html'}</a> <strong>&middot;</strong>
                      <a href="{$relative}/album/addphotos/{$album.AID}">Add More Photos</a>
                </div>
                <div class="clear_right"></div>
            </div>
            <div class="upload_container">
                <div class="separator">
                    <label for="upload_album_name">Name:</label>
                    <input name="album_name" type="text" value="{$album.name}" id="upload_album_name" class="large" /><br />
                    <span id="album_name_error" style="display: none;">Please enter the album name!</span>
                </div>
                <div class="separator">
                    <label for="upload_album_category">Category:</label>
                    <select name="album_category" id="upload_album_category">
                    <option value="0"{if $album.category == ''} selected="selected"{/if}>-----</option>
                    {section name=i loop=$categories}
                    <option value="{$categories[i].CHID}"{if $album.category == $categories[i].CHID} selected="selected"{/if}>{$categories[i].name}</option>
                    {/section}
                    </select><br />
                    <span id="album_category_error" style="display: none;">Please select a category!</span>
                </div>
                <div class="separator">
                    <label for="upload_album_tags">Tags:</label>
                    <textarea name="album_tags" cols="45" id="upload_album_tags">{$album.tags}</textarea><br /><br />
                    <span id="album_tags_error" style="display: none;">Please enter the album tags!</span>
                </div>
                <div class="separator">
                    <label for="upload_album_type_public">Type:</label>
                    <input name="album_type" type="radio" value="public" id="upload_album_type_public" class="radio"{if $album.type == 'public'} checked="checked"{/if} />&nbsp;
                    Public (everybody can see this album)
                </div>
                <div class="separator">
                    <label for="upload_album_type_private">&nbsp;</label>
                    <input name="album_type" type="radio" value="private" id="upload_album_type_private" class="radio"{if $album.type == 'private'} checked="checked"{/if} />&nbsp;
                    Private (only you and your friends can see this album)
                </div>
            </div>            
            <br />
        </div>
        <div class="box">
            {if $photos}
            <br /><div class="blinkml"><strong>STEP 1</strong>: Click one of the photos below to choose a cover for this album:</div><div class="clear_left"></div><br />
            {section name=i loop=$photos}
            {if $smarty.section.i.index == '0'}
            <div class="photo_row">
            {/if}
            <div class="photo_box">
                <a href="{$relative}/photo/{$photos[i].PID}/"><img src="{$relative}/media/photos/tmb/{$photos[i].PID}.jpg" alt="{$photos[i].caption|escape:html}" width="150" id="album_photo_{$photos[i].PID}" /></a>
            </div>
            {if $smarty.section.i.index gt '0' && $smarty.section.i.index mod 4 == '3' && $smarty.section.i.index != $smarty.section.i.total-1}
            <div class="clear_left"></div>
            </div>
            <div class="photo_row">
            {/if}
            {if $smarty.section.i.index == $smarty.section.i.total-1}
                <div class="clear_left"></div>
                </div>
            {/if}
            {/section}
            <br /><div class="blinkml"><strong>STEP 2</strong>: Click and drag the photo below to position it correctly.</div><div class="clear_left"></div><br />
            <input name="x1" type="hidden" value="0" id="x1" />
            <input name="y1" type="hidden" value="0" id="y1" />
            <input name="x2" type="hidden" value="120" id="x2" />
            <input name="y2" type="hidden" value="140" id="y2" />
            <input name="width" type="hidden" value="120" id="width" />
            <input name="height" type="hidden" value="140" id="height" />
            <input name="photo" type="hidden" value="1" id="photo" />
            <input name="random" type="hidden" value="" id="random" />
            <br />
            &nbsp; <img src="{$relative}/media/photos/tmb/{$photos[0].PID}.jpg?{0|rand:100}" id="album_cover" class="album_cover" />
            <br /><br />                                                                        
            {else}
                <br />THIS ALBUM CONTAINS NO PHOTOS! CLICK <a href="{$relative}/album/addphotos/{$album.AID}">HERE</a> TO ADD PHOTOS!<br /><br />
            {/if}
        </div>
        <br />
        <input name="submit_album_edit" type="submit" value=" Save " class="button" />
        </form>
        </div>
    </div>
    <div class="clear"></div>
</div>
