// <script>
/*
 (C) Copyright  2002 ACSYS, Inc.  All Rights Reserved. 
 Author:	JS-S
 Page:		Generic library to support DHTML coding

 Dependencies:
 DynAPI Browser library

*/

/*
  Create a global image object and its 
  corresponding mouseover image.
*/
function Img(sImgName, sImgBaseUrl, sImgSrc)
{
  sImgBaseUrl = (sImgBaseUrl) ? sImgBaseUrl + '/images'
                              : '/images'
  window[sImgName] = new Image();
  window[sImgName].src = sImgBaseUrl + '/' + (sImgSrc ? sImgSrc : sImgName) + '.gif';
  window[sImgName + "On"] = new Image();
  window[sImgName + "On"].src = sImgBaseUrl + '/' + (sImgSrc ? sImgSrc : sImgName) + 'On.gif';
}

function bPointInRange(x,y,arrRange)
{
  return ((x>=arrRange[0])&&(x<=arrRange[1])&&(y>=arrRange[2])&& (y<=arrRange[3]));
}

function SwitchImg(sImgID, sNewImg, objNSDocument)
{
  if (document.images && !objNSDocument)
  {
    if (document.images[sImgID])
      document.images[sImgID].src = window[sNewImg].src;
    return;
  }

  if (objNSDocument)
    if (objNSDocument.images)
      if (objNSDocument.images[sImgID])
        objNSDocument.images[sImgID].src = window[sNewImg].src;
}

function acsysGetPageX(obj)
{
  if (!obj)
    return 0;
  
  if (is.ns4)
    return (obj.pageX) ? obj.pageX : 0;

  if (is.ie)
  {
    var pageX = obj.offsetLeft;
    var parent = obj.offsetParent;

    while (parent != null)
    {
      pageX += parseInt(parent.offsetLeft);
      if (parent.tagName == "TABLE") 
        if (!isNaN(parseInt(parent.border)))
          pageX += parseInt(parent.border);
      parent = parent.offsetParent;
    }
    return pageX;
  }
  else
  {
    return (obj.offsetParent!=null) ? obj.offsetLeft + acsysGetPageX(obj.offsetParent) : obj.offsetLeft;
  }
}

function acsysGetPageY(obj)
{
  if (!obj)
    return 0;

  if (is.ns4)
    return (obj.pageY) ? obj.pageY : 0;
  
  if (is.ie)
  {
    var pageY = obj.offsetTop;
    var parent = obj.offsetParent;

    while (parent != null)
    {
      pageY += parseInt(parent.offsetTop);
      if (parent.tagName == "TABLE") 
        if (!isNaN(parseInt(parent.border)))
          pageY += parseInt(parent.border);
      parent = parent.offsetParent;
    }
    return pageY;
  }
  else
  {
    return (obj.offsetParent!=null) ? obj.offsetTop + acsysGetPageY(obj.offsetParent) : obj.offsetTop;
  }
}

function acsysGetWidth(obj)
{
  if (is.ns4)
    return (obj.clip.width) ? obj.clip.width : 0;
  else if (is.ie)
    return (obj.style.visibility == "hidden") ? obj.scrollWidth : obj.offsetWidth;
  else
    return obj.offsetWidth;
}

function acsysGetHeight(obj)
{
  if (is.ns4)
    return (obj.clip.height) ? obj.clip.height : 0;
  else if (is.ie)
    return (obj.style.visibility == "hidden") ? obj.scrollHeight : obj.offsetHeight;
  else
    return obj.offsetHeight;
}

if(document.layers)
{
  iNS4LoadWidth=window.innerWidth;
  iNS4LoadHeight=window.innerHeight;
}

function HandleResize()
{
  if(document.layers)
    if (window.innerWidth!=iNS4LoadWidth||window.innerHeight!=iNS4LoadHeight)
      location.reload();
}
