
function CustomPageImage(image, name, id) {
   this.Image = image;
   this.Name  = name;
   this.ID    = id;
}

function GetCustomPageImageById( PAGE_IMAGES, id ) {
   for ( var i = 0; i < PAGE_IMAGES.length; i++ ) {
      if ( PAGE_IMAGES[i].ID == id ) {
         return PAGE_IMAGES[i];
      }
   }
   return null;
}

function SortCustomPageImagesByName( PAGE_IMAGES ) {
   
   function ImageSort( a, b ) {
      return a.Name.toLowerCase() < b.Name.toLowerCase() ? -1 : a.Name.toLowerCase() > b.Name.toLowerCase() ? 1 : 0;
   }
   return PAGE_IMAGES.sort( ImageSort );

}

