agent = navigator.userAgent;
browserVer = 2;

var destHREF=""
var Ok = 0
var aHref = new Array() 
var ArrayOfStrings = new Array ()

function load()
{
aHref[1] = "http://www.altavista.com/cgi-bin/query?pg=q&sc=on&q=" + MkRequest(document.form1.testo.value) + "&kl=XX&stype=stext" 

aHref[2] ="http://search.virgilio.it/search/cgi/search.cgi?vrs=0&db=v&op=and&qs=" + MkRequest(document.form1.testo.value) 

aHref[3] ="http://search-arianna.iol.it/abin/search?extlist=arianna&query="+MkRequest(document.form1.testo.value)+"&FormsButton1=Trova%21"

aHref[4] ="http://www.it.lycos.de/cgi-bin/pursuit?matchmode=and&mtemp=main.sites&etemp=error&query=" +MkRequest(document.form1.testo.value)+ "&cat=it"

aHref[5] = "http://www.google.com/search?q="+MkRequest(document.form1.testo.value)

aHref[6] = "http://search.yahoo.com/bin/search?p=" +MkRequest(document.form1.testo.value)

aHref[7] ="http://it.search.yahoo.com/search/it?p="+MkRequest( document.form1.testo.value)

aHref[8] = "http://search.excite.com/search.gw?search=" + MkRequest(document.form1.testo.value)

aHref[9] = "http://xoom.snap.com/search/power/results/1,180,xoom-0,00.html?KM=a&KW" + MkRequest(document.form1.testo.value)+"&AM0=m&AT0=w&AK0=&AN=1&NR=20&FR=f&PL=a&DR=0&FM=1&FD=1&FY=1998&TM=11&TD=08&TY=1999&XT=&DM=members.xoom.com&LN=&tag=tt.xm.mempage.sb'"

aHref[10]="http://www.northernlight.com/nlquery.fcg?cb=0&qr="+MkRequest(document.form1.testo.value)+"&orl="

aHref[11]="http://www.alltheweb.com/search?cat=web&cs=iso-8859-1&l=any&q="+MkRequest(document.form1.testo.value)

}
function SplitString (Str)
{
   ArrayOfStrings = Str.split(" ")
}
function MkRequest (Str)
{
   var a = ""
   var i = 0 
    
   SplitString(Str)     
   
   for (i=0;i < ArrayOfStrings.length;i++)

   {
                a = a + ArrayOfStrings[i] 
                
                if ( i + 1 < ArrayOfStrings.length)
                   a = a + "+" 
   }
                return a
}
function go ()
{

destHREF=aHref[document.form1.list1.options[document.form1.list1.selectedIndex].value]

}

function gosite ()
{

destHREF=aHref[13]

}


if (agent.indexOf("MSIE") == -1)
{
  if (agent.substring(0,7) == "Mozilla")
  {
     if (parseInt(agent.substring(8,9)) <= 4) {browserVer = 1;}
  }
}

function setVariables(){
if (navigator.appName == "Netscape") {
v=".top=";h=".left=";dS="document.";sD="";
y="window.pageYOffset";x="window.pageXOffset";}
else {h=".pixelLeft=";v=".pixelTop=";dS="";sD=".style";
y="document.body.scrollTop";x="document.body.scrollLeft";}
checkLocationA();}

var ArrayOfStrings = new Array ()
movex=0,movey=0,xdiff=0,ydiff=0,ystart=0,xstart=0;bPreLoad=false;

function checkLocation(){
object="object1";yy=eval(y);xx=eval(x);ydiff=ystart-yy;xdiff=xstart-xx;
if ((ydiff<(-1))||(ydiff>(1))) movey=Math.round(ydiff/10),ystart-=movey
if ((xdiff<(-1))||(xdiff>(1))) movex=Math.round(xdiff/10),xstart-=movex
eval(dS+object+sD+v+ystart);
eval(dS+object+sD+h+xstart)
setTimeout("checkLocation()",10)}
function checkLocationA(){ystart=eval(y);xstart=eval(x);}

function preLoad()
{
    
    var img = new Array(arguments.length);
    
    for(i = 0; i < arguments.length; i++)
    {
    img[i] = new Image();
    img[i].src = "../comune/" + arguments[i];
    }
}


function swap(arg,img)
{
   if (document.images[arg].src)
    {
      var actual = document.images[arg].src;
      lunghezza = actual.length;
      carattere = actual.substring(lunghezza-5, lunghezza-4);
      if (carattere == "N") document.images[arg].src = "comune/" + img + "_OFF.gif";
      else if (carattere == "F") document.images[arg].src = "comune/" + img + "_ON.gif";
    }     

}

var strX = "";

// Create the navigation window
function openDoc(urlWin,w,h) {
window.open(urlWin,'','left=100,top=10,toolbar=no,location=no,menubar=no,scrollbars=yes,width=' + w + ',height=' + h)
}



function popWin(iNum) {
	bPC = navigator.userAgent.indexOf("Win")>=0 ? true:false;
	if (bPC) {
		iWidth = 544;
	}
	else {
		iWidth = 528;
	}
        open("./popup.html?" + iNum,"","height=462,width="+iWidth+",scrollbars=yes");
}

function spawn(expr,qty,reversed){
var spawnee=[expr];
for(s=1;s<qty;s++){
spawnee[s]=expr+spawnee[s-1];
}
return reversed? spawnee.reverse() : spawnee();
}

function mw_crumbs(divider,default_page)
{
  if(!divider) {divider=" : "}
  if(!default_page){default_page="index.html"}
  
  var m=location.toString(),h="";
  m=m.substring(m.indexOf("/")+1);
  m=m.split("/");
  var howmany=spawn("../",m.length,true);
  howmany[m.length]=default_page;
  
  for(i=1;i<m.length-1;i++)
  {  
     if (i == 1)  
     {
        h+=("<a href='http://www.comune.alpignano.to.it'>Home Page</a>"+divider)

     }
     else
     {           
        h+=("<a href="+howmany[i+2]+">"+unescape( m[i]+"</a>"+divider))
     }    
  }
  
  h += "<b>"+document.title+"</b>";
  
  return h
}

function scriviposizione(){

var m=location.toString()
document.write("<font size='-1'>");
document.write(mw_crumbs(" -> ","","Home Page"));
document.write("</font><br>");
}