old function js