<?php include("includes/head.php");?>
<?php 
$searchedQuery = "";
$searchedDept = "";
$searchedDeptFile = "";

if(!empty($_POST['searching']))
{
	if(!empty($_POST['department_id']) && !empty($_POST['file_id']))
	{
		$depts = $_POST['department_id'];
		$files = $_POST['file_id'];
		
		//--------------------------------
		$selQry_depts_src = "SELECT * FROM ".TBL_DEPARTMENTS." WHERE id='$depts'";
		$deptsSrcInfo =  $con->getSingleRow($selQry_depts_src, __FILE__,__LINE__);
		
		$selQry_files_src = "SELECT * FROM ".TBL_FILES." WHERE id='$files'";
		$filesSrcInfo =  $con->getSingleRow($selQry_files_src, __FILE__,__LINE__);
		
		$searchedDept = $deptsSrcInfo["name"];
		$searchedDeptFile = $filesSrcInfo["name"];
		//--------------------------------
		
		$searchedQuery = " AND ".TBL_STAKEHOLDERS_DEPTS_FILES.".dept_id IN(".$depts.") AND ".TBL_STAKEHOLDERS_DEPTS_FILES.".file_id IN(".$files.")";
	}
	elseif(!empty($_POST['department_id']))
	{
		$depts = $_POST['department_id'];
		$searchedQuery = " AND ".TBL_STAKEHOLDERS_DEPTS_FILES.".dept_id IN(".$depts.") ";
		
		//--------------------------------
		$selQry_depts_src = "SELECT * FROM ".TBL_DEPARTMENTS." WHERE id='$depts'";
		$deptsSrcInfo =  $con->getSingleRow($selQry_depts_src, __FILE__,__LINE__);
		
		$searchedDept = $deptsSrcInfo["name"];
		//--------------------------------
	}
	//----------------------------------------
	if(!empty($_POST['category_id']) && !empty($_POST['category_id']))
	{
		$cat = $_POST['category_id'];
		
		//--------------------------------
		$selQry_cats_src = "SELECT * FROM ".TBL_CATEGORIES." WHERE category_id='$cat'";
		$catsSrcInfo =  $con->getSingleRow($selQry_cats_src, __FILE__,__LINE__);
		
		$searchedCat = !empty($catsSrcInfo["category_title"])?$catsSrcInfo["category_title"]:'';
		//--------------------------------
		
		$searchedQuery .= " AND ".TBL_STAKEHOLDERS.".category_id='".$cat."' ";
	}
}
//-------------------------------
if(isset($_GET['mode']) && $_GET['mode']=='Priority')
{
	$searchedQuery .= " AND ".TBL_STAKEHOLDERS.".is_high_priority='1' ";
}
//echo $searchedQuery;
?>
<?php 
$selQuery_map_det = "SELECT 
		".TBL_STAKEHOLDERS.".id as sh_id,
		".TBL_STAKEHOLDERS.".abbreviation as name, 
		".TBL_STAKEHOLDERS.".sh_current_orientation,
		".TBL_MAPPINGS_DETAILS.".orientation_type,
		".TBL_MAPPINGS_DETAILS.".node_color,
		".TBL_MAPPINGS_DETAILS.".node_size,
		".TBL_MAPPINGS_DETAILS.".node_positionX,
		".TBL_MAPPINGS_DETAILS.".node_positionY,
		".TBL_MAPPINGS_DETAILS.".node_positionX2,
		".TBL_MAPPINGS_DETAILS.".node_positionY2,
		".TBL_MAPPINGS_DETAILS.".node_width,
		".TBL_MAPPINGS_DETAILS.".node_height,
		".TBL_MAPPINGS_DETAILS.".node_positionCX,
		".TBL_MAPPINGS_DETAILS.".node_positionCY,
		".TBL_MAPPINGS_DETAILS.".sh_svg_file,
		".TBL_MAPPINGS_DETAILS.".sh_json_data
	FROM  ".TBL_STAKEHOLDERS."
	INNER JOIN ".TBL_MAPPINGS_DETAILS." ON (".TBL_STAKEHOLDERS.".id=".TBL_MAPPINGS_DETAILS.".sh_id) 
	LEFT JOIN ".TBL_STAKEHOLDERS_DEPTS_FILES." ON (".TBL_STAKEHOLDERS.".id = ".TBL_STAKEHOLDERS_DEPTS_FILES.".stakerholder_id)
	WHERE orientation_type='C'
	$searchedQuery;";
