<?php
include("includes/site_info.php");
include('session_handler.inc');

$WUserID = $_SESSION['Sess_UserId'];
$WUsername = $_SESSION['Sess_UserName'];
if ($_REQUEST['gid']) { $gid = $_REQUEST['gid']; }
else { $gid = 0; }

$galleryname_query=mysql_query("SELECT * FROM gallery WHERE mem_id = '$WUserID' and Gallery_ID = '$gid'") or die(mysql_error());
$galleryname_TOTAL = mysql_num_rows($galleryname_query);
if ($galleryname_TOTAL >0) {
	$galleryname=mysql_fetch_object($galleryname_query) or die(mysql_error());
} else {
?>

<div id="top_panel" class="grey_row_back">
  <?php include ("panel_top.php"); ?>
</div>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="5" class="white_back_t_xb">
        <tr>
          <td><div class="grey_12 pink_row_back solid_line_separator padding_5">Edit Album</div></td>
        </tr>
             <tr class="lightgrey_10">
              <td align="center"><a title="Add Album" href="#caddalbum?tab=media" onclick="javascript: callpage(this.href);" rel="subpage_link">Add Album</a> | <a href="#cgalleries?tab=media" onclick="javascript: callpage(this.href);">Back to Galleries</a></td>
            </tr>
        <tr>
          <td align="center"><div class="padding_10">Can't find a photo or album to edit.</div></td>
        </tr>
      </table></td>
  </tr>
</table>
<?php
	die;
}

?>
<div id="top_panel" class="grey_row_back">
  <?php include ("panel_top.php"); ?>
</div>
<script type="text/javascript">
jQuery(document).ready(function(){
    jQuery("#edit_delete").submit(function(){

	 	jQuery('#loading').show();
	 	jQuery('#right_loading_c').show();

	var str = 'Submit=edit_delete&' + jQuery(this).serialize();

   		jQuery.ajax({
   		type: "POST",
   		url: "gallery_submit.php",
   		data: str,
   		success: function(result){
		jQuery('#loading').hide();	
	 	jQuery('#right_loading_c').hide();
		location.href="#cgalleries?tab=media&"+result;
		jQuery.get('galleries.php?tab=media&'+result, function(data) {
 		jQuery("#main_content").fadeIn('slow');
 		jQuery('#main_content').html(data);
		});
		}

 });
return false;
    });
});
   </script>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="5" class="white_back_t_xb">
        <tr>
          <td colspan="2"><div class="grey_12 pink_row_back solid_line_separator padding_5">Edit Album -
              <?=$galleryname->Name?>
            </div></td>
        </tr>
        <tr>
          <td valign="top" class="right_side_menu_panel"><div style="width:80px; text-align:right;">
              <ul id="left-small-menu">
                <li><a href="#ceditgallery?tab=media&gid=<?=$gid?>" rel="subpage_link" onclick="javascript: callpage(this.href);">Edit&nbsp;Photos</a></li>
                <li><a href="#caddgphoto?tab=media&gid=<?=$gid?>" rel="subpage_link" onclick="javascript: callpage(this.href);">Add&nbsp;More</a></li>
                <li><a href="#ceditinfo?tab=media&gid=<?=$gid?>" rel="subpage_link" onclick="javascript: callpage(this.href);">Edit&nbsp;Info</a></li>
				<li><a href="#ceditdelete?tab=media&gid=<?=$gid?>" rel="subpage_link" class="current" onclick="javascript: callpage(this.href);">Delete</a></li>
              </ul>
			  </div>          </td>
          <td valign="top" width="100%"><div id="sub_content">
            <form id="edit_delete" name="edit_delete" method="post" style="padding:0; margin:0; border:0;">
              <input name="userid" type="hidden" value="<?=$WUserID?>" />
              <input name="gid" type="hidden" value="<?=$gid?>" />
              <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td><table width="100%" border="0" cellspacing="0" cellpadding="10">
                        <tr>
                          <td valign="top" align="left" width="100%">
                              <table width="100%" border="0" cellspacing="0" cellpadding="5" class="white_back_t_xb">
                                <tr>
                                  <td align="center" valign="top"><strong>Delete Album</strong></td>
                                </tr>
                                <tr>
                                  <td align="center" valign="top">Are you sure you want to delete "<strong><?=$galleryname->Name?></strong>"?</td>
                                </tr>
                                
                                <tr>
                                  <td valign="top">&nbsp;</td>
                                </tr>
                            </table>                            </td>
                        </tr>
                      </table>
                    <div class="left solid_line"><img src="images/spacer.gif" width="1" height="1" /></div>                  </td>
                </tr>
                <tr>
                  <td align="center"><input name="delete" type="submit" class="button" id="delete" value="Delete"/>
                    <input name="cancel" type="button" class="button" id="cancel" value="Cancel" onclick="javascript: callpage('#cgallery?tab=media&gid=<?=$gid?>');"/></td>
                </tr>
                <tr>
                  <td align="center">&nbsp;</td>
                </tr>
              </table>
            </form></div></td>
        </tr>
      </table></td>
  </tr>
</table>
