var searchname = 'searchfull.html';		// name of THIS html file 

var usebannercode = false;			// Also generate banner HTML code (use any service/cgi/java/what ever you want !)
var displaycategories = false;		// display the categories, or not?
var displaysearchengines = false; // display the "other search engines", or not?

var fgcolor = "'#e6e6e6'";	// forground color for text on page
var barcolor = "'#818181'"; 	// background color for top-bars

var ButtonPicture = "images/search.gif";
var EmailPicture = "";		// picture to use for email-adresses
var HTMLPicture = ""; 		// picture to use for HTML adresses
var FTPPicture = ""; 		// picture to use for FTP adresses

var tableWidth = "350";  	// Width of all output to the screen


function templateBody(){
	document.write('<html><head><title>XSearch</title></head><body bgcolor="#ffffff" text="#000000" link="#000099" vlink="#996699" alink="#996699"><Center><font face="Arial" size="3"><table border=1><tr><td center>');
}

function templateEnd(){
	document.write('</td></tr></table></font></center></body></html>');
}

function bannerCode() {
	document.write(
'<CENTER><TABLE border=1 width='+tableWidth+'><TR><TD><font face="arial" size="3">'+
'<B>New Features:</b><br>'+
'* On populair demand, you can now disable the "Other search engines" block, but setting <i>displaysearchengines=false</i><br>'+
'* Some servers had a problem with the space between words in the URL, so it is now replaced with a + sign<br>'+
'* Added <i>ButtonPicture</i> variable to specify the Search-Button image location.'+
'* Minor speed up by removing unneeded lines, and making document.writes faster.'+
'</font></td></tr></table></center><br>');
}
// ----  END OF CONFIGURATION BLOCK ---- //


//-----------------------------------------------------------------------------------------------
//
//  Initialise some variables
//
var finds =0;  		// This will count the maximum of hits found 
var sites =0;  		// This will count the amount of different sites found (site-matches)
var version = "v4.3"	// version number of XSearch
var andresult = false;	// do AND search (if not it's an OR)
var SortResults = true; // Sort the results
var display_start = 1;	
var displast = 10;

