working on js function for bg switching