<?= $this->Html->css('multi-image-selector-with-tag-caption.css'); ?>
    <?= $this->Html->script('multi-image-selector-with-tag-caption.js'); ?>
<section class="content">
            <div class="col-md-12">
            <div class="submenu">
            <?php 
            echo $this->element('banners/menu/mainmenu'); ?>
                 </div>

               <div class="submenu">
            <?php 
            echo $this->element('banners/menu/pageBannersSubmenu'); ?>
                 </div>
                <div class="panel panel-default">
                    <div class="panel-body">
                
                       
                   


<div class="row">
  
<div class="row">
    <h4><center><b><?php echo $pageContentTitle; ?></b></center></h4>
</div>
        <hr class="hr-primary" />
        
    </div>
<!-- </?php echo $this->element('banners/sectionTopform'); ?> -->
<?php echo $this->element('banners/form'); ?>





</div>
              
            </div>
        </section>

       <script>
        function removeImage(str){
            // remove picture reference from the table and file from the server
            xhttp = new XMLHttpRequest();
            xhttp.onreadystatechange = function() {
                if (xhttp.readyState == 4 && xhttp.status == 200) {

                    // Sanitize all the json encodings make it a bare string : and ,
                    alert('deleted');
                    
                    var oldpicture = document.getElementById('image_div' + str);
                    oldpicture.parentNode.removeChild(oldpicture);
                }
            }
            xhttp.open("GET", "../removeNewsImage/"+str, true);
            xhttp.send();
        }
    </script>  
    
    <script>
        $(document).ready(function() {
              
           $('#imag').click();
        });
        
        function loadimages(){
            var str = $("#search_tag").val();
            var xhttp;
          if (str == "") {
            return;
          }
          xhttp = new XMLHttpRequest();
          xhttp.onreadystatechange = function() {
            if (xhttp.readyState == 4 && xhttp.status == 200) {
              
              // Sanitize all the json encodings make it a bare string : and ,
              var myresult = xhttp.responseText.replace(/"/gi,'');
              
              myresult = myresult.replace(/{/gi,'');
              myresult = myresult.replace(/}/gi,'');
              myresult = myresult.replace('[','');
              myresult = myresult.replace(']','');
              var mydata = myresult.split(',');
              
              var inneroptions = "";
              //alert('mydata');
              for (var region in mydata) {
                  if (mydata.hasOwnProperty(region)) {
                      var current = mydata[region].split(':');
                      current[1] = current[1].replace('\\','');
                      inneroptions = inneroptions + "<li><img width='95px' height='70px' class='search-thumb' onclick='updateSelected(this)' src='../img/" + current[1] + "' name='" + current[0] + "' /></li>";
                  }
                
                document.getElementById("my-images").innerHTML = inneroptions;
              }
            }
          }
          xhttp.open("GET", "getImages/"+str, true);
          xhttp.send();
        }
        
       
 $(document).ready(function () {
    $('#img')[0].click();  //$('#about').get(0).click();
});     
       
    </script> 