<!--
//Copyright 2006 by Joy Reynolds
//Prepare the keywords from a search for manipulation.
keywordsA=new Array();
manipulator=new Array();
var newWin='';

function keywin(here,there,w) {      //hold the ranges of the keyword groups
  this.here=here;
  this.there=there;
  this.w=w;
  }

function findElement(id) {
  var el='';
  if (document.getElementById)            //Level 1 DOM (Netscape 6, Explorer 5)
    el=document.getElementById(id);
  else if (document.all)                  //IE4 DOM
    el=document.all[id];
  return el;                              //else Netscape 4 is buggy
  }

function loadkeywords() {           //get the keywords from the textarea into an array
  var el=findElement('allkeywords')
	if (el) {
		allkey=el.value
		allkey=allkey.replace(/\t[^\n]+\n/g,",");
		allkey=allkey.replace(/\n/g,",");
		allkey=allkey.replace(/\s+,/g,",");
		allkey=allkey.replace(/^,*(.*?),*$/,"$1");           //get rid of leading and trailing commas
		keywordsA=allkey.split(',');
		}
  }

function getkeywords(winname) {         //called from the manipulator window
  var win=winname.replace(/\D+/,"")
  if (manipulator[win] && manipulator[win].w.name == winname)
    return keywordsA.slice(manipulator[win].here,manipulator[win].there);
  else return new Array();
  }

function manipulate(win,here,there) {        //open new window to manipulate keyword group
  if (typeof here == "undefined" || here <0) here=0;
  if (typeof there == "undefined" || there >keywordsA.length || there ==0) there=keywordsA.length;
  url="manipulate_keywords.htm";
  if (manipulator[win])  newWin=manipulator[win].w;     //have we done this one before?
  else newWin='';
  if (!newWin.closed && newWin.location)               //for IE4&5
    newWin.location.href = url;
  else
    newWin=window.open(url,"manipulator_"+win,"",true);
  if (!newWin.opener) newWin.opener = self;             //for really old browsers
  if (manipulator[win]) manipulator[win].w=newWin
  else manipulator[win]=new keywin(here,there,newWin);
  if (newWin.focus) newWin.focus();
  return false;
  }
//-->