//  This is the main start of the script
//  it's called by the HTML code
//-----------------------------------------
function searchAll(keyword){
	// first we initialise some variables
	//------------------------------------
	var nw=1;
	finds=0;
	sites=0;
	clearSearch(); 
	// abort on failed parse
	//-----------------------
	var x = parseIt(keyword);
	if(x == -1) {	
		return;
	}
	total_keywords=x;
	// prepare the output document
	//----------------------------
	document.open();
	document.clear();
	AddBody();
	// if keywords are to long display an ending ... 
	//------------------------------------------------
	if (keyword.length>50){
		keyword=keyword.substring(0,60)+"...";
	}

	results=new makeArray(records_count,1);
	order=new makeArray(records_count,1);
	for (q=1; q<=results.length; q++){
		results[q]=0;
		order[q]=q;
	}

	data=new makeRecordLinks(records_count);
	foundwords=new makeArray(records_count,0);

	while(keywords[nw].length > 1) {
		search(data,keywords[nw]);
		nw++;
	} 

	if (andresult){
		for (a=1; a<=results.length;){
			if (results[a]>0){
				if (results[a]<=(total_keywords-1)*2){
					results[a]=0;
					sites=sites-1;
				}
			}
			a++;
		}
	}


	// sort the results, so most hits comes first
	//-------------------------------------------
	var temp =0;

	if ((SortResults==true)&&(keywords!='[all]')){
	 	for (a=results.length; a>=2;){
			for (b=1; b<a;){
				if (results[order[a]]>results[order[b]]){
					temp=order[b];
					order[b]=order[a];
					order[a]=temp;
				}
				b++;
			}
			a--;
		}
	} else {
		b=0;
	 	for (a=results.length; a>=2;){
			if (results[a]>0){
				order[b]=a;
				b++
			}
			a--;
		}
	}

	//
	// Now we build the output page
	//-------------------------------
	// display any other search engines we know of
	//--------------------------------------------

	if ((displaysearchengines==true) && (finds!=0)){
		document.write("<table border=0 width="+tableWidth+"><tr><td bgcolor="+barcolor+"><font face='arial' size='3' color="+fgcolor+"><B>Other Search engines</b></font></td></tr></table><br><br>");
		var i =0;
		var j =sites;
		for (q=0; q<=sites;) {
			if (v3[order[q]]=='searchengine') {
				pos=data[order[q]].v1.indexOf('href=');
				tmpurl=data[order[q]].v1.substring(pos+5,data[order[q]].v1.indexOf(' ',pos+5));
				pos=data[order[q]].v1.indexOf(' ',pos);
				tmp=data[order[q]].v1.substring(0,pos)+'?'+findw.substring(1,findw.length)+data[order[q]].v1.substring(pos,data[order[q]].v1.length);
				document.write("<font face='arial' size='2'><li>"+tmp+"<br>found at: "+tmpurl+"</font><br></li>");
				i++;
				j=j-1;
			}
			q++;
		}
		if (i==0){
			document.write("<font face='arial' size='2'><li>No search engines found.</li></font><br>");
		}

		sites=j;
	}

	displast=display_start;
	displast=displast+10;
	if (displast>sites){
		displast=sites+1;
	}


	document.write("<br><table border=0 width="+tableWidth+"><tr><td bgcolor="+barcolor+"><font face='arial' size='3' color="+fgcolor+"><B>Search results for:  " +keyword +"</b></font></td></tr></table><br>"+
						"<font face='arial' size='2'>Showing results: "+display_start+" - "+(displast-1)+" out of "+sites+"</font><br><br>"+
						"<table border=0 width='"+tableWidth+"'>");
	if (finds==0){
		document.write("<tr><td><font face=arial>"+
							"<LI>Try to use other keywords for a better result</li>"+
							"<LI>Use multiple keywords if possible</li>"+
							"</font></td></tr></table>");
		DisplayXSearch();
		document.close();
		return
	}

	q2=display_start;
	q3=displast;
	for (q=display_start; q<q3;){
	   if (results[order[q]]>0){
		if ((v3[order[q]]!='searchengine') || (findw.indexOf('searchengine')>-1)) {
			if ((data[order[q]].v1.indexOf('<font')<0) && (data[order[q]].v1.indexOf('<FONT')<0)) {
				tmp='<font face=arial size=2>'+data[order[q]].v1+'</font>';
				data[order[q]].v1=tmp;
			}
			document.write("<tr><td><font face=arial size=2><B>"+q2+". </B></font>"+data[order[q]].v1);
			if (v1[order[q]].indexOf("mailto:")!=-1){ 
				document.write("<center><table width=100% border=0 cellspacing='0' cellpadding='0'><td width='5%'>"+EmailPicture+"</td><td width='95%'>");
			} else if (v1[order[q]].indexOf("ftp:")!=-1){ 
				document.write("<center><table width=100% border=0 cellspacing='0' cellpadding='0'><td width='5%'>"+FTPPicture+"</td><td width='95%'>");
			} else {
				document.write("<center><table width=100% border=0 cellspacing='0' cellpadding='0'><td width='5%'>"+HTMLPicture+"</td><td width='95%'>");
			}
			document.write("<font face='arial'></font><font face=arial size=2></font></td></tr></td></table></center>");
			q2++;
		}
		else { 
			q3++;
		}
	   }
	  q=q+1;
	}

	if (finds>10){  // sites
		document.write("<BR><B><font face=arial size=2>");
		pages=Math.round(finds/10);  //sites
		if (finds%10<6) { // sites
			pages++;
		}

		// Create the parameter string
		paramstring=searchname+"?keywords="+keyword+"&and="+andresult+"&sort="+SortResults;

		if (display_start>1){
			document.write("<a href='"+paramstring+"&disp="+(display_start-10)+"'>Previous page</a>&nbsp |&nbsp ");
		} else {
			document.write("Previous page &nbsp|&nbsp ");
		}
		if (displast<=sites){
					document.write("<a href='"+paramstring+"&disp="+(displast)+"'>Next page</a>&nbsp |&nbsp&nbsp Page: ");
		} else {
			document.write("Next page &nbsp|&nbsp&nbsp Page: ");
		}
		for (i=1; i<=pages;){
			if ((((i-1)*10)+1)<=sites) {
				document.write("<a href='"+paramstring+"&disp="+(((i-1)*10)+1)+"'>"+i+"</a>&nbsp&nbsp ");
			}
			i++;
		}
		document.write('</b></font>');
	}

	document.write("</table></font>"  +"");

	DisplayXSearch();
	document.close();
}



