Infatti...i CSS accettano SOLO stringhe come valori di lunghezza e misure in genere. Quindi anche JavaScript deve impostare i valori come stringhe, completi di unità di misura.
codice:
function newbox(itemcontent,width,height) {
document.getElementById(itemcontent).style.width = width + "px";
document.getElementById(itemcontent).style.height = height + "px";
document.getElementById(itemcontent).style.marginLeft = (-(width / 2)) + "px";
document.getElementById(itemcontent).style.marginTop = (-(height / 2)) + "px";
}