2nd iteration on CORS related issues

See the comment in stardog.js.
Cleaned up the code and provided a reference implementation as a node.js app for expected CORS behavior here: https://gist.github.com/laczoka/5065270.