<script type="text/javascript">


function validate_gallery(){

	var slug_filter = /^[a-z0-9-]+$/ ;
		
	if($("#gallery_title").val()==''){
		$("#msg_gallery_title").html('Please enter gallerys title');
		$("#gallery_title").addClass('jquery_err');
		$("#gallery_title").focus();
		return false;
	}else{
		$("#msg_gallery_title").html('');
		$("#gallery_title").removeClass('jquery_err');
	}
		
	document.galleryFrm.submit();
}

</script>
<!-- Content (Right Column) -->

<div id="content" class="box">
  <h1>Image Gallery &raquo; Add Image</h1>
  <?php if(isset($successMsg) && $successMsg!=''){ ?>
  <p class="msg done"><?php echo $successMsg; ?></p>
  <?php } ?>
  <?php if(isset($failedMsg) && $failedMsg!=''){ ?>
  <p class="msg error"><?php echo $failedMsg; ?></p>
  <?php } ?>
  <form action="addgallery.php" method="post" id="galleryFrm" name="galleryFrm" enctype="multipart/form-data" >
    <?php if(isset($_REQUEST['gallery_id']) && $_REQUEST['gallery_id']!=''){ ?>
    <input type="hidden" id="gallery_id" name="gallery_id" value="<?php echo $gallerysDetail->gallery_id ?>" >
    <?php } ?>
    <!-- Login -->
    <fieldset>
    <legend>Image Gallery Details</legend>
    <p class="nomt">
      <label for="inp-01" class="req">Title :</label>
      <br />
      <input type="text" size="50" name="gallery_title" id="gallery_title" value="<?php echo $gallerysDetail->gallery_title; ?>" class="input-text-02" />
      <br/>
      <span class="smaller low message" id="msg_gallery_title">&nbsp;</span> </p>
    <p class="nomt">
      <label for="inp-01" class="req">Gallery Image :</label>
      <br />
      <input type="file" size="50"  name="gallery_banner" id="gallery_banner" class="input-text-02"   />
      <?php if($gallerysDetail->gallery_banner!='' && file_exists(DIR_UPLOAD_BANNER.$gallerysDetail->gallery_banner)) {?>
      <img src="<?php echo DIR_UPLOAD_BANNER_SHOW.$gallerysDetail->gallery_banner ?>" height="110" width="90"  />
      <input type="hidden" id="uploaded_file" name="uploaded_file" value="<?php echo $gallerysDetail->gallery_banner;  ?>" />
      <?php } ?>
      <br/>
      <span class="smaller low message" id="msg_gallery_banner">&nbsp;</span> </p>
      <p class="nomt">
      <label for="inp-01" class="req">Display On Banner Slider:</label>
      <br />
          <select id="on_sponcer" name="on_sponcer" class="input-text-02">
            <option value="1" selected="selected">Active</option>
            <option value="0" <?php if ($gallerysDetail->on_sponcer == 0) {echo 'selected="selected"';}?>>Inactive</option>
          </select>
      <br/>
    </p>
    <p class="nomt">
      <label for="inp-01" class="req">Display On Image Gallery:</label>
      <br />
          <select id="on_gallery" name="on_gallery" class="input-text-02">
            <option value="1" selected="selected">Active</option>
            <option value="0" <?php if ($gallerysDetail->on_gallery == 0) {echo 'selected="selected"';}?>>Inactive</option>
          </select>
      <br/>
    </p>
    <p class="nomt">
      <label for="inp-01" class="req">Display On Client Logo:</label>
      <br />
          <select id="on_client_logo" name="on_client_logo" class="input-text-02">
            <option value="1" selected="selected">Active</option>
            <option value="0" <?php if ($gallerysDetail->on_client_logo == 0) {echo 'selected="selected"';}?>>Inactive</option>
          </select>
      <br/>
    </p>
    
    <p class="nomb">
      <label for="inp-03" class="req">Status :</label>
      <br />
      <select id="gallery_status" name="gallery_status" class="input-text-02">
        <option value="0" <?php echo ($gallerysDetail->gallery_status==0) ? "selected='selected'" : "" ?>>Inactive</option>
        <option value="1" <?php echo (!isset($gallerysDetail->gallery_status) || $gallerysDetail->gallery_status==1) ? "selected='selected'" : "" ?>>Active</option>
      </select>
      <br/>
      <span class="smaller low message" id="msg_gallery_status">&nbsp;</span> </p>
    </fieldset>
    <?php if(isset($gallerysDetail->gallery_id) && $gallerysDetail->gallery_id!=''){ ?>
    <p>
      <input type="button" value="Edit gallery" id="submitPage" name="submitPage" class="input-submit" onclick="return validate_gallery();" />
    </p>
    <?php }else{ ?>
    <p>
      <input type="button" value="Add gallery" id="submitPage" name="submitPage" class="input-submit" onclick="return validate_gallery();" />
    </p>
    <?php } ?>
    
      <input type="button" value="Cancel" id="cancel" name="cancel" class="input-submit" onclick="javascript:window.location='gallerylist.php'" />
   
    <input type="hidden" id="hiddenSubmit" name="hiddenSubmit" value="submit" />
  </form>
</div>
<!-- /content -->
