Update iDb.js

put the currDoc Save Checking Code into a function