Also, you should change the following part of the code above from this:
if ((f.type=="text" && f.value=="") || (f.type=="checkbox" && f.value=="Off"))
To:
if (f.valueAsString==f.defaultValue)
Also, you should change the following part of the code above from this:
if ((f.type=="text" && f.value=="") || (f.type=="checkbox" && f.value=="Off"))
To:
if (f.valueAsString==f.defaultValue)