// ***
// ***  Purpose: Javascript functions, used for Image Management,
// ***           for neatness.
// ***  Author:  Jarrod Oberto
// ***  Date:    17-02-08
// ***
// ***



// *** ________________________________________

  function displayImages(GalId)
  {
      //callAHAHStandard('ajax/diplayimg.php?id='+GalId,'DisplayHere', '<img src=\'site_images/anim.gif\'>');
      callAHAHStandardNested('ajax/diplayimg.php?id='+GalId,'DisplayHere', '<img src=\'site_images/anim.gif\'>', 'setInfoChkBox', GalId);
  }

// *** ________________________________________

  function getGallerySettings(GalId)
  {
      callAHAHStandard('ajax/getgalsettings.php?id='+GalId,'DisplayHere', '<img src=\'site_images/anim.gif\'>');  
  }

// *** ________________________________________

  function turnOnOffImg(obj)
  {
      var iValue = obj.value;

      if (obj.checked) {
          // *** show
          callAHAHStandard('ajax/processim.php?p=showhide&show=1&id='+iValue,'LoadingHere', '<img src=\'site_images/anim.gif\'>');  
      }else{
          // *** hide
          callAHAHStandard('ajax/processim.php?p=showhide&show=0&id='+iValue,'LoadingHere', '<img src=\'site_images/anim.gif\'>');  
      }
  }

  function setWeighting(weight, imgId)
  {
      var iId = imgId;
      var iWeight = weight.value;

      callAHAHStandard('ajax/processim.php?p=weight&weight='+iWeight+'&id='+iId,'LoadingHere', '<img src=\'site_images/anim.gif\'>');  
  }

  function setViews(views, imgId)
  {
      var iId = imgId;
      var iViews = views.value;

      callAHAHStandard('ajax/processim.php?p=views&views='+iViews+'&id='+iId,'LoadingHere', '<img src=\'site_images/anim.gif\'>');  
  }

// *** ________________________________________

  function deleteImg(imgId)
  {
      var iValue = imgId;

      var answer = confirm ("Are you sure you want to delete image (id " + iValue +")");
      if (answer == true) {
          callAHAHStandard('ajax/deleteimg.php?id='+iValue,'LoadingHere', '<img src=\'site_images/anim.gif\'>');   
      }else{

      }
}

// *** ________________________________________

  function setInfo(galId, obj, tag)
  {
      var iGalId  = galId;
      var iValue  = obj.value;
      var sAttrib = tag;
     
      if (obj.checked) {
          // *** show info 
          callAHAHStandard('ajax/processim.php?p=setinfo&galid='+iGalId+'&setting=y&setinfotag='+sAttrib,'LoadingHere', '<img src=\'site_images/anim.gif\'>');   
      }else{
          // *** hide info 
          callAHAHStandard('ajax/processim.php?p=setinfo&galid='+iGalId+'&setting=n&setinfotag='+sAttrib,'LoadingHere', '<img src=\'site_images/anim.gif\'>'); 
      }
  }

// *** ________________________________________






