﻿// JScript File

function replace(string,text,by) {
    // Replaces string in prm 'text' with string in prm 'by' in string 'string'.
    var strLength = string.length, txtLength = text.length;
    if ((strLength == 0) || (txtLength == 0)) return string;

    var i = string.indexOf(text);
    if ((!i) && (text != string.substring(0,txtLength))) return string;
    if (i == -1) return string;

    var newstr = string.substring(0,i) + by;

    if (i+txtLength < strLength)
        newstr += replace(string.substring(i+txtLength,strLength),text,by);

    return newstr;
}

function doBottomPos() {
   if (!document.layers && document.getElementById) {
      var firstBottom = 0;
      var secondBottom = 0;
      var First = document.getElementById('left_search_content');
      var Second = document.getElementById('main_content');
      var Nav = document.getElementById('temp_bottomnav');
      firstBottom = parseInt(replace(First.style.top,'px','')) + First.offsetHeight + 20;
      secondBottom = parseInt(replace(Second.style.top,'px','')) + Second.offsetHeight + 20;
      if (firstBottom>secondBottom && firstBottom>850) {
         Nav.style.top = firstBottom + 'px';
      }
      else if (secondBottom>850) {
         Nav.style.top = secondBottom + 'px';
      }
      Nav.style.display = 'block';
   }
} 