<search function="gg">
  <name>Google</name>
  <description>
    Google is reputed to be the web's fastest and most versatile search engine.<br/>
    <div class="helpboxDescLabels">Switches:</div>
    <table class="helpboxDescTable">
      <tr><td>/ifl</td><td> - </td><td>"I'm Feeling Lucky": Go directly to Google's top-ranked result.</td></tr>
      <tr><td>/advanced</td><td> - </td><td>Use the Google Advanced Search page.</td></tr>
      <tr><td>/groups</td><td> - </td><td>Search Google's newsgroup archive.</td></tr>
      <tr><td>/directory</td><td> - </td><td>Search Google's copy of the DMOZ open directory.</td></tr>
      <tr><td>/images</td><td> - </td><td>Search for images.</td></tr>
      <tr><td>/news</td><td> - </td><td>Search for news (<i>warning : still in beta, .com/english only</i>).</td></tr>
      <tr><td>/froogle</td><td> - </td><td>Find products for sale online(<i>warning : still in beta, .com/english only</i>).</td></tr>
      <tr><td>/glossary</td><td> - </td><td>Find definitions for words, phrases and acronyms(<i>warning : still in beta, .com/english only</i>).</td></tr>
      <tr><td>/define</td><td> - </td><td>Find Google's own definitions for words, phrases and acronyms(<i>warning : english only</i>).</td></tr>
      <tr><td>/since:days</td><td> - </td><td>Search pages based on when they were indexed.  Use either a number to specify when, or 
        <div style="padding: 0 0 0 20px">
          /since:t - indexed today<br/>   
          /since:y - indexed yesterday<br/>   
          /since:w - indexed in the last 7 days<br/>   
          /since:m - indexed in the last 30 days   
        </div> 
      </td></tr>
      <tr><td>/cache</td><td> - </td><td>Given a URL, loads Google's cached copy of the web page.</td></tr>
      <tr><td>/related</td><td> - </td><td>Given a URL, finds other sites closely related.</td></tr>
      <tr><td>/link</td><td> - </td><td>Given a URL, finds other sites that link to it.</td></tr>
      <tr><td>/video</td><td> - </td><td>Search recent TV programs online.</td></tr>
      <tr><td>/maps</td><td> - </td><td>Search for maps, directions, or businesses.</td></tr>
    </table>
    <div class="helpboxDescLabels">Locales:</div>
    <table class="helpboxDescTable">
      <tr><td>/local</td><td> - </td><td>Limits search results to the specified locale.</td></tr>
      <tr><td>/canada</td><td> - </td><td>Use the localized canadian version of Google.</td></tr>
      <tr><td>/deutschland</td><td> - </td><td>Use the localized german version of Google.</td></tr>
      <tr><td>/france</td><td> - </td><td>Use the localized french version of Google.</td></tr>
      <tr><td>/italia</td><td> - </td><td>Use the localized italian version of Google.</td></tr>
      <tr><td>/uk</td><td> - </td><td>Use the localized United Kingdom version of Google.</td></tr>
    </table>
    <div class="helpboxDescLabels">Language:</div>
    <table class="helpboxDescTable">
      <tr><td colspan="3">Display Google tips and messages in...</td></tr>
      <tr><td>/language:de</td><td> - </td><td>german</td></tr>
      <tr><td>/language:es</td><td> - </td><td>spanish</td></tr>
      <tr><td>/language:fr</td><td> - </td><td>french</td></tr>
      <tr><td>/language:it</td><td> - </td><td>italian</td></tr>
      <tr><td colspan="3">and many more... see <a href="http://www.google.com/help/customize.html#displang" target="_new">www.google.com/help/customize.html#displang</a></td></tr>
    </table>
    <div class="helpboxDescLabels">Examples:</div>
    <table class="helpboxDescTable">
      <tr><td>gg dqsd /images</td></tr>
      <tr><td>gg tony blair /uk /directory</td></tr>
      <tr><td>gg /froogle cd clock radio</td></tr>
      <tr><td>gg /glossary wrt</td></tr>
      <tr><td>gg /define wrt</td></tr>
      <tr><td>gg /video "search engine"</td></tr>
      <tr><td>gg /maps hotels near lax</td></tr>
    </table>
  </description>
  <category>Search the Web</category>
  <link>http://www.google.com/</link>
  <contributor>Ryan Edwards, David Bau, news and language switches by MLL, video and maps by Gregory Krohne</contributor>
  
  <form name="ggf"
        action="http://www.google.com/search"
        method="get">
    <input type="hidden" name="hl" value=""/>
    <input type="hidden" name="cat" value=""/>
    <input type="hidden" name="meta" value=""/>
    <input type="hidden" name="num" value=""/>
    <input type="hidden" name="ie" value="utf-8"/>
    <input type="hidden" name="q"/>
  </form>
  
  <form name="ggf_adv"
        action="http://www.google.com/advanced_search"
        method="get">
    <input type="hidden" name="hl" value=""/>
    <input type="hidden" name="ie" value="utf-8"/>
    <input type="hidden" name="q"/>
  </form>
  
  <form name="ggf_ifl"
        action="http://www.google.com/search"
        method="get">
    <input type="hidden" name="hl" value=""/>
    <input type="hidden" name="q"/>
    <input type="hidden" name="meta" value=""/>
    <input type="hidden" name="ie" value="utf-8"/>
    <input type="hidden" name="btnI" value="I'm Feeling Lucky"/>
  </form>
  
  <form name="ggf_image"
        action="http://images.google.com/images"
        method="get">
    <input type="hidden" name="hl" value=""/>
    <input type="hidden" name="ie" value="utf-8"/>
    <input type="hidden" name="q"/>
  </form>
  
  <form name="ggf_groups"
        action="http://groups.google.com/groups"
        method="get">
    <input type="hidden" name="hl" value=""/>
    <input type="hidden" name="ie" value="utf-8"/>
    <input type="hidden" name="q"/>
  </form>
  
  <form name="ggf_news"
        action="http://news.google.com/news"
        method="get">
    <input type="hidden" name="ie" value="utf-8"/>
    <input type="hidden" name="hl" value=""/>
    <input type="hidden" name="q"/>
  </form>
  
  <form name="ggf_fresh"
        action="http://www.researchbuzz.com/cgi-bin/goofresh.cgi" 
        method="get">
    <input type="hidden" name="query" />
    <input type="hidden" name="datemod" value="0" />
  </form>

  <form name="ggf_froogle"
        method="get"
        action="http://froogle.google.com/froogle">
    <input type="hidden" name="q" value="" />
    <input type="hidden" name="ie" value="utf-8"/>
  </form>

  <form name="ggf_glossary"
        method="get"
        action="http://labs.google.com/glossary">
    <input type="hidden" name="q" value="" />
    <input type="hidden" name="ie" value="utf-8"/>
  </form>

  <form name="ggf_video"
        method="get"
        action="http://video.google.com/videosearch">
    <input type="hidden" name="q" value="" />
    <input type="hidden" name="ie" value="utf-8"/>
  </form>

  <form name="ggf_maps"
        method="get"
        action="http://maps.google.com/maps">
    <input type="hidden" name="q" value="" />
  </form>

  <script><![CDATA[
    function gg(q)
    //by MLL: warning : news service is still in beta stage, so URLs below may change
    {
      var args = parseArgs(q, "ifl, advanced, groups, directory, images, news, since, cache, related, link, froogle, glossary, define, local, video, maps, canada, deutschland, france, italia, uk, language");
      var mode, local, local_meta = "", local_tld = "com", msglang = "";
      
      if( nullArgs( "gg", q ) ) return false;

      // Establish the locale and mode the search will run in.
      if( args.switches.length > 0 )
      {
        for( var j=0; j<args.switches.length; j++ )
        {
          switch( args.switches[j].name )
          {
            case "canada": local_tld = "ca"; local_meta = "cr=countryCA"; break;
            case "deutschland": local_tld = "de"; local_meta = "cr=countryDE"; break;
            case "france": local_tld = "fr"; local_meta = "cr=countryFR"; break;
            case "italia": local_tld = "it"; local_meta = "cr=countryIT"; break;
            case "uk": local_tld = "co.uk"; local_meta = "cr=countryUK|countryGB"; break;
            
            case "local": local = true; break;
            
            case "language": msglang = args.switch_val["language"]; break;
            case "since": break;
            
            default:
              if(mode) // multiple 'modes' have been specified
              { 
                nullArgs("gg","?"); 
                return false; 
              } 
              else
                mode = args.switches[j].name;
              break;
          }
        }
      }
      
      // Set number of results
      if (typeof strGoogleNum != "undefined") document.ggf.num.value = strGoogleNum;
      
      // Change the form data to use the correct locale
      document.ggf.action = document.ggf_ifl.action = "http://www.google." + local_tld + "/search";
      document.ggf_adv.action = "http://www.google." + local_tld + "/advanced_search";
      document.ggf_image.action = "http://images.google." + local_tld + "/images";
      document.ggf_groups.action = "http://groups.google." + local_tld + "/groups";
      document.ggf_news.action = "http://news.google." + local_tld + "/news";
      
      // If the user specified to search localized content only, restrict it now.
      if(local)
        document.ggf.meta.value = document.ggf_ifl.meta.value = local_meta;
      else
        document.ggf.meta.value = document.ggf_ifl.meta.value = "";
      
      // No parameters, so go to the appropriate web page.
      if( args.q == "" )
      {
        var googleURL = "http://www.google." + local_tld;
        switch( mode )
        {
          case "ifl":       googleURL = "http://www.google." + local_tld + "/help/features.html#lucky"; break;
          case "advanced":  googleURL = "http://www.google." + local_tld + "/advanced_search"; break;
          case "images":    googleURL = "http://images.google." + local_tld; break;
          case "directory": googleURL = "http://images.google." + local_tld + "/dirhp"; break;
          case "groups":    googleURL = "http://www.google." + local_tld + "/grphp"; break;
          case "news":      googleURL = "http://www.google." + local_tld + "/news"; break;
          case "froogle":   googleURL = "http://froogle.google.com/froogle"; break;
          case "glossary":  googleURL = "http://labs.google.com/glossary"; break;
          case "define":    googleURL = "http://www.google." + local_tld + "/help/operators.html#define"; break;
          default: 
        }
        openSearchWindow( googleURL ); 
        return;
      }
      else
      {
      	// Force UTF-8 encoding
      	args.q = utf8(args.q);
      	
        //apply the daterange specification
        if( args.switch_val["since"] == "" )
        {
          nullArgs("gg","?");
          return false;
        }
        if( typeof args.switch_val["since"] != "undefined" )
        {
          var today = new Date();
          var todayj = julian(today.getYear(),today.getMonth()+1,today.getDate());
          var deltadays;
          switch ( args.switch_val["since"] )
          {
            case "t": deltadays = 0; break;
            case "y": deltadays = 1; break;
            case "w": deltadays = 7; break;
            case "m": deltadays = 30; break;
            default: deltadays = args.switch_val["since"]; break;
           }
          if( isNaN(deltadays) )
          {
            nullArgs("gg","?");
            return false;
          }
          var sincej = todayj - deltadays;
          args.q = args.q + " daterange:" + sincej + "-" + todayj;
        }

        if( mode )
        {
          // Perform a validity check on the specified switch
          if((mode == "related" || mode == "cache" || mode == "link") && !isURL(args.q))
          {
            nullArgs("gg","?"); 
            return false;
          }

          switch( mode )
          {
            case "ifl":
              document.ggf_ifl.q.value = args.q;
              document.ggf_ifl.hl.value = msglang;
              submitForm(ggf_ifl);
              break;
            case "advanced":
              document.ggf_adv.q.value = args.q;
              document.ggf_adv.hl.value = msglang;
              submitForm(ggf_adv);
              break;
            case "directory":
              document.ggf.q.value = args.q;
              document.ggf.hl.value = msglang;
              document.ggf.cat.value = "gwd/Top";
              submitForm(ggf);
              break;
            case "images":
              document.ggf_image.q.value = args.q;
              document.ggf_image.hl.value = msglang;
              submitForm(ggf_image);
              break;
            case "related":
              document.ggf.q.value="related:" + args.q;
              document.ggf.hl.value = msglang;
              document.ggf.cat.value = "";
              submitForm(ggf);
              break;
            case "cache":
              document.ggf.q.value="cache:" + args.q;
              document.ggf.hl.value = msglang;
              document.ggf.cat.value = "";
              submitForm(ggf);
              break;
            case "link":
              document.ggf.q.value="link:" + args.q;
              document.ggf.hl.value = msglang;
              document.ggf.cat.value = "";
              submitForm(ggf);
              break;
            case "groups":
              document.ggf_groups.q.value = args.q;
              document.ggf_groups.hl.value = msglang;
              submitForm(ggf_groups);
              break;
            case "news":
              document.ggf_news.q.value = args.q;
              document.ggf_news.hl.value = msglang;
              submitForm(ggf_news);
              break;
            case "froogle":
              document.ggf_froogle.q.value = args.q;
              submitForm(ggf_froogle);
              break;
            case "glossary":
              document.ggf_glossary.q.value = args.q;
              submitForm(ggf_glossary);
              break;
            case "define":
              document.ggf.q.value = "define:" + args.q;
              document.ggf.hl.value = msglang;
              document.ggf.cat.value = "";
              submitForm(ggf);
              break;
            case "video":
              document.ggf_video.q.value = args.q;
              submitForm(ggf_video);
              break;
            case "maps":
              document.ggf_maps.q.value = args.q;
              submitForm(ggf_maps);
              break;
          }
        }
        else
        {
          document.ggf.q.value = args.q;
          document.ggf.hl.value = msglang;
          document.ggf.cat.value = "";
          submitForm(ggf);
        }
      }
    }

    function julian(Y,M,D) {
    //inspired from http://pacific.commerce.ubc.ca/xr/julian.html
    //(did not check it toroughly, but seems to work)
       with (Math) {
         jd=367*Y-floor(7*(Y+floor((M+9)/12))/4)
           -floor(3*(floor((Y+(M-9)/7)/100)+1)/4)
           +floor(275*M/9)+D+1721028;
       }
       return jd;
    }
    
    function gg_keypressHook(keypressEvent)
    {
      switch(keypressEvent.keyCode){
      //CTRL+D doesn't work because it's trapped by IE
        //case 4:  // CTRL+D : Definitions
        //  return gg(document.deff.q.value + " /define");
        case 6:  // CTRL+F : Froogle
          gg(document.deff.q.value + " /froogle"); return true;
        case 9:  // CTRL+I : Images
          gg(document.deff.q.value + " /images"); return true;
        case 12: // CTRL+L : I'm Feeling Lucky
          gg(document.deff.q.value + " /ifl"); return true;
      //CTRL+N doesn't work because it's trapped by IE
        //case 14: // CTRL+N : News
        //  return gg(document.deff.q.value + " /news");
        case 19: // CTRL+S : Stock Quotes
          gg("stocks: " + document.deff.q.value); return true;
        case 20: // CTRL+T : Thesaurus
          gg(document.deff.q.value + " /glossary"); return true;
        case 21: // CTRL+U : Google Groups
          gg(document.deff.q.value + " /groups"); return true;
        default:
          return false;
      }
    }

    function gg_keypressHook_okp()
    {
      if (okp() == false) {
	return false;
      } else {
	return (gg_keypressHook(window.event) == false) ? true : false;
      }
    }

  //register google hot-keys
    if (typeof registerKeypressHook == "function") {
      registerKeypressHook(gg_keypressHook);
    } else {
      document.onkeypress = gg_keypressHook_okp;
    }

  ]]></script>

  <copyright>
  Copyright (c) 2002 David Bau
  Distributed under the terms of the
  GNU Public License, Version 2 (http://www.gnu.org/copyleft/gpl.txt)
  </copyright>
</search>