Minor code improvements of lib.js

1. Added cross-browser support for Array.prototype.indexOf function
   It gives an ability to new browsers perform better on array
   search operations, and provides a fallback to the browsers
   which lacks this function support
2. In all places declaration of vars moved to a single declaration blocks
   which is a good-practice
3. Improved addClass function. Now it will not produce unnecessary spaces
4. Improved removeClass function by using nativer indexOf function for
   browsers which do support it. Algorithm improved also, it now
   takes into account that className of an element could have same
   class name included several times, and as result removes all of them.