    // Rutina per obrir popups ...     
       var win= null;
       function NewWindow(mypage,myname,w,h,scroll,pos) {
             if(pos=="random") {
                     LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;
                     TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;
             } else if(pos=="center") {
                     LeftPosition=(screen.width)?(screen.width-w)/2:100;
                     TopPosition=(screen.height)?(screen.height-h)/2:100;
             } else {
                     LeftPosition=0;TopPosition=20
             }
             settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
             win=window.open(mypage,myname,settings);
             
       }

       function _viewfoto(im,t,w,h) {
       window.open("kimg.php?image="+im+"&title="+t,"_blank","width="+w+",height="+h+",scrollbars=yes,menubar=no,screenX=100,screenY=100");
       }

       function foto(camp){
         window.open("imageBrowser.php?camp="+camp+"&valor="+eval(camp).value,"wfoto","resizable=no,menubar=no,height=400,width=600");
       }
       
       function confirmacio()
       {
          if(confirm('Atenci . Ets a punt d\'esborrar un registre de la base de dades. Vols continuar ?'))
            return true;
          else
            return false;
       }
         
       
          var navegador=navigator.userAgent;
          
          function popup(f)
            {
             window.open(f,"Afegir","toolbar=0,resizable=no,status=no,menubar=no,scrollbars=yes,width=500,height=275");
            }
          function overTD(td,color)
          {         
              if(navegador.search('MSIE')>0)
                 td.style.cursor='hand';
              else 
                 td.style.cursor='pointer';
     
              
              td.bgColor=color;
          }
          function outTD(td,color)
          {
              td.style.cursor='default';
              td.bgColor=color;
          }
          function clickTD(url,w,h)
          {              
                NewWindow(url,'',w,h,'yes','center');
          }



        var Dies = new Array
        ("Diumenge",
         "Dilluns",
         "Dimarts",
         "Dimecres",
         "Dijous",
         "Divendres",
         "Dissabte",
         "Diumenge");
        var Mesos = new Array
        ("Gener",
         "Febrer",
         "Mar",
         "Abril",
         "Maig",
         "Juny",
         "Juliol",
         "Agost",
         "Setembre",
         "Octubre",
         "Novembre",
         "Desembre");
       /*  
         var avui = new Date ();
         var any = avui.getYear();
         if (any < 1000)
						any+=1900
         var mes = avui.getMonth();
         
         var dia = avui.getDay();

       	 var day = avui.getDate();
         	if (day<10)
					day="0"+day*/
   
function fecha(){

var mydate=new Date()
var year=mydate.getYear()
if (year < 1000)
year+=1900
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
if (daym<10)
daym="0"+daym
	document.write(""+Dies[day]+" "+daym+" de "+Mesos[month]+" de "+year+"")
/* var dayarray=new Array("Domingo","Lunes","Martes","Miercoles","Jueves","Viernes","Sabado")
var montharray=new Array("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre")*/


}

         
         
  	
            function showSubMenu(elemento,fondo) {
      var submenu = document.getElementById(elemento);
      if (submenu) {
        submenu.style.visibility='visible';
        submenu.style.display='inline';
        submenu.style.backgroundColor = fondo;
      }
    }

    function hideSubMenu(elemento) {
          var submenu = document.getElementById(elemento);
          if (submenu) {
            submenu.style.visibility='hidden';
          }
        }
        
        
    //rollovers menú horitzontal i lateral
    
    if (((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) >= 3)) || ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4 ))) {
    	rollOvers = 1;
		} else {
    	rollOvers = 0;
		}
		loaded = 0;
		
		function loadImg () {
   	 if (rollOvers) {
   	 	
   	 		//menú lateral
    	    
        munOn = new Image(150, 18);
        munOn.src = "templates/img/ca/lat_municipi_of.gif";
        
       	munOff = new Image(150, 18);
        munOff.src = "templates/img/ca/lat_municipi.gif";
      
        insOn = new Image(150, 18);
        insOn.src = "templates/img/ca/lat_institucio_of.gif";
        
        insOff = new Image(150, 18);
        insOff.src = "templates/img/ca/lat_institucio.gif";

        servOn = new Image(150, 18);
        servOn.src = "templates/img/ca/lat_serveistecnics_of.gif";
        
        servOff = new Image(150, 18);
        servOff.src = "templates/img/ca/lat_serveistecnics.gif";
        
        secOn = new Image(150, 18);
        secOn.src = "templates/img/ca/lat_secretaria_of.gif";
        
        secOff = new Image(150, 18);
        secOff.src = "templates/img/ca/lat_secretaria.gif";
        
        modOn = new Image(150, 18);
        modOn.src = "templates/img/ca/lat_models_of.gif";
        
        modOff = new Image(150, 18);
        modOff.src = "templates/img/ca/lat_models.gif";
        
        altOn = new Image(150, 18);
        altOn.src = "templates/img/ca/lat_altresserveis_of.gif";
        
        altOff = new Image(150, 18);
        altOff.src = "templates/img/ca/lat_altresserveis.gif";
        
        regOn = new Image(150, 18);
        regOn.src = "templates/img/ca/lat_registre_of.gif";
        
        regOff = new Image(150, 18);
        regOff.src = "templates/img/ca/lat_registre.gif";
	
	tauOn = new Image(150, 18);
        tauOn.src = "templates/img/ca/lat_tauler_of.gif";
        
        tauOff = new Image(150, 18);
        tauOff.src = "templates/img/ca/lat_tauler.gif";
	
	licOn = new Image(150, 18);
        licOn.src = "templates/img/ca/lat_perfil_of.gif";
        
        licOff = new Image(150, 18);
        licOff.src = "templates/img/ca/lat_perfil.gif";	
		
				//menú horitzontal		
		
				actOn = new Image(75, 25);
        actOn.src = "templates/img/ca/m_actualitat_of.gif";
        
        actOff = new Image(75, 25);
        actOff.src = "templates/img/ca/m_actualitat.gif";
        
        butOn = new Image(126, 25);
        butOn.src = "templates/img/ca/m_butlleti_of.gif";
        
        butOff = new Image(126, 25);
        butOff.src = "templates/img/ca/m_butlleti.gif";
        
        enOn = new Image(82, 25);
        enOn.src = "templates/img/ca/m_enllasos_of.gif";
        
        enOff = new Image(82, 25);
        enOff.src = "templates/img/ca/m_enllasos.gif";
		
				mapOn = new Image(123, 25);
        mapOn.src = "templates/img/ca/m_mapaweb_of.gif";
        
        mapOff = new Image(123, 25);
        mapOff.src = "templates/img/ca/m_mapaweb.gif";
				
				
        loaded = 1;
    }
	}
	function switchOn(imgName) {
        if (loaded == 1) {
        imgOn = eval(imgName + "On.src");
        window.document[imgName].src = imgOn;
        }
	}
	function switchOff(imgName) {
        if (loaded == 1) {
        imgOff = eval(imgName + "Off.src");
        window.document[imgName].src = imgOff;
        }
	}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           