<!--

var max_engines = 40;
var search_string = "my_query";
var msg = "TOROWeb - by Carmine Felice and Giovanni Mascia"; 

//if (document.all) 
	//document.body.onmousedown=new Function ("if (event.button==2||event.button==3) alert(msg)")

function noclick(scx) 
{ 
	if (navigator.appName == "Netscape" && scx.which == 3) 
	{ 
		alert(msg); 
		return false; 
	} 
	if (navigator.appVersion.indexOf("MSIE") != -1 && event.button == 2) 
	{ 
		alert(msg); 
		return false; 
	} 
} 
document.onmousedown = noclick

function makeArray(n) 
{
	for (var i = 1; i <= n; i++) 
		this[i] = 0;
	this.maxlen = n;
	this.len = 0;
	return this;
}

var engines = new makeArray(max_engines);

function find_it(what, where) 
{
	for (var i = 0; i <= where.length - what.length; i++) 
	{
		if (what == where.substring(i, i + what.length))
		return i;
	}
	return false;
}
function openWin( imageURL, width, height, associate ) 
{
   optionString = "scrollbars=no,status=no,menubar=no,resizable=no,location=no,toolbar=no,width=" + width + ",height=" + height;
   imageWindow = this.window.open(imageURL,'imgwindow',optionString );
}
function openWin2( imageURL, width, height, associate ) 
{
   optionString = "scrollbars=no,status=no,menubar=yes,resizable=no,location=no,toolbar=no,width=" + width + ",height=" + height;
   imageWindow = this.window.open(imageURL,'imgwindow',optionString );
}
function openWin1( imageURL, width, height, associate ) 
{
   optionString = "scrollbars=yes,status=no,menubar=no,resizable=yes,location=no,toolbar=no,width=" + width + ",height=" + height;
   imageWindow = this.window.open(imageURL,'imgwindow',optionString );
}
function iquadro(url,w,h,b,s){
	if (navigator.appName=="Netscape" && parseInt(navigator.appVersion)<5) {
		btv=window.open(url,xq,"width="+w+",height="+h+",resizable=no,scrollbars=yes,status=no,menubar=no,canali=no,location=no,directories=no"); xq=xq+1;
		document.write("Occorre NETSCAPE 6 per avere il testo qui.")
	}
	else document.write("<iframe src="+url+" width="+w+" height="+h+" marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder="+b+" scrolling="+s+"></iframe>")
}
function info() {
	if (document.I.M.value==1) window.open("http://news2000.iol.it/index.jhtml?focus=ricerca_rc_1&sorg=0&parole=tutte&ricerca="+document.I.L.value)
	if (document.I.M.value==2) window.open("http://cgi.venere.it/ihr/ihr_search2.cfm?lg=it&layout=3&citta="+document.I.L.value)
	if (document.I.M.value==3) window.open("http://194.21.28.45/dbristoranti/Action.lasso?[DATABASE]=Ristorantidb&[response]=/dbristoranti/hitlist.html&[noResults]=/dbristoranti/noresult.html&[layout]=layout1&prezzo=%3C999999&[search]=Trova&luogo="+document.I.L.value)
	if (document.I.M.value==4) window.open("http://www.kwmeteo.kataweb.it/comuni.shtml?citta="+document.I.L.value.toUpperCase())
	if (document.I.M.value==5) window.open("http://www.internetbookshop.it/ser/serpge.asp?type=keyword&shop=544&T="+document.I.L.value)
	if (document.I.M.value==6) window.open("http://www.comune."+document.I.L.value+".it")
	if (document.I.M.value==7) window.open("http://www.merqurio.com/turni/scegli.php3?comune="+document.I.L.value+"&radio1=1&data_giorno="+myday+"&data_mese="+mymonth+"&data_anno="+year+"&ora_giorno="+mydate.getHours()+"&ora_minuti="+mydate.getMinutes())
	if (document.I.M.value==8) window.open("http://www.museionline.it/ita/cerca/ric_prov.asp?prv="+document.I.L.value)
}
function soft() { 
if (document.K.M.value==1) window.open("http://www.tucows.com/perl/tucowsSearch?key=all&platform=%&word="+document.K.L.value.toUpperCase())
if (document.K.M.value==2) window.open("http://volftp.mondadori.com/reframe.htm?http://ricerca.volftp.mondadori.com/VOLFTP/find.exe?lang=it&go=1&w="+document.K.L.value)
if (document.K.M.value==3) window.open("http://ftpsearch.lycos.com/cgi-bin/search?form=medium&query="+document.K.L.value)
if (document.K.M.value==4) window.open("http://download.cnet.com/search/redirector/1,10207,0-0,00.html?qt="+document.K.L.value)
if (document.K.M.value==5) window.open("http://shareware.search.com/search?cat=247&tag=ex.sa.fd.srch.sa_all&q="+document.K.L.value)
if (document.K.M.value==6) window.open("http://www.winsite.com/bin/Search?q="+document.K.L.value)
if (document.K.M.value==7) window.open("http://www.zdnet.it/zdnet/HPSWLibDir.asp?txtU="+document.K.L.value)

}
function engine(name, options, home, search) {	
	var found_at = find_it(search_string, search);
	this.name = name;
	this.options = options;
	this.home = home;
	this.pre_found_at = search.substring(0, found_at);
	this.post_found_at = search.substring(found_at + search_string.length, search.length);
}

