function openGreener() {
  doc = jetpack.tabs.focused.contentDocument;
  width = jetpack.tabs.focused.contentWindow.innerWidth;
  height = jetpack.tabs.focused.contentWindow.innerHeight;
  var refererUrl = encodeURIComponent(doc.location);
  var gas_overlay = doc.createElement('div');
  gas_overlay.setAttribute('id','gas_overlay');
  gas_overlay.setAttribute('style', 'position:fixed;top:0;left:0;width:'+width+'px;height:'+height+'px;text-align:center;z-index:5000;background-color:#00328e;-moz-opacity: 8;opacity:.80;filter: alpha(opacity=80);');
  var gas_iframe = doc.createElement("IFRAME");
  gas_iframe.setAttribute('id','gas_iframe');
  gas_iframe.setAttribute('allowTransparency', 'true');
  gas_iframe.setAttribute('frameBorder', '0');
  gas_iframe.setAttribute('style', 'position:fixed;top:'+(height/2-145)+'px;left:'+(width/2-283)+'px;width:567px;height:290px;z-index:5001;border:none;background-color: transparent;');
  gas_iframe.setAttribute('src', 'http://www.greenanysite.com/index.php/gas/jetpack__0_1?from='+refererUrl);
  doc.getElementsByTagName("body").item(0).appendChild(gas_overlay);
  doc.getElementsByTagName("body").item(0).appendChild(gas_iframe);
}

jetpack.statusBar.append({
  html: '<div style="cursor: pointer;margin:2px 0 0 5px;background-image: url(http://www.greenanysite.com/images/jetpack_button_bg.png);background-position:left;padding: 0 4px 0 36px;color:#fff;height: 19px;float:left;line-height:19px;">Green This!</div><div style="cursor: pointer;margin-top:2px;background-image: url(http://www.greenanysite.com/images/jetpack_button_bg.png);background-position:right;width:20px;height:19px;float:left;">&nbsp;</div>',
  width: 137,
  onReady: function(widget){
    $(widget).click(function(){
      openGreener();
    });
  }
});