home *** CD-ROM | disk | FTP | other *** search
/ Enter 2005 October / enter-2005-10.iso / files / copernicagentbasic.exe / %SUPPORTTEMP% / CopernicAgentExt.dll / HTML / INTEGRATION_MENU_SEARCHEXT < prev   
Encoding:
Text File  |  2005-11-14  |  1.6 KB  |  53 lines

  1. <SCRIPT LANGUAGE="JavaScript">
  2.   var parentWin = external.menuArguments;
  3.   if (parentWin)
  4.   {
  5.     var el = parentWin.event.srcElement;
  6.     var tag = el.tagName;
  7.     var doctxt = parentWin.document.body.createTextRange();
  8.     var searchtext = "";
  9.  
  10.     switch (tag) {
  11.       case "A":
  12.         searchtext = el.innerText;
  13.         break;
  14.  
  15.       case "IMG":
  16.         searchtext = el.alt;
  17.         break;
  18.  
  19.       case "INPUT":
  20.       case "TEXTAREA":
  21.         if (el.type == "image")
  22.           searchtext = el.alt
  23.         else if (el.type != "radio") {
  24.           searchtext = parentWin.document.selection.createRange().text;
  25.           if (searchtext == "")
  26.             searchtext  = el.createTextRange().text;
  27.         }
  28.       break;
  29.     }
  30.  
  31.     if (searchtext == "") {
  32.       searchtext = parentWin.document.selection.createRange().text;
  33.       if (searchtext == "") {
  34.         doctxt.moveToPoint(parentWin.event.clientX, parentWin.event.clientY);
  35.         doctxt.moveStart("word", 1);
  36.         doctxt.moveStart("word", -1);
  37.         doctxt.moveEnd("word", -1);
  38.         doctxt.moveEnd("word", 1);
  39.         searchtext = doctxt.text;
  40.       }
  41.     }
  42.  
  43.     curlocation = "" + document.location;
  44.     tmp = curlocation.split('/');
  45.     newlocation = '';
  46.     for (var i = 0; i + 1 < tmp.length; i++)
  47.       newlocation  = newlocation  + tmp[i] + "/";
  48.  
  49.     newWin = top.window.open(newlocation + 'INTEGRATION_BAND_SEARCHBAR_HTML#' + searchtext, 'CopernicAgentSearch', 'toolbar=no,scrollbars=no,resizable=no,width=270,height=261');
  50.     if (newWin.document.all.queryinp)
  51.       newWin.document.all.queryinp.value = searchtext;
  52.   }
  53. </SCRIPT>