var BrowserHacks = {
  apply_iframe_shim: function(element,options) {
    // iframe shim only necessary for IE 5 and 6.
    if(!(window.navigator &&
      window.navigator.appVersion && 
      /MSIE [56]/.exec(window.navigator.appVersion))) {
      return false;
    }
    
    var iframe = document.createElement("iframe");
    var options = (options == null) ? $H() : options;    
    
    options = $H({
      src           : (document.location.protocol == "https:" ? "/blank.html" : "about:blank"),
      height        : element.clientHeight ? element.clientHeight : "100%",
      width         : element.clientWidth ? element.clientWidth : "100%",
      frameborder   : "0",
      scrolling     : "no",
      marginheight  : "0",
      marginwidth   : "0",
      hspace        : "0",
      vspace        : "0",
      tabIndex      : "-1",
      border        : "0",
      style         : $H()
    }).merge(options);
    
    options.style = $H({
      zIndex     : "-1",
      position   : "absolute",
      top        : "0px",
      left       : "0px",
      border     : "0",
      overflow   : "hidden"
    }).merge(options.style);

    // dont need to force id on iframe for now.
    //
    // if(typeof(options.id)=='undefined') {
    //   if(typeof(element.id)=='undefined') {
    //     BrowserHacks.iframe_shim_counter++;
    //     options.id = "browserhacks_iframe_shim_" + BrowserHacks.iframe_shim_counter;
    //   }
    //   else {
    //     options.id = element.id + "_iframe_shim";
    //   }
    // }
    
    options.each(function(kv){if(kv[0]!='style'){iframe.setAttribute(kv[0],kv[1])}});
    options.style.each(function(kv){iframe.style[kv[0]]=kv[1]});
    element.appendChild(iframe);
  }
  
};
