context: var horizontalFrames = new function(){  /* settings */  var min_frame_width = 50;  var intervalOnResize = 100;  /* end settings */  var resize_slider_height = 0;  var resize_slider_delta = 0;  var selection_catcher = null;  var is_resizing_frames = false;  var __previous = null;  var __next = null;  var self = this;    var mousedownListener = function(event)  {    var slider = event.target;    var container = slider.parentElement;    // the table, must have 0 padding and 0 border width */    var children = container.getChildElements(), child = null, i = 0;    for( ; child = children[i]; i++)    {      if ( child == slider )      {        __previous = children[i-1];        __next = children[i+1];        break;      }    }    resize_slider_delta = event.offsetX;    document.addEventListener('mousemove', resize_frame_onmousemove, false);    document.addEventListener('mouseup', finish_frame_resize, false);    selection_catcher =       document.getElementById('selection_catcher_container').getElementsByTagName('input')[0];  }  var resize_frame_onmousemove = function(event)  {    if( is_resizing_frames ) return;    is_resizing_frames = true;    selection_catcher.focus();    /* TODO: container not over the whole window */    var slider_left = event.pageX - resize_slider_delta;    var previous_offsetWidth = __previous.offsetWidth;    var next_offsetWidth = __next.offsetWidth;    var delta = slider_left - __previous.offsetLeft - previous_offsetWidth;    if( previous_offsetWidth + delta > min_frame_width       && next_offsetWidth - delta > min_frame_width )    {      __previous.style.width = ( previous_offsetWidth + delta  )+'px';      __next.style.width = ( next_offsetWidth - delta )+'px';      __next.style.cssText += '';    }    is_resizing_frames = false;  }  var finish_frame_resize = function(event)  {    document.removeEventListener('mousemove', resize_frame_onmousemove, false);    document.removeEventListener('mouseup', finish_frame_resize, false);  }  this.setInitialFramesWidth = function(container)  {    var _frames = container.getChildElements(), frame = null, i = 0,      length = _frames.length;    for(i=0; frame = _frames[i]; i++)    {      if( frame.firstChild && i < length-1)      {        frame.style.width = frame.offsetWidth +'px';      }    }  }  this.setFramesHeight = function(container, height)  {    var _frames = container.getElementsByTagName('ul')[0].getChildElements(),       frame = null, firstChild = null, i = 0;    for(i=0; frame = _frames[i]; i++)    {      if( firstChild = frame.firstChild )      {        firstChild.style.height = (height - getPaddingAndBorders(firstChild)) +'px';        if(firstChild.hasClass('vertical-frame-container'))        {          verticalFrames.setUpFrames(firstChild, firstChild.offsetHeight);        }      }    }  }  this.setUpFrames = function(container, height)  {    var _frames = null, frame = null, table = null, cell = null,       length = 0, i =  0;    if( !container.__init )    {      container.__init = true;      table = document.createElement('ul');      table.className = 'table';      _frames = container.getChildElements();      length = _frames.length;      for( i=0; frame = _frames[i]; i++ )      {        cell = table.render(['li']);        frame.addClass('horizontal-frame');            cell.appendChild(container.removeChild(frame));        if( i != length-1 )        {          table.render(sliderTemplate());        }      }      container.appendChild(table);      self.setInitialFramesWidth(table);      if ( !document.getElementById('selection_catcher_container') )      {        document.body.render(selectionCatcherTemplate());      }    }    self.setFramesHeight(container, height);  }  var getPaddingAndBorders = function(frame)  {    var style = window.getComputedStyle(frame, null);    return 0 +       + parseInt(style['paddingTop']) + parseInt(style['paddingBottom'])       + parseInt(style['borderTopWidth']) + parseInt(style['borderBottomWidth']);  }  var sliderTemplate = function()  {    return ['li',       'class', 'horizontal-frame-slider',      'onmousedown', mousedownListener      ]  }  var selectionCatcherTemplate = function()  {    return ['div', ['input'], 'id', 'selection_catcher_container']  }}
meta: 7593	/local1/tlutelli/issta_data/temp/all_js/javascript/2007_temp/2007/7593/7c42c9c6a7061755fd1e51ae2a847a4d609b358e/html_frames.js/buggy/src/scripts/html_frames.js