// Show all categories in the database
//-------------------------------------
function cat(){

	document.open();
	document.clear();
	AddBody();

	if (displaycategories) {
		var cats=0;
		var singleword="";
		var pos = 0;
		var match = 0;

		data=new makeRecordLinks(records_count);
		results=new makeArray(records_count,0);
		order=new makeArray(records_count,0);
	
		for (q=1; q<=records_count; q=q+1){
			match=-1;
	
			singleword=data[q].v2;
			phrase=data[q].v1;

			pos=singleword.indexOf(" ");
			singleword=singleword.substring(0,pos);
			if (singleword!='searchengine') {

				for (b=1; b<=cats; b=b+1){
					if (results[b]==singleword){
						match=b;
					}
				}
				if (match<0){
					cats++;
					results[cats]=singleword;
					order[cats]=phrase;
				} else {
					if (order[match].length<80) {
						order[match]=order[match]+', '+phrase;
					}
				}
			}
		}

		document.writeln("<center><table border=0 width='500'><tr><td valign='top' align='left'><font face='Arial' size='2'>");

		for (b=1; b<=Math.round(cats/2); b=b+1){
			singleword=searchname+'?keywords='+results[b]+'&and=false&sort=true';
			document.writeln("<B><a href='"+singleword+"'>"+results[b].substring(0,1).toUpperCase()+results[b].substring(1,results[b].length)+"</a></b><br>"+order[b]+"<br><br>");
		}

		document.write("</font></td><td align='left' valign='top'><font face='arial' size='2'>");
		for (b=Math.round(cats/2)+1; b<=cats; b=b+1){
			singleword=searchname+'?keywords='+results[b]+'&and=false&sort=true';
			document.writeln("<B><a href='"+singleword+"'>"+results[b].substring(0,1).toUpperCase()+results[b].substring(1,results[b].length)+"</a></b><br>"+order[b]+"<br><br>");
		}
		document.writeln("</font></td></tr></table></center>");
	}

	DisplayXSearch();
	document.close();
}


// function that will create an array for us
//----------------------------------------------
function makeArray(n,vartype) {
	this.length = n;
	for (var k = 1; k <= n; k++) {
		if (vartype==0){
			this[k] = "";
		} else {
			this[k] = 0;
		}
	}
	return this;
}               

// oldArray function
//==================================
function oldArray() {
	this.length = oldArray.arguments.length
	for (var i = 0; i < this.length; i++) {
		this[i] = oldArray.arguments[i]
	}
	return this;
}

function stripInput(key) {
	while(key.substring(0,1) == ","  || key.substring(0,1) == " " ) { 
		key = key.substring(1,key.length);
	}
	while(key.substring(key.length-1,key.length) == "," || key.substring(key.length-1,key.length) == " ") {
		key = key.substring(0,key.length-1);
	}
	return key;
}

function parseIt(key) {
	key = stripInput(key);
	key+=" ";
	var y = 1;

	while(key.indexOf(" ") > 0) {
		if (key.substring(0,1)=='"') {
			var pos=key.indexOf('"',2);
			keywords[y]=key.substring(1,pos);
			keywords[y]=stripInput(keywords[y]);
			y++;
			key=key.substring(pos+1,key.length);
		} else {
		  var pos=key.indexOf(' AND ');
		  if ((pos>0) && (key.indexOf(' ')>=pos)) {
			pos=key.indexOf(' ',pos+5);
			keywords[y]=key.substring(0,pos);
			keywords[y]=stripInput(keywords[y]);
			y++;
			key=key.substring(pos+1,key.length);
			if (key.substring(0,4)=='AND ') {
				pos=keywords[y-1].indexOf(' ')+5;
				key=keywords[y-1].substring(pos,keywords[y-1].length)+' '+key;
			}
		} else {
		  	var pos=key.indexOf(' OR ');
		  	if ((pos>0) && (key.indexOf(' ')>=pos)) {
				pos=key.indexOf(' ');
				keywords[y]=key.substring(0,pos);
				keywords[y]=stripInput(keywords[y]);
				if (keywords[y]!=keywords[y-1]) {
					y++;
				}
				key=key.substring(pos+1,key.length);
				pos=key.indexOf('OR ');
				key=key.substring(pos+3,key.length);
				pos=key.indexOf(' ');
				keywords[y]=key.substring(0,pos);
				keywords[y]=stripInput(keywords[y]);
				y++;
				key=key.substring(pos+1,key.length);
				if (key.substring(0,3)=='OR ') {
					key=keywords[y-1]+' '+key;
				}
		} else {
			var pos = key.indexOf(" ");
	
			keywords[y]=key.substring(0,pos);
			keywords[y] = stripInput(keywords[y]); 
			y++;
	
			if(y > 50) {
				alert("too many search words");
				return -1;
			}
			key=key.substring(pos+1,key.length);
		}}}
		
	}
	return y-1;
}


