﻿function pageWidth() {
    var bod, w;
    bod = document.getElementById("body");
    if (bod == null)
        bod = document.body;
    if (bod == null)
        return 0;
    w = bod.clientWidth;

    if (new String(w).indexOf("px") > 0)
        w = new Number(new String(w.replace("px", "")));

    if (w != null)
        return w;
        
    return document.body.style.width;
}
