// ==UserScript==
// @name           Google with Yahoo
// @namespace      http://www.akiyan.com/
// @description    Google with Yahoo
// @include        http://search.yahoo.co.jp/search*
// ==/UserScript==

(function(){
  if (window.parent != window.self) {
    return;
  }
  var $ = function(id){ return document.getElementById(id); };
  var $c = function(a) { return document.createElement(a) };
  var $t = function(t) { return document.getElementsByTagName(t) };
  var $s = function(e, s) { e.setAttribute('style', s); };
  
  var keyword = $('yschsp').value;
  var body = $t('body')[0];
  body.style.marginRight = "37%";
  
  var url = 'http://www.google.co.jp/search?hl=ja&q=' + encodeURIComponent(keyword);
  var d = $c('div');
  $s(d, 'position:absolute;top:25px;background:#fff;padding:3px;right:4px;width:35%;float:right;height:95%');
  var a = $c('a');
  a.href = url;
  a.innerHTML = 'Google Search';
  d.appendChild(a);
  body.appendChild(d);

  var iframe = $c('iframe');
  iframe.src = url;
  $s(iframe, 'width:100%;border:1px solid #ccc');
  iframe.style.height = body.offsetHeight + "px";
  d.appendChild(iframe);
  
})();