docs: function generateEvents(boxes) {
  	var events = new Array();
  	var event = new Object();
  	
  	for (i = 0; i < boxes.length; i++) {  // traverse the list of boxes
  		var leftx = Math.min(boxes[i][0][0], boxes[i][1][0]);
  		var rightx = Math.max(boxes[i][0][0], boxes[i][1][0]);
  		
  		event = new Object();
  		event.x = leftx;
  		event.type = "add";
  		event.index = i;
  		events.unshift(event);
  		
  		event = new Object();
  		event.x = rightx;
  		event.type = "remove";
  		event.index = i;
  		events.push(event);
  	}
  	return events;
  }