// Infoplease Hot Words Search Application ($Revision: 1.1 $) 
// Copyright (c) 2000 The Family Education Company.  
// All rights reserved worldwide.

var IPHWversion  = "1";
var IPHWstr = "";
var IPHWnum = 0;

// Test for compatibility
var IPHWcompatible = 0;
if ((navigator.appName == "Microsoft Internet Explorer"
     || navigator.appName == "Netscape")
    && parseInt(navigator.appVersion) >= 4) {

  IPHWcompatible = 1;
  var IPHWwhitespace = new RegExp('([ \\t\\v\\f\\r\\n]|%0D|%0A|%20)+', 'g');
}

// Search within window W for a text selection.
function IPHWntg (w) {
  var str;
  var rng;
  if (w.document.getSelection != null) {
    str = escape(w.document.getSelection());
    str = str.replace (IPHWwhitespace,"%20");
  } else {
    if (w.document.selection.type == "Text" ) {
      rng = w.document.selection.createRange();
      str = rng.text;
    }
  }
  if (str) { return (str); }
  return "";
}

function IPHWgrab() {
  IPHWstr = IPHWntg(window);
  if (IPHWstr.length > 0) {
    window.top.status = 'Click to look up "' + unescape(IPHWstr) + '"';
  } else {
    window.top.status = 'Infoplease Hotwords: select text to look up';
  }
  return true;
}

function IPHWout() {
  window.top.status = "";
  return true;
}

function IPHWgo() {
  IPHWnum++;
  if ((IPHWstr.length > 0)) {
    url = IPHWdest + '/search.php3?query=' + IPHWstr
	  + '&hw=' + IPHWid + IPHWversion
	  + '&in=all';
    childwin = window.open (url,'IPSearch'+IPHWnum,'toolbar=yes,location=yes,directories=no,status=yes,scrollbars=yes,resizable=yes,copyhistory=no,menubar=yes,width=620,height=460');
  } else {
    var tm = String.fromCharCode(174);
	alert ('To use the HotWords' + tm + ' lookup button:\n\n1. Highlight a word or phrase you want more information about.\n2. Click the lookup button.\n3. A new window will pop up with all the search results on our site for your word or phrase.');
  }
  return false;
}

// Finally, print out the button itself.
if (IPHWcompatible) {
  document.write ('<a href="#" onMouseOver="return IPHWgrab();" onMouseOut="return IPHWout();" onClick="return IPHWgo();"><img src="' + IPHWimg + '" width=' + IPHWimgwidth + ' height=' + IPHWimgheight + ' border=0 vspace=' + IPHWvspace + ' hspace=' + IPHWhspace + ' alt="' + IPHWalttag + '"></a>');
}