misc javascript code