// ==UserScript==
// @name             Adds Site Search By green.search.goo.ne.jp
// @namespace        http://an-k.jp/
// @description	     Adds Site Search By green.search.goo.ne.jp
// @include          *
// @version          1.00
// ==/UserScript==

if (self.location.href!=top.location.href) return;

if(document.contentType != 'text/html') return;

var GM_infoPanel = document.createElement('div');

with(GM_infoPanel.style) {
   top   = 0;
   right     = 0;
   padding  = '2px';
   opacity  = 0;
   fontSize = 'x-small';
   color    = '#000000';
   backgroundColor = '#EEEEEE';
   border   = '1px solid #C0C0C0';

   zIndex   = 100;
   position = 'fixed';

   width    = '100px';
   cursor   = 'pointer';
}

GM_infoPanel.innerHTML = '&nbsp;';
GM_infoPanel.addEventListener('mouseover', makeForm, false);
GM_infoPanel.addEventListener('mouseout', hideForm, false);

document.body.appendChild(GM_infoPanel);

function makeForm() {
   var site = document.domain;

   this.style.opacity = '';
   this.style.width   = '';

   this.innerHTML =
      '<form action="http://green.search.goo.ne.jp/search" method="get" '+
      'Accept-charset="EUC-JP" style="margin:0px" target="_blank">' +
      '<span id="delete_site_search__">×</span>'+
      '<input type="hidden" name="Domain" value="' + site + '">'+
      '<input type="hidden" name="IE" value="EUC-JP">'+
      '<input type="hidden" name="DS" value="IN">'+
      '<input type="text" size="20" name="MT">'+
      '<input type="submit" value="Site Search">'+
      '</form>'+
      '';

   this.removeEventListener('mouseover', makeForm, false);
   this.addEventListener('mouseover', showForm, false);
   var button = document.getElementById('delete_site_search__');
   with(button.style){
     fontSize = '125%';
     marginRight = '0.5em';
   }
   button.addEventListener('click', deleteForm, false);
}

function hideForm() {
  GM_infoPanel.style.opacity  = '0';
}
function showForm() {
   GM_infoPanel.style.opacity  = '100';
}
function deleteForm() {
   document.body.removeChild(GM_infoPanel);
}

/* This code is in the public domain. */