var keywords = new makeArray(50,0);
var results;
var foundword;
var data;
var order;
var total_keywords;

function clearSearch() {
	for(var x=1;x <= 25; x++) {
		keywords[x]=""; 
	}
}

function dataEntry (){
        this.v1="";
        this.v2="";
        return this;
}

function makeRecordLinks(size) {
	this.length = size;
	for (var r=1; r<= size; r++) {
           this[r] = new dataEntry();
           this[r].v1 = v1[r];
           this[r].v2 = v2[r]; 
	}
        return this;
}

function AddBody(){
	var keytext='"'+searchname+'?keywords="+';
	var andtext='"&and="+';

		document.write('<script>function doSearch(){'+
							'searchwords=document.searchform.searchwords.value; '+
							'while (searchwords.indexOf(" ")>-1){ pos=searchwords.indexOf(" ");'+
							'searchwords=searchwords.substring(0,pos)+"+"+searchwords.substring(pos+1); }'+
							'document.location='+keytext+' searchwords+'+andtext+'"0"}'+
							'<'+'/'+'script>'
							);

		templateBody();
		document.write("<form name='searchform' method='post' action='javascript:doSearch()'><table border='0' width='100%'><tr><td align='center'><font face='Arial, Helvetica, sans-serif' size='3'><input name='searchwords' type='text' size='30'><a href='javascript:doSearch()'><img src='"+ButtonPicture+"' border=0></a></font></td></tr></table></form>");

	if (usebannercode) {	bannerCode(); }
}

function DisplayXSearch(){
	document.write("<center><br><table border=0 width='"+tableWidth+"'><td bgcolor="+barcolor+" align='center'></td></table></center>");
	templateEnd();
}