$mapdetInfo = $con->getMultiRow($selQuery_map_det);		
?>
<link rel="stylesheet" type="text/css" href="scripts/raphael/css/styles.css">
<script type="text/javascript" src="scripts/raphael/js/js/bootstrap.min.js"></script>
<script type="text/javascript" src="scripts/raphael/js/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="scripts/raphael/js/main.js"></script>
<script type="text/javascript" src="scripts/raphael/js/raphael-min.js"></script>
<script type="text/javascript" src="scripts/raphael/js/raphael.js"></script>
<script type="text/javascript" src="scripts/raphael/js/helpers_svg_paths_multi.js"></script>
<script type="text/javascript" src="scripts/raphael/js/javascript-multi.js"></script>
<script>
$( document ).ready(function() {	
	
		<?php 
		$tot_mappingsInfo = count($mapdetInfo);
		if($tot_mappingsInfo > 0){
			for($md=0;$md<$tot_mappingsInfo;$md++)
			{
				?>				
				redrawNameSet('<?php echo isset($mapdetInfo[$md]['orientation_type'])?$mapdetInfo[$md]['orientation_type']:'';?>','<?php echo isset($mapdetInfo[$md]['name'])?$mapdetInfo[$md]['name']:'';?>','<?php echo isset($mapdetInfo[$md]['sh_id'])?$mapdetInfo[$md]['sh_id']:'';?>','<?php echo isset($mapdetInfo[$md]['node_color'])?$mapdetInfo[$md]['node_color']:'';?>','<?php echo isset($mapdetInfo[$md]['node_size'])?$mapdetInfo[$md]['node_size']:'';?>','<?php echo isset($mapdetInfo[$md]['id'])?$mapdetInfo[$md]['id']:'';?>','<?php echo isset($mapdetInfo[$md]['node_positionX'])?$mapdetInfo[$md]['node_positionX']:'';?>','<?php echo isset($mapdetInfo[$md]['node_positionY'])?$mapdetInfo[$md]['node_positionY']:'';?>','<?php echo isset($mapdetInfo[$md]['node_positionX2'])?$mapdetInfo[$md]['node_positionX2']:'';?>','<?php echo isset($mapdetInfo[$md]['node_positionY2'])?$mapdetInfo[$md]['node_positionY2']:'';?>','<?php echo isset($mapdetInfo[$md]['node_width'])?$mapdetInfo[$md]['node_width']:'';?>','<?php echo isset($mapdetInfo[$md]['node_height'])?$mapdetInfo[$md]['node_height']:'';?>','<?php echo isset($mapdetInfo[$md]['node_positionCX'])?$mapdetInfo[$md]['node_positionCX']:'';?>','<?php echo isset($mapdetInfo[$md]['node_positionCY'])?$mapdetInfo[$md]['node_positionCY']:'';?>','');			
				<?php 
			}
		}
		?>			
});
</script>

<style>
/*search box css start here*/
.search-sec {
	background: #1A4668;
	padding: 2rem;
	padding-left:1px;
}
.search-slt {
	display: block;
	width: 100%;
	font-size: 0.875rem;
	line-height: 1.5;
	color: #55595c;
	background-color: #fff;
	background-image: none;
	border: 1px solid #ccc;
	height: calc(3rem + 2px) !important;
	border-radius:0;
}
.wrn-btn {
	width: 100%;
	font-size: 14px;
	font-weight: 400;
	text-transform: capitalize;
	height: calc(3rem + 2px) !important;
	border-radius:0;
}
</style>

<body>
<!--[if lt IE 8]>
        <p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
        <![endif]-->
