
 var ie = document.all ? 1:0;
 var ns = ie ? 0 : 1;


  function getLayer(l, p) {
   if (ie)  ob= document.all[l].style;
    else {
     if (p)  ob= document.layers[p].document.layers[l];
       else  ob= document.layers[l];
   } 
  
if (ob)  return ob; else alert(l + " : " + p + "failed");
  }
  
  function showLayer(l, p) { // layer, parent
    getLayer(l, p).visibility = ie?'visible':'show';
   
  }

  function hideLayer(l, p) { // layer, parent
    getLayer(l, p).visibility = ie?'hidden':'hide';
  }


  function getImageOb(n, l, p) {
   if (ns && l)  return getLayer(l, p).document.images[n];
    else return document.images[n];
  }
  
  function setImageSrc(n, s, l, p) {
    getImageOb(n, l, p).src = s;
  }
  
  function setLayerXY(l, x, y, p) {
  var lOb = getLayer(l, p);
  
   if (ie) {
     lOb.posLeft = x;
     lOb.posTop = y;
   } else {
     lOb.left = x;
     lOb.top = y;
   }
  }
  
  function setLayerY(l, y, p) {
   if (ie)  getLayer(l, p).posTop = y;
    else getLayer(l, p).top = y;
  }

  function setLayerX(l, x, p) {
   if (ie)  getLayer(l, p).posLeft = x;
    else getLayer(l, p).left = x;
  }
  
  function setLayerZ(l, z, p) {
    getLayer(l, p).zIndex = z;
  }
  

    
  function getLayerY(l, p) {
    return ie?(getLayer(l, p).posTop):(getLayer(l, p).top);
  }
  
  function getLayerX(l, p) {
    return ie?(getLayer(l, p).posLeft):(getLayer(l, p).left);
  }
    
  function getLayerZ(l, p) {
    return getLayer(l, p).zIndex;
  }
  
  function getLayerHeight(l, p) {
    return ie ? (document.all[l].scrollHeight) : (getLayer(l, p).document.height);
  }

  function getLayerWidth(l, p) {
    return ie ? (document.all[l].scrollWidth) : (getLayer(l, p).document.width);
  }

  function layerWrite(str, l, p) {
   if (ie)
     document.all[l].innerHTML = str;
   else {
    var ob = getLayer(l, p).document;
    
     ob.open();
     ob.write(str);
     ob.close();
   }
  }
  
  function setLayerClip(iX, iY, fX, fY, l, p) {
   var ob = getLayer(l, p);
   
   if (ie) 
     ob.clip = "rect(" + iY + "px " + fX + "px " + fY + "px " + iX + "px)";
   else {
     ob.clip.left = iX;
     ob.clip.top = iY;

     ob.clip.right = fX;
     ob.clip.bottom = fY;
   }
  }
  
  function getWindowHeight() {
    return (ie ? document.body.clientHeight : window.innerHeight);    
  }

  function getWindowWidth() {
    return (ie ? document.body.clientWidth : window.innerWidth);    
  }
  
  function centerLayerV(l, xOfs, p, h) {
    setLayerY(l, ( (getWindowHeight() - (h?h:getLayerHeight(l, p)) ) / 2 ) + (xOfs ? xOfs : 0), p);
  }
  
  function centerLayerH(l, yOfs, p, w) {
    setLayerX(l, ( (getWindowWidth() - (w?w:getLayerWidth(l, p)) ) / 2 ) + (yOfs ? yOfs : 0), p);
  }
  
 
