// dynlib
// Version 1.05 - Feb 10, 2002
// Created by Lloyd Hassell
// Email: lloydhassell@hotmail.com
// Web: www14.brinkster.com/lloydh/dynlib
// --- 1. BROWSER DETECTION ---
var dyn = (document.all || document.layers || document.getElementById) ? true : false;
var ie = (navigator.appName.indexOf('Microsoft') != -1) ? true : false;
var ie4 = (ie && document.all && !document.getElementById) ? true : false;
var ie5 = (ie && document.getElementById && navigator.userAgent.indexOf('MSIE 6.0') == -1) ? true : false;
var ie6 = (ie && document.getElementById && !ie5) ? true : false;
var ie4Min = (ie4 || ie5 || ie6) ? true : false;
var ie5Min = (ie5 || ie6) ? true : false;
var ie6Min = ie6;
var ns = (navigator.appName.indexOf('Netscape') != -1) ? true : false;
var ns4 = (ns && document.layers) ? true : false;
var ns6 = (ns && document.getElementById) ? true : false;
var ns4Min = (ns4 || ns6) ? true : false;
var ns6Min = ns6;
// --- 2. LAYER ADDING ---
function addLayer(LAYERID,PARENTLAYEROBJ) {
   if (ie4Min) {
      if (isBlank(PARENTLAYEROBJ)) PARENTLAYEROBJ = document.body;
      PARENTLAYEROBJ.insertAdjacentHTML('BeforeEnd','<div id="' + LAYERID + '" style="position:absolute;left:0;top:0;width:1;visibility:hidden;"></div>');
      return (document.all) ? document.all[LAYERID] : document.getElementById(LAYERID);
      }
   else if (ns4) {
      if (isBlank(PARENTLAYEROBJ)) {
         document.layers[LAYERID] = new Layer(0);
         return document.layers[LAYERID];
         }
      else {
         PARENTLAYEROBJ.document.layers[LAYERID] = new Layer(0,PARENTLAYEROBJ);
         return PARENTLAYEROBJ.document.layers[LAYERID];
         }
      }
   else if (ns6) {
      if (isBlank(PARENTLAYEROBJ)) PARENTLAYEROBJ = document.body;
      var tempLayer = document.createElement('div');
      tempLayer.setAttribute('id',LAYERID);
      tempLayer.setAttribute('style','position:absolute;left:0;top:0;width:1;visibility:hidden;');
      PARENTLAYEROBJ.appendChild(tempLayer);
      return document.getElementById(LAYERID);
      }
   }
// --- 3. LAYER APPEARANCE ---
function setLayerBgColor(LAYEROBJ,COLOR) {
   if (ns4) LAYEROBJ.document.bgColor = COLOR;
   else if (dyn) LAYEROBJ.style.backgroundColor = COLOR;
   }
function setLayerBgSrc(LAYEROBJ,SRC) {
   if (ns4) LAYEROBJ.background.src = SRC;
   else if (dyn) LAYEROBJ.style.backgroundImage = 'url(' + SRC + ')';
   }
// --- 4. LAYER CLIPPING ---
function getLayerClipBottom(LAYEROBJ) {
   if (ns4) return LAYEROBJ.clip.bottom;
   else if (dyn) {
      var tempClipArray = LAYEROBJ.style.clip.substring(5,LAYEROBJ.style.clip.length - 3).split('px ');
      return parseInt(tempClipArray[2]);
      }
   }
function getLayerClipLeft(LAYEROBJ) {
   if (ns4) return LAYEROBJ.clip.left;
   else if (dyn) {
      var tempClipArray = LAYEROBJ.style.clip.substring(5,LAYEROBJ.style.clip.length - 3).split('px ');
      return parseInt(tempClipArray[3]);
      }
   }
function getLayerClipRight(LAYEROBJ) {
   if (ns4) return LAYEROBJ.clip.right;
   else if (dyn) {
      var tempClipArray = LAYEROBJ.style.clip.substring(5,LAYEROBJ.style.clip.length - 3).split('px ');
      return parseInt(tempClipArray[1]);
      }
   }
function getLayerClipTop(LAYEROBJ) {
   if (ns4) return LAYEROBJ.clip.top;
   else if (dyn) {
      var tempClipArray = LAYEROBJ.style.clip.substring(5,LAYEROBJ.style.clip.length - 3).split('px ');
      return parseInt(tempClipArray[0]);
      }
   }
