/* topbar.js
    (C) 2006 podomatic all rights reserved
    author J E
    purpose-- facilitates sizing of floating tabsection to width of mainsection

*/
function rescaleTop(){
    var topSection  = document.getElementById("newHeader")
  
    if (typeof self.innerWidth != "undefined")
    {
	    w 	= self.innerWidth; 
      h 	= self.innerHeight;
    }
    else
	  {
      w 	= document.body.parentNode.offsetWidth; 
      h 	= document.body.parentNode.offsetHeight;
    }

    var refEl = document.getElementById("contentContainer")
    if (refEl == null)
        return;
    refEl.style.height = (h) + "px"
    refEl.style.width = (w) + "px"
    refEl.style.left = 0 + "px"
    refEl.style.top = 0 + "px"
    refEl.style.margin = "0px;"
    refEl.style.border = "0px;"
    if (!podomatic.isSafari())
    {
        refEl.style.overflow = "hidden"
        refEl.style.overflowY = "scroll"
    }

    refEl.style.position    = "absolute";
    refEl       = document.getElementById("pagehead")
    if (refEl == null)
        refEl       = document.getElementById("anybody")
    if (refEl == null)
        return;

        
    var x           = podomatic.getXOffset(refEl)
    var isIE        = (typeof(document.all) != "undefined" ? 6 : 4) 
    var width       = refEl.offsetWidth - isIE
    
    if(width < 0) return;
    topSection.style.left = x + "px"
    topSection.style.width = width + "px"
    

    /*
    document.getElementById("header-links").style.width = "100%"
    document.getElementById("header-links").style.width = "auto"*/
    
    if (refEl.id == "anybody")
    {   
        refEl.style.paddingTop = (topSection.offsetHeight + (isIE == 6 ? 0 : 3)) + "px"
    }
}    

podomatic.isSafari = function()
{
	// String found if this is a AppleWebKit based product
	var kitName = "applewebkit/";
	var tempStr = navigator.userAgent.toLowerCase();
	var pos = tempStr.indexOf(kitName);
	return (pos != -1);
}
window.onresize = rescaleTop
podomatic.init.add(rescaleTop)
