Fixing replacing of \ to / on windows. String.replace('\\', '/') was replacing only the first occurrence.

see http://davidwalsh.name/javascript-replace