Fixing problems with single quotes and javascript