
/* Apply hack to cure IE6's text-selection bug. (Thanks to http://blog.tom.me.uk/2003/07/23/boie6selecta.php) */

if (window.createPopup && document.compatMode && document.compatMode=="CSS1Compat")
{
  document.onreadystatechange = onresize = function fixIE6AbsPos()
  {
    if (!document.body) return;
    if (document.body.style.margin != "0px") document.body.style.margin = 0;
    onresize = null;
    document.body.style.height = 0;
    setTimeout(function(){ document.body.style.height = document.documentElement.scrollHeight+'px'; }, 1);
    setTimeout(function(){ onresize = fixIE6AbsPos; }, 100);
  }
}

/* Now we've fixed this major regression, enable dictionary look-up in the Cambridge online dictionary. */

 NS = (navigator.appName == "Netscape") ? 1 : 0;

 if (NS) document.captureEvents(Event.DBLCLICK);

 document.ondblclick = dict;

function dict() {
if (NS) {
/* Uses depracated but compatible method */
t = document.getSelection();
pass_to_dictionary(t);
} else {
t = document.selection.createRange();
if(document.selection.type == 'Text' && t.text != '') {
document.selection.empty();
pass_to_dictionary(t.text); 
      }
   }
}

function pass_to_dictionary(text) {
var dictWindow;
 if (text > '') {
   dictWindow=window.open('http://dictionary.cambridge.org/results.asp?searchword='+text,
			  'dictwindow',
			  'height=700, width=690, resizable=yes, scrollbars=yes');
   if (window.focus) { dictWindow.focus() }
 }

}

