refactoring jquery.imagecover.js

rewritten with a better javascript style/code, fixed indentation and many scope problems.