Motion detector for Gallery switching Use AMD (requirejs) + Motion Detector ( thanks for mtschirs ) , most of functions are modulized , so it allow people easily to reuse the code