<!-- Header top area start-->
<?php include("includes/header.php");?>
<!-- Header top area end-->
<!-- Menu area start-->
<?php include("includes/navigation.php");?>
<!-- Menu area end-->
<!-- Data table area Start-->
<div class="admin-dashone-data-table-area mg-b-40" style="min-height:500px;">
  <div class="container">
    <div class="row">
      <div class="col-lg-12">
        <div class="row">
          <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12" style="width:110% !important;">
            <div class="tab-content view-mail-ov-mg-t-30">
              <div class="tab-pane fade in zoomInDown shadow-reset active">
                <div class="sparkline8-list shadow-reset">
                  <div class="sparkline8-hd">
                    <div class="main-sparkline8-hd">
                      <h1>Stakeholders Map</h1>
                      <div class="sparkline8-outline-icon"> <a href="dashboard.php">
                        <button class="btn btn-sm btn-danger login-submit-cs" type="button">Back to Dashboard</button>
                        </a>&nbsp; </div>
                    </div>
                  </div>
                  <div class="sparkline8-graph" style="height:1030px !important; margin-bottom:208px;">
                    <div class="container bootstrap snippet">
                      <div class="row">
                          <div id="searchFilter">
                            <section class="search-sec">
                              <div class="container">
                                <form action="#" method="post" novalidate="novalidate">
                                  <input type="hidden" name="searching" value="Y">
                                  <div class="row">
                                    <div class="col-lg-12">
                                      <div class="row">
                                        
                                        <div class="col-lg-3 col-md-3 col-sm-12 p-0">
                                          <select class="form-control search-slt" name="department_id" id="department_id">
                                            <option value="">Select Departments</option>
                                            <?php 
                                              $srno = 0;
                                                                              
                                              if($_SESSION['userGroupID']==1 or $_SESSION['userGroupID']==2){								  
                                                $selQry_depts = "SELECT * FROM ".TBL_DEPARTMENTS." ORDER BY name";
                                              }else{
                                                  $selQry_depts = "SELECT * FROM ".TBL_DEPARTMENTS." where status='1' and id IN(".$userDeptAccess.") ORDER BY name";
                                              }
                                              $deptsInfo =  $con->getMultiRow($selQry_depts, __FILE__,__LINE__);
                                              $totDeptsListings = count($deptsInfo);
                                                if($totDeptsListings>0)
                                                {
                                                    for($dept=0;$dept<$totDeptsListings;$dept++)
                                                    {
                                                        $srno++;
                                              //----------------------------------------
                                            ?>
                                            <option value="<?php echo $deptsInfo[$dept]['id'];?>" <?php if(!empty($_POST['department_id']) && $_POST['department_id']==$deptsInfo[$dept]['id']){?>selected <?php }?>><?php echo $deptsInfo[$dept]['name'];?></option>
                                            <?php }
                                            }?>
                                          </select>
                                        </div>
                                        <div class="col-lg-3 col-md-3 col-sm-12 p-0">
                                          <select class="form-control search-slt" name="file_id" id="file_id">
                                            <option value="">Select Files</option>
                                          </select>
                                        </div>                                        
                                        <div class="col-lg-3 col-md-2 col-sm-12 p-0">
                                          <select class="form-control search-slt" name="category_id" id="category_id">
                                            <option value="">Select Category</option>
                                            <?php 
                                              //--------------- Category Info ----------
                                              $srno = 0;
                                                                              
                                              $selQry_cats = "SELECT * FROM ".TBL_CATEGORIES." where status='1' ORDER BY category_title";
                                              $catsInfo =  $con->getMultiRow($selQry_cats, __FILE__,__LINE__);
                                              $totCatsListings = count($catsInfo);
                                                if($totCatsListings>0)
                                                {
                                                    for($cat=0;$cat<$totCatsListings;$cat++)
                                                    {
                                                        $srno++;
                                              //----------------------------------------
                                            ?>
                                            <option value="<?php echo $catsInfo[$cat]['category_id'];?>" <?php if(!empty($_POST['category_id']) && $_POST['category_id']==$catsInfo[$cat]['category_id']){?>selected <?php }?>><?php echo $catsInfo[$cat]['category_title'];?></option>
                                            <?php }
                                            }?>
                                          </select>
                                        </div>
                                        <div class="col-lg-1 col-md-2 col-sm-12 p-0">
                                          <button type="submit" class="btn btn-primary wrn-btn">Search</button>
                                        </div>
                                        <?php if(isset($_GET['mode']) && $_GET['mode']=='Priority'){?>
                                        <div class="col-lg-2 col-md-2 col-sm-12 p-0"> <a href="sh-map.php">
                                          <button type="button" class="btn btn-warning wrn-btn" >Clear Priority Filter</button>
                                          </a> </div>
                                        <?php }else{?>
                                        <div class="col-lg-2 col-md-2 col-sm-12 p-0"> <a href="sh-map.php?mode=Priority">
                                          <button type="button" class="btn btn-primary wrn-btn" >Priority Stakeholders</button>
                                          </a> </div>
                                        <?php }?>
                                        <!--<div class="col-lg-2 col-md-2 col-sm-12 p-0"> <a href="sh-overview.php?mode=Edit">
                                          <button type="button" class="btn btn-primary wrn-btn">Edit Mode</button>
                                          </a> </div>-->                                     
                                      </div>
                                    </div>
                                  </div>
                                </form>
                              </div>
                            </section>
                          </div>
                        </div>
                        <div class="row">
                          <div style="text-align:left; margin-left:50px;">
                            <ul>
                              <li type="circle" style="color:#FF0000;font-size: 1.2em; float:left; margin-left:25px;">Resistant</li>
                              <li type="circle" style="color:#FF9933;font-size: 1.2em;float:left;margin-left:25px;">Neutral</li>
                              <li type="circle" style="color:#00FF00;font-size: 1.2em;float:left;margin-left:25px;">Supportive</li>
                            </ul>
                          </div>                         
                          <div style="text-align:center; margin-top:30px;">
                            <h1><?php echo !empty($orgsInfo['name'])?$orgsInfo['name']:'';?>&nbsp;<?php echo !empty($searchedDept)?" - ".$searchedDept:'';?>&nbsp;<?php echo !empty($searchedDeptFile)?" - ".$searchedDeptFile:'';?>&nbsp;<?php echo !empty($searchedCat)?" - ".$searchedCat:'';?>
                            <?php if(!empty($_GET['mode']) && $_GET['mode']=='Priority'){echo " - Priority Stakeholders";}?>
                            </h1>
                          </div>
                      <div class="row" style="margin-top:5px;">
                        <div id="canvas"></div>
                        <div id="app_container">
                          <!--<embed id="svgFile" src="svgFile.svg" type="image/svg+xml" />-->
                          <span id="dot_tip" style="display: none;">Move the circle with your mouse into the right position.</span>
                          <form id="controls" class="ng-pristine ng-valid">
                            <!--<input for="addName" id="addName" name="addName" title="Add a new name to the grid" type="button" value="Add Name">-->
                            <!--<a href="#" id="ajax_test">
                          	<input for="generateImage" id="generateImage" name="generateImage" title="Save this diagram as an image" type="button" value="Save">
                          </a>-->
                            <!--&nbsp;
                          <a href="sh-mapping.php?ra=y"><input for="" id="rankAnotherSH" name="rankAnotherSH" title="Rank another" type="button" value="Rank Another"></a>-->
                            <input for="clear" id="clear" name="clear" title="Erase all names from the grid" type="button" value="Clear" style="display:none;">
                            <input type="hidden" name="curshid" id="curshid" value="">
                            <input type="hidden" name="lastshid" id="lastshid" value="">
                            <input type="hidden" name="name" id="shname" value="">
                            <input type="hidden" name="name" id="shid" value="">
                          </form>
                          <div class="addNameBoxVisable" id="addNameBox">
                            <form id="addNameForm" class="ng-pristine ng-valid" style="display: none;">
                              <div class="panel panel-info">
                                <div class="panel-heading">
                                  <div class="panel-title" id="formTtitle"></div>
                                  <div style="float:right; font-size: 85%; position: relative; top:-10px"></div>
                                </div>
                                <div class="panel-body">
                                  <div id="div_id_select" class="form-group required">
                                    <label for="id_select"  class="control-label col-md-4  requiredField"> Orientation<span class="asteriskField">*</span> </label>
                                    <div class="controls col-md-8 "  style="margin-bottom: 10px">
                                      <label class="radio-inline" style="color:#FF0000;">
                                      <input type="radio" name="strokeStyleSelect" id="strokeStyleSelect_red" value="red"  style="margin-bottom: 10px" checked>
                                      Resistant </label>
                                      <label class="radio-inline" style="color:#FF9900">
                                      <input type="radio" name="strokeStyleSelect" id="strokeStyleSelect_orange" value="orange"  style="margin-bottom: 10px">
                                      Neutral </label>
                                      <label class="radio-inline" style="color:#00CC33">
                                      <input type="radio" name="strokeStyleSelect" id="strokeStyleSelect_green" value="green"  style="margin-bottom: 10px">
                                      Supportive </label>
                                    </div>
                                  </div>
                                  <div id="div_id_As" class="form-group required">
                                    <label for="id_As"  class="control-label col-md-4  requiredField">Influence<span class="asteriskField">*</span> </label>
                                    <div class="controls col-md-8 "  style="margin-bottom: 10px">
                                      <label class="radio-inline">
                                      <input type="radio" name="strokeSizeSelect" id="strokeSizeSelect_2" value="10"  style="margin-bottom: 10px" checked>
                                      Low </label>
                                      <label class="radio-inline">
                                      <input type="radio" name="strokeSizeSelect" id="strokeSizeSelect_3" value="16"  style="margin-bottom: 10px">
                                      Medium </label>
                                      <label class="radio-inline">
                                      <input type="radio" name="strokeSizeSelect" id="strokeSizeSelect_10" value="20"  style="margin-bottom: 10px">
                                      High </label>
                                    </div>
                                  </div>
                                  <div class="form-group" style="margin-top:75px;">
                                    <div class="aab controls col-md-4 "></div>
                                    <div class="controls col-md-8 ">
                                      <input for="nameSubmit" id="nameSubmit" name="nameSubmit" type="submit" value="Add">
                                      <input for="nameCancel" id="nameCancel" name="nameCancel" type="button" value="Cancel">
                                    </div>
                                  </div>
                                </div>
                              </div>
                            </form>
                          </div>
                          <div class="editNameBoxVisable" id="editNameBox">
                            <form id="editNameForm" class="ng-pristine ng-valid">
                              <input for="newName" id="newName" maxlength="20" type="hidden" readonly>
                              <div class="panel panel-info" style="text-align:left !important;">
                                <div class="panel-heading">
                                  <div class="panel-title" id="formEditTtitle"></div>
                                  <div style="float:right; font-size: 85%; position: relative; top:-10px"></div>
                                </div>
                                <div class="panel-body">
                                  <div id="div_id_select" class="form-group required">
                                    <label for="id_select"  class="control-label col-md-4  requiredField"> Orientation<span class="asteriskField">*</span> </label>
                                    <div class="controls col-md-8 "  style="margin-bottom: 10px">
                                      <label class="radio-inline" style="color:#FF0000;">
                                      <input type="radio" name="newStrokeStyleSelect" id="newStrokeStyleSelect_red" value="red"  style="margin-bottom: 10px" checked>
                                      Resistant </label>
                                      <label class="radio-inline" style="color:#FF9900">
                                      <input type="radio" name="newStrokeStyleSelect" id="newStrokeStyleSelect_orange" value="orange"  style="margin-bottom: 10px">
                                      Neutral </label>
                                      <label class="radio-inline" style="color:#00CC33">
                                      <input type="radio" name="newStrokeStyleSelect" id="newStrokeStyleSelect_green" value="green"  style="margin-bottom: 10px">
                                      Supportive </label>
                                    </div>
                                  </div>
                                  <div id="div_id_As" class="form-group required">
                                    <label for="id_As"  class="control-label col-md-4  requiredField">Influence<span class="asteriskField">*</span> </label>
                                    <div class="controls col-md-8 "  style="margin-bottom: 10px">
                                      <label class="radio-inline">
                                      <input type="radio" name="strokeNewSizeSelect" id="strokeNewSizeSelect_2" value="10"  style="margin-bottom: 10px" checked>
                                      Low </label>
                                      <label class="radio-inline">
                                      <input type="radio" name="strokeNewSizeSelect" id="strokeNewSizeSelect_3" value="16"  style="margin-bottom: 10px">
                                      Medium </label>
                                      <label class="radio-inline">
                                      <input type="radio" name="strokeNewSizeSelect" id="strokeNewSizeSelect_10" value="20"  style="margin-bottom: 10px">
                                      High </label>
                                    </div>
                                  </div>
                                  <div class="form-group" style="margin-top:75px;">
                                    <div class="aab controls col-md-4 "></div>
                                    <div class="controls col-md-8 ">
                                      <input for="nameEdit" id="nameEdit" name="nameEdit" type="submit" value="OK">
                                      <input for="nameEditCancel" id="nameEditCancel" name="nameEditCancel" type="button" value="Cancel">
                                    </div>
                                  </div>
                                </div>
                              </div>
                            </form>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
