//Presentació de la foto
   function foto(){
      var aramateix=new Date();
      h=aramateix.getHours();
      m=aramateix.getMinutes();
      s=aramateix.getSeconds();
      aleat=3600*h+60*m+s;
      nf=(aleat%178)+1; // [%darrera_foto]
      if(nf<10){
         f="fotos/foto00"+nf+".jpg";
      }else{
         if(nf<100){
            f="fotos/foto0"+nf+".jpg";
         }else{
            f="fotos/foto"+nf+".jpg";
         }
      }
      document.getElementById("foto").src=f;
   }

//Accés als itineraris
function itiner(){     
   var adr1=document.getElementById("form1").itin.options[document.getElementById("form1").itin.selectedIndex].value;
   location.href="it"+adr1+".htm";
} 

//Accés als mapes
function mapes(){
   var adr2=document.getElementById("form2").mapa.options[document.getElementById("form2").mapa.selectedIndex].value; 
   location.href="mapa.htm?"+adr2;
}

//Accés a la informació sobre els Països Catalans
function pcat(){     
   var adr3=document.getElementById("form3").reg.options[document.getElementById("form3").reg.selectedIndex].value;
   location.href="pcat/"+adr3+".htm";
} 

//Accés a la cerca de topònims
function topon(){
   location.href="buscatopon.htm";
}

//Accés a la presentació
function present(){
   location.href="presentacio.htm";
}

//Enllaços
   function altreswebs(){
   location.href="links.htm";
}

//Desplaçament pel mapa
   function inicial(){
      origen=document.location.search;
      yo=origen.substring(1,3);
      xo=origen.substring(3,5);
      yo=eval(yo);
      xo=eval(xo);
      posar();
   }
   function n(){
      yo--;
      posar();
   }
   function ne(){
      xo++;
      yo--;
      posar();
   }
   function e(){
      xo++;
      posar();
   }
   function se(){
      xo++;
      yo++;
      posar();
   }
   function s(){
      yo++;
      posar();
   }
   function sw(){
      xo--;
      yo++;
      posar();
   }
   function ww(){
      xo--;
      posar();
   }
   function nw(){
      xo--;
      yo--;
      posar()
   }
   function posar(){
      //Entorn
      if(xo==1){xo=2}
      if(xo==14){xo=13}
      if(yo==1){yo=2}
      if(yo==26){location.href="mapa_pv.htm";}
      xi=xo-1;
      xf=xo+1;
      yi=yo-1;
      yf=yo+1;
      //Afegeix un 0 si cal
      if (yo>9) {yot=yo}else{yot="0"+yo}
      if (xo>9) {xot=xo}else{xot="0"+xo}
      if (yi>9) {yit=yi}else{yit="0"+yi}
      if (xi>9) {xit=xi}else{xit="0"+xi}
      if (yf>9) {yft=yf}else{yft="0"+yf}
      if (xf>9) {xft=xf}else{xft="0"+xf}
      //Col·locació
      lse=xo+yo;
      if(lse<29){
         document.images.ie.src="mapes/"+yft+xit+".gif";
         document.images.ic.src="mapes/"+yft+xot+".gif";
         document.images.id.src="mapes/"+yft+xft+".gif";
         document.images.ce.src="mapes/"+yot+xit+".gif";
         document.images.cc.src="mapes/"+yot+xot+".gif";
         document.images.cd.src="mapes/"+yot+xft+".gif";
         document.images.se.src="mapes/"+yit+xit+".gif";
         document.images.sc.src="mapes/"+yit+xot+".gif";
         document.images.sd.src="mapes/"+yit+xft+".gif";
      }
      posicio();
   }
   function retorn(){
      yo=origen.substring(1,3);
      xo=origen.substring(3,5);
      yo=eval(yo);
      xo=eval(xo);
      posar();
   }

//Retorn a l'índex
   function r_index(){
      location.href="index.htm"
   }
   function r_index2(){
      location.href="../index.htm"
   }

// Efectes de la resolució de la pantalla
function posicio(){
   var amplada=screen.width;
   document.getElementById('a').style.position="absolute";
   document.getElementById('a').style.top="65px";
   document.getElementById('b').style.position="absolute";
   document.getElementById('b').style.top="65px";
   document.getElementById('c').style.position="absolute";
   document.getElementById('c').style.top="65px";
   document.getElementById('d').style.position="absolute";
   document.getElementById('d').style.top="240px";
   document.getElementById('e').style.position="absolute";
   document.getElementById('e').style.top="240px";
   document.getElementById('f').style.position="absolute";
   document.getElementById('f').style.top="240px";
   document.getElementById('g').style.position="absolute";
   document.getElementById('g').style.top="415px";
   document.getElementById('h').style.position="absolute";
   document.getElementById('h').style.top="415px";
   document.getElementById('i').style.position="absolute";
   document.getElementById('i').style.top="415px";
   marge_1=(amplada-1050)/2;
   marge_2=marge_1+350;
   marge_3=marge_2+350;
   document.getElementById('a').style.left=marge_1;
   document.getElementById('b').style.left=marge_2;
   document.getElementById('c').style.left=marge_3;
   document.getElementById('d').style.left=marge_1;
   document.getElementById('e').style.left=marge_2;
   document.getElementById('f').style.left=marge_3;
   document.getElementById('g').style.left=marge_1;
   document.getElementById('h').style.left=marge_2;
   document.getElementById('i').style.left=marge_3;
}


