]> matita.cs.unibo.it Git - helm.git/blob - helm/searchEngine/html/index.html
The processorURL parameter must now be instantiated by the searchEngine.
[helm.git] / helm / searchEngine / html / index.html
1 <HTML>
2 <HEAD>
3 <SCRIPT language="Javascript">
4 var query="*"; // stringa che contiene la query nel suo stato attuale.
5 var storeps=1;
6 var storepv=1;
7 var storepb=1; // queste tre variabili contengono il numero da assegnare al prossimo simbolo set, val o boole per creare il link nel frame in alto a sinistra.
8 var stadd; // contiene la stringa da aggiungere alla query.
9 var fb; // contiene la stringa da aggiungere alla query prima che i set,val e boole siano convertiti in link.
10 var ltr="*"; // qui viene memorizzato qual è l' ultimo link su cui si è cliccato.
11 var norvars=0;
12 var nosvars=0;
13 var novvars1=0;
14 var novvars2=0; // queste tre variabili servono per sapere dove memorizzare i nomi delle rvar,svar e vvar inserite dall' utente. 
15 var wrong=0;
16 var ricordaliaslist=0;
17 var actinput=0;
18 var numeroazioniannullate=0;
19 var terminecic="";var listaliases="";vlds=new Array();//contengono i parametri per dialogare col server in caso di ambiguità nella Match Conclusion.
20 var disambiguation_choices = "";
21 aliasglob=new Array();//per conservare la lista degli alias
22 function initialize()
23         {
24         rvars=new Array(100);
25         svars=new Array(100);
26         vvars1=new Array(100);
27         vvars2=new Array(100); // contengono le rvar,svar e vvar inserite dall' utente. 
28         storia=new Array();
29         storia[0]="*";
30         norvars=0;
31         nosvars=0;
32         novvars1=0;
33         novvars2=0;
34         ltr="*";
35         query="*";
36         storeps=1;
37         storepv=1;
38         storepb=1;
39         ricordaliaslist=0;
40         vlds=new Array();
41         aliasglob=new Array();
42         actinput=0;
43         numeroazioniannullate=0;
44         }
45
46 // @processorURL@ will be substituted by the searchEngine using
47 // the correct value
48 var processorURL="@processorURL@";
49
50 function ask_uwobo(url)
51        {
52          return (top.topurl+"/ask_uwobo?url="+escape(processorURL + "apply?xmluri=" + escape(url) + "&keys=T1%2CT2%2CL%2CE&param.processorURL="+escape(processorURL)+"&param.getterURL=http%3A//mowgli.cs.unibo.it%3A58081/&param.proofcheckerURL=http%3A//mowgli.cs.unibo.it%3A58084/&param.draw_graphURL=http%3A//mowgli.cs.unibo.it%3A58083/&param.uri_set_queueURL=http%3A//mowgli.cs.unibo.it%3A58082/&param.UNICODEvsSYMBOL=unicode&param.keys=d_c%2CC1%2CHC2%2CL&param.thkeys=T1%2CT2%2CL%2CE&param.embedkeys=d_c%2CTC1%2CHC2%2CL&param.doctype-public=-//W3C//DTD%20XHTML%201.0%20Transitional//EN&param.encoding=iso-8859-1&param.thencoding=iso-8859-1&param.media-type=text/html&param.thmedia-type=text/html&param.interfaceURL=http%3A//helm.cs.unibo.it/helm/html/cic/index.html&param.thinterfaceURL=http%3A//helm.cs.unibo.it/helm/html/theory/index.html&param.CICURI=dummy:query_result&param.naturalLanguage=yes&param.annotations=no&param.topurl=http://helm.cs.unibo.it/helm&prop.method=html"));
53        }
54 function help(w) // quando invocata, visualizza l' help relativo ad un oggetto. Di solito è legata ad un evento onFocus o onMouseOver.  
55         {
56         hw.document.close();
57         switch (w)      {
58                         case -10: hw.document.write("Insert an <a href="+top.topurl+top.action+"grammarpdq.html#Id target=gw>Id</a> or an <a href="+top.topurl+top.action+"grammarpdq.html#Uri target=gw>Uri</a> here.")
59                                 break;
60                         case -9: hw.document.write("By clicking this you may add or remove aliases as you wish.")
61                                 break;
62                         case -81: hw.document.write("Allows you to recover your last input")
63                                 break;
64                         case -8: hw.document.write("Allows you to delete your last input")
65                                 break;
66                         case -7: hw.document.write("Erases your query and starts a new pre-defined query, you will keep your list of aliases.")
67                                 break;
68                         case -6: hw.document.write("Puts this string in the current cursor position. This button works only with Internet Explorer.")
69                                 break;
70                         case -5: hw.document.write("Erases your query and starts a new one.")
71                                 break;
72                         case -4: hw.document.write("If you click this your query will be processed and the results will appear in the frame above.")
73                                 break;
74                         case -3: hw.document.write("Substitutes your query with the text written in the area above. Unless you have a good knowledge of MathQL, it's recommended that you use this only to recover errors.")
75                                 break;
76                         case -2: hw.document.write("This is the edit/submit window. You can modify your query here, but be aware that no syntax check will be performed and that if you enter a <a href="+top.topurl+top.action+"grammar.html#rvar target=gw>variable</a> it won't be available for quick composition later. You may also want to add a <a href="+top.topurl+top.action+"grammar.html#set target=gw>set</a>, a <a href="+top.topurl+top.action+"grammar.html#val target=gw>val</a> or a <a href="+top.topurl+top.action+"grammar.html#boole target=gw>boole</a> somewhere in the query. If you do, write '&lt;set&gt;','&lt;val&gt;' or '&lt;bol&gt;' in the point you'd like it to appear, or use the buttons on the right if you are using IE. When you're done with the query, click the Submit button.")
77                                 break;
78                         case -1: hw.document.write("You may see the grammar here.")
79                                 break;
80                         case 0: hw.document.write("")
81                                 break;
82                         case 1: hw.document.write("You may enter an arbitrary statement here; be careful since syntax errors won't be detected.");                              
83                                 break;  
84                         case 2: hw.document.write("Enter an <a href="+top.topurl+top.action+"grammar.html#attr_list target=gw>attr_list</a> here.");
85                                 break;
86                         case 3: hw.document.write("Enter an <a href="+top.topurl+top.action+"grammar.html#id target=gw>id</a> here.");
87                                 break;
88                         case 4: hw.document.write("You must select one previously entered <a href="+top.topurl+top.action+"grammar.html#rvar target=gw>rvar</a>. If you haven't already entered at least one, you can't choose this. ");
89                                 break;
90                         case 5: hw.document.write("Enter a <a href="+top.topurl+top.action+"grammar.html#path target=gw>path</a> here.");
91                                 break;
92                         case 6: hw.document.write("You must select one previously entered <a href="+top.topurl+top.action+"grammar.html#svar target=gw>svar</a>. If you haven't already entered at least one, you can't choose this. ");
93                                 break;
94                         case 7: hw.document.write("Enter a <a href="+top.topurl+top.action+"grammar.html#string_list target=gw>string_list</a> here.");
95                                 break;
96                         case 8: hw.document.write("You must select one <a href="+top.topurl+top.action+"grammar.html#vvar target=gw>vvar</a> previously entered as an 'attr'. If you haven't already entered at least one, you can't choose this. ");
97                                 break;
98                         case 81: hw.document.write("You must select one <a href="+top.topurl+top.action+"grammar.html#vvar target=gw>vvar</a> previously entered in a 'let' statement. If you haven't already entered at least one, you can't choose this. ");
99                                 break;
100                         case 9: hw.document.write("Enter a single <a href="+top.topurl+top.action+"grammar.html#quoted_string target=gw>quoted_string</a> here.");
101                                 break;
102                         }       
103         }
104 function tpa(quotpath)
105         {
106         while (quotpath.indexOf("<")>-1)
107                 {quotpath=quotpath.replace("<","&lt;");}
108         while (quotpath.indexOf(">")>-1)
109                 {quotpath=quotpath.replace(">","&gt;");}
110         return (quotpath);
111         }
112 function idcheck(ident)
113         {
114         lettera=/[a-zA-Z]/;
115         partediid=/[a-zA-Z0-9_\-\']/;
116         if (!lettera.test(ident.charAt(0))){alert("an Id must begin with a letter.");return(0)}
117         while (ident.length>0)
118                 {
119                 ident=ident.substring(1,(ident.length));
120                 if (ident.length>0){
121                 if (!partediid.test(ident.charAt(0))){alert(ident.charAt(0)+" is not a valid character for an Id.");return(0);}
122                 }}
123         return(1)
124         }
125 function uricheck(ident)
126         {
127         cifra=/[0-9]/
128         cic=ident.substring(0,5);//alert(cic);
129         if (cic!="cic:/"){alert("an Uri must begin with the string 'cic:/'");return(0);}
130         ident=ident.substring(5,ident.length);//alert(ident);
131         if (ident.indexOf(".")<0){alert("an Uri must contain a '.'");return(0);}
132         ident1=ident.substring(0,ident.indexOf("."));//alert(ident1);
133         ident2=ident.substring(ident.indexOf(".")+1,ident.length);//alert(ident2);
134         while (ident1.length>0)
135                 {       
136                 if (ident1.indexOf("/")>-1)             
137                         {
138                         if (idcheck(ident1.substring(0,ident1.indexOf("/")))==0){return (0)}
139                         ident1=ident1.substring(ident1.indexOf("/")+1,ident1.length);//alert(ident1);
140                         }
141                 else {if (idcheck(ident1)==0){return (0)}       
142                         ident1="";}
143                 }
144         if (ident2=="con"||ident2=="var"){return(1)}
145         if (ident2.substring(0,6)!="ind#1/"){alert ("syntax error in the Uri.");return(0);}
146         ident2=ident2.substring(6,ident2.length);//alert(ident2);
147         if (!cifra.test(ident2.charAt(0))){alert ("syntax error in the Uri.");return(0);}
148         if (ident2.indexOf("/")>-1)
149                 {
150                 while (ident2.charAt(0)!="/")
151                         {
152                         //alert(ident2);
153                         if (!cifra.test(ident2.charAt(0))){alert ("syntax error in the Uri.");return(0);}
154                         ident2=ident2.substring(1,ident2.length);
155                         }
156                 }
157         while (ident2.length>0)
158                 {
159                 //alert(ident2);
160                 ident2=ident2.substring(1,ident2.length);
161                 if (ident2.length>0){
162                 if (!cifra.test(ident2.charAt(0))){alert ("syntax error in the Uri.");return(0);}
163                 }}
164         
165         return(1)
166         }
167 function gramcheck(how,what) // esegue il controllo sintattico sulla stringa "what", controllando che rispetti i requisiti indicati dalla clausola "how". Se qualcosa non è ok, la variabile "wrong" viene posta ad 1 e la stringa da aggiungere viene ignorata, mentre viene visualizzato un apposito messaggio di errore.              
168         {
169         var slash=0;
170         var alpha=/[A-Za-z:_]/
171         var numero=/[0-9]/
172         switch (how)    {               
173                         case "qsl": // lista di quoted string
174                                 if (what.charAt(0)!="{") {gramcheck("qs",what);break;}
175                                 if (what.charAt(what.length-1)!="}") {alert ("The list must end with a '}'.");wrong=1;break;}
176                                 what=what.substring(1,what.length-1);//alert (what);
177                                 while (what.indexOf("\",\"")>-1)
178                                         {
179                                         as=what.substring(0,what.indexOf("\",\"")+1);//alert(as);
180                                         what=what.substring(what.indexOf("\",\"")+2,what.length);//alert(what);
181                                         gramcheck("qs",as);
182                                         }
183                                 gramcheck("qs",what);
184                                 break;
185                         case "qp": // quoted path
186                                 if (what.charAt(0)!="\"") {alert ("A quoted string must be included between quotes."); wrong=1; break;}
187                                 if (what.charAt(what.length-1)!="\"") {alert ("A quoted string must be included between quotes."); wrong=1; break;}
188                                 while (what.indexOf("\"/\"")>-1)
189                                         {
190                                         as=what.substring(0,what.indexOf("\"/\"")+1);//alert(as);
191                                         what=what.substring(what.indexOf("\"/\"")+2,what.length);//alert(what);
192                                         gramcheck("qs",as);
193                                         }
194                                 gramcheck("qs",what);
195                                 break;
196                         case "qs": // quoted string
197                                 if (what.charAt(0)!="\"") {alert ("A quoted string must be included between quotes."); wrong=1; break;}
198                                 if (what.charAt(what.length-1)!="\"") {alert ("A quoted string must be included between quotes."); wrong=1; break;}
199                                 what=what.substring(0,what.length-1);//alert (what);
200                                 if (wrong==1) break;
201                                 else while (what.length>0)
202                                         {
203                                         what=what.substring(1,what.length);
204                                         if (what.charAt(0)=="\"" && slash==0) {alert ("A \" in a quoted string must be preceded by a \\.");wrong=1;break;} 
205                                         if (what.charAt(0)=="\\") {slash=1} else {slash=0} 
206                                         if (slash==1 && what.length==1) {alert ("A \\ in a quoted string must be followed by something.");wrong=1;}
207                                         }
208                                 break;
209                         case "vlist": // lista di vvar (tutto ciò che si trova dopo "attr")
210                                 //alert(what.substring(0,4));                           
211                                 if ((what.substring(0,4))!="attr"){wrong=1;alert("A vvar_list must begin with the word 'attr'")}
212                                 what=what.substring(5,(what.length));vl=what;
213                                 //alert(what+"what");
214                                 while (what.length>0)
215                                                         {
216                                                         if (what.indexOf(",")>0) {vv=(what.substring(0,what.indexOf(",")));}
217                                                         else {vv=what}                                  
218                                 //alert(vv+"vv");
219                                                         if (vv.charAt(0)!="$"){wrong=1;alert("A vvar must begin with a '$'");}
220                                                         if (vv.indexOf("<-")>0)
221                                                                         {
222                                                                         what=what.substring(vv.length+1,what.length);
223                                 //alert(what+" nuovowhat "+wrong);
224                                                                         path=vv.substring(vv.indexOf("<-")+2,vv.length);
225                                 //alert(path+" path "+wrong);
226                                                                         gramcheck("qp",path); 
227                                                                         vv=vv.substring(1,(vv.indexOf("<-")));
228                                 //alert(vv+" vv "+wrong);
229                                                                         gramcheck("id",vv);
230                                                                         }
231                                                         else {wrong=1;alert("An Assign must contain a '<-'.");what="";}
232                                 //alert (what+"what");  
233                                                         }
234                                 break;
235                         case "id":
236                                 //alert (what.charAt(0));
237                                 if (!alpha.test(what.charAt(0))) {wrong=1;alert("An ID must begin with a letter , ':' , or '_' .");}
238                                 while (what.length>1)   {
239                                         what=what.substring(1,(what.length));
240                                         if (!alpha.test(what.charAt(0)) && !numero.test(what.charAt(0)))
241                                         {wrong=1;alert(what.charAt(0)+" is not a valid character for an id.");}
242                                         //document.write(what+"<BR>");
243                                                         }       
244                                 break;
245                         }
246         
247         if (how=="vlist" && wrong==0) // nel caso in cui sia stato eseguito il controllo su una lista di vvar e non siano stati riscontrati errori, tutte le variabili inserite vengono memorizzate.
248                 {
249                 while (vl.length>0)
250                         {
251                         if (vl.indexOf(",")>-1)
252                                 {
253                                 vvars2[novvars2++]=vl.substring(0,vl.indexOf("<"));
254                                 vl=vl.substring(vl.indexOf(",")+1,vl.length);
255                                 }
256                         else    
257                                 {
258                                 vvars2[novvars2++]=vl.substring(0,vl.indexOf("<"));;
259                                 vl="";
260                                 }                                               
261                         }
262                 //alert ("esco dal loop");
263                 }
264         if (wrong==0) {cw.inputok=1} else stadd="";
265         }
266 function savelink(n,t) // invocata quando si clicca su un link, memorizza quale di questi debba poi essere sostituito. 
267         {
268         if (t=='s') { top.ltr="[?set"+String(n)+"]";}
269         if (t=='v') { top.ltr="[?val"+String(n)+"]";}
270         if (t=='b') { top.ltr="[?bol"+String(n)+"]";}
271 //      alert(ltr);
272         }
273 function aggcw() // invocata automaticamente ad ogni modifica della variabile "query", fa apparire nel frame in alto a destra il menu di composizione relativo al primo link della query. Consente quindi di comporre tutta la query senza mai cliccare su alcun link. 
274         {
275         pq=query;
276         while (pq.length>0)
277                 {
278                 if (pq.indexOf("[?")>-1)        
279                         {
280                         ltr=pq.slice(pq.indexOf("[?"));
281                         ltr=ltr.substring(ltr.indexOf("[?"),(ltr.length-ltr.indexOf("[?"))-(ltr.length-ltr.indexOf("]")-1));
282                         wto=ltr.substring(2,5);
283                         if (wto=="set") {window.open(top.topurl+action+"set.html","cw");pq="";}
284                         else if (wto=="val") {window.open(top.topurl+action+"val.html","cw");pq="";}
285                         else if (wto=="bol") {window.open(top.topurl+action+"boole.html","cw");pq="";}
286                         else pq=pq.substring(pq.indexOf("[?")+2,pq.length);
287                         }
288                 else {window.open(top.topurl+action+"blank.html","cw");pq="";}
289                 } 
290         }
291 function aggform() // aggiorna il form nel frame centrale. Invocata ad ogni cambio della variabile "query".
292         {
293         cquery=query;
294         while (cquery.indexOf("<")>-1)
295                 {
296                 cquery=cquery.replace(cquery.substring(cquery.indexOf("<"),cquery.indexOf(">")+1),"");
297                 //alert(cquery);
298                 }
299         while (cquery.indexOf("[?")>-1)
300                 {
301                 //alert(cquery);
302                 if (cquery.indexOf("]")>-1)
303                         {
304                         while (cquery.indexOf("]")<cquery.indexOf("[?") && cquery.indexOf("]")>-1)
305                         {cquery=cquery.replace("]","q+u+a+d+r+a+c+h+i+u+s+a");}//alert("loop"+cquery.indexOf("]")+cquery.indexOf("[?"))}
306                         ag1=cquery.slice(cquery.indexOf("[?"));//alert(ag1);
307                         ag1=ag1.substring(ag1.indexOf("[?"),(ag1.length-ag1.indexOf("[?"))-(ag1.length-ag1.indexOf("]")));//alert(ag1);
308                         ag2=ag1.substring(2,5);//alert(ag2);
309                         if (ag2=="set") cquery=cquery.replace(cquery.substring(cquery.indexOf("[?"),cquery.indexOf("]")+1),"<set>");
310                         else if (ag2=="val") cquery=cquery.replace(cquery.substring(cquery.indexOf("[?"),cquery.indexOf("]")+1),"<val>");
311                         else if (ag2=="bol") cquery=cquery.replace(cquery.substring(cquery.indexOf("[?"),cquery.indexOf("]")+1),"<boole>");
312                         else cquery=cquery.replace(cquery.substring(cquery.indexOf("[?"),cquery.indexOf("[?")+1),"q+u+a+d+r+a");
313                         //alert(cquery);
314                         }
315                 else {cquery=cquery.replace("[?","q+u+a+d+r+a?")}
316                 //alert(cquery);        
317                 }
318         while (cquery.indexOf("q+u+a+d+r+a+c+h+i+u+s+a")>-1)
319                 {
320                 cquery=cquery.replace("q+u+a+d+r+a+c+h+i+u+s+a","]");
321                 }
322         while (cquery.indexOf("q+u+a+d+r+a")>-1)
323                 {
324                 cquery=cquery.replace("q+u+a+d+r+a","[");
325                 }
326         while (cquery.indexOf("&lt;")>-1)
327                 {
328                 cquery=cquery.replace("&lt;","<");
329                 }
330         while (cquery.indexOf("&gt;")>-1)
331                 {
332                 cquery=cquery.replace("&gt;",">");
333                 }
334         top.sw.agg();
335         }
336 function ripristina()
337         {
338         //alert (actinput+" "+storia.length);
339         if (numeroazioniannullate>0)
340                 {
341                 numeroazioniannullate--;
342                 query=storia[actinput+1];actinput++;
343                 qw.document.close();
344                 qw.document.write(query);
345                 aggform();
346                 sw.apply();
347                 aggcw();
348                 cw.focus();
349                 }
350         }
351 function annulla()
352         {
353         //alert (actinput+" "+storia.length);
354         if (actinput>0)
355                 {
356                 numeroazioniannullate++;
357                 query=storia[actinput-1];actinput--;
358                 qw.document.close();
359                 qw.document.write(query);
360                 aggform();
361                 sw.apply();
362                 if (query=="*"){cw.location=top.topurl+action+"set.html";ltr="*";} else {aggcw();}
363                 cw.focus();
364                 }
365         }
366 function parse() // prende la stringa che si sta tentando di inserire nella query, aggiunge i link dove necessario e mette il risultato nella variabile "fb"
367         {
368         while (fb.indexOf("[set]")>-1){
369         if (fb.indexOf("set")>0)
370                 {
371       fb=fb.replace("[set]","<A HREF="+top.topurl+action+"set.html target=cw onclick=top.savelink("+top.storeps+",'s')>[?set"+top.storeps+"]</A>");
372                 top.storeps++;
373                 }
374                                          }
375         while (fb.indexOf("[val]")>-1){
376         if (fb.indexOf("val")>0)
377                 {
378       fb=fb.replace("[val]","<A HREF="+top.topurl+action+"val.html target=cw onclick=top.savelink("+top.storepv+",'v')>[?val"+top.storepv+"]</A>");
379                 top.storepv++;
380                 }
381                                          }
382         while (fb.indexOf("[boole]")>-1){
383         if (fb.indexOf("boole")>0)
384                 {
385                 fb=fb.replace("[boole]","<A HREF="+top.topurl+action+"boole.html target=cw onclick=top.savelink("+top.storepb+",'b')>[?bol"+top.storepb+"]</A>");
386                 top.storepb++;
387                 }
388                                          }
389         }
390 function aggq() // aggiorna la query sostituendo l' ultimo link editato con la stringa inserita, poi aggiorna tutti i frame.
391         {
392         //window.open(top.topurl+action+"summary.html","cw");
393         qw.document.close();
394         fb=stadd;       
395         nst=ltr.substring(5,(ltr.length-1));// alert(nst+" "+ltr);
396         query=query.replace("<A HREF="+top.topurl+action+"set.html target=cw onclick=top.savelink("+nst+",'s')>"+ltr+"</A>",ltr);
397         query=query.replace("<A HREF="+top.topurl+action+"val.html target=cw onclick=top.savelink("+nst+",'v')>"+ltr+"</A>",ltr);
398         query=query.replace("<A HREF="+top.topurl+action+"boole.html target=cw onclick=top.savelink("+nst+",'b')>"+ltr+"</A>",ltr);
399         parse();
400         query=query.replace(ltr,fb);
401         actinput++;storia[actinput]=query;numeroazioniannullate=0;//alert (actinput+" "+storia.length);
402         qw.document.write(query);aggform();
403         aggcw();
404         cw.focus();
405         }
406 var topurl=document.location.protocol+'//'+document.location.host;
407 //var topurl="";
408 var action="/getpage?url=";
409 //var action="";
410
411
412 // UTILITY FUNCTIONS FOR templateambigpdq1.html
413 function templateambigpdq1_armageddon()
414         {
415         top.initialize();
416         top.window.open(top.topurl+top.action+"start.html","qw");
417         top.window.open(top.topurl+top.action+"blank.html","cw");
418         top.window.open(top.topurl+top.action+"blank.html","hw");
419         top.window.open(top.topurl+top.action+"blank.html","gw");
420         top.window.open(top.topurl+top.action+"blank.html","sw");
421         }
422
423 function templateambigpdq1_resetta()
424         {
425         if (confirm("This will erase your query and start a new one. Are you sure you want to do this?"))
426                 {templateambigpdq1_armageddon();}
427         }
428
429 function templateambigpdq1_listauri(document,elenco)
430         {
431         for (i=0;i<elenco.length;i++)
432                 {
433                 document.write("<input type=checkbox name=uricheck value="+elenco[i]+"> "+elenco[i]+"<br>"); 
434                 }
435         }
436
437 function templateambigpdq1_invia(document,top,elenco,ident)
438         {
439         vecchiavlds=top.vlds.length;
440         stringa=top.topurl+"/searchPattern?term="+top.terminecic;
441         stringa=stringa+"&aliases="+top.listaliases;
442         stringa=stringa+"&choices=";
443         var choices = "";
444         top.vlds[top.vlds.length]=ident;
445         for (j=0;j<elenco.length;j++)
446                 {
447                 if (document.disamb.uricheck[j].checked)
448                         {
449                         top.vlds[top.vlds.length]=document.disamb.uricheck[j].value;
450                         }
451                 }
452         top.vlds[top.vlds.length]=";";
453         for (j=0;j<top.vlds.length;j++)
454         {
455            choices=choices+(top.vlds[j]==";"?";":escape(top.vlds[j]))+" ";
456         }
457         choices=choices.substring(0,choices.length-2);
458         stringa=stringa+escape(choices);
459         if (top.vlds.length==vecchiavlds){alert("You must select at least one of the options.");}
460         else
461         {
462            window.open(ask_uwobo(stringa),"cw");
463         }
464         } 
465
466   function templateambigpdq1_selezionaCostanti(document,elenco) {
467     for (i=0; i<elenco.length; i++) {
468       if (elenco[i].substring(elenco[i].length-4, elenco[i].length) != ".var") {
469         document.disamb.uricheck[i].checked = true;
470       } else {
471         document.disamb.uricheck[i].checked = false;
472       }
473     }
474   }
475
476
477
478 // UTILITY FUNCTIONS FOR templateambigpdq2.html
479 function templateambigpdq2_armageddon()
480         {
481         top.initialize();
482         top.window.open(top.topurl+top.action+"start.html","qw");
483         top.window.open(top.topurl+top.action+"blank.html","cw");
484         top.window.open(top.topurl+top.action+"blank.html","hw");
485         top.window.open(top.topurl+top.action+"blank.html","gw");
486         top.window.open(top.topurl+top.action+"blank.html","sw");
487         }
488
489 function templateambigpdq2_resetta()
490         {
491         if (confirm("This will erase your query and start a new one. Are you sure you want to do this?"))
492                 {templateambigpdq2_armageddon();}
493         }
494
495 function templateambigpdq2_listainterpretazioni(document,elenco,labels)
496         {
497         for (i=0;i<elenco.length;i++)
498                 {
499                       document.write("<input type=radio name=interp value="+elenco[i]+"> "+labels[i]+"<br />"); 
500                 }
501         }
502
503 function templateambigpdq2_invia(document,elenco)
504         {
505         stringa=top.topurl+"/searchPattern?term="+top.terminecic;
506         stringa=stringa+"&aliases="+(top.listaliases==""?"":"%20");
507         controllo=stringa.length;
508         for (j=0;j<elenco.length;j++)
509                 {
510                 if (document.disamb.interp[j].checked)
511                         {
512                         stringa=stringa+escape(elenco[j]);
513
514       // TODO da implementare nella terza fase
515                         //top.aliasglob[top.aliasglob.length]=document.disamb.interp[j].value;
516
517                         //for (k=0;k<top.aliasglob.length;k++){alert(top.aliasglob[k])}
518                         //top.listaliases=top.listaliases+document.disamb.interp[j].value;//in caso di query ulteriori con la stessa lista di alias
519                         }
520                         
521                 }
522         if (stringa.length!=controllo) 
523                 {
524                 window.open(ask_uwobo(stringa),"cw");
525                 }
526                 else {alert("You must choose one option.");}
527         } 
528
529
530
531 // UTILITY FUNCTIONS FOR templateambigpdq3.html
532 function templateambigpdq3_init(aliases)
533 {
534    top.aliasglob = new Array();
535    for (i=0; i<aliases.length; i++) {
536       top.aliasglob[i] = aliases[i];
537    }
538    top.vlds=new Array();
539    top.window.open(top.topurl+top.action+"editorpdq.html", "sw");
540 }
541 </SCRIPT>
542 </HEAD>
543   <script>
544     document.write(' <FRAMESET ROWS="69%,31%"> <FRAMESET COLS="40%,60%"> <FRAMESET ROWS="46%,54%"> <FRAME NAME="qw" SRC="'+topurl+action+'start.html"> <FRAME NAME="sw" SRC="'+topurl+action+'blank.html"> </FRAMESET> <FRAME NAME="cw" SRC="'+topurl+action+'blank.html"> </FRAMESET> <FRAMESET COLS="49%,51%"> <FRAME NAME="gw" SRC="'+topurl+action+'blank.html" onFocus="help(-1)";> <FRAME NAME="hw" SRC="'+topurl+action+'blank.html"> </FRAMESET> </FRAMESET>');
545   </script>
546 </HTML>