Added fix for trim image issue. New JS code to handle the -1 case of selection of ANY TRIM