function setLayerClip(LAYEROBJ,TOP,RIGHT,BOTTOM,LEFT) {
   if (dyn) {
      if (isBlank(TOP)) TOP = getLayerClipTop(LAYEROBJ);
      if (isBlank(RIGHT)) RIGHT = getLayerClipRight(LAYEROBJ);
      if (isBlank(BOTTOM)) BOTTOM = getLayerClipBottom(LAYEROBJ);
      if (isBlank(LEFT)) LEFT = getLayerClipLeft(LAYEROBJ);
      if (ns4) {
         LAYEROBJ.clip.left = LEFT;
         LAYEROBJ.clip.top = TOP;
         LAYEROBJ.clip.right = RIGHT;
         LAYEROBJ.clip.bottom = BOTTOM;
         }
      else LAYEROBJ.style.clip = 'rect(' + TOP + 'px ' +  RIGHT + 'px ' + BOTTOM + 'px '  + LEFT + 'px)';
      }
   }
// --- 5. LAYER DIMENSIONS ---
function getLayerHeight(LAYEROBJ) {
   if (ie4) return LAYEROBJ.clientHeight;
   else if (ns4) return LAYEROBJ.clip.height;
   else if (dyn) return parseInt(LAYEROBJ.style.height);
   }
function getLayerWidth(LAYEROBJ) {
   if (ie4) return LAYEROBJ.clientWidth;
   else if (ns4) return LAYEROBJ.clip.width;
   else if (dyn) return parseInt(LAYEROBJ.style.width);
   }
function setLayerSize(LAYEROBJ,WIDTH,HEIGHT) {
   if (ie4) {
      if (!isBlank(WIDTH)) LAYEROBJ.style.pixelWidth = WIDTH;
      if (!isBlank(HEIGHT)) LAYEROBJ.style.pixelHeight = HEIGHT;
      }
   else if (ns4) {
      if (!isBlank(WIDTH)) LAYEROBJ.clip.right = WIDTH;
      if (!isBlank(HEIGHT)) LAYEROBJ.clip.bottom = HEIGHT;
      }
   else if (dyn) {
      if (!isBlank(WIDTH)) LAYEROBJ.style.width = WIDTH + 'px';
      if (!isBlank(HEIGHT)) LAYEROBJ.style.height = HEIGHT + 'px';
      }
   }
// --- 6. LAYER HTML ---
function setLayerHTML(LAYEROBJ,STR) {
   if (navigator.userAgent.indexOf('MSIE 5.0') && navigator.userAgent.indexOf('Mac') != -1) STR += '\n';
   if (ns4) {
      LAYEROBJ.document.open();
      LAYEROBJ.document.write(STR);
      LAYEROBJ.document.close();
      }
   else if (dyn) LAYEROBJ.innerHTML = STR;
   }
// --- 7. LAYER OBJECT ---
function getLayerObj(LAYERID) {
   if (ie4) return document.all[LAYERID];
   else if (ns4) {
      var tempLayerObj = null;
      var tempParentObj = (arguments.length == 1) ? document : arguments[1];
      for (var tempLayerLoop in tempParentObj.layers) {
         var tempObj = tempParentObj.layers[tempLayerLoop];
         var tempConstructor = tempObj.constructor + '';
         if (tempConstructor.indexOf('function Layer()') != -1) {
            if (tempLayerLoop == LAYERID) return tempObj;
            else if (tempObj.document.layers.length > 0) tempLayerObj = getLayer(LAYERID,tempObj);
            }
         }
      return tempLayerObj;
      }
   else if (dyn) return document.getElementById(LAYERID);
   }
// --- 8. LAYER POSITIONING ---
function getLayerLeft(LAYEROBJ) {
   if (ns4) return LAYEROBJ.left;
   else if (dyn) return parseInt(LAYEROBJ.style.left);
   }
function getLayerTop(LAYEROBJ) {
   if (ns4) return LAYEROBJ.top;
   else if (dyn) return parseInt(LAYEROBJ.style.top);
   }
function moveLayerTo(LAYEROBJ,LEFT,TOP) {
   if (ns4) {
      if (isBlank(LEFT)) LEFT = getLayerLeft(LAYEROBJ);
      if (isBlank(TOP)) TOP = getLayerTop(LAYEROBJ);
      LAYEROBJ.moveTo(LEFT,TOP);
      }
   else if (dyn) {
      if (!isBlank(LEFT)) LAYEROBJ.style.left = LEFT + 'px';
      if (!isBlank(TOP)) LAYEROBJ.style.top = TOP + 'px';
      }
   }
// --- 9. LAYER VISIBILITY ---
function hideLayer(LAYEROBJ) {
   if (ns4) LAYEROBJ.visibility = 'hide';
   else if (dyn) LAYEROBJ.style.visibility = 'hidden';
   }
function showLayer(LAYEROBJ) {
   if (ns4) LAYEROBJ.visibility = 'show';
   else if (dyn) LAYEROBJ.style.visibility = 'visible';
   }
// --- 10. OTHER CODE ---

function isBlank(STR) {
   if (dyn) {
      if (STR == null) STR = '';
      STR += '';
      STR = STR.replace(/^\s+|\s+$/g,'');
      return (STR == '') ? true : false;
      }
   }