common javascript code