added js for dynamic layout