Fixed javascript screen resizing bug