some javascript functions