In most browsers, you can use document.evaluate() to pass an XPath expression, and get a result. In Internet Explorer, however, this method just doesn't work. No error message, no result, just some unexpected behavior in your application. Luckily, there's an easy solution that doesn't require you to rewrite your code, or implement some ugly if IE hacks.
The solution is called Wicked Good Xpath, and is an open source project maintained by Google. It's easy to use, and doesn't interfere with your existing code. You can find everything you need here.
Basically, all you have to do is download the .js file, and add it to your page through script tags.