Add fallback to element ID

If an element with matching "name" attribute is not found, look for one
with matching "id" attribute instead. If element is not an input, set
HTML content instead of value.

Makes it easier to use Floodling to fill non-inputs like divs and spans.
Merge branch 'Element-ID-fallback'
Replace else-ifs with switch

Seems a bit cleaner using switch statements. Also moved var statements
to top of functions.