

// Global 'corrector' for IE/Mac et al., but doesn't hurt others
var fudgeFactor = {top:-1, left:-1};

// Center a positionable element whose name is passed as 
// a parameter in the current window/frame, and show it
function centerIt(layerName) {
    // 'obj' is the positionable object
    var obj = getRawObject(layerName);
    
   //alert('1,' + 'obj.offsetWidth=' + obj.offsetWidth + ' ' + typeof obj.scrollWidth +', obj.scrollWidth=' + obj.scrollWidth + ', window.scrollWidth=' + window.scrollWidth);
    // set fudgeFactor values only first time
    if (fudgeFactor.top == -1) {
    	//alert('2');
        if ((typeof obj.offsetTop == "number") && obj.offsetTop > 0) {
        	//alert('3');
            fudgeFactor.top = obj.offsetTop;
            fudgeFactor.left = obj.offsetLeft;
            //alert('4');
        } else {
        //alert('5, ' + obj.offsetTop + ', ' + fudgeFactor.top);
            fudgeFactor.top = 0;
            fudgeFactor.left = 0;
            //alert('6');
        }
       // if (obj.offsetWidth && (typeof obj.scrollWidth == "number")) {
         if (obj.offsetWidth && obj.scrollWidth) {
       // alert('6' + typeof obj.scrollWidth);
       //alert('7,' + 'obj.offsetWidth=' + obj.offsetWidth + ', obj.scrollWidth=' + obj.scrollWidth);
            if (obj.offsetWidth != obj.scrollWidth) {
            //alert('8,' + 'obj.offsetWidth=' + obj.offsetWidth + ', obj.scrollWidth=' + obj.scrollWidth);
                //obj.style.width = obj.scrollWidth; 
                //alert('9');   
            }
        }
    }
    //alert('10');
    var x = Math.round((getInsideWindowWidth()/2) - (getObjectWidth(obj)/2));
    //alert('11');
    var y = Math.round((getInsideWindowHeight()/2) - (getObjectHeight(obj)/2));
    //alert('12');
    shiftTo(obj, x - fudgeFactor.left, y - fudgeFactor.top);
    //alert('13');
    show(obj);
}

// Special handling for CSS-P redraw bug in Navigator 4
function handleResize() {
    if (isNN4) {
        // causes extra re-draw, but gotta do it to get banner object color drawn
        location.reload();
    } else {
        centerIt('container');
    }
}
