added IE support

use Object.prototype.toString instead of window.toString.