SearchHistory = function(){
  var content = '';
  function initialize(entries) {

    content = $('search_window').innerHTML;
    entries.each(function(entry){
      url = entry[1]
      content += "<a href='" + url + "' class='entry pointer block'>" + entry[0] + "</a>"
    });
    
    var history_window = new Control.Window($(document.body).down('[href=#search_history]'),{  
        position: 'relative',  
        className: 'search_history_window',
        offsetLeft: -266,
        width:254,
        offsetTop: 21,
        afterClose: closeAll,
        closeOnClick: true
      });
      history_window.container.insert(content);
  }
  

  function closeAll() {
    openWindows().each(function(w){
      w.close();
    });
  }
  
  function openWindows() {
    return Control.Window.windows.findAll(function(e){return e.isOpen});
  }
  
  return {initialize:initialize, closeAll:closeAll,openWindows:openWindows}
}();

