Help - how do I set the first 8 Characters into an id???

Help - how do I set the first 8 Characters into an id???

Hey

I have the following script which takes the url of a page, strips out the / and sets the id of the body tag.

the trouble is I only want the first 8 Characters - can anyone help me with this????

Here is the code so far:

$(document).ready(function() {

var pathname = window.location.pathname;
var pathSlashesReplaced = pathname.replace(/\//g, "-");
var pathSlashesReplacedNoFirstDash = pathSlashesReplaced.replace("-","");
var newID = pathSlashesReplacedNoFirstDash.replace(/(\.[\s\S]+)/ig, "");

$("body").attr("id",newID);

if ( $("body").attr("id") == "")
{
$("body").attr("id","home-page");
}

});


Please yell if you need any further explanation

Thanks