function search(records, keyword)
{
	var hit=0;
	var addcomplete=0;
	
        for (q=1; q<=records.length; q++) {
			// check for a full hit
			//------------------------
			addcomplete=0;
			 search_parm=records[q].v2.toLowerCase();
			 search_parm=" "+search_parm+" "+v3[q].toLowerCase();

			 if (keyword.indexOf(' AND ')>0){
				firstword=keyword.substring(0,keyword.indexOf(' '));
				lastword=keyword.substring(keyword.indexOf(' AND ')+5,keyword.length);
				if ((search_parm.indexOf(" "+firstword+" ") != -1) && (search_parm.indexOf(" "+lastword+" ")!= -1 )){
	                    		hit++;
					finds++;
					if(hit < 2) { 
						if (results[q]==0){	sites++;	}
						results[q]=results[q]+2; 

						keyword=keyword.toUpperCase();
						foundwords[q]=foundwords[q]+"<B>"+firstword+"</b>&nbsp&nbsp<B>"+lastword+"</b>&nbsp&nbsp";
						keyword=keyword.toLowerCase();
					} 
				}
			 } else {
			 keyword=keyword.toLowerCase();
                         if ((search_parm.indexOf(" "+keyword+" ") != -1) ||(keyword=="[all]")){
                    		hit++;
				finds++;
				if(hit < 2) { 
					if (results[q]==0){	sites++;	}
					results[q]=results[q]+2;
					keyword=keyword.toUpperCase();
					foundwords[q]=foundwords[q]+"<B>"+keyword+"</b>&nbsp&nbsp ";
					keyword=keyword.toLowerCase();
				} 
				
                         } else {

				// check for a half hit (ie. search:share find:SHAREware)
				//-------------------------------------------------------
				if (search_parm.indexOf(keyword) != -1) {
					hit++;
					finds++;
					if(hit < 2) { 
						if (results[q]==0){  sites++;  }
						results[q]=results[q]+1;
						// now do a trick with the found word
						// first get the position where the word is found
						x=search_parm.indexOf(keyword)+keyword.length;
						// the part infront of the keyword 
						pos=search_parm.substring(1,x-keyword.length);
						while (pos.indexOf(" ")!=-1){
							y=pos.indexOf(" ");
							pos=pos.substring(y+1,pos.length);
						}
						if (pos.length<=2){
							pos=pos.toUpperCase();
							addcomplete++;
							foundwords[q]=foundwords[q]+"<B>"+pos+"</b>";
						} else {
							foundwords[q]=foundwords[q]+pos;
						}
						// add keyword to foundwords (in BOLD)
						keyword=keyword.toUpperCase();
						foundwords[q]=foundwords[q]+"<B>"+keyword+"</b>";
						// now add the rest of the word to it
						pos=search_parm.substring(x,search_parm.length);
						fullresult=search_parm.substring(x,x+pos.indexOf(" "));

						if (fullresult.length<=2){
							fullresult=fullresult.toUpperCase();
							addcomplete++;
							foundwords[q]=foundwords[q]+"<B>"+fullresult+"</b>   "; 
						} else {
							foundwords[q]=foundwords[q]+fullresult+"   "; 
						}
						keyword=keyword.toLowerCase();
						if (addcomplete>1) {
							results[q]=results[q]+1;
						}
					}
				}
			}
			}
			hit=0;
	} 
}                                       
//-------------------------------------------------------
// DATA SECTION
// This part contains the searchwords and the site-links
//-------------------------------------------------------
var records_count=0; 

v1 = new makeArray(records_count);
v2 = new makeArray(records_count);
v3 = new makeArray(records_count);

var a=0;

//----- START OF DATABASE -------\\

a +=1
  v1[a] = "<a href=faqfull.html target='_top'>Frequently Asked Questions</a>"
  v2[a] = "faq faqs frequently asked questions what parapsychology not study topic psychic experience interesting controversy controversial psi research experiments practical applications criticisms degree develop ability esp extra sensory perception clairvoyance telepathy precognition psychokinesis pk bio pk poltergeist haunting obe out of hody experience nde near death reincarnation"
  v3[a] = "Frequently Asked Questions"


a += 1
  v1[a] = "<a href=generalfull.html target='_top'>General Information</a>"
  v2[a] = "general info information case study field investigation experiment parapsychology j.b. rhine esp cards karl zener mean chance controversy quantum mechanics physics statistics future applied psi decline effect duke university parapsychology laboratory myers briggs type indicator mbti psi mediated instrumental response pmir"
  v3[a] = "General Information"

a += 1
  v1[a] = "<a href=historical.html target='_top'>Historical Information</a>"
  v2[a] = "historical info information catholic church saints spiritualism mesmerism emmanuel sweedenborg d.d. home society for psychical research parapsychological association spr pa rhine duke university parapsychology laboratory medium"
  v3[a] = "Historical Information"

a += 1
  v1[a] = "<a href=espfull.html target='_top'>Extrasensory Perception (ESP)</a>"
  v2[a] = "esp extrasensory perception extra sensory gesp general carl jung collective unconscious esp cards pearce pratt crisis apparition rhine institute for parapsychology altered state of consciousness sheep goat effect"
  v3[a] = "Extrasensory Perception (ESP)"

a += 1
  v1[a] = "<a href=clairvoyancefull.html target='_top'>Clairvoyance</a>"
  v2[a] = "clairvoyance emmanuel sweedenborg clairaudience russell targ hal puthoff stanford research institute remote viewing pat price"
  v3[a] = "Clairvoyance"

a += 1
  v1[a] = "<a href=telepathyfull.html target='_top'>Telepathy</a>"
  v2[a] = "telepathy altered states of consciousness maimonides dream laboratory ganzfeld autoganzfeld charles honorton white noise"
  v3[a] = "Telepathy"

