fixed several js code warnings
improved overlay behaviour when no width is given.