<?php require_once './utility/texteditor_utility.php';?>
<?php
$req = $_POST['List'];
if(empty($req)){
		$req ="Add";
}
$ctrl_name = BASE_URL."/members";
$page_name = BASE_URL."/members/".$req;
$num = $cnt;
?>
<style>
		.black_overlay{
			display: none;
			position:fixed;
			top: 0%;
			left: 0%;
			width: 100%;
			height: 100%;
			background-color: black;
			z-index:1001;
			-moz-opacity: 0.7;
			opacity:.70;
			filter: alpha(opacity=70);
		}
		.white_content {
			display: none;
			position:fixed;
			top: 30%;
			left: 32%;
			width: 470px;
			height: 600px;
			z-index:1002;
			overflow: auto;
		}
</style>
<h1 class="page-header"><?php echo $_REQUEST["List"]?> Member</h1>          
<div class="bs-example table-responsive">
	<table align="center" width="100%" border="0">    	
    	 <?php if(!empty($error_msg)) {?>     
            <tr>
                <td align="center">  
                  <div class="col-lg-8 alert alert-danger" style="clear:right">
                    <?php echo $error_msg;?>
                 </div>             
                </td>
             </tr>   
			 
         <?php } ?> 
		 	<tr>
                <td align="center">  
                  <div style="clear:right" align="right">
                   <button value="AddRecord" type="button" name="AddButton" class="btn btn-primary" onclick="location.href='<?php echo BASE_URL?>/members/index'">Back to Members</button>
                 </div>             
                </td>
             </tr>   
        <tr>
        	<td align="center">       
             <div class="col-lg-8">
             <div class="well">
                  <form name="frm" id="frm" method="post" class="bs-example form-horizontal" enctype="multipart/form-data"  onsubmit="return checkvalid()">
                    <fieldset>                  
                      <div class="form-group">
                          <label class="col-lg-3 control-label" for="name">Select File</label>
                        <div class="col-lg-8">
                          <input type="file" name="ufile" id="ufile">
						  <br />
						  <a href="../static/uploadfiles/members_import/DataElementsJPC-test.xls">Example xls file</a>
                        </div>
                      </div>
					  
                  
                      <div class="form-group">
                        <div class="col-lg-8 col-lg-offset-1">                    
                          <button class="btn btn-primary" name="Submit" type="submit" value="Submit">Submit</button>&nbsp; <button class="btn btn-primary" name="Cancel" type="button" value="Cancel" onclick="location.href='<?php echo BASE_URL?>/members/index'">Cancel</button>
                        </div>
                      </div>
                    </fieldset>
                  </form>
            </div>
          </div>
            </td>
        </tr>
    </table>
</div>
<script type="text/javascript">
function checkvalid(){
	if(document.frm.ufile.value==''){
		alert("Please select file to Import");
		return false;
	}
	var type = GetExt(document.frm.ufile.value);		
				var validExt = ".xls";
				type = type.toLowerCase();
				var pos = validExt.indexOf(type)
				if(pos > 0)
				{
					
				}
				else
				{
					  alert(".xls Files are valid for \"File \", Please Browse Another Valid File") ;
					  document.frm.ufile.focus();
					  return false;
				}
}
function GetExt(str) 
{
		var limage_name =str.split("\\");	 
	   var arr = limage_name[limage_name.length -1].split(".");
	   return arr[arr.length-1];	  
}
</script>