Gallery item modal logic (fancybox); Cleared up main.js code