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 doAdjustment() {
   if (!document.layers && document.getElementById) {
      var LeftSegment = document.getElementById('content_left');
      var MidSegment = document.getElementById('divider');
      var RightSegment = document.getElementById('content_right');
      var Footer = document.getElementById('footer');

      //get offset positions
      var positionSetLeft = parseInt(replace(LeftSegment.style.top,'px','')) + LeftSegment.offsetHeight + 15;
      var positionSetMid = parseInt(replace(MidSegment.style.top,'px','')) + MidSegment.offsetHeight;
      var positionSetRight = parseInt(replace(RightSegment.style.top,'px','')) + RightSegment.offsetHeight + 15;
     
      if (positionSetLeft>positionSetRight && positionSetLeft>positionSetMid) {
         Footer.style.top = positionSetLeft + 'px';
      }
      else {
         if (positionSetRight>positionSetLeft && positionSetRight>positionSetMid) {
            Footer.style.top = positionSetRight + 'px';
         }
         else {   
			Footer.style.top = positionSetMid + 'px';
	     }
      }
      Footer.style.display = 'block';
   }
} 
