Javascript common utilities