Small changes to decouple from window.document

Added some small changes, so that chosen does not rely on the select-element to be in the document when it's initialized.