added dynamic width in case gallery
refactor js for version final of case page