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

$WUserID = $_SESSION['Sess_UserId'];
$WUsername = $_SESSION['Sess_UserName'];

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

	if (jQuery("#albumname").val() == "")
    {
      alert("Invalid Album Name!");
      jQuery("#albumname").focus();
      return false;
    }

	if ( ! jQuery("input").is(':checked') )
    {
      alert("Invalid Privacy Setting!");
      jQuery("input").focus();
      return false;
    }
	 	jQuery('#loading').show();
	 	jQuery('#right_loading_c').show();

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

   		jQuery.ajax({
   		type: "POST",
   		url: "gallery_submit.php",
   		data: str,
   		success: function(result){
		jQuery('#loading').hide();	
	 	jQuery('#right_loading_c').hide();
		if(result.indexOf("done") == 0) { 
		var jump = 'addgphoto.php?tab=media&';
		var hash = '#caddgphoto?tab=media&';
		} else {
		var jump = 'addalbum.php?tab=media&';
		var hash = '#caddalbum?tab=media&';
		}
		location.href=hash+result;
		jQuery.get(jump+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><div class="grey_12 pink_row_back solid_line_separator padding_5">Add Album</div></td>
        </tr>
        <tr>
          <td valign="top" width="100%"><div id="sub_content">
            <form id="add_album" name="add_album" method="post" style="padding:0; margin:0; border:0;">
              <input name="userid" type="hidden" value="<?=$WUserID?>" />
              <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 valign="top">Album&nbsp;Name:</td>
                                  <td valign="top"><input name="albumname" type="text" id="albumname" value="<?=$_REQUEST['albumname']?>" size="40" maxlength="250" /></td>
                                </tr>
                                <tr>
                                  <td valign="top">Description:</td>
                                  <td width="100%" valign="top"><textarea name="description" id="description" cols="40" rows="4" class="grey_12_xb"><?=$_REQUEST['description']?></textarea></td>
                                </tr>
                                <tr>
                                  <td valign="top">Privacy:</td>
                                  <td valign="top"><label><input name="privacy" type="radio" value="Public" <?php if($_REQUEST['privacy']=="Public"){ echo "checked";}?>/> Public</label> <label><input name="privacy" type="radio" value="Private" <?php if($_REQUEST['privacy']=="Private"){ echo "checked";}?>/> Private</label></td>
                                </tr>
                                <tr>
                                  <td valign="top">&nbsp;</td>
                                  <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="save" type="submit" class="button" id="save" value="Add Album"/>
                    <input name="cancel" type="button" class="button" id="cancel" value="Cancel" onclick="javascript: callpage('#cgalleries?tab=media');"/></td>
                </tr>
                <tr>
                  <td align="center">&nbsp;</td>
                </tr>
              </table>
            </form></div></td>
        </tr>
      </table></td>
  </tr>
</table>