</div>
<!-- Data table area End-->
<!-- Modal -->
<div class="modal fade" id="myModal" role="dialog">
  <div class="modal-dialog modal-lg">
    <!-- Modal content-->
    <div class="modal-content">
      <!--<div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">&times;</button>
                <h4 class="modal-title"></h4>
            </div>-->
      <div class="modal-body"> </div>
      <div class="modal-footer">
        <!--<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>-->
      </div>
    </div>
  </div>
</div>
<!-- Footer Start-->
<?php include("includes/footer.php");?>
<!-- Footer End-->
<!-- Data table area End-->
<script type="text/javascript" src="scripts/raphael/js/jquery_002.js"></script>
<script type="text/javascript" src="scripts/raphael/js/lozad.js"></script>
<script type="text/javascript" src="scripts/raphael/js/modernizr.js"></script>
<script type="text/javascript" src="scripts/raphael/js/PublicPromoRoundel.js"></script>
<script type="text/javascript" src="scripts/raphael/js/CrossBrowserLoader.js"></script>
<script type="text/javascript" src="scripts/raphael/js/Resizer.js"></script>
<script type="text/javascript" src="scripts/raphael/js/LazyLoader.js"></script>
<script type="text/javascript" src="scripts/raphael/js/GlobalNav.js"></script>
<script type="text/javascript" src="scripts/raphael/js/GlobalSearch.js"></script>
<script type="text/javascript" src="scripts/raphael/js/ComponentAccordion.js"></script>
<script type="text/javascript" src="scripts/raphael/js/ComponentAuthorship.js"></script>
<script type="text/javascript" src="scripts/raphael/js/PublicPlpMainpageCookieHandler.js"></script>
<script type="text/javascript" src="scripts/raphael/js/PublicMediaQueryNewsletterPanel.js"></script>
<script type="text/javascript" src="scripts/raphael/js/PublicCarousel.js"></script>
<script type="text/javascript" src="scripts/raphael/js/PublicPrint.js"></script>
<script type="text/javascript" src="scripts/raphael/js/PublicLogoSwitch.js"></script>
<script type="text/javascript" src="scripts/raphael/js/PublicMediaQueries.js"></script>
<script type="text/javascript" src="scripts/raphael/js/PublicMain.js"></script>
<!-- jquery
		============================================ -->
