	n_pagina=0;
	pagina_ini=0;
  act_npag=0;
	var url_ricerca="";
	var foto_wms_img;
	var wms;
	var id_tematismo="";
	var layer_terr="";
	var url_georss="";
  var attrattori="";
  var nomecerca=""
  var indirizzocerca=""
  var comunecerca=""
  var richiesta_percorso="";
  var check_itinerario=0;
  var checkbox=0;
  var  cerca=new Array();
  var lista_percorsi=0; //MDe Santis 22/10/2007
  var	layer_geocoding=""
  var url_box_geoblog
//funzione che controlla i valori inseriti nel cerca
	
	function submit_query(id_tem){
					nomecerca=(document.getElementById("Nome").value);
					indirizzocerca=document.getElementById("Indirizzo_cerca").value;
					comunecerca=document.getElementById("Citta").value;
					check=true
					tem=document.getElementById("tema").value
					check_itinerario=0
		if (tem!="-1" && nomecerca=="" && indirizzocerca=="" && comunecerca=="") {

				alert(GCLang[RTLang][8])
				check=false;
		}else if (tem=="-1"  && comunecerca=="") {
		
				alert(GCLang[RTLang][10])
				check=false;
		}
		if (check==true) crea_query(-1)
	}
	
function crea_query(tematismo,attrattori_i,tema,territorio,provincia){
	
	
		  nomecerca=""
  		indirizzocerca=""
  		 comunecerca=""
  		if (lista_percorsi == 1 ) { //MDe Santis 23102007 Necessario per eliminare la pagina degli itinerari
  			lista_percorsi=0; 
  			document.getElementById('Percorsi_DB').className="MenuRisorse"; 
  			Percorsi_DBStato=0;
  		}
	if (id_tematismo=="-1," || id_tematismo=="20,") id_tematismo=""
		
		indice_territorio=map.getLayerIndex(layer_terr)
		if (indice_territorio!=-1) map.removeLayer(map.layers[indice_territorio])
		
		if ((territorio!="" && territorio!=undefined) || (provincia!="" && provincia!=undefined )){
					type_zoom="cerca"
			   	if (territorio=="") terr=provincia	
			   	else terr=territorio        
				  layer_terr=new OpenLayers.Layer.WMS("Territorio", indirizzo_base+"/check_img.asp?idTerritorio="+terr,
            
           {layers: 'comuni','bgcolor':'97B6D1', transparent: 'true',format: 'image/png'} ,
            //{layers: 'comuni,province','bgcolor':'97B6D1', transparent: 'true',format: 'image/png'} ,
              {tileSize: new OpenLayers.Size(2048,2048), buffer: 0} ,          
           {"maxExtent": new OpenLayers.Bounds(247052,4316881,1054826,4702970), "maxResolution":massima_res,"projection":"EPSG:32633","units":"m"} 
          );
           map.addLayers([	
						layer_terr
					]);
          
				}
		
	if (tematismo!=""){
	
		  type_zoom="zoom"
			
		  extent_view=map.getExtent()
	
			tlx=extent_view.left;
			tly=extent_view.top;
			brx=extent_view.right;
			bry=extent_view.bottom;
	
			width_view=(map.getSize()).w
		
			 
		if (tematismo==-1 || tematismo==20){
				
			rimuovi_ricerca();
			type_zoom="cerca"
			id_tematismo=document.getElementById("tema").value+","
			if (id_tematismo!="-1,") {
				if (id_tematismo!="20,") {
					nomecerca=(document.getElementById("Nome").value).replace("&","$");
					indirizzocerca=(document.getElementById("Indirizzo_cerca")).value.replace("&","$");
					comunecerca=(document.getElementById("Citta").value).replace("&","$");
					
					url_ricerca=indirizzo_base+"/georss/stored.asp?id_tem="+id_tematismo+"&nome="+nomecerca+"&comune="+comunecerca+"&indirizzo="+indirizzocerca+"&id_lingua="+curLang
			  	}
			  else{
			  	indirizzocerca=document.getElementById("Indirizzo_cerca").value;
					comunecerca=document.getElementById("Citta").value;
					civicocerca=document.getElementById("Civico").value;
		
					validate=0;
				
					validate_point(indirizzocerca,comunecerca,civicocerca)
				  return;
				}
			}
			else{
					comunecerca=(document.getElementById("Citta").value).replace("&","$");
						
					layer_terr=new OpenLayers.Layer.WMS("Territorio", indirizzo_base+"/check_img.asp?idTerritorio=&nomeComune="+document.getElementById("Citta").value,
         // {layers: 'comuni,province','bgcolor':'97B6D1', transparent: 'true',format: 'image/png'} ,
              {layers: 'comuni','bgcolor':'97B6D1', transparent: 'true',format: 'image/png'} ,
                 {tileSize: new OpenLayers.Size(2048,2048), buffer: 0} ,     
           {"maxExtent": new OpenLayers.Bounds(247052,4316881,1054826,4702970), "maxResolution":massima_res,"projection":"EPSG:32633","units":"m"} 
          );
           map.addLayers([	
						layer_terr
					]);
					//url_ricerca=indirizzo_base+"/georss/stored.asp?id_tem=0,&nome=&comune="+comunecerca+"&indirizzo=&id_lingua="+curLang
					validate=0;
					validate_point("",comunecerca,"")
					return;
			}
		}
			
		 if (tematismo!=0 && tematismo!=-1  && tematismo!="20" && (!isNaN(tematismo))){
	
		   	id_tematismo=id_tematismo+tematismo+","
		    url_ricerca=indirizzo_base+"/georss/stored.asp?id_tem="+id_tematismo+"&id_lingua="+curLang
			
		  }else{
		     if (tematismo==0) {
	           
		     		url_ricerca=indirizzo_base+"/georss/stored.asp?id_tem="+id_tematismo+"&id_lingua="+curLang
		     	
		    	}
		  	
		  }
		     
		   if (attrattori_i!="" && (attrattori_i)!=null){
		   		type_zoom="cerca"
		   		attrattori=attrattori_i
		   		
			  	url_ricerca=url_ricerca+"&idattrattori="+attrattori
			  	
			 }
		 	if (tema!="" && (tema)!=null){
		 				
			  	url_ricerca=url_ricerca+"&tema="+tema
				
			}
		 if (tipoRicerca=="ALL"){
		 	
		 		id_tematismo=tematismo
		    url_ricerca=indirizzo_base+"/georss/stored.asp?id_tem="+id_tematismo+"&id_lingua="+curLang+"&tipoRicerca="+tipoRicerca
		    if (attrattori_i!="" && (attrattori_i)!=null){
		   		type_zoom="cerca"
		   		attrattori=attrattori_i
		   		url_ricerca=url_ricerca+"&idattrattori="+attrattori
			  	
			 }
			}
		
		  if (id_tematismo!=""){
					//	url_ricerca=url_ricerca+"&geoblog="+geoblog
					
					 url_georss=url_ricerca+"&geoblog="+geoblog+"&tlx="+tlx+"&tly="+tly+"&brx="+brx+"&bry="+bry+"&width="+width_view
				   
					 if (map.getLayerIndex(newl)!=-1){
							map.removeLayer(map.layers[0])
							newl=""
					}
					
					//prompt("",url_georss)
					add_georss(url_georss);
				
			 }else{
			 	 if (map.getLayerIndex(newl)!=-1){
			 	 	  index_blog=map.getLayerIndex(layer_blog)
					 	 	if (index_blog==-1){
								rimuovi_ricerca()
							}else {
								index_ricerca=map.getLayerIndex(newl)
												
								if (index_ricerca!=-1){
									map.layers[index_ricerca].destroy()
									if (map.popups.length!=0) map.removePopup(map.popups[0])
								}
							 	visualizza_geoblog();
							} 
						
				
					}
			}
		}
	
		

	}
	
	function add_box_ricerca(url_geo){
		//MC 22-04-08 per gestire la velocitą degli eventi su FF
			if (map.getLayerIndex(newl)!=-1 || map.getLayerIndex(layer_blog)!=-1 || url_geo.search("view_prev")!=-1){
					 document.getElementById("Ricerca").src=""
					 
				  /*if (document.getElementById("MenuRouting2").style.display!="none" || id_itin!="") check_itinerario=1
				  else check_itinerario=0*/
				  	
				   
					
					position_box();
				
					if (lista_percorsi != 0) {
						//document.getElementById("select").style.display="none"; 
						document.getElementById("Ricerca").src="georss/box_itinerari.asp?" + url_geo } //MDe Santis 22/10/2007
			    else if (id_tematismo!="20," && id_tematismo!="-1,")
			    	{
			    			
			    	  	document.getElementById("Ricerca").src="georss/box_ricerca_stored.asp?"+((url_geo.split("?"))[1])+"&itin="+check_itinerario+"&tom="+checkbox+"&n_pagina="+n_pagina
			    	}
			    	
			    else 	{
			    	
			    	//document.getElementById("select").style.display="none"; //MDe Santis 23/10/2007
			    	document.getElementById("Ricerca").src="geocoding/box_geocoding.asp?"+((url_geo.split("?"))[1])+"&itin="+check_itinerario+"&n_pagina="+n_pagina}
			    
			    tematismi=(id_tematismo.split(","))
			    check_servizi=0
			    check_risorse=0
			    
			    for (var n=0;n<(tematismi.length-1);n++){
			     
			     if (tematismi[n]>=11  && tematismi[n]<=16 || tematismi[n]==28){
			     	  check_servizi=1;
			     }else if (tematismi[n]>16 && tematismi[n]!=18){
			     	     check_servizi=1;
			     	     check_risorse=1; 
			     		}else{
			     			 check_risorse=1;
			     		
			    	}
			    	if (tematismi[n]==-1){
			    		check_servizi=1;
			     
			     		check_risorse=1;
			    	}
			    }	
			    if ((check_servizi==1 && check_risorse==1) || (geoblog==1 && check_risorse==1) || id_tematismo=="20," ){
			    		color="Giallo"
			    	
			    	}else{
			    		if (check_servizi==1  || (geoblog==1)){
			    	     color="Blu"
			    			
			        }else{
			        	color="Rossa"
			        	
			      	}
			  	
			  }
			  			document.getElementById("iconaris").src="PK_layout/img/IconaCerca"+color+".gif"
			  			
			     		document.getElementById("iconarisriga").style.backgroundImage="url(PK_layout/img/Riga"+color+".gif)"
			     		
			     		document.getElementById("iconarisriga").className="testoBianco"
			     		document.getElementById("precedenti").src="PK_layout/img/FrecciaCercaSx"+color+".gif"
			     		document.getElementById("successivi").src="PK_layout/img/FrecciaCercaDx"+color+".gif"
			     	
			     		
			     	//	document.getElementById("cestino").src="PK_layout/img/Cestino"+color+".gif"
			     		document.getElementById("iconafine").src="PK_layout/img/Riga"+color+"Fine.gif"
			     	    
			     espandi_ric();
			     act_npag=0; //MDe Santis 16/10/2007
			    //  count_pagina(0)
			  }  
	}
	n_geocod=0
	function add_georss(url_geo){
		
		  if (geocoding!=1)   mostraDivWaitPlease();
		 	  var value =url_geo.replace("'","&apos;");
		 		
		    if (url_ricerca=="") url_ricerca=url_geo.split("&geoblog")[0]
			
			  if (geocoding==1 && (id_tematismo=="" || id_tematismo=="20," )) { 
			  	  tab_body=document.getElementById("Geocoding").tBodies[0]
          	n_righe=tab_body.rows.length
          
         		eval("layer_geocoding"+n_geocod+"=''")
			  	 	eval("layer_geocoding"+n_geocod+"=new OpenLayers.Layer.GeoRSS('Geocodifica', '"+value+"')");
			  		map.addLayer(eval("layer_geocoding"+n_geocod));
			  		n_geocod=n_geocod+1
			  	
			  		if (geocoding==1) {
			  		  
          		//map.setLayerIndex(eval("layer_geocoding"+n_geocod))
			  		}
			    }else{
			    		index_ricerca=map.getLayerIndex(newl)
							if (index_ricerca!=-1){
									map.layers[index_ricerca].destroy()
									if (map.popups.length!=0) map.removePopup(map.popups[0])
								}
					if (id_tematismo=="20,") name_l="Indirizzi"
					else name_l="Ricerca"
					
			    	newl = new OpenLayers.Layer.GeoRSS(name_l, value);
			    	map.addLayer(newl);
			      map.setLayerIndex(newl,0)
			      map.layers[0].setZIndex(400)
			     }
			
			   /*  if (layer_geocoding!="") {
			     
			     		map.setLayerIndex(layer_geocoding,1)
			      
			   	
			     
					  if (markers_geo!="") {
					     
					     	map.setLayerIndex(markers_geo,2)
					     	}
					     	

			      }*/
			    
					   
			    	if  (layer_geocoding!="") {
			    		  
			   	    	map.layers[map.getLayerIndex(layer_geocoding)].setZIndex(Math.round(400)+4)
			   	    	
					     if (markers_geo!="") 	map.layers[markers_geo].setZIndex(Math.round(400)+5)
					    }
					  
					
			   	 if (geocoding!=1 || (id_tematismo!="" && id_tematismo!="20," && geocoding==1))	setTimeout("add_box_ricerca('"+value.replace(/'/g,"£")+"')",500)
				
			 }
			

//spegnere tutti i criteri di ricerca	
function SwitchBGOffAll() {
  if (document.getElementById('ArteArchitettura').className=="MenuRisorseOn") { document.getElementById('ArteArchitettura').className="MenuRisorse"; ArteArchitetturaStato=0 };
  if (document.getElementById('TermeBenessere').className=="MenuRisorseOn") { document.getElementById('TermeBenessere').className="MenuRisorse"; TermeBenessereStato=0 };
  if (document.getElementById('Spirito').className=="MenuRisorseOn") { document.getElementById('Spirito').className="MenuRisorse"; SpiritoStato=0 };
  if (document.getElementById('Eno').className=="MenuRisorseOn") { document.getElementById('Eno').className="MenuRisorse"; EnoStato=0 };
  //if (document.getElementById('Artigianato').className=="MenuRisorseOn") { document.getElementById('Artigianato').className="MenuRisorse"; ArtigianatoStato=0 };
  if (document.getElementById('Natura').className=="MenuRisorseOn") { document.getElementById('Natura').className="MenuRisorse"; NaturaStato=0 };
  if (document.getElementById('Mare').className=="MenuRisorseOn") { document.getElementById('Mare').className="MenuRisorse"; MareStato=0 };
  if (document.getElementById('Sport').className=="MenuRisorseOn") { document.getElementById('Sport').className="MenuRisorse"; SportStato=0  };
  if (document.getElementById('Eventi').className=="MenuRisorseOn") { document.getElementById('Eventi').className="MenuRisorse"; EventiStato=0  };
 	if (document.getElementById('Percorsi_DB').className=="MenuRisorseOn" && lista_percorsi == 1) { document.getElementById('Percorsi_DB').className="MenuRisorse"; Percorsi_DBStato=0; lista_percorsi = 0;  }; //MDe Santis 23102007
 	
  if (document.getElementById('Congressi').className=="MenuRisorseOn") { document.getElementById('Congressi').className="MenuRisorse"; CongressiStato=0 };
  if (document.getElementById('COMUOV').className=="MenuInformazioniOn") { document.getElementById('COMUOV').className="MenuInformazioni"; COMUOVStato=0 };
  if (document.getElementById('DOVDOR').className=="MenuInformazioniOn") { document.getElementById('DOVDOR').className="MenuInformazioni"; DOVDORStato=0 };
  if (document.getElementById('DOVMAN').className=="MenuInformazioniOn") { document.getElementById('DOVMAN').className="MenuInformazioni"; DOVMANStato=0 };
  if (document.getElementById('TEMPL').className=="MenuInformazioniOn") { document.getElementById('TEMPL').className="MenuInformazioni"; TEMPLStato=0 };
  if (document.getElementById('INFOGEN').className=="MenuInformazioniOn") { document.getElementById('INFOGEN').className="MenuInformazioni"; INFOGENStato=0 };
  if (document.getElementById('ALTSERV').className=="MenuInformazioniOn") { document.getElementById('ALTSERV').className="MenuInformazioni"; ALTSERVStato=0 };
	 if (document.getElementById('APT').className=="MenuInformazioniOn") { document.getElementById('APT').className="MenuInformazioni"; APTStato=0 };

	if (document.getElementById('GEOBLOG1').className=="MenuInformazioniOn") { document.getElementById('GEOBLOG1').className="MenuInformazioni"; GEOBLOG1Stato=0 };
 

}

function rimuovi_geocoding(){
		document.getElementById("BoxRisultatiRicerca").style.visibility='hidden';
		document.getElementById("BoxRicercaRidotta").style.visibility='hidden';
		document.getElementById("Geocoding").innerHTML='';
		index_geocoding=map.getLayerIndex(layer_geocoding)
		map.layers[index_geocoding].destroy()
		if (map.popups.length!=0) map.removePopup(map.popups[0])
}

function rimuovi_ricerca(){
		index_ricerca=map.getLayerIndex(newl)
	
		
		if (index_ricerca!=-1 ){
			map.layers[index_ricerca].destroy()
			if (map.popups.length!=0) map.removePopup(map.popups[0])
		}
		if (layer_geocoding!="") {
					     	
					     	//map.setLayerIndex(layer_geocoding,1)
					    	map.layers[map.getLayerIndex(layer_geocoding)].setZIndex(404)     
					   	 if (markers_geo!="") {
					     	
					     //	map.setLayerIndex(markers_geo,2)
					    	map.layers[2].setZIndex(405)
					     	}
					     	
					     
		}
			document.getElementById("BoxRicerca").style.visibility='hidden';
			document.getElementById("BoxRisultatiRidotta").style.visibility='hidden';
			document.getElementById("Ricerca").src='';
	
		
		index_blog=map.getLayerIndex(layer_blog)
		if (index_blog!=-1){
			map.layers[index_blog].destroy()
			
			geoblog=0
			layer_blog=""
			if (map.popups.length!=0) map.removePopup(map.popups[0])
		}
		indice_territorio=map.getLayerIndex(layer_terr)
							  
		if (indice_territorio!=-1) map.removeLayer(map.layers[indice_territorio])
						
   	
		newl=""
		id_tematismo=""
		url_ricerca=""
		url_georss=""
		if (tipoRicerca=="ALL"){
  		tipoRicerca="";
  		id_tematismo="";
  		attrattori="";
  	}
		//lista_percorsi=0; //MDe Santis 23102007
		SwitchBGOffAll()
		checkbox=0; //MDe Santis 12102007
		act_npag=0;
		nascondiDivWaitPlease();
		//document.getElementById("select").style.display="inline";
		//document.getElementById("submit").style.display="none"; // End MDe Santis
	}
	
	function espandi(){
		//valoreTopMappaRidotta č definito nella index
		document.getElementById("MappaRidotta").style.visibility='hidden';
		if (browser.isNS)
		{
			document.getElementById("MappaPiccola").style.top=valoreTopMappaRidotta;
		}

		document.getElementById("MappaPiccola").style.visibility='visible';

		overview.maximizeControl();
		
}
function riduci(){
		document.getElementById("MappaPiccola").style.visibility='hidden';
		document.getElementById("MappaRidotta").style.visibility='visible';
		overview.minimizeControl();
		
}
function riduci_ric(){
		document.getElementById("BoxRicerca").style.visibility='hidden';
		document.getElementById("BoxRisultatiRidotta").style.visibility='visible';
}
function espandi_ric(){

	  document.getElementById("BoxRisultatiRidotta").style.visibility='hidden';
	 
		document.getElementById("BoxRicerca").style.visibility='visible';

		
		
}
function close_ric(){
	document.getElementById("BoxRicerca").style.display='none';
	document.getElementById("BoxRisultatiRidotta").style.display='none';
}

function espandi_info(){
	  if (document.getElementById("PannelloInformazioni").style.visibility=='visible') {
	  		document.getElementById("PannelloInformazioni").style.visibility='hidden';
		}else{
			document.getElementById("PannelloInformazioni").style.visibility='visible';
		}
}

function espandi_risorse(){
	  if (document.getElementById("PannelloRisorse").style.visibility=='visible') {
	  		document.getElementById("PannelloRisorse").style.visibility='hidden';
		}else{
			document.getElementById("PannelloRisorse").style.visibility='visible';
		}
}
function espandi_cerca(){
	  if (document.getElementById("PannelloCerca").style.visibility=='visible') {
	  		document.getElementById("PannelloCerca").style.visibility='hidden';
		}else{
			document.getElementById("PannelloCerca").style.visibility='visible';
		}
}
function preview(tipo) {
   	                                         
        switch (tipo){
        	case "0":
        	  if (tipo_vista!=0){
        	  	document.getElementById("mista").src=img_mista_off
        	  	document.getElementById("mappa").src=img_stradario_off
        	  	document.getElementById("foto").src=img_foto_on
        	 		document.getElementById("cgr").style.visibility="visible"
   	  			        	
							
							 map.setBaseLayer(sfondo_cart,false,true);
							 
							 for (var i=0;i<map.layers.length;i++){
									if (!map.layers[i].isBaseLayer){		
											if ( map.layers[i].name=="stradario"){
													map.layers[i].setVisibility(false,false);
										 			
										 	}
									}
							  }
							
							  
             tipo_vista=0
            }
              break;
            
           case "1":
          		
              if (tipo_vista!=1){
              
			           	document.getElementById("mista").src=img_mista_off
		        	  	document.getElementById("mappa").src=img_stradario_on
		        	  	document.getElementById("foto").src=img_foto_off
	           		document.getElementById("cgr").style.visibility="hidden"
	            		tipo_vista=1  
		         
							  map.setBaseLayer(stradario,false,true);
							  for (var i=0;i<map.layers.length;i++){
								 if (!map.layers[i].isBaseLayer){		
										if (map.layers[i].name=="stradario"){
											
									 			 map.layers[i].setVisibility(false,false);
									 			
									 	}
								   }
							  }
							   
							 
						
							   
							  }  
              break;
           
           case "2":
           if (tipo_vista!=2){
           	   document.getElementById("mista").src=img_mista_on
        	  	document.getElementById("mappa").src=img_stradario_off
        	  	document.getElementById("foto").src=img_foto_off
           		document.getElementById("cgr").style.visibility="visible"
           	
   					 		 tipo_vista=2
				  						
						
           			
							   map.setBaseLayer(sfondo_cart,false,true);
							   
							   for (var i=0;i<map.layers.length;i++){
									 if (!map.layers[i].isBaseLayer){			
												if (map.layers[i].name=="stradario"){
													
											 			 map.layers[i].setVisibility(true,false);
											 			
											 	}
										   }
							  	}
							  
							  
							 
								
								
							  }  
              break;
        }
  
   
 
	 
	
 }
function position_box(){
	
	
	document.getElementById("BoxRicerca").style.left=17
	document.getElementById("BoxRisultatiRidotta").style.left=17
	//document.getElementById("BoxRicerca").style.top=window.document.body.offsetHeight-270
  document.getElementById("BoxRisultatiRidotta").style.bottom="30px"
	document.getElementById("BoxRicerca").style.bottom="25px"
	document.getElementById("BoxRisultatiRidottaScheda").style.bottom="30px"
	document.getElementById("geoblog_ridotto").style.bottom="30px"
	document.getElementById("divWaitPlease").style.left=17+(map.getSize().w)/2-150
  document.getElementById("divWaitPlease").style.top= window.document.body.offsetHeight-364
 
 
  
}
function position_boxSpaziale(){
  
	document.getElementById("BoxRicercaSpaziale").style.right=1
	document.getElementById("BoxRicercaSpazialeRidotta").style.right=1
  if (navigator.appName.contains("Microsoft")) r=7
  else r=0
	document.getElementById("BoxRicercaSpaziale").style.top=255+r
	document.getElementById("BoxRicercaSpazialeRidotta").style.top=235
	document.getElementById("divWaitPlease").style.left=17+(map.getSize().w)/2-150
  document.getElementById("divWaitPlease").style.top= window.document.body.offsetHeight-364		
}
function count_pagina_old(pagina){
	// 	n_record=frames["Ricerca"].document.all.numrecord.value    
	 	 n_record=document.getElementById("Ricerca").document.getElementById("numrecord").value 
	 	 n_record=document.getElementById("Ricerca").document.all.numrecord.value 
    	if (pagina>0 && pagina<((n_record)/nris_pagina)-1){
    		
      	document.getElementById("precedenti").style.display="inline"
      	document.getElementById("successivi").style.display="inline"
    	}else{
    		 if (pagina==0 && n_record>nris_pagina){
    		 				document.getElementById("successivi").style.display="inline"
    						document.getElementById("precedenti").style.display="none"
    		  	}else{
    		  		if (pagina==0) {
    		  				document.getElementById("successivi").style.display="none"
    							document.getElementById("precedenti").style.display="none"
    		  		}else
		    		  		{
		    		  			document.getElementById("precedenti").style.display="inline"
		    		  		document.getElementById("successivi").style.display="none"
		    		  	}  
		    		 }
    		 } 
}
 


function reset_request(){
	document.getElementById("Nome").value="";
	document.getElementById("Citta").value="";
	document.getElementById("Indirizzo_cerca").value="";
}
var mode_old=""

function resize_view(){
 
		placePanel('PannelloCerca');
		placePanel('PannelloRisorse');
		placePanel('PannelloInformazioni');
    placePanel("BoxRicercaSpaziale")
    
    larghezza=window.document.body.scrollWidth
		document.getElementById("MenuRouting").style.left=(parseFloat(larghezza)-317)+"px";
		document.getElementById("MenuRouting2").style.left=(parseFloat(larghezza)-317)+"px";
		document.getElementById("divResultRouting").style.left=(parseFloat(larghezza)/2-135)+"px";
		larghezza=(map.getCurrentSize()).w+34

		
    
    document.getElementById("BoxRicercaScheda").style.bottom=35
		document.getElementById("BoxRisultatiRidottaScheda").style.bottom=38
		position_boxSpaziale();
		position_box();
		if (layer_geocoding!=""){
			document.getElementById("BoxRisultatiRicerca").style.left=(map.getSize()).w-350
			document.getElementById("BoxRicercaRidotta").style.left=(map.getSize()).w-350
		  document.getElementById("mirino").style.left=larghezza-300+"px";			

		}
 
 
 		if (document.getElementById("download_info").style.display == "inline" && document.getElementById("download_info").style.top == "122px") {
 			document.getElementById("download_info").style.left = document.getElementById("PannelloInformazioni").style.left;
		} else if (document.getElementById("download_info").style.display == "inline" && document.getElementById("download_info").style.top == "122px") {
			document.getElementById("download_info").style.left = document.getElementById("PannelloRisorse").style.left;
		}	else if (document.getElementById("download_info").style.display == "inline" && document.getElementById("download_info").style.left == "412px") {
			document.getElementById("download_info").style.top = document.getElementById("BoxRicerca").style.top
		} else if (document.getElementById("download_itin_db").style.display == "inline" && document.getElementById("download_itin_db").style.left == "412px") {
			document.getElementById("download_itin_db").style.top = document.getElementById("BoxRicerca").style.top
		}
	

}

function risultati_box(name){
	if (name=="primo") name2="secondo"
	else name2="primo"
	document.getElementById(name+"folder").background="PK_layout/img/FolderOnCn.gif"
  document.getElementById(name2+"folder").background="PK_layout/img/FolderOffCn.gif"
 
}

function espandi_scheda(){
  document.getElementById("BoxRicercaScheda").style.display="inline"
	document.getElementById("BoxRisultatiRidottaScheda").style.display="none"
}
function riduci_scheda(){
  document.getElementById("BoxRicercaScheda").style.display="none"
	document.getElementById("BoxRisultatiRidottaScheda").style.display="inline"
}
function chiudi_scheda(){
	document.getElementById("BoxRicercaScheda").style.display="none"
	document.getElementById("Scheda").src=""
	document.getElementById("BoxRisultatiRidottaScheda").style.display="none"
}


function google_earth(){
	extent_view=map.getExtent()
	
	extent_tlx=extent_view.left;
	extent_tly=extent_view.top;
	extent_brx=extent_view.right;
	extent_bry=extent_view.bottom;
	
	tlx=(UTM2LL(extent_tlx,extent_tly,33))[1]
	tly=(UTM2LL(extent_tlx,extent_tly,33))[0]
	brx=(UTM2LL(extent_brx,extent_bry,33))[1]
	bry=(UTM2LL(extent_brx,extent_bry,33))[0]
	
	ext=tlx+","+bry+","+brx+","+tly
	width_view=(map.getSize()).w

	if (url_georss!="") dati_q=(url_georss.split("?"))[1]
	else 
		dati_q=""

	document.getElementById("kml").src="kml/kml.asp?ext="+ext+"&tipo="+tipo_vista+"&"+dati_q

}

function arrotonda(numero,precisione){
	valore=Math.round(numero*Math.pow(10,precisione))/Math.pow(10,precisione)
	return(valore);
}
/*
Sezione GeoBlog
MC 18/05/07
*/
markers_geoblog=""
flag_marker=0
function inserisci_geoblog(){
	document.getElementById("geoblog_ridotto").style.display="none"
 	document.getElementById("frame_geoblog").contentWindow.document.getElementById("tbl_geoblog").style.display="inline"
	document.getElementById("frame_geoblog").contentWindow.document.getElementById("insert_geoblog").style.display="none"
	//document.getElementById("frame_geoblog").style.display="none"
	
	
	document.getElementById("frame_geoblog").style.display="inline";
  index_geoblog=map.getLayerIndex(layer_blog);
  if (index_geoblog==-1) {
  	SelectBG('GEOBLOG1','blu','Geoblog')
  	//visualizza_geoblog(); 
  	
  }
	 map.flag_marker=1
	 map.controls[1].leaveMode();
	 map.events.register("click", map, function(e) { 
	 	if (map.flag_marker==1){
	 		
		   coord_utm = map.getLonLatFromViewPortPx(e.xy);
		   coord_utmx=coord_utm .lon
		   coord_utmy=coord_utm .lat
		 
		   //bisogna convertire le coordinate da utm33 a geografico wgs84
		   	  
					YGeo=arrotonda((UTM2LL(coord_utmx,coord_utmy,33))[0],5)
				  XGeo=arrotonda((UTM2LL(coord_utmx,coord_utmy,33))[1],5)
				  lat_grad=Convert_DecToGrad(YGeo)
				  lon_grad=Convert_DecToGrad(XGeo)
				  
			/*	 document.getElementById("frame_geoblog").contentWindow.document.getElementById("blog_x_GPS").value=XGeo
				 document.getElementById("frame_geoblog").contentWindow.document.getElementById("blog_y_GPS").value=YGeo
				*/
				 document.getElementById("frame_geoblog").contentWindow.document.getElementById("blog_x").value=XGeo
				 document.getElementById("frame_geoblog").contentWindow.document.getElementById("blog_y").value=YGeo
				 val_lat=lat_grad.split("|")
				 document.getElementById("frame_geoblog").contentWindow.document.getElementById("lat_gr").value=val_lat[0]
				 document.getElementById("frame_geoblog").contentWindow.document.getElementById("lat_pr").value=val_lat[1]
				 document.getElementById("frame_geoblog").contentWindow.document.getElementById("lat_sr").value=val_lat[2]
				  val_lon=lon_grad.split("|")
				 document.getElementById("frame_geoblog").contentWindow.document.getElementById("lon_gr").value=val_lon[0]
				 document.getElementById("frame_geoblog").contentWindow.document.getElementById("lon_pr").value=val_lon[1]
				 document.getElementById("frame_geoblog").contentWindow.document.getElementById("lon_sr").value=val_lon[2] 
				
				 document.getElementById("frame_geoblog").contentWindow.document.getElementById("blog_x_utm").value=arrotonda(coord_utmx,0)
				 document.getElementById("frame_geoblog").contentWindow.document.getElementById("blog_y_utm").value=arrotonda(coord_utmy,0)
	        //MC 10/04/08
	       document.getElementById("frame_geoblog").contentWindow.document.getElementById("check_comune").src="check_comune.asp?Xc="+arrotonda(coord_utmx,0)+"&YC="+arrotonda(coord_utmy,0)
	       
	       
	       type_segnalazione=0
	       
	       index_marker_geoblog=map.getLayerIndex(markers_geoblog) 
	      
	       if (index_marker_geoblog!=-1) 	map.layers[index_marker_geoblog].destroy()

				
			
			    markers_geoblog = new OpenLayers.Layer.Markers("geoblog_marker");
			    map.addLayer(markers_geoblog);
			   	index_marker=map.getLayerIndex(markers_geoblog) 
		    	icon = OpenLayers.Marker.defaultIcon("PK_layout/img/BandierinaBluMappa.gif");
		    	marker_geoblog = new OpenLayers.Marker(coord_utm,icon);
		    	markers_geoblog.addMarker(marker_geoblog);
		}	    
   })

}
function GestisciOnChangeLatLonGradi_geoblog(objControllo)
{
	var RetVal;
	RetVal = false;
	
	
	//Start - Validazione dati -----------------------------------------
	LatG = document.getElementById("lat_gr").value;
	LatP = document.getElementById("lat_pr").value;
	LatS = document.getElementById("lat_sr").value;
	
	LonG = document.getElementById("lon_gr").value;
	LonP = document.getElementById("lon_pr").value;
	LonS = document.getElementById("lon_sr").value;
	
	//Conversione
	strDecLat = Convert_GradToDec(LatG,LatP,LatS).replace(",",".");
	strDecLon = Convert_GradToDec(LonG,LonP,LonS).replace(",",".");
		
	//Scrivi nelle texbox dei decimali
	  document.getElementById("blog_x").value=strDecLon
		document.getElementById("blog_y").value=strDecLat
	
	
	//Controllo Presenza coordinate
	if ((LatG + LatP + LatS != "") && (LonG + LonP + LonS != ""))
	{	//0
				
				
		//Controllo formato e range delle coodinate del punto in GRADI
		if ((strDecLat != "") && (strDecLon != ""))
		{	//1
									
			//Controllo formato e range delle coodinate del punto in DECIMALE
			if (IsLatLong(strDecLat,strDecLon) == true)
			{	//2
				 
				 RetVal = true;
								
			}	//2
			else
			{	//2
				//alert(parent.GCLang[parent.RTLang][15]);
			}	//2
			
			
		}	//1
		else
		{	//1
			//alert(parent.GCLang[parent.RTLang][16]);
		}	//1
	
				
	}	//0
	else
	{	//0
		//alert(parent.GCLang[parent.RTLang][16]);
	}	//0
	//End - Validazione dati ----------------------------------------------
	
	
	//Start - Aggiornamento posizione buffer sulla mappa ------------------
	if (RetVal == true)
	{		//0
		
		//Conversione in UTM
		XGeo_RS=parseFloat(strDecLon);
		YGeo_RS=parseFloat(strDecLat);
		XUtm_RS=(LL2UTM(YGeo_RS,XGeo_RS,33))[0];
		YUtm_RS=(LL2UTM(YGeo_RS,XGeo_RS,33))[1];
		
		 document.getElementById("blog_x_utm").value=arrotonda(XUtm_RS,0)
		 document.getElementById("blog_y_utm").value=arrotonda(YUtm_RS,0)
		
		//MC 10/04/08
	       document.getElementById("check_comune").src="check_comune.asp?Xc="+arrotonda(XUtm_RS,0)+"&YC="+arrotonda(YUtm_RS,0)
	       
	}		//0
		
}
function GestisciOnChangeLatLonDec_geoblog(objControllo)
{
	var RetVal;
	RetVal = false;
	
	
	//Start - Validazione dati -----------------------------------------
	lat = (document.getElementById("blog_x").value).replace(",",".");
	lon = (document.getElementById("blog_y").value).replace(",",".");
	
	//Conversione in gradi
	strGradLat = Convert_DecToGrad(lat);
	strGradLon = Convert_DecToGrad(lon);
	//InserisciInGrad(strGradLat,strGradLon);
	
	  
	 val_lat=strGradLat.split("|")
				 document.getElementById("lat_gr").value=val_lat[0]
				 document.getElementById("lat_pr").value=val_lat[1]
				 document.getElementById("lat_sr").value=val_lat[2]
				  val_lon=strGradLon.split("|")
				document.getElementById("lon_gr").value=val_lon[0]
				document.getElementById("lon_pr").value=val_lon[1]
				document.getElementById("lon_sr").value=val_lon[2] 
	//Controllo Presenza coordinate
	if ((lat != "") && (lon != ""))
	{	//0
		
		//Controllo formato e range delle coodinate del punto di partenza
		if (IsLatLong(lat,lon) == true)
		{	//1
			 
			 RetVal = true;
							
		}	//1
		else
		{	//1
			//alert(strFormatoCoordinate + " " + strRangeLatLong);
		}	//1
		
				
	}	//0
	else
	{	//0
		//alert(parent.GCLang[parent.RTLang][16]);
	}	//0
	//End - Validazione dati ----------------------------------------------
	
	
	
	//Start - Aggiornamento posizione buffer sulla mappa ------------------
	if (RetVal == true)
	{		//0
		
		//Conversione in UTM
		XGeo_RS=parseFloat(lon);
		YGeo_RS=parseFloat(lat);
		XUtm_RS=(LL2UTM(YGeo_RS,XGeo_RS,33))[0];
		YUtm_RS=(LL2UTM(YGeo_RS,XGeo_RS,33))[1];
 			document.getElementById("blog_x_utm").value=arrotonda(XUtm_RS,0)
		 document.getElementById("blog_y_utm").value=arrotonda(YUtm_RS,0)
//MC 10/04/08
	     document.getElementById("check_comune").src="check_comune.asp?Xc="+arrotonda(XUtm_RS,0)+"&YC="+arrotonda(YUtm_RS,0)
	       
    
     
	}		//0
	//End - Aggiornamento posizione buffer sulla mappa ---------------------
	
}
function IsLatLong(strLat,strLong)
//Verifica formato coordinate
//Si assume che le stringhe non siano vuote
//Se il parametro rispetta i requisiti allora TRUE altruimensi FALSE
{
	var RetVal;
		
	RetVal = false;
	
	//alert("strLat: " + strLat + " - " + "strLong: " + strLong);
			
	//Controllo che si tratti di numeri
	if ((!isNaN(strLat)) && (!isNaN(strLong)))
	{	
			
			//Controllo range
			if ((parseFloat(strLat) >= minLat) && (parseFloat(strLat) <= maxLat) && (parseFloat(strLong) >= minLong) && (parseFloat(strLong) <= maxLong))
			{
				RetVal = true;
				
			}else{
					//
			}
			
	}	else{
		//	alert(parent.GCLang[parent.RTLang][16]);
	}
		
	
	return RetVal;	
}

function Convert_GradToDec(g,p,s)
//input: g,p,s stringa
//output: decimale in stringa
//Se errore o input vuoto allora strDecimale  ritornata = ""
{
	strDec = "";
	Dec = 0;
	
	try
	{//0
		
		//Controllo presenza input
		if ((g + p + s) != "")
		{	//1
			
			//Start - inizializzazione valori
			if (g == "")
				{
					valg = 0;
				}
			else
				{
					valg = parseInt(g);
				}
				
			if (p == "")
				{
					valp = 0;
				}
			else
				{
					valp = parseInt(p);
				}
				
			if (s == "")
				{
					vals = 0;
				}
			else
				{
					vals = parseInt(s);
				}	
			//End - inizializzazione valori
			
			
			//Conversione in Decimale
			Dec = valg + valp/60 + vals/3600;
			
			//Conversione in stringa
			strDec = String(Dec);
		}	//1

	}
	catch(e)	
	{
	}
	finally
	{
		return strDec;
	}
	
}
function Convert_DecToGrad(Dec)
//input: stringa decimale lat lon
//output: stringa in grad lat lon formattata g|p|s
//Se errore o input vuoto allora strGrad ritornata = ""
{
	strGrad = "";
	
	try
	{//0
		
		//Controllo presenza input
		if (Dec != "")
		{	//1
			
			valDec = parseFloat(Dec);		//Valore decimale
			
			if (valDec >= 0)						//Segno (In realtą non utilizzato in questa applicazione)
			{
				segno = 1;
			}
			else
			{
				segno = -1;
			}
			
			valG = Math.floor(valDec);	//Gradi
			
			aux = (valDec - valG)*60;
			
			valP = Math.floor(aux);			//Primi
			
			aux = (aux - valP)*60;
			
			valS = Math.floor(aux);			//Secondi
			
			strGrad = String(valG) + "|" + String(valP) + "|" + String(valS);
			
		}	//1

	}
	catch(e)	
	{
	}
	finally
	{
		return strGrad;
	}
	
}
function ins_geoblog(){


	 parent.map.flag_marker=1
	// parent.map.controls[1].leaveMode();
	parent.map.controls[1].switchModeTo("pan");
	//alert("creo")
	 parent.map.events.register("click", parent.map, function(e) { 
	 	if (parent.map.flag_marker==1){
	 		
		   coord_utm = parent.map.getLonLatFromViewPortPx(e.xy);
		   coord_utmx=coord_utm .lon
		   coord_utmy=coord_utm .lat
		 
		   //bisogna convertire le coordinate da utm33 a geografico wgs84
		   	  
					YGeo=arrotonda((UTM2LL(coord_utmx,coord_utmy,33))[0],5)
				  XGeo=arrotonda((UTM2LL(coord_utmx,coord_utmy,33))[1],5)
				  lat_grad=Convert_DecToGrad(YGeo)
				  lon_grad=Convert_DecToGrad(XGeo)
				 document.getElementById("blog_x").value=XGeo
				 document.getElementById("blog_y").value=YGeo
				 val_lat=lat_grad.split("|")
				 document.getElementById("lat_gr").value=val_lat[0]
				 document.getElementById("lat_pr").value=val_lat[1]
				 document.getElementById("lat_sr").value=val_lat[2]
				  val_lon=lon_grad.split("|")
				 document.getElementById("lon_gr").value=val_lon[0]
				 document.getElementById("lon_pr").value=val_lon[1]
				 document.getElementById("lon_sr").value=val_lon[2] 
				 
				 document.getElementById("blog_x_utm").value=arrotonda(coord_utmx,0)
				document.getElementById("blog_y_utm").value=arrotonda(coord_utmy,0)
	       
	       	//MC 10/04/08
	       document.getElementById("check_comune").src="check_comune.asp?Xc="+arrotonda(coord_utmx,0)+"&YC="+arrotonda(coord_utmy,0)
	       parent.type_segnalazione=0
	       
	       index_marker_geoblog=parent.map.getLayerIndex(parent.markers_geoblog) 
	      
	       if (index_marker_geoblog!=-1) 	parent.map.layers[index_marker_geoblog].destroy()

				
			
			    parent.markers_geoblog = new parent.OpenLayers.Layer.Markers("geoblog_marker");
			    parent.map.addLayer(parent.markers_geoblog);
			   	index_marker=parent.map.getLayerIndex(parent.markers_geoblog) 
		    	icon = parent.OpenLayers.Marker.defaultIcon("PK_layout/img/BandierinaBluMappa.gif");
		    	marker_geoblog = new parent.OpenLayers.Marker(coord_utm,icon);
		    	parent.markers_geoblog.addMarker(marker_geoblog);
		}	    
   })

}
function check_geoblog(tipo_segnalazione){
	var str,str_mod,flag;
	
	rda = /"/g;
	ra = /'/g;
	flag=false;
if (flag==false && tipo_segnalazione==0){ 
if (document.getElementById("titolo").value=="" )
	{
		/*	if (curLang=="it") {
			 	alert("Il campo \"Titolo\" č obbligatorio!");
				flag=true;
			} else if (curLang=="en") {
				alert("The field \"Title\" is mandatory!");
				flag=true;
			}	else if (curLang=="de") {
				alert("Suche");
				flag=true;
			}	*/
			alert(parent.GCLang[parent.RTLang][17])
			flag=true;
			
	}
	else if (document.getElementById("titolo").value!="")
	{
		str = document.getElementById("titolo").value;
		str_mod = str.replace(ra,"''");
		str = str_mod.replace(rda,"");
		document.getElementById("titolo").value = str;
	}
}
	if (document.getElementById("testo").value=="" && flag==false)
	{
		/*	if (curLang=="it") {
			 	alert("Il campo \"Descrizione\" č obbligatorio!");
				flag=true;
			} else if (curLang=="en") {
				alert("The field \"Description\" is mandatory!");
				flag=true;
			}	else if (curLang=="de") {
				alert("Suche");
				flag=true;
			}*/
			if (tipo_segnalazione==0)
						alert(parent.GCLang[parent.RTLang][18])
			else
				  alert(top.parent.GCLang[top.parent.RTLang][18])
					flag=true;
	}
	else if (document.getElementById("testo").value!="")
	{
		str = document.getElementById("testo").value;
		str_mod = str.replace(ra,"''");
		str = str_mod.replace(rda,"");
		document.getElementById("testo").value = str;
	}

  if (flag==false && tipo_segnalazione==0){
			blog_x=document.getElementById("blog_x").value
			blog_y=document.getElementById("blog_y").value

			if (typeof(blog_x)=="number" && typeof(blog_y)=="number" && IsLatLong(blog_y,blog_x)) {
					blog_x= blog_x.toString();
					blog_y = blog_y.toString();
				}
				if (((blog_x=="") && (blog_y =="")) || ((blog_x=="") || (blog_y =="")) || document.getElementById("txtIdComune").value=="") {
					/*if (curLang=="it") {
					 	alert("E' necessario indicare un punto sulla mappa!");
						flag=true;
					} else if (curLang=="en") {
						alert("It's necessary to indicate a point on the map!");
						flag=true;
					}	else if (curLang=="de") {
						alert("Suche");
						flag=true;
					}*/
					alert(parent.GCLang[parent.RTLang][15])
					flag=true;
				} 
				else { 
					if (!IsLatLong(blog_y,blog_x)){
							   alert(parent.GCLang[parent.RTLang][15]);
								 flag=true
							}else{
									flag = false;
								} 
				 if (	flag == false) {       
					var inputUtente = blog_x+blog_y;	   
					var ok=false;
					for (i=0;i<inputUtente.length;i++) {
						inputUtente = inputUtente.toString();
						var car = inputUtente.substr(i,1);
						if (((isNaN(parseInt(car))) == true)&&(car!=".")) {						          
							alert(parent.GCLang[parent.RTLang][16]); 
							flag = true;
							break;
						} 
						else 			
									flag = false;
								
						
					}
				}
		}
}
		nome_utente=document.getElementById("nome_utente").value
if (nome_utente.charAt(0)==" ") nome_utente=nome_utente.substring(1,nome_utente.length-1);
if (nome_utente.charAt(nome_utente.length-1)==" ") nome_utente=nome_utente.substring(0,nome_utente.length-2);
if (nome_utente==""  && flag==false)
	{
		/*if (curLang=="it") {
			 	alert("Il campo \"Nome\" č obbligatorio!");
				flag=true;
			} else if (curLang=="en") {
				alert("The field \"Name\" is mandatory!");
				flag=true;
			}	else if (curLang=="de") {
				alert("Suche");
				flag=true;
			}*/
			 if (tipo_segnalazione==0)
						alert(parent.GCLang[parent.RTLang][20])
			else
				  alert(top.parent.GCLang[top.parent.RTLang][20])
					
					flag=true;
	}
	else if (nome_utente!="")
	{
		str = nome_utente;
		str_mod = str.replace(ra,"''");
		str = str_mod.replace(rda,"");
		nome_utente = str;
	}
		cognome_utente=document.getElementById("cognome").value
if (cognome_utente.charAt(0)==" ") cognome_utente=cognome_utente.substring(1,cognome_utente.length-1);
if (cognome_utente.charAt(cognome_utente.length-1)==" ") cognome_utente=cognome_utente.substring(0,cognome_utente.length-2);	
	if (cognome_utente=="" && flag==false)
	{
		/*if (curLang=="it") {
			 	alert("Il campo \"Cognome\" č obbligatorio!");
				flag=true;
			} else if (curLang=="en") {
				alert("The field \"Last Name\" is mandatory!");
				flag=true;
			}	else if (curLang=="de") {
				alert("Suche");
				flag=true;
			}*/
			 if (tipo_segnalazione==0)
						alert(parent.GCLang[parent.RTLang][21])
			else
				  alert(top.parent.GCLang[top.parent.RTLang][21])
					
					flag=true;
	}
	else if (cognome_utente!="")
	{
		str = cognome_utente;
		str_mod = str.replace(ra,"''");
		str = str_mod.replace(rda,"");
		cognome_utente = str;
	}
	mail=document.getElementById("mail").value
	if (mail.charAt(0)==" ") mail=mail.substring(1,mail.length-1);
	if (mail=="" && flag==false)
	{
	   /*	if (curLang=="it") {
			 	alert("Il campo \"E-mail\" č obbligatorio!");
				flag=true;
			} else if (curLang=="en") {
				alert("The field \"E-mail\" is mandatory!");
				flag=true;
			}	else if (curLang=="de") {
				alert("Suche");
				flag=true;
			}	
			*/
			 if (tipo_segnalazione==0)
						alert(parent.GCLang[parent.RTLang][22])
			else
				  alert(top.parent.GCLang[top.parent.RTLang][22])

					flag=true;
	}
	else if (mail!="")
	{
		if ((mail).indexOf('@', 0) == -1 || (mail).indexOf('.', 0) == -1){ 
				    /*if (curLang=="it") {
							 	alert("Indirizzo e-mail non valido!");
								flag=true;
							} else if (curLang=="en") {
								alert("E-mail address not valid!");
								flag=true;
							}	else if (curLang=="de") {
								alert("Suche");
								flag=true;
							}*/
							 if (tipo_segnalazione==0)
						alert(parent.GCLang[parent.RTLang][23])
			else
				  alert(top.parent.GCLang[top.parent.RTLang][23])
					
								flag=true;
			}else{
			str = mail;
			str_mod = str.replace(ra,"''");
			str = str_mod.replace(rda,"");
			mail = str;
		}
	}

	
	
	strImgOne = (document.getElementById("img").value).toLowerCase();
	if ((strImgOne!="")&&(strImgOne.slice(strImgOne.length-3,strImgOne.length)!="jpg") && (strImgOne.slice(strImgOne.length-3,strImgOne.length)!="jpeg") && (strImgOne.slice(strImgOne.length-3,strImgOne.length)!="gif") &&  (strImgOne.slice(strImgOne.length-3,strImgOne.length)!="png") ){
  	  /*if (curLang=="it") {
							 	alert("Il file inserito ha un formato non permesso.I formati supportati sono:jpg,jpeg,gif,png.");
								flag=true;
							} else if (curLang=="en") {
								alert("Please, insert in attachment only the following file formats: jpg,jpeg,gif,png.");
								flag=true;
							}	else if (curLang=="de") {
								alert("Suche");
								flag=true;
							}*/
							 if (tipo_segnalazione==0)
						alert(parent.GCLang[parent.RTLang][24])
			else
				  alert(top.parent.GCLang[top.parent.RTLang][24])
		
					flag=true;
  }
 	
 	if (flag==false) {
		document.getElementById("submit_geoblog").target="insert_geoblog"
		
		document.getElementById("submit_geoblog").submit();
		document.getElementById("tbl_geoblog").style.display="none"
		document.getElementById("insert_geoblog").style.display="inline"
		
	}
	
}

function cancella_form(){
	document.forms[0].reset()

}
function riduci_blog(){
  this.frameElement.style.display="none"
  parent.document.getElementById("geoblog_ridotto").style.display="inline"
}
function riduci_blog2(){
  document.getElementById("frame_geoblog").style.display="inline";
 document.getElementById("geoblog_ridotto").style.display="none"
}
function chiudi_blog(){
 	document.getElementById("tbl_geoblog").style.display="inline"
	document.getElementById("insert_geoblog").style.display="none"
	this.frameElement.style.display="none"

  if (this.frameElement.id=="commenti") t=parent.parent
  else t=parent
 if (t.map){
	index_marker_geoblog=t.map.getLayerIndex(t.markers_geoblog) 
	if (index_marker_geoblog!=-1) t.map.layers[index_marker_geoblog].destroy()

		t.map.flag_marker=0
	}	
	
}
function chiudi_blog2(){
	document.getElementById("geoblog_ridotto").style.display="none"
 	document.getElementById("frame_geoblog").contentWindow.document.getElementById("tbl_geoblog").style.display="inline"
	document.getElementById("frame_geoblog").contentWindow.document.getElementById("insert_geoblog").style.display="none"
	document.getElementById("frame_geoblog").style.display="none"

	index_marker_geoblog=map.getLayerIndex(markers_geoblog) 
	if (index_marker_geoblog!=-1) map.layers[index_marker_geoblog].destroy()

	map.flag_marker=0
		
	
}
layer_blog=""
geoblog=0

function visualizza_geoblog(){
		
    view=map.getExtent();
	  tlx= view.left;
	  tly=view.top;
	  brx=view.right;
	  bry=view.bottom; 
	  width_view=(map.getSize()).w


		extent="tlx="+tlx+"&tly="+tly+"&brx="+brx+"&bry="+bry+"&width="+width_view
		
		url_geoblog=indirizzo_base+"/geoblog/crea_geoblog.asp?"+extent
	  index_geoblog=map.getLayerIndex(layer_blog)
	  if (index_geoblog!=-1) 	map.layers[index_geoblog].destroy()
	  
		layer_blog = new OpenLayers.Layer.GeoRSS("Geoblog", url_geoblog);
   	geoblog=1
   		
   if (map.getLayerIndex(newl)!=-1 && url_ricerca!="" && id_tematismo!="") url_box_geoblog=url_ricerca+"&geoblog=1&"+extent
   else {
   		
   		url_box_geoblog=url_geoblog+"&id_tem=-1,&geoblog=1"
   }
	 map.addLayer(layer_blog);
	 
	 if (lista_percorsi == 1 ) { //MDe Santis 23102007 Necessario per eliminare la pagina degli itinerari
  			lista_percorsi=0; 
  			document.getElementById('Percorsi_DB').className="MenuRisorse"; 
  			Percorsi_DBStato=0;
   }
   GEOBLOG1Stato=1
	 SwitchBGOn('GEOBLOG1','blu')
	 add_box_ricerca(url_box_geoblog)

}

function nascondi_geoblog(){
		index_geoblog=map.getLayerIndex(layer_blog)
		geoblog=0
		map.layers[index_geoblog].destroy()
		
		if (map.getLayerIndex(newl)==-1) rimuovi_ricerca()
		
		else {
			 extent_view=map.getExtent()
	
			tlx= extent_view.left;
			tly=extent_view.top;
			brx=extent_view.right;
			bry=extent_view.bottom;
	
			width_view=(map.getSize()).w

			url_georss=url_ricerca+"&geoblog="+geoblog+"&tlx="+tlx+"&tly="+tly+"&brx="+brx+"&bry="+bry+"&width="+width_view
			
			add_box_ricerca(url_georss)
		}
	
}

//gestione bookmark
// Modifica Michele De Santis 22/05/2005
function GetCurrentView() {
	  //Recupero, attraverso il metodo getExtent, le coordinate del rettangolo della visualizzazione attuale
	  view=map.getExtent();
	  tlx= view.left;
	  tly=view.top;
	  brx=view.right;
	  bry=view.bottom; 
	  
	  vista=tipo_vista;
	  
	  temat=id_tematismo;
	  
	  tipo=document.getElementById("Scheda").src;
    
	  pan_zoom=map.controls[1].mode; 
	  
	  // Modifica Michele De Santis 27/06/2007 
	  //id_lang=curLang;	//Multilanguage
	  // Fine modifica
	  
	  if ( document.getElementById("MappaPiccola").style.visibility == 'visible' ) {
        flag_mappa=1; } //aperta
       else {
        flag_mappa=0;   //ridotta a icona
      } 
	  
	  passaggio_parametri="tlx=" + tlx + "&tly=" + tly + "&brx=" + brx + "&bry=" + bry + "&vista=" + vista + "&temat=" + temat + "&tipo=" + tipo + "&pan_zoom=" + pan_zoom + "&flag_mappa=" + flag_mappa + "&id_lang=" + curLang;

	 // if (id_tematismo != 0) { 
	 id_layerGeorss=window.parent.map.getLayerIndex(newl)
		if (id_layerGeorss!=-1){
	  	 rg=/&/g;
	  	 /*url_geo=url_georss.split("geoblog=")
	  	
	  	 url_georss=url_geo[0]+url_geo[1].slice(2,url_geo[1].length)*/
	  	 
	  	 eventuale_geo=url_georss.replace(rg,"$");
	  	 
	  
    	if ( document.getElementById("BoxRicercaScheda").style.display == "inline" ) {
        flag_scheda=1; }  // aperta
      else {
        flag_scheda=0;    // ridotta a icona
      } 
	  	 
	  //	 passaggio_parametri=passaggio_parametri + "&eventuale_geo=" + eventuale_geo + "&npag=" + npag + "&flag_box=" + flag_box + "&flag_scheda=" + flag_scheda;	
	  	 
	  	  passaggio_parametri=passaggio_parametri + "&eventuale_geo=" + eventuale_geo  + "&flag_scheda=" + flag_scheda;
	  	
	  	 }
    	
       index=(document.getElementById("Ricerca").src).indexOf("n_pagina=");
       
     if (index!=-1) {
       npag=((document.getElementById("Ricerca").src).split("n_pagina=")[1]).split("&")[0];
        
       if ( document.getElementById("BoxRicerca").style.visibility == 'hidden' ) {
         flag_box=0; 
         }  // ridotta a icona 
    	 else {
    	   flag_box=1;    // aperta
    	}
    	  passaggio_parametri=passaggio_parametri + "&npag=" + npag + "&flag_box=" + flag_box;
	  	}
 
	 if (window.parent.map.layers[0].features){ 
	  for (i=0; i<window.parent.map.layers[0].features.length; i++) {
	  	if (window.parent.map.layers[0].features[i].popup != null) {
	  		idmarker=i;
	  		passaggio_parametri=passaggio_parametri + "&idmarker=" + idmarker;}
	  }
	}
	
	 
		id_layerGeoblog=window.parent.map.getLayerIndex(layer_blog)

		if (id_layerGeoblog!=-1){
			passaggio_parametri=passaggio_parametri+"&geoblog=1"
		
		if (window.parent.map.layers[id_layerGeoblog].features){
			
		 for (i=0; i<window.parent.map.layers[id_layerGeoblog].features.length; i++) {
			if (window.map.layers[id_layerGeoblog].features[i].popup != null) {
				idmarker_geoblog=i;
				/*if ( document.getElementById("frame_geoblog").style.display == "inline" ) {
					flag_geoblog=1; //popup aperta
					passaggio_parametri=passaggio_parametri + "&flag_geoblog=" + flag_geoblog;
				}
					else {
					flag_geoblog=0; //popup chiusa
					passaggio_parametri=passaggio_parametri + "&flag_geoblog=" + flag_geoblog;
				}	*/ 
				passaggio_parametri=passaggio_parametri + "&idmarker_geoblog=" + idmarker_geoblog;
			}
			
		}
	}
	} 
				
				
		
	
	
	  
	 	  return passaggio_parametri; 
		
	
	
	
	
}
// Fine modifica


//Start - Gestione Ricerca Spaziale -------------------------------------------------------------------------	
var pointLayer
function crea_buffer(x,y,idTema_RS,NomeTema_RS){
//Start - TG
//x,y: lat/lon centro buffer
//End - TG

		//position_boxSpaziale()
		//per la ricerca spaziale
	  map.controls[1].leaveMode();
	 
	 if (map.getLayerIndex(pointLayer)==-1){
	  		pointLayer = new OpenLayers.Layer.Vector("Point Layer");
	 		 	map.addLayers([pointLayer]);
	 			
			  drawControls = {point: new OpenLayers.Control.DrawFeature(pointLayer,OpenLayers.Handler.Point,null,"singlePoint")}
		    map.addControl(drawControls["point"]);
		    
		    //Aggiunta layer marker per il buffer
		    markers_buffer = new OpenLayers.Layer.Markers("Marker_buffer");
				map.addLayer(markers_buffer);
				icon_buffer = OpenLayers.Marker.defaultIcon("PK_layout/img/BandierinaMappaPartenza.gif");

    }
      drawControls["point"].activate();

   
    //TG 25/10/2007 ADD
		SettaCoordinateTema(x,y,idTema_RS,NomeTema_RS)
    //TG
    
 }
 
 function destroy_buffer()
 //1)Distruggo solo la prima feature(CHE č ANCHE L'UNICA) del layer buffer
 //NB La modalitą di ricerca spaziale NON viene disattivata!
 {
		try
		{
			//Tento di istanziare l'oggetto della feature
			objFeatureBuffer = map.layers[map.getLayerIndex(pointLayer)].features[0];
			
			//Se l'oggetto esiste allora lo distruggo
			if (objFeatureBuffer != null)
			{
				objFeatureBuffer.destroy();	
				//	
			}
			
			//Tento di istanziare l'oggetto marker del buffer
			objFeatureMarker = map.getLayerIndex(markers_buffer);
			
			//Se l'oggetto esiste allora lo distruggo
			if (objFeatureMarker != -1)
			{
				map.layers[objFeatureMarker].clearMarkers();	
				//	
			}
			
		}
		catch(e){}
 		
 }
 
 
 function resize_buffer(value){
 			
		//TG 17/10/2007
		document.getElementById("CampoValoreSlider").value = value;		//Memorizzo il valore dello slider nella textbox
		
		CalcolaAmpiezzaBuffer(value);	//Calsolo l'ampiezza del buffer da mostrare all'utente
		//TG
			
		//Ridisegna buffer
		if (map.getLayerIndex(pointLayer)!=-1 ){
			if ( map.layers[map.getLayerIndex(pointLayer)].features.length>0){
				map.layers[map.getLayerIndex(pointLayer)].features[0].style.pointRadius=((value*rangeSpaziale*1000)/map.getResolution())
			  
				map.layers[map.getLayerIndex(pointLayer)].drawFeature(map.layers[map.getLayerIndex(pointLayer)].features[0]);
			}	
		}
    
}

function SettaCoordinateTema(x,y,idTema_RS,NomeTema_RS)
//Setta le coordinate e il tema nei campi del box ricerca spaziale
//e chiama le opportune funzioni di gestione del buffer
//Start - TG
//x,y: lat/lon centro buffer
//End - TG
{
	//TG 25/10/2007
	//Setto il punto di partenza
	if ((x!="" && x!=undefined) && (y!="" && y!=undefined))
    {	//1
    	//Arrotondamento alla secoda cifra decimale
    	//alert(x + " , " + y);
    	document.getElementById("lat_ricspaziale").value = arrotonda(x,4);
    	document.getElementById("lon_ricspaziale").value = arrotonda(y,4);
    	
    	
    	//Conversione in UTM
			XGeo_RS=parseFloat(document.getElementById("lon_ricspaziale").value);
			YGeo_RS=parseFloat(document.getElementById("lat_ricspaziale").value);
			XUtm_RS=(LL2UTM(YGeo_RS,XGeo_RS,33))[0];
			YUtm_RS=(LL2UTM(YGeo_RS,XGeo_RS,33))[1];
			
			
			//Conversione in gradi
			strGradLat = Convert_DecToGrad(document.getElementById("lat_ricspaziale").value);
			strGradLon = Convert_DecToGrad(document.getElementById("lon_ricspaziale").value);
			InserisciInGrad(strGradLat,strGradLon);
			
			
			//Aggiornamento buffer
			AggiornaPosizioneBuffer(XUtm_RS,YUtm_RS);
			resize_buffer(parseFloat(document.getElementById("CampoValoreSlider").value));
    }	//1
   
   
   
    //Setto il tema
   if ((idTema_RS!="" && idTema_RS!=undefined) && (NomeTema_RS!="" && NomeTema_RS!=undefined))
		{	//1
			
			ObjControlloTema = document.getElementById("tema");
			num_elementi = ObjControlloTema.options.length;
						
			//alert("idTema_RS: " + idTema_RS + " - " + "NomeTema_RS: " + NomeTema_RS + " - " + "num_elementi: " + num_elementi);
			
			//Cerco l'idTema nella lista
			trovato = false;
			i = 0;
			while ((i<num_elementi) && (trovato==false))
			{	//2
								
				//Se trovo l'elemento corrispondente allora forzo la sue selezione nella combo  
			  if (parseInt(ObjControlloTema.options[i].value) == parseInt(idTema_RS))
				{	//3
					trovato = true;
					
					ObjControlloTema.selectedIndex = i;
				}	//3
				
				i++;
				
			}	//2
			
		} //1
  //TG  
}
 


function rimuovi_ricspaziale(){
//1)Rimuove l'intero layer del buffer
//2)Disabilita la modalitą ricerca spaziale
	   
		indice_spaziale=map.getLayerIndex(pointLayer)
		map.layers[indice_spaziale].destroy();
		drawControls["point"].deactivate();
		drawControls=null
	   
}

function espandi_ricspaziale(){
	
	document.getElementById("IdImgFrecciaBoxRicerca").src = "PK_layout/img/FrecciaGiuTrasp.gif";
	
		
	document.getElementById("BoxRicercaSpaziale").style.visibility = "visible";
}

function riduci_ricspaziale(){
		
		document.getElementById("IdImgFrecciaBoxRicerca").src = "PK_layout/img/FrecciaSuTrasp.gif";
		
				
		document.getElementById("BoxRicercaSpaziale").style.visibility = "hidden";
}


function posiziona_ricspaziale()
{
	//Posizioni di riferimento
	var offset_H_BoxRicerca = 164;
	var offset_H_Intestazione = 100;
	var offset_H_Extra = 0;
	
	var offset_W_BoxRicerca = document.getElementById("PannelloCerca").style.left;
	var offset_W_Extra = 0;
	
	
	//Adattamento al browser
	/*
	if (browser.isNS)
	{
		offset_H_Extra = 1;
	}
	else
	{
	}	
	*/
	
	
	//Posizionamento	
	//document.getElementById("BoxRicercaSpaziale").style.left = offset_W_BoxRicerca;
	
//	document.getElementById("BoxRicercaSpaziale").style.top = offset_H_BoxRicerca + offset_H_Intestazione;
	
}




function GestisciVisualizBoxRicercaSpaziale()
//Gestione visualizzazione del box di ricerca spaziale
{
	
	//posiziona_ricspaziale();
	
	if (document.getElementById("BoxRicercaSpaziale").style.visibility == "hidden")
	{
		espandi_ricspaziale();
	}
	else
	{
		riduci_ricspaziale();		
	}
				
}


function ApriRicercaSpaziale(Lat_RS,Lon_RS)
{
	//alert("GestisciRicercaSpaziale: " + Lat_RS + " - " + Lon_RS);
	
	//Creo il buffer intorno al punto selezionato dall'utente
	crea_buffer(Lat_RS,Lon_RS);
	
	//Avvio geocoding
	AvviaGeocodingRicercaSpaziale(Lon_RS,Lat_RS)
	
	//Se il menu a tendina "Cerca" non č ancora aperto allora forzo la sua apertura
	if (!slideDownInitHeight['PannelloCerca']) 
	{
		slidedown_showHide('PannelloCerca','subPannelloCerca','frecciaGiallo');
	}
	
	espandi_ricspaziale();

}


function InizializzaBoxRicercaSpaziale()
{
	riduci_ricspaziale();
	
	//posiziona_ricspaziale();
	placePanel("BoxRicercaSpaziale")
	
	Gestistisci_ResettaRicercaSpaziale();
	
}
//End - Gestione Ricerca Spaziale -------------------------------------------------------------------------	


function mostra_itinerario(itinerario){
	if (itinerario){
		document.getElementById("title_routing").innerHTML=parent.GCLang[parent.RTLang][29]
		document.getElementById("title_routing2").innerHTML=parent.GCLang[parent.RTLang][29]
	
					document.getElementById("MenuRouting").style.display=""
					larghezza=window.document.body.scrollWidth
					document.getElementById("MenuRouting").style.left=(parseFloat(larghezza)-317)+"px";
					document.getElementById("MenuRouting2").style.left=(parseFloat(larghezza)-317)+"px";
					document.getElementById("divResultRouting").style.left=(parseFloat(larghezza)/2-130)+"px";
					document.getElementById("MenuRouting2").style.display="none"
					check_itinerario=1		
			 
	}else
		{
		document.getElementById("title_routing").innerHTML=parent.GCLang[parent.RTLang][30]
		document.getElementById("title_routing2").innerHTML=parent.GCLang[parent.RTLang][30]
		
			if (document.getElementById("MenuRouting2").style.display=="none"){
					document.getElementById("MenuRouting").style.display="none"
					larghezza=window.document.body.scrollWidth
					document.getElementById("MenuRouting").style.left=(parseFloat(larghezza)-317)+"px";
					document.getElementById("MenuRouting2").style.left=(parseFloat(larghezza)-317)+"px";
					document.getElementById("divResultRouting").style.left=(parseFloat(larghezza)/2-130)+"px";
					document.getElementById("MenuRouting2").style.display=""
					
			} 
	}

	 if (itinerario) document.getElementById("view_percorso").src="RoutingGeocoding/view_percorso.asp?id_itin="+itinerario
	// setTimeout("sendRoutingQuery()",3000);
	// sendRoutingQuery()
}

//MDe Santis 09/10/2007 funzione per l'attivazione dell'interfaccia download gpx-ov2 intero tematismo

function download_div(id_tem) {
	document.getElementById("download_info").style.display="inline";
	//if (document.getElementById("td_eventi_georss").style.display == "inline") document.getElementById("td_eventi_georss").style.display = "none"
	document.getElementById("eventi_georss").style.display="none";
	document.getElementById("numeroTematismo").value=unescape(id_tem);
	document.getElementById("id_attratori").value=""+attrattori;
	document.getElementById("ext_tlx").value="";
	document.getElementById("ext_tly").value="";
	document.getElementById("ext_brx").value="";
	document.getElementById("ext_bry").value="";

	if (11<=id_tem && id_tem<=16) {
			
			document.getElementById("download_info").style.top = 116;
			document.getElementById("download_info").style.left = 219;
			//if (navigator.appName.contains("Microsoft")) document.getElementById("download_info").style.left = document.getElementById("PannelloInformazioni").style.left;
			//else document.getElementById("download_info").style.left=document.getElementById("PannelloInformazioni").style.left;
			//document.getElementById("download_info").style.left = "386";
			document.getElementById("table_inf").width="150";
			document.getElementById("bttn_gpx").className="bttn_blu";
			document.getElementById("bttn_ov2").className="bttn_blu";
	} else {
		if (id_tem == 9 && navigator.appName == "Netscape") document.getElementById('eventi_georss').style.display="table-row"; 
		else if (id_tem == 9 && navigator.appName == "Microsoft Internet Explorer") document.getElementById('eventi_georss').style.display="inline";
			document.getElementById("download_info").style.top = "116";
			document.getElementById("download_info").style.left = 219;
			//if (navigator.appName.contains("Microsoft")) document.getElementById("download_info").style.left = "565";
			//else document.getElementById("download_info").style.left = "571";
			document.getElementById("table_inf").width="150";
			document.getElementById("bttn_gpx").className="bttn_red_geo";
			document.getElementById("bttn_ov2").className="bttn_red_geo";
	} 
		
	
}

//MDe Santis 11/10/2007 funzione per l'attivazione dell'interfaccia download gpx-ov2 intero singoli attrattori
function attiva_checkbox() {
		
	if ( id_tematismo != "" && parent.document.tot_risultati != 0 ) {
	
			checkbox=1;
			url_box=(document.getElementById("Ricerca").src).split("&tom=");
		
			url_box=url_box[0]+"&tom="+checkbox+"&n_pagina="+act_npag;
			document.getElementById("Ricerca").src=url_box;
			
			document.getElementById("select").style.display="none";
			document.getElementById("submit").style.display="inline";
		} else {
			/*if (curLang=="it") {
					alert("Attivare almeno un punto di interesse sulla mappa") 
					return false;
				}
				else if (curLang=="en") {
					alert("Select at least a point of interest on the map") 
					return false;
				}
				else if (curLang=="de") {
					alert("Suche") 
					return false;
				}*/
					alert(GCLang[RTLang][25])
					return false;
		}
	
	}
	
function disattiva_checkbox() {
		
	if (id_tematismo != "" && document.getElementById("submit").style.display == "inline") {
	
			checkbox=0;
			url_box=(document.getElementById("Ricerca").src).split("&tom=");
		
			url_box=url_box[0]+"&tom="+checkbox+"&n_pagina="+act_npag;
			document.getElementById("Ricerca").src=url_box;
			
			document.getElementById("select").style.display="inline";
			document.getElementById("submit").style.display="none";
			if (document.getElementById("download_info").style.display == "inline") document.getElementById("download_info").style.display = "none";
		}
	
}
	
	
//MDe Santis 17/10/2007 funzione per l'attivazione dell'interfaccia download gpx-ov2 percorsi
function tomtom_percorsi() {
	
	//length_percorso=RTSegments.length;
	
	//arrivo=RTSegments[RTSegmentsCount-1];
	x_start=RTSegments[0].envelope.minx;
	y_start=RTSegments[0].envelope.miny;
	desc_start=RTSegments[0].desc[0]
	x_arrivo=RTSegments[RTSegmentsCount-1].envelope.minx;
	y_arrivo=RTSegments[RTSegmentsCount-1].envelope.miny;
	desc_arrivo=RTSegments[RTSegmentsCount-1].desc[0]
	//n_stop=0;
	
	document.getElementById("download_percorsi").style.display="inline";
	document.getElementById("download_percorsi").style.top = 116; //"180";
	document.getElementById("download_percorsi").style.left = "219";
	document.getElementById("partenza_x").value=x_start;
	document.getElementById("partenza_y").value=y_start;
	document.getElementById("arrivo_x").value=x_arrivo;
	document.getElementById("arrivo_y").value=y_arrivo;
	
	document.getElementById("partenza_desc").value=desc_start;
	document.getElementById("arrivo_desc").value=desc_arrivo;
	
	document.getElementById("stop_x").value="";
	document.getElementById("stop_y").value="";
	document.getElementById("stop_desc").value=""
	for (i=1; i<(RTSegmentsCount-1); i++) {
		if (RTSegments[i].desc.length == 1) {
			document.getElementById("stop_x").value=document.getElementById("stop_x").value + RTSegments[i].envelope.minx+";"
			document.getElementById("stop_y").value=document.getElementById("stop_y").value + RTSegments[i].envelope.miny+";"
			document.getElementById("stop_desc").value=document.getElementById("stop_desc").value + RTSegments[i].desc[0] + ";"
			i++;
		}
		
	}
		
	
	//alert("");

}


function submit_download_info() {
	
	if (document.getElementById("id_attratori").value == "" && document.getElementById("numeroTematismo").value == "") {
			/*	if (curLang=="it") {
					alert("Selezionare almeno un campo") 
					return false;
				}
				else if (curLang=="en") {
					alert("Select at least a field") 
					return false;
				}
				else if (curLang=="de") {
					alert("Suche") 
					return false;
				}*/
			alert(GCLang[RTLang][26])
					return false;
		
		
	} else {
		document.getElementById('info').submit();
		//document.getElementById('info').style.display='none'; 
	}
	
}


//M De Santis 22/10/2007 Funzione che abilita la visualizzazione dell'elenco dei percorsi all'interno del BoxRicerca

function visualizza_percorsi(poi) {
	id_temat=id_tematismo;
	if (document.getElementById('GEOBLOG1').className=="MenuInformazioniOn") geoblog_old=1;
	else geoblog_old=0;
	rimuovi_ricerca();
	lista_percorsi=1;
	id_iti="";
	//alert(geoblog_old);
			extent_view=map.getExtent();
			tlx=extent_view.left;
			tly=extent_view.top;
			brx=extent_view.right;
			bry=extent_view.bottom;
	
	url_geo="view_prev="+url_georss+"&tlx="+tlx+"&brx="+brx+"&bry="+bry+"&tly="+tly+"&geo_blog="+geoblog_old+"&poi="+poi+"&id="+id_iti+"&itin="+check_itinerario+"&id_temat="+id_temat+"&n_pagina="+n_pagina	
	add_box_ricerca(url_geo);
	
	
}
	
	
	
//M De Santis 22/10/2007 Funzione che disabilita la visualizzazione dell'elenco dei percorsi all'interno del BoxRicerca
	
function nascondi_percorsi() {
	//alert("");
	lista_percorsi=0;
	rimuovi_ricerca();
	


}

function opengeo(dati){
 
  form_obj=document.getElementById("pk_geo");
	
	form_obj.result.value=dati;
	doSubmit1(form_obj);
}
function doSubmit1(form){
	url_geo="pk_geocoding.asp"
	window.open('../pk_geocoding_form.asp', 'pkgeocoding', 'scrollbars=0,menubar=0,toolbar=0,location=0,status=0,width=600,height=480,resizable=0');
  add_georss(url_geo,"Geocoding")
  form.submit()
  return true;

}
function notdraw(p){
	if (drawControls){
	//	if (drawControls["point"].active){
			 if (p) drawControls["point"].activate();
			 else  	drawControls["point"].deactivate();
	//	}
	}
	   
}

function modulo_3D(){
	var objForm=document.getElementById("form_3D")
	
	if (url_ricerca=="" && (url_box_geoblog || lista_percorsi!=0))
		objForm.url_ricerca.value=(document.getElementById("Ricerca").src)
	else
		objForm.url_ricerca.value=url_ricerca
	extent_vista=map.getExtent()
	objForm.preview.value=tipo_vista
	objForm.extent_tlx.value=extent_vista.left
	objForm.extent_tly.value=extent_vista.top
	objForm.extent_brx.value=extent_vista.right
	objForm.extent_bry.value=extent_vista.bottom
	objForm.tematismo.value=id_tematismo
	objForm.geoblog.value=geoblog
	objForm.submit();
}
	function mostraDivWaitPlease()
	{
		document.getElementById("divWaitPlease").style.display = "inline";
	}
	
	
	function nascondiDivWaitPlease()
	{
		document.getElementById("divWaitPlease").style.display = "none";
	}
