updated javascript to accomodate the new hidden fields