function Add(name, options, home, search) 
{
	engines.len++;
	if (engines.len <= engines.maxlen) 
		engines[engines.len] = new engine(name, options, home, search);
	else 
		alert("Better increase max_engines to: " + engines.len);
}

Add("AltaVista", "SELECTED",
	"http://www.altavista.digital.com/",
	"http://www.altavista.digital.com/cgi-bin/query?pg=q&what=web&fmt=.&q=my_query");
	
Add("AltaVista.it", "",
	"http://www.altavista.it/",
	"http://search.it.altavista.com/cgi-bin/query?pg=q&sc=on&q=my_query&kl=XX&what=it&search.x=39&search.y=13");

Add("Aol", "",
	"http://www.aol.com/",
	"http://search.aol.com/dirsearch.adp?query=my_query");

Add("Arianna", "",
	"http://arianna.iol.it/",
	"http://search-arianna.iol.it/abin/search?query=my_query");

Add("Aziende-Molise", "",
	"http://www.aziende-molise.it/",
	"http://www.aziende-molise.it/cgi-bin2/search.cgi?query=my_query&type=phrase&Regione=&mh=10&I1.x=27&I1.y=11");

Add("Dog Pile", "",
	"http://www.dogpile.com/", 
	"http://ms3.dogpile.com/search?q=my_query");

Add("Deja News", "", 
	"http://www.dejanews.com/", 
	"http://www.dejanews.com/dnquery.xp?QRY=my_query");

Add("Excite", "",
	"http://www.excite.com/",
	"http://www.excite.com/search.gw?search=my_query&trace=a&collection=web&searchButton.x=32&searchButton.y=11");

Add("Google", "",
	"http://www.google.com/",
	"http://www.google.com/search?q=my_query&hl=it&safe=off&start=0&sa=N");

Add("Go", "",
	"http://www.go.com/",
	"http://www.go.com/Split?pat=go&col=WW&qt=my_query&Go=GO%21");

Add("Godado", "",
	"http://www.godado.it/",
	"http://www.godado.it/godado.pperl?sid=3850610003-973103366&Keywords=my_query&p1=1&w1=21&Godado%21.x=25&Godado%21.y=7");

Add("Hot Bot", "",
	"http://www.HotBot.com/",
	"http://www.HotBot.com/search.html?_v=1.0&OP=0&SW=web&SM=MC&MT=my_query&MOD=0&date=WH&DR=newer&DM=1&DD=1&DY=96&DV=10&DU=years&smiley=&RD=AN&RG=NA&domain=&DC=10&FJS=off&FJA=off&FRA=off&FVI=off&FAC=off&FSW=off&FVR=off&FSU=off&FSM=off&OP=0&MOD=0&FS=&search.x=33&search.y=17");

Add("Highway61", "",
	"http://www.highway61.com/",
	"http://www.digiweb.com/~vmirror/search/nph-seek.cgi?string=my_query");

Add("Info seek", "",
	"http://www.infoseek.com/",
	"http://guide-p.infoseek.com/Titles?qt=my_query&col=WW&sv=IS&lk=noframes");

Add("Lycos.it", "",
	"http://www.lycos.it/",
  "http://www.lycos.it/cgi-bin/pursuit?matchmode=and&mtemp=main&etemp=error&query=my_query&cat=lycos&x=19&y=12");

Add("Lycos", "",
	"http://www.lycos.com/",
  "http://www.it.lycos.de/cgi-bin/pursuit?matchmode=and&mtemp=main&etemp=error&query=my_query&cat=lycos&x=19&y=12");  

Add("News Index", "", 
	"http://www.newsindex.com/", 
	"http://www.newsindex.com/cgi-bin/process.cgi?query=my_query");

Add("Look Smart", "", 
	"http://www.looksmart.com/", 
	"http://www.looksmart.com/r_search?key=my_query");

Add("Web Crawler", "",
 	"http://www.webcrawler.com/", 
	"http://www.webcrawler.com/cgi-bin/WebQuery?searchText=my_query");

