<!--

var shownId = '';
var baloonId = '';
var shownBtn = null;
var currBtn = null;
var currField = null;
var currHiddenField = null;
var initInputs = new Array;

function hideLeer(leerId) {
  if (document.layers) {
    document.layers[leerId].visibility = 'hide';
  } else if (document.getElementById) {
    document.getElementById(leerId).style.visibility = 'hidden';
  } else if (document.all) {
    document.all[leerId].style.visibility = 'hidden';
  }
}

function findLeer(leerId) {
  var leerElem;
  if (document.getElementById) {
    leerElem = document.getElementById(leerId);
  } else if (document.all) {
    leerElem = document.all[leerId];
  } else if (document.layers) {
    leerElem = document.layers[leerId];
  }
  return leerElem;
}

function showLeer(leerId, leerPos, html) {
  if (document.getElementById) {
    var leerElem = document.getElementById(leerId);
    with (leerElem) {
      innerHTML = html;
      style.left = leerPos.x;
      style.top = leerPos.y;
      style.visibility = 'visible';
    }
  } else if (document.all) {
    var leerElem = document.all[leerId];
    with (leerElem) {
      innerHTML = html;
      style.left = leerPos.x;
      style.top = leerPos.y;
      style.visibility = 'visible';
    }
  } else if (document.layers) {
    with (document.layers[leerId]) {
      left = leerPos.x;
      top = leerPos.y;
      document.open();
      document.write(html);
      document.close();
      visibility = 'show';
    }
  }
}

function ancPosX(anchorPtr) {
  if (document.layers) {
    return anchorPtr.x;
  } else if (document.getElementById || document.all) {
    var pos = anchorPtr.offsetLeft;
    while (anchorPtr.offsetParent != null) {
      anchorPtr = anchorPtr.offsetParent;
      pos += anchorPtr.offsetLeft;
    } 
    return pos;
  }
}

function ancPosY(anchorPtr) {
  if (document.layers) {
    return anchorPtr.y;
  } else if (document.getElementById || document.all) {
    var pos = anchorPtr.offsetTop;
    while (anchorPtr.offsetParent != null) {
      anchorPtr = anchorPtr.offsetParent;
      pos += anchorPtr.offsetTop;
    } 
    return pos;
  }
}

function getPosition(ancName) {
  for (var i = 0; i < document.anchors.length; i++) {
    if (document.anchors[i].name == ancName) {
      this.x = ancPosX(document.anchors[i]);
      this.y = ancPosY(document.anchors[i]);
      return this;
    }
  }
}

function chr(charCode) {
  return unescape('%' + charCode.toString(16));
}

function lead_zero(v, m) {
  var lz;
  for (var i=0; i<m-1; i++) { lz += '0' }
  var r = lz + v;
  return r.substring(r.length-m, r.length);
}

if (document.layers) {
  origWidth = window.innerWidth;
  origHeight = window.innerHeight;
}

function hideCurrInput() {
  if (shownId != '') hideLeer(shownId);
  if (baloonId != '') hideLeer(baloonId);
  if (shownBtn != null && shownBtn.style) shownBtn.style.borderStyle = 'outset';
  shownId = '';
  baloonId = '';
  shownBtn = null;
  currField = null;
  currHiddenField = null;
}

function resizing() {
  if (document.layers) {
    if (window.innerWidth != origWidth || window.innerHeight != origHeight) location.reload();
  } else {
    hideCurrInput();
  }
}

function resetDefaults() {
  for (var i=0; i<initInputs.length; i++) {
    initInputs[i].form[initInputs[i].field].value = initInputs[i].value;
    initInputs[i].form[initInputs[i].field + 'Ms'].value = initInputs[i].hidden;
    if (initInputs[i].type == 'color') bC(initInputs[i].form[initInputs[i].field])
  }
}

function resetInputs() {
  hideCurrInput();
  setTimeout("resetDefaults()", 200);
}

window.onresize = resizing;

if( document.layers )  {
  window.captureEvents(Event.MOUSEDOWN);
  window.onmousedown = hideCurrInput;
} else {
  document.onmouseup = hideCurrInput;
}

var defaultInputBackground = 'FFFFFF';
var defaultInputColor = '000000';

//-->