<script src="js/vendor/jquery-1.11.3.min.js"></script>
<!-- bootstrap JS
		============================================ -->
<script src="js/bootstrap.min.js"></script>
<!-- notification JS
		============================================ -->
<script src="js/Lobibox.js"></script>
<script src="js/notification-active.js"></script>
<!-- Tree Viewer JS
		============================================ -->
<script src="js/tree-line/jstree.min.js"></script>
<script src="js/tree-line/jstree.active.js"></script>
<script>
$(document).ready(function() {
	
	/*$(".modal").on("hidden.bs.modal", function() {
    	$(".modal-body").html("");//
  	});*/
	
	//department_id,file_id
	
	//------------------ Get Houses ------------
    $( "#department_id" ).change(function() 
      {  
        var did = $(this).val();
        $.ajax({
            url: "get-files-by-departments.php",
            type: 'POST',
            headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')},
            data: 'did=' + did,
            success: function(result){
							
                $('#file_id').html('');
                $('#file_id').append('<option value="">---Select Files---</option>');
				
				$.each( JSON.parse(result), function(key, value) { // or use data without  JSON.parse(data) 
					var k = value.file_id;
					var v = value.file_name;
					$('#file_id').append($('<option>', {value:k, text:v}));
				});
				
            },
            error: function()
            {
                 //handle errors
                 //alert('error...');
                 $('#file_id').html('');
                 $('#file_id').append('<option value="">---Select Files---</option>');
            }
        });

      });
      //----------------------------------------
  
} );
</script>
</body>
</html>
