startList = function()
{
  if (document.all&&document.getElementById)
  {
    navRoot = document.getElementById("nav");
    if( navRoot && navRoot.childNodes )
    {
    for (i=0; i<navRoot.childNodes.length; i++)
    {
      node = navRoot.childNodes[i];
      if (node.nodeName=="LI")
      {
        node.onmouseover=function()
        {
          this.className+=" over";
        }
        node.onmouseout=function()
        {
          this.className=this.className.replace(" over", "");
        }
      }
    }
    }
  }
}

function getComputedWidth(elt)
{
  if( elt.offsetWidth )
  {
    return elt.offsetWidth;
  }
  if( elt.clip && elt.clip.width )
  {
    return elt.clip.width;
  }

  return document.defaultView.getComputedStyle(elt, "").getPropertyValue("width");
}

function getComputedHeight(elt)
{
  if( elt.offsetHeight )
  {
    return elt.offsetHeight;
  }
  if( elt.clip && elt.clip.height )
  {
    return elt.clip.height;
  }

  return document.defaultView.getComputedStyle(elt, "").getPropertyValue("height");
}

function repositionCopyright()
{
  if( document.all )
  {
    for( i = 0; i < document.all.length; i++ )
    {
      var cand = document.all.item(i);
      if( cand && cand.className && (cand.className == "copyright") ) //&& cand.firstChild )
      {
        var p = cand;
        //cand = cand.firstChild;
        while( p.parentNode && p.parentNode.offsetHeight > p.offsetHeight )
        {
         p = p.parentNode;
        }
        var s = cand.previousSibling;
        if( p && s )
        {
          var h = s.offsetHeight + cand.offsetHeight;
          if ( h < p.offsetHeight )
          {
            cand.style.top = cand.offsetTop + (p.offsetHeight - cand.offsetHeight) + "px";
            cand.style.position = "absolute";
          }
        }
      }
    }
  }
}

function autoIframe(frameId, matchElementId)
{
 var frame = document.getElementById(frameId);
 var innerDoc = (frame.contentDocument) ? frame.contentDocument : frame.contentWindow.document;
 innerDoc.body.className="";
 var objToResize = (frame.style) ? frame.style : frame;
 var border = innerDoc.body.border ? innerDoc.body.border : 0;
 var padding = innerDoc.body.padding ? innerDoc.body.padding : 0;
 if( matchElementId )
 {
   var matchElt = document.getElementById(matchElementId);
   if( matchElt.style )
   {
     matchElt = matchElt.style;
   }
   matchElt.height = innerDoc.body.scrollHeight + 2 * (padding + border) + "px";
 }
 //alert(frame.contentWindow.pageYOffset);
 //alert(innerDoc.body.scrollHeight);
 objToResize.height = innerDoc.body.scrollHeight + 2 * (padding + border) + "px";
 var holder = document.getElementById("rightcolumn");
 if( holder )
 {
    var w = getComputedWidth( holder );
    if( w )
    {
      objToResize.width = w+"px";
    }
 }
 innerDoc.body.className="toplist";

 repositionCopyright();
}

function setIframeToURL( _iframeID, _URL )
{
  var iframe = document.getElementById( _iframeID );
  if( iframe && iframe.src )
  {
    iframe.src = _URL;
  }
}


function loadIframesFromQuery()
{
  var dc = document.location.href;
  var begin = dc.indexOf("?");
  if( begin == -1 )
  {
	  return null;
  }
  dc = dc.substring(begin+1, dc.length);

  for( begin = dc.indexOf("=");
 begin >= 0; begin = dc.indexOf("=") )
  {
    var prefix = dc.substring(0, begin);
    dc = dc.substring( begin + 1 );
    var end = dc.indexOf("&");
    var body;
    if( end < 0 )
    {
      body = dc;
      dc = "";
    }
    else
    {
      body = dc.substring(0, end);
      dc = dc.substring( end+1 );
    }

    if( prefix.indexOf("i_") == 0 )
    {
      prefix = unescape(prefix.substring(2));
      body = unescape(body);
      if( body.indexOf(":") < 0 )
      {
        setIframeToURL( prefix, body );
      }
    }
  }
}
