<script type="text/javascript">
function validate_nomination(){

	
	
	
	if($("#name").val()==''){
		$("#msg_nomination_error_message").html('Please enter name');
		$("#name").addClass('jquery_err');
		$("#name").focus();
		return false;
	}else{
		$("#msg_nomination_error_message").html('');
		$("#name").removeClass('jquery_err');
	}
	
	
	
}



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

<div id="content" class="box">
  <h1> Nomination &raquo; Add Nomination</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="" method="post" id="nominationFrm" name="nominationFrm" onsubmit="return validate_nomination();" enctype="multipart/form-data">
    <?php if(isset($_REQUEST['id']) && $_REQUEST['id']!=''){ ?>
    <input type="hidden" id="id" name="id" value="<?php echo $nominationDetail->id ?>" >
    <?php } ?>
    <!-- Login -->
    
    <p class="nomt"> <span class="smaller low message" id="msg_nomination_error_message" style="font-weight:bold;">&nbsp;</span> </p>
    <div id="tab01" class="eng_tab">
      <fieldset>
        <legend>Basic Details</legend>
        <p class="nomt">
          <label for="inp-01" class="req">Restaurant Name*:</label>
          <br />
          <select id="restaurant_id" name="restaurant_id" class="input-text-02">
            <?php foreach($restaurantList as $restaurant){ 
		   ?>
            <option value="<?php echo $restaurant->id;?>" <?php if($nominationDetail->restaurant_id == $restaurant->id){ echo 'selected="selected"';}?> ><?php echo  $restaurant->name;?> </option>
            <?php } ?>
          </select>
          <br/>
          <span class="smaller low message" id="msg_name">&nbsp;</span> </p>
        <p class="nomb">
          <label for="inp-03" class="req">Nomination By :</label>
          <br />
          <select id="user_id" name="user_id" class="input-text-02">
            <?php foreach($userList as $user){ 
		    $userType = ($user->type == 1) ? 'Listener' : 'Restaurant Owner';
			?>
            <option value="<?php echo $user->id;?>" <?php if($nominationDetail->user_id == $user->id){ echo 'selected="selected"';}?> ><?php echo  $user->name; echo " ( $userType )";?> </option>
            <?php } ?>
          </select>
          <br/>
          <span class="smaller low message" id="msg_status">&nbsp;</span> </p>
        <p class="nomb">
          <label for="inp-03" class="req">Category :</label>
          <br />
          <select id="category_id" name="category_id" class="input-text-02">
            <?php foreach($categoryList as $category){ 
		    ?>
            <option value="<?php echo $category->id;?>" <?php if($nominationDetail->category_id == $category->id){ echo 'selected="selected"';}?> ><?php echo  $category->name;;?> </option>
            <?php } ?>
          </select>
          <br/>
          <span class="smaller low message" id="msg_status">&nbsp;</span> </p>
        <p class="nomb">
          <label for="inp-03" class="req">Status :</label>
          <br />
          <select id="status" name="status" class="input-text-02">
            <option value="0" <?php echo ($nominationDetail->status==0) ? "selected='selected'" : "" ?>>Inactive</option>
            <option value="1" <?php echo (!isset($nominationDetail->status) || $nominationDetail->status==1) ? "selected='selected'" : "" ?>>Active</option>
          </select>
          <br/>
          <span class="smaller low message" id="msg_status">&nbsp;</span> </p>
      </fieldset>
    </div>
    <?php if(isset($nominationDetail->id) && $nominationDetail->id!=''){ ?>
    <p>
      <input type="submit" value="Edit nomination" id="submit" name="submit" class="input-submit" />
    </p>
    <?php }else{ ?>
    <p>
      <input type="submit" value="Add nomination" id="submit" name="submit" class="input-submit" />
    </p>
    <?php } ?>
    <input type="button" value="Cancel" id="cancel" name="cancel" class="input-submit" onclick="javascript:window.location='nominationlist.php'" />
  </form>
</div>
<!-- /content --> 