a += 1
  v1[a] = "<a href=precognitionfull.html target='_top'>Precognition</a>"
  v2[a] = "precognition random number generator rng helmut schmidt bessent altered state of consciousness"
  v3[a] = "Precognition"

a += 1
  v1[a] = "<a href=psychokinesisfull.html target='_top'>Psychokinesis (PK)</a>"
  v2[a] = "psychokinesis pk rng random number generator helmut schmidt kulagina parise micro macro pear princeton engineering anomalies research uri geller toronto society psychical research"
  v3[a] = "Psychokinesis"

a += 1
  v1[a] = "<a href=biopkfull.html  target='_top'>Bio-PK</a>"
  v2[a] = "bio-pk bio pk psychokinesis mind science foundation braud healing psychic biofeedback placebo effect direct mental interaction with living systems dmils kirlian photography aura"
  v3[a] = "Bio-Psychokinesis"

a += 1
  v1[a] = "<a href=poltergeistfull.html target='_top'>Poltergeist</a>"
  v2[a] = "poltergeist rspk recurrent spontaneous psychokinesis pk william roll harry price rosenheim focus"
  v3[a] = "Poltergeist"

a += 1
  v1[a] = "<a href=hauntingfull.html target='_top'>Haunting</a>"
  v2[a] = "haunting hauntings ghost ghosts apparition harry price recurrent localized discarnate entity"
  v3[a] = "Hauntings"

a += 1
  v1[a] = "<a href=obefull.html target='_top'>Out-of-Body Experience (OBE)</a>"
  v2[a] = "out-of-body experience out of body experience obe astral projection traveling robert morris harary keith spirit"
  v3[a] = "Out-of-Body Experience (OBE)"

a += 1
  v1[a] = "<a href=ndefull.html target='_top'>Near Death Experience</a>"
  v2[a] = "near death experience nde"
  v3[a] = "Near Death Experience"

a += 1
  v1[a] = "<a href=reincarnationfull.html target='_top'>Reincarnation</a>"
  v2[a] = "reincarnation regression cryptonmensia hypnosis past life ian stevenson"
  v3[a] = "Reincarnation"

a += 1
  v1[a] = "<a href=otherfull.html target='_top'>Other Psychic Phenomena</a>";
  v2[a] = "other psychic phenomena deja vu psychometry retrocognition dowsing divining rod pendulum"
  v3[a] = "Other Psychic Phenomena"

a += 1
  v1[a] = "<a href=occultfull.html target='_top'>The Occult</a>"
  v2[a] = "occult"
  v3[a] = "The Occult"

a += 1
  v1[a] = "<a href=mythlegfull.html target='_top'>Myths and Legends</a>";
  v2[a] = "myths legends myth legend"
  v3[a] = "Myths and Legends"

a += 1
  v1[a] = "<a href=popfull.html target='_top'>Pop Culture Phenomena</a>"
  v2[a] = "pop culture phenomena news tidbits monthly columns listings"
  v3[a] = "Pop Culture Phenomena"

a +=1
  v1[a] = "<a href=moreinfofull.html target='_top'>For More Information</a>"
  v2[a] = "for more information info books journals book journal web sites websites university universities institute institutes link links organizations"
  v3[a] = "For More Information"


a += 1
  v1[a] = "<a href=aboutsitefull.html target='_top'>About the Site</a>"
  v2[a] = "about site authors bindi tiara thinkquest think quest resources"
  v3[a] = "About the Site"

