/* XSearch Engine version5.2 */
/* developed by P.Bestebroer */
/* http://www.dynamic-core.net */
function trecords(){
this.index=(trecords.count++)
this.link=''
this.keywords=''
this.description=''
return this
}
trecords.prototype.set=function(link,keywords,description) {
this.link=link
this.keywords=keywords
this.description=description
}
trecords.prototype.searchstring=function() { return this.link+' '+this.keywords+' '+this.description }
trecords.prototype.count=0
function add(link,keywords,description) {
al=records.length
records[al]=new trecords()
records[al].set(link,keywords,description)
}
records = new Array()
finds=0
sites=0
version="v5.2"
andresult=false
SortResults=true
display_start=0
displast=10
function qsort(f, l){ // not used anymore, causes stack-overflow in large database
// Qsort function by Rob B.
var a=f
var b=l
var s
var m = results[(a+b)>>1].val
while (a<=b) {
while (results[a].val>m) {a++}
while (m>results.val) {b--}
if (a<=b) {
s=results[a]
results[a]=results[b]
results[b]=s
a++
b--
}
}
if (f=0; i--) {
for (var j=i; j>=0; j--) {
if (results[i].val>results[j].val) {
s=results[i]
results[i]=results[j]
results[j]=s
}
}
}
}
function searchAll(keyword){
var timeA=new Date()
var nw=0
finds=0
sites=0
var x = parseIt(keyword)
if(x == -1) return
total_keywords=x
document.open()
document.clear()
document.write('')
AddBody()
if (keyword.length>50) keyword=keyword.substring(0,60)+"..."
results=new Array()
for (q=0; q0) {
if (results[a].val<=(total_keywords-1)<<1) {
results[a].val=0
sites-=1
}
}
}
}
if (SortResults && keywords!='[all]') bsort()
// Now we build the output page
displast=display_start
displast+=10
if (displast>sites) displast=sites
var timeB=new Date()
if (finds==0) { display_start=-1; displast=0 }
document.write("
Resultados "+(display_start+1)+"-"+(displast)+" de "+sites+" para "+keyword+" Tiempo de búsqueda "+((timeB-timeA)/1000)+" segundos.
")
if (displast>sites && finds!=0) displast=sites+1
if (finds==0) {
document.write("
no se encontró ''"+keyword+"''
"+
"
La palabra - "+keyword+" - no se encuentra en la base de datos.
"+
"
Verifique que haya deletreado bien la palabra.
"+
"
Intente nuevamente utilizando otra palabra clave.
"+
"
Pruebe ingresando varias palabras en un mismo campo.
"+
"")
DisplayXSearch()
document.close()
return
}
q2=display_start
q3=displast
for (q=display_start; q0) {
rc=results[q].rec
document.write(""+records[rc].link+" ")
x1=records[rc].link.indexOf('http://')
if (x1==-1) x1=records[rc].link.indexOf('href=')+5
else x1+=7
x2=records[rc].link.indexOf('>')-1
if (x1>0 && x2>0) {
tmp=records[rc].link.substring(x1,x2)
x2=tmp.indexOf(' ')
if (x2>0) tmp=tmp.substring(0,x2)
if (tmp.substring(0,1)=="'") tmp=tmp.substring(1,tmp.length-2)
if (tmp.substring(0,1)=='"') tmp=tmp.substring(1,tmp.length-1)
document.write("
"+records[rc].description+"
"+tmp+"
")
}
q2++
}
}
if (finds>10) {
document.write(" ")
pages=Math.round(finds/10)
if (finds%10<6) pages++
// Create the parameter string
paramstring=searchname+"?keywords="+keyword+"&and="+andresult+"&sort="+SortResults
document.write("
")
if (display_start>0) document.write("anterior")
document.write(" ")
for (i=1; i<=pages; i+=1){
if ((((i-1)*10)+1)<=sites) document.write(""+i+"   ")
}
document.write(" ")
if (displast<=sites) document.write("siguiente")
document.write("
")
}
DisplayXSearch()
document.close()
}
function Cat() {
document.open()
document.clear()
document.write()
AddBody()
DisplayXSearch()
document.close()
}
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)+" "
var y=0
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) return -1
key=key.substring(pos+1,key.length)
}
}
}
}
return y-1
}
var keywords = new Array()
var results
function AddBody() {
var keytext='"'+searchname+'?keywords="+'
var andtext='"&and="+'
document.write('