My regex is pretty bad, so I will improvise with a less efficient solution :P
// The first part is to ensure you can handle both URLs with the http:// and those without
x = window.location.href.split("http:\/\/")
x = x[x.length-1];
x = x.split("\/")[1]; //Result is in x