Add("Meta Crawler", "", 
	"http://www.metacrawler.com/", 	
	"http://www.metacrawler.com/crawler?general=my_query");

Add("Northern Light", "", 
	"http://www.northernlight.com/", 
	"http://www.northernlight.com/nlquery.fcg?qr=my_query");

Add("Yahoo!", "",
	"http://www.yahoo.com/",
	"http://search.yahoo.com/bin/search?p=my_query");

Add("Yahoo.it!", "",
	"http://www.yahoo.it/",
	"http://search.yahoo.it/search/it?p=my_query");

Add("Katalogo", "",
	"http://www.katalogo.it/",
	"http://search.katalogo.it/search/cgi-bin/kwsearchadv.cgi?query2=my_query&numres=10&npag=10&Submit2=Cerca&Submit2=Cerca&radiobutton=it");

Add("Janas", "",
	"http://janas.tiscalinet.it/",
	"http://janas.tiscalinet.it/searchbin/search?query=my_query");

Add("Juno", "",
	"http://www.juno.com/",
	"http://www.juno.com/web_search.juno?key=my_query&search=0&comefrom=iadb-search&isp=adb&submit.x=14&submit.y=12");

Add("Virgilio",  "",
	"http://www.virgilio.it/",
	"http://www.virgilio.it/virgilio/owa/ft.startquery?querystr=my_query&cerca=Cerca&dbfrom=virgilio");

Add("Searchmission", "",
	"http://p.searchmission.com/",
	"http://p.searchmission.com/1/p_sb01/786/443/?q=my_query");

Add("Searchtraffic", "",
	"http://www.searchtraffic.com/",
	"http://www.searchtraffic.com/search.php3?l=mp3net&term=my_query");

Add("Supereva", "",
	"http://www.supereva.it/",
	"http://search.supereva.it/cgi-bin/gsearch.chm?q=my_query");

Add("Ultra.infoseek", "",
	"http://ultra.infoseek.com/",
	"http://ultra.infoseek.com/Titles?qt=my_query");


// End of search engines

function doSearch(form) 
{
	//form.submit();
	var new_query = "";
	for (i=0; i<form.query.value.length; i++) 
	{
		var thischar = form.query.value.charAt(i);
		if (thischar != ' ')
			new_query += thischar;
		else if (lastchar != ' ')
			new_query += '+';
		lastchar = thischar;
	}
	var search_engine = engines[1 + form.service.selectedIndex];
	if ((search_engine.options == "*") || (search_engine.options == "**")) 
	{
		new_query = "";
		if (search_engine.options == "*") 
		{
			alert('Since "' + search_engine.name + '" has different form handling methods, you will have to manually enter your search query at its home page.');
		}
	}
	location.href = new_query ? search_engine.pre_found_at + new_query + search_engine.post_found_at : search_engine.home;
}

function clearQuery() 
{
	document.forms[0].elements[1].value = "";
}

function doInstructions() 
{
	instructions = open("", "instructions", "toolbar=no,location=0,directories=no,status=no,menubar=0,scrollbars=yes,resizable=0,copyhistory=0,width=300,height=300");
	instructions.document.writeln('<CENTER><FONT SIZE=+2>Instructions</FONT></CENTER>');
	instructions.document.writeln('<HR WIDTH=75%>');
	instructions.document.writeln('<FONT SIZE=-1><UL TYPE="disc">');
	instructions.document.writeln('<LI>select the search engine you want in the selection list.');
	instructions.document.writeln("<LI>type in your query in the query box or leave it blank to go to the search engine's home page.");
	instructions.document.writeln('<LI>click on GO! to submit your query.');
	instructions.document.writeln('<LI>click on Clear to clear your query.');
	instructions.document.writeln("<LI>some search engines use certain form methods that require you to manually enter your query at the search engine's home page.  If this is the case, you will be alerted.");
	instructions.document.writeln('</UL></FONT>');
	}

//</script>


// -->

function setCookie(name, value, expires, path, domain, secure) 
{
	var curCookie=name + "=" + escape(value) +((expires) ? ";	expires=" + expires.toGMTString() : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : "")
	document.cookie=curCookie
}

function getCookie(name) 
{
	var dc=document.cookie;
	var px=name + "=";
	var begin=dc.indexOf("; " + px);
	
	if (begin == -1) 
	{ 
		begin = dc.indexOf(px); 
		if (begin != 0) 
		  return null; 
	}
	else 
		begin += 2;
	var end=document.cookie.indexOf(";", begin);
	if (end == -1) 
		end = dc.length;
	return unescape(dc.substring(begin + px.length, end));
}

function GoTo (UrlStr) 
{	
	if (UrlStr) 
		location='http://'+UrlStr
}
