epedev-203, epedev-340

change file and thumbnail form field from type file to type
managed_file, this allow drupal to clean up temporary/orphan file
change how javascript setting is attached to the form with after_build
function, this prevent losing setting variable if there is a form error
(but only for the 1st time)
adjust javascript to show thumbnail field if there is a form error but
user already attach a non image resource file to the form