a += 1
  v1[a] = "<a href=glossaryfull.html target='_top'>Glossary</a>"
  v2[a] = "glossary terms people agent alchemy altered states of consciousness american society for psychical research anomalous phenomena apparition astral body aspr projection astrology aura autoganzfeld bessent bias biofeedback bio pk braud call chiromancy clairaudience clairvoyance collective unconscious correlation crisis cryptomneisa decline effect deja vu direct hit discarnate entity theory divination divining rod dmils dowsing duke university parapsychology laboratory esp cards experimenter extra sensory perception faith healing feedback focus forced choice method free response ganzfeld geller gesp general ghost goat haunting home honorton kirlian photography kulagina macro pk maimonides magic magick dream laboratory mean chance expectation medium mentation mesmerism meta analysis micro mind science foundation miss morris myers briggs type indicator near death experience nde negative psi noise occultism out of body paranormal parapsychology parapsychological association pear laboratory princeton engineering anomalies research placebo poltergesit precognition harry price pat projective psi psychic healing psychical research psychokinesis psychometry psychophysical puthoff random number generator rng receiver receptive recurrent localized spontaneous regression reincarnation remote viewing retrocognition rhine roll rspk run schmidt scrying sender sheep signal spiritualism cases human combustion stanford institute statistical significance stevenson stigmata subject swann targ target telekinesis telepathy toronto transpersonal psychology traveling trial white zener"
  v3[a] = "Glossary"

//------ END OF DATABASE  --------\\
records_count = a;
// ----end data -------
	var searchwords = '';
	var newload = true;

	function countParams(text){
		pos=-1;
		tmp = "";
		if (text==''){
			return 0;
		}
		text=text+'&';
		
		i=0;

		while (text.length>0){
			pos=text.indexOf('&',0);
			tmp=text.substring(pos+1);
			text=tmp;
			i++;
		}

		return i;
	}	

	function getCommand(text,val){
		pos=-2;
		tmp = "";
		text=text+'&';
		
		for (i=0; i<=val;){
			pos2=pos+2;
			pos=text.indexOf('&',pos2);
			tmp=text.substring(pos,pos2-1);
			i++;
		}
		text=tmp;
		pos=text.indexOf('=',0);
		if (pos!=-1){
			tmp=text.substring(pos,0);
		}
		tmp=tmp.toLowerCase();
		return tmp;
	}

	function getValues(text,val){
		pos=-2;
		tmp = "";
		text=text+'&';
		
		for (i=0; i<=val;){
			pos2=pos+2;
			pos=text.indexOf('&',pos2);
			tmp=text.substring(pos,pos2-1);
			i++;
		}

		text=tmp;
		pos2=text.indexOf('=',0)+1;
		if (pos2!=-1){
			tmp=text.substring(pos2);
		} else { tmp='' }
	
		pos=-2;
		text=tmp;	
		if (text.indexOf('%20')>0){
			pos=text.indexOf('%20',0);
			tmp=text.substring(0,pos2-4)+' '+text.substring(pos2-1,text.length);
			text=tmp;
		}
		return tmp;
	}		

	function initXsearch(){
		if (searchwords!=''){
			searchAll(searchwords);
		} else {
			if (newload) {
				cat();
			}
		}
	}

	function doParamStuff(findw){
		Myparams=countParams(findw);
		if (Myparams>0){
			for (cnt=0; cnt<Myparams;){
	
				tempw=getCommand(findw,cnt);
				tempv=getValues(findw,cnt);
	
				if (tempw=='keywords'){
					searchwords=getValues(findw,cnt);
					origsearchwords=searchwords;
					while (searchwords.indexOf('+')>-1)
					{
						pos=searchwords.indexOf('+');
						searchwords=searchwords.substring(0,pos)+' '+searchwords.substring(pos+1);
					}
				}
				if (tempw=='sort'){
					if ((tempv=='0')||(tempv=='false')){
						SortResults=false;
					} else {
						SortResults=true;
					}
				}
					
				if (tempw=='and'){
					if ((tempv=='1')||(tempv=='true')){
						andresult=true;
					} else {
						andresult=false;
					}
				}

				if (tempw=='disp'){
					display_start=parseInt(tempv);
				}
			cnt=cnt+1;
			}
		}
		initXsearch();
	}

	if ((navigator.appName!='Netscape')&&(navigator.appVersion<4)){
		var s = '';
		findw=document.location;
		s=findw;
		pos=s.indexOf('?');
		if (pos>-1){
			findw=findw.substring(pos+1,s.length);
		}
	} else {
		findw=document.location.search;
		findw="&"+findw.substring(1,findw.length);
	}

	while (findw.indexOf('%20')>0){
			pos2=findw.indexOf('%20',0);
			tmp=findw.substring(0,pos2)+' '+findw.substring(pos2+3,findw.length);
			findw=tmp;
	}

	doParamStuff(findw);

