// BEGIN reading currently selected text
function readText() {
	if ((domData.isOther) || (domData.isIE5Mac)) { return; }
	var text = "";
	if (domData.isNN4) { text = window.getSelection().toString(); 
	} else if (domData.isIE4up) { text = document.selection.createRange().text; 
	} else if (domData.isNN6up) { text = window.getSelection().toString(); }
	return text;
} // END readText()


// BEGIN run a search from the selected word
function defineWord() {
	if ((domData.isOther) || (domData.isIE5Mac)) { return; }
	var word = readText();
           word = word.replace(new RegExp("–","g"),"")
            word = unescape(unescape(word));

	if (word == "") { 
		alert("To use the cross-reference feature, use your mouse to select text, then click the cross-reference link or option.");
		return; 
	}
	var lookup = "/search/query?view=crossref&text="+word;
	popup(lookup,"definer",750,500);
} // END define

// BEGIN run a search from the selected word
function defineWordOHO() {
	if ((domData.isOther) || (domData.isIE5Mac)) { return; }
	var word = readText();
            word = word.replace(new RegExp("–","g"),"")
            word = unescape(unescape(word));
         
	if (word == "") { 
		alert("To use the cross-reference feature, use your mouse to select text, then click the cross-reference link or option.");
		return; 
	}
	var lookup = "/search/oho_query?view=crossref&text="+word+"&subjects=oho_business,oho_philosophy,oho_politics,oho_religion";
	popup(lookup,"definer",750,500);
} // END define