//----------------------------------------------------------------------
// CROSS BROWSER LIB:                           ------------------------
//----------------------------------------------------------------------
function xDef()
{
  for(var i=0; i<arguments.length; ++i){if(typeof(arguments[i])=='undefined') return false;}
  return true;
}

function xGetElementByID(e)
{
  if(typeof(e)=='string') {
    if(document.getElementById) e=document.getElementById(e);
    else if(document.all) e=document.all[e];
    else e=null;
  }
  return e;
}

function xClientHeight()
{
  var v=0,d=document,w=window;
  if((!d.compatMode || d.compatMode == 'CSS1Compat') /* && !w.opera */ && d.documentElement && d.documentElement.clientHeight)
    {v=d.documentElement.clientHeight;}
  else if(d.body && d.body.clientHeight)
    {v=d.body.clientHeight;}
  else if(xDef(w.innerWidth,w.innerHeight,d.width)) {
    v=w.innerHeight;
    if(d.width>w.innerWidth) v-=16;
  }
  return v;
}

function xClientWidth()
{
  var v=0,d=document,w=window;
  if((!d.compatMode || d.compatMode == 'CSS1Compat') && !w.opera && d.documentElement && d.documentElement.clientWidth)
    {v=d.documentElement.clientWidth;}
  else if(d.body && d.body.clientWidth)
    {v=d.body.clientWidth;}
  else if(xDef(w.innerWidth,w.innerHeight,d.height)) {
    v=w.innerWidth;
    if(d.height>w.innerHeight) v-=16;
  }
  return v;
}

function xGetStyle(o)
{
  var style = null;

  // checkW3C DOM, then MSIE 4, then NN 4.
  if (o)
  {
    if (o.style)
      style = o.style;
    else if (document.getElementById && document.getElementById(o)) 
      style = document.getElementById(objectId).style;
    else if (document.all && document.all(o)) 
      style = document.all(o).style; 
    else if (document.layers && document.layers[o]) 
      style = document.layers[o];
  } 
  return style;
}
function xSetDisplay(o, d)
{
  if (o)
  {
     var s = xGetStyle(o);
     if (s)
       s.display = d;
  }
}
function xMove(o, l, t, w, h)
{
  if (o)
  {
    var s = xGetStyle(o);
    if (s)
    {
      s.left = l;
      s.top = t;
      s.width = (w>0)?w:0;
      s.height = (h>0)?h:0;
    }
  }
}
function xSetOpacity(obj, opacity) 
{
  opacity = (opacity == 100)?99.999:opacity;
  
  // IE/Win
  obj.style.filter = "alpha(opacity:"+opacity+")";
  
  // Safari<1.2, Konqueror
  obj.style.KHTMLOpacity = opacity/100;
  
  // Older Mozilla and Firefox
  obj.style.MozOpacity = opacity/100;
  
  // Safari 1.2, newer Firefox and Mozilla, CSS3
  obj.style.opacity = opacity/100;
}
//----------------------------------------------------------------------
