// Body ID for all
// Adds an ID attribute to body elements

/*
  ID value is build from the server name:
   - www is dropped
   - dots are replaced with dashes
   - numbers are prepended with an underscore

  Rewritten by liorean, 2005-03-20. Repackaged by Rijk.
*/

function bodyIDforAll() {
    if(document.body){
        var
            b=document.body;
        if(!b.hasAttribute('id'))
            b.setAttribute('id',location.host
                .replace(/^www\./,'')
                .replace(/^\d/,'_$&')
                .replace(/\./g,'-'));
    // debug: uncomment the next line to see the body-IDs (this gets old really fast)
    //  alert(document.body.id);
    }
}

