///////////////////////////////////////
// UbiEst Java Applet Methods support
///////////////////////////////////////

var HotelID = "";

// variabil per la risoluzione dell' indirizzo , per il percorso testuale e per i pop-up
var AMC1 ="";  // codice della nazione
var AMC2 ="";  // codice della regione;
var AMC3 ="";  // codice della provincia;
var AMC4 ="";  // codice del comune
var AMC5 ="";  // codice di zona di un comune

var AMD4 ="";  // descrizione del comune (nome)
var ADDR ="";  // descrizione indirizzo 
var AMC  ="";  // insieme dei codici descritti sopra  

// Abilita i pop-up prima di chiudersi a richiamare una funzione di ricerca
var search = 0;   
// Se vale 1 indica che sto ricercando solo un comune senza indirizzo
var searchcity = 0;
// Cambia la descrizione a seconda si ricerchi un indirizzo(0) o un comune e un indirizzo(1)
var AddrLookup = 0;
// Abilita(1)/Disabilita(0) l'apertura del pop-up per le ricerche dei comuni
var CityPopup = 0;
// Individua il tipo ricerca che si sta effettuando
/*
1 --> ricerca mappa da un indirizzo
2 --> calcolo percorso (prima tappa)
3 --> calcolo percorso (seconda tappa)
4 --> aggiungi tappa
5 --> calcolo percorso
*/
var searchtype=0;

var scala = 0;   // scala da richiedere
var puntox = 0;  // coord X (UTM)
var puntoy = 0;  // coord Y (UTM)

var ScaleMaxPoi=0; // scala massima per richiedere i Poi
var StatusCheck=true;  // variabile stato checkbox poi   true(attivati)\false(disattivati)

// Array per la gestione dei P.O.I
arraycategory0= new Array(); //Nome del broker
arraycategory1= new Array(); //Identificativo del gruppo
arraycategory2= new Array(); //Descrizione del gruppo
arraycategory3= new Array(); //nome checkbox nella pagina html (form+campo)

//Array gestione Form di ricerca
acountry = new Array();
acity    = new Array();
aaddress = new Array();
anumber  = new Array();

/**
Inizilaizzazione dei quattro array per la gestione dei P.O.I devono
essere definite a seconda dei P.O.I da visualizzare
*/
function categoriepoi()  {
  var i=0;
 
  arraycategory0[i]="";   
  arraycategory1[i]="";
  arraycategory2[i]="";
  arraycategory3[i]=""; 
  
  arraycategory0[++i]="UBIEST";      
  arraycategory1[i]="NAV_2_1001";
  arraycategory2[i]="Vitto";
  arraycategory3[i]="Applet_Form.Cat_NAV_2_1001"; 
  
  arraycategory0[++i]="UBIEST";      
  arraycategory1[i]="NAV_2_1002";
  arraycategory2[i]="Alloggio";
  arraycategory3[i]="Applet_Form.Cat_NAV_2_1002"; 
  
  arraycategory0[++i]="UBIEST";
  arraycategory1[i]="NAV_1_992";
  arraycategory2[i]="Trasporti";
  arraycategory3[i]="Applet_Form.Cat_NAV_1_992"; 
  
  arraycategory0[++i]="UBIEST";
  arraycategory1[i]="NAV_1_993";
  arraycategory2[i]="ServiziPubblici";
  arraycategory3[i]="Applet_Form.Cat_NAV_1_993"; 
  
  arraycategory0[++i]="UBIEST" ;
  arraycategory1[i]="NAV_1_994" ;
  arraycategory2[i]="TempoLibero";
  arraycategory3[i]="Applet_Form.Cat_NAV_1_994"; 
  
  arraycategory0[++i]="UBIEST" ;
  arraycategory1[i]="NAV_1_995" ;
  arraycategory2[i]="Soldi";
  arraycategory3[i]="Applet_Form.Cat_NAV_1_995"; 
  
/*  arraycategory0[++i]="CUSTOM" ;
  arraycategory1[i]="ALFA" ;
  arraycategory2[i]="ALFA";
  arraycategory3[i]="Applet_Form.Cat_ALFA";   
  
  arraycategory0[++i]="CUSTOM" ;
  arraycategory1[i]="BETA" ;
  arraycategory2[i]="BETA";
  arraycategory3[i]="Applet_Form.Cat_BETA";     */
 
} //categoriepoi


/**
Inizilaizzazione dei quattro array per la gestione delle form di ricerca
all'interno della pagina principale a seconda delle ricerche che si 
intendono utilizzare
*/
function categoryform(){
	var i=0;
	
	acountry[i]="";      
   acity[i]   ="";
   aaddress[i]="";
   anumber[i] =""; 
   // 1 campi ricerca indirizzo  
   acountry[++i]="ricerca.Country";      
   acity[i]="ricerca.City";
   aaddress[i]="ricerca.Address";
	anumber[i]="ricerca.Number"; 
	// 2 campi calcolo percorso(1)
   acountry[++i]="percorsi.Country";      
   acity[i]="percorsi.City";
   aaddress[i]="percorsi.Address";
	anumber[i]="percorsi.Number"; 	
	// 3 campi calcolo percorso(2)
   acountry[++i]="percorsi.Country2";      
   acity[i]="percorsi.City2";
   aaddress[i]="percorsi.Address2";
	anumber[i]="percorsi.Number2"; 
	// 4 campi aggiungi tappa
   acountry[++i]="percorsi2.Country";      
   acity[i]="percorsi2.City";
   aaddress[i]="percorsi2.Address";
	anumber[i]="percorsi2.Number"; 
	// 5 campi calcolo percorso
   acountry[++i]="percorsi2.Country";      
   acity[i]="percorsi2.City";
   aaddress[i]="percorsi2.Address";
	anumber[i]="percorsi2.Number"; 					
	}


//------------------------------------------------------mappa-------------------------------------------------------

// Selezione della modalità di funzionamento
/** Modalità Normale - Navigazione
*/
function SetNormalMode() {

 	document.uemapvw.SetMode(1);
	document.Applet_Form.normale.src='images/normale_b.gif';
   document.Applet_Form.distanze.src='images/distanze_a.gif';
   document.Applet_Form.tappe.src='images/tappe_a.gif';
   document.Applet_Form.toponimi.src='images/toponimi_a.gif';	 	

 	}

/** Modalità FlyDistance - Distanze Aeree
*/
function SetFlyDistMode() {

 	document.uemapvw.SetMode(2);
	document.Applet_Form.normale.src='images/normale_a.gif';
   document.Applet_Form.distanze.src='images/distanze_b.gif';
   document.Applet_Form.tappe.src='images/tappe_a.gif';
   document.Applet_Form.toponimi.src='images/toponimi_a.gif';		 	
	
	}

/** Modalità MultiPath - Percorsi
*/
function SetMultiPathMode() {

	document.uemapvw.SetMode(3);
	document.Applet_Form.normale.src='images/normale_a.gif';
   document.Applet_Form.distanze.src='images/distanze_a.gif';
   document.Applet_Form.tappe.src='images/tappe_b.gif';
   document.Applet_Form.toponimi.src='images/toponimi_a.gif';		
	
	}

/** Modalità ToolTip - Toponomi
*/
function SetToolTipMode() {

	document.uemapvw.SetMode(4);
	document.Applet_Form.normale.src='images/normale_a.gif';
   document.Applet_Form.distanze.src='images/distanze_a.gif';
   document.Applet_Form.tappe.src='images/tappe_a.gif';
   document.Applet_Form.toponimi.src='images/toponimi_b.gif';		
   
	}

// History delle mappe generate
/**
Funzione per la cronologia delle mappe visualizzate
@param type  
*/
function DoAction(type){
	//	case 1:first
	//	case 2:previous
	//	case 3:next
	//	case 4:last

	document.uemapvw.DoAction(parseInt(type));	
   // Gestione Poi
	PoiCategoryStatus();
	cancella();
	/*
	if (actuawin!=null){
		cancella();
		ubitag();
		}
	else
		{cancella();}
	*/
	}


/**
Funzione di stampa della pagina contenente la mappa 
*/
function PrintPage() {
  window.print();
}

/**
Funzione di stampa della mappa visualizzata dall'applet
Questa non deve essere utilizzata con php 4.2 usare PrintPage();
*/
function PrintMap() {
  var lsRegExp = /\+/g;
  var scrip1= "<SCRIPT LANGUAGE='JavaScript'>function printit(){ if (window.print) { window.print() ;} else {";
  var scrip2= "var WebBrowser = '<OBJECT ID=\"WebBrowser1\" WIDTH=0 HEIGHT=0 CLASSID=\"CLSID:8856F961-340A-11D0-A96B-00C04FD705A2\"></OBJECT>';";
  var scrip3= "document.body.insertAdjacentHTML('beforeEnd', WebBrowser); webBrowser1.ExecWB(6, 2);}}" ;
  var scrip4= "<SCRIPT LANGUAGE='JavaScript'>function c(){document.forms[0].submit();}<\/SCRIPT>";
  var html = "<html><body bgcolor='#ffffff'  leftmargin='0' topmargin='0' marginwidth='0' marginheight='0'><form action='/JMB1.2.9.5/JGate/PrintMap.php' method='POST'><input type='hidden' name='datagif' Value='"+document.uemapvw.GetMap2Print()+"'></form></body></html>";
  var dim = "height=490,width=470,resizable=no,scrollbars=0";
  o = window.open( "","",dim);
  o.document.write(scrip4+html); //scrip
  o.c(); 
  o.document.close();
}

/**
Visualizza il dettagio dei Poi contenuti nella mappa (non è un evento applet)
*/
function POIOnMap(){
	var lsRegExp =/\+/g; 
	var x; 
	testx=document.uemapvw.DisplayPoi();
	if(opc!=null){opc.close(); opc=null;}
	if (testx==""){ return;}
	x=  unescape(String(testx).replace(lsRegExp,' '));
	setxmlc(x);
	if (arrayelemc.length > 1  )	{visuac();}
}

//------------------------------------------------------mappa-------------------------------------------------------

//------------------------------------------------------ricerca-----------------------------------------------------

/**
Sincronizza lo stato dei Poi (accesi\spenti) tra l'applet e la pagina principale (checkbox)
*/
function PoiCategoryStatus(){
  for(i=1; i<arraycategory0.length; i++){
  	 eval("document."+arraycategory3[i]+ ".checked=document.uemapvw.GetPoiCategoryStatus(\""+arraycategory0[i] +"\",\""+arraycategory1[i]+"\");");
  }
}

/**
Attiva disattiva i checkbox dei Poi
*/
function CheckStatus(status){
  for(i=1; i<arraycategory0.length; i++){
  	 //alert("document."+arraycategory3[i]+ ".disabled="+status+";");
  	 eval("document."+arraycategory3[i]+ ".disabled="+status+";");
  }
}


/**
Cancella il percorso sia nella mappa che nel pop-up
*/
function DeletePath(){
	document.uemapvw.DeletePath();
	cancella();
	}

/**
Visualizza il percorso testuale se non già visualizzato 
*/
function DisplayDetailPath() {
    if (actuawin==null)
    	{ubitag();}
	 else
	 	{actuawin.focus();}
}

/**
Risoluzione dell'indirizzo per ottenere le sue coordinate
@param country codice della nazione 
@param city nome del comune
@param address nome dell'indirzzo
@param numero numero civico
@param tipo intero per forzare la ricerca a un solo risultato
*/
function Search(country,city,address,numero,tipo){
	//	alert(country+' '+city+' '+address+' '+numero);
	// varibile per il force dell'indirizzo
	var force="";
	if (tipo==1) force="\" FORCE=\"1";  // non usare apice singolo --> if (tipo==1) force='\" FORCE=\"1';
	
	//alert(AMD4);
	if ((city.toUpperCase()!=AMD4 && ADDR!=address.toUpperCase()) || ADDR!=address.toUpperCase() ) {
		if (city.toUpperCase()!=AMD4) {AMC = "";}
		if (AMC == ""){
		   //alert('Richiedo Città+Indirizzo');			
   		AddrLookup=1;
   		//if (address.toUpperCase()=="") address="@"+city;
   		if (address.toUpperCase()=="") address=" ";   		
			document.uemapvw.SearchLocation( country,'', '','', city+force,'','','','',address, numero);
			}
		else{
		   //alert('Richiedo Indirizzo');			
			AddrLookup=0;
   		//if (address.toUpperCase()=="") address="@"+city;
   		if (address.toUpperCase()=="") address=" ";			
			document.uemapvw.SearchLocation( AMC+force,'', '','', city,'','','','',address, numero);
			}
		return false;
		}
	else if (AMD4!=city.toUpperCase()){
		//alert('Richiedo Città');
		searchcity = 1;	
		document.uemapvw.SearchLocation( country, '', '', '', '', '','','', city, '', '');
		return false;
		}
	return true;
}// Search 


/**
Risoluzione dell'indirizzo per ottenere le sue coordinate anche se trova nomi uguali
@param type tipo di ricerca 
@param country codice della nazione 
@param city nome del comune
@param address nome dell'indirzzo
@param numero numero civico
*/
function SearchAddress(type,country,city,address,numero){
	//alert(type);
	searchtype=type;
	CityPopup = 1;	
	Search(country,city,address,numero,0);
	CityPopup = 0;
	//alert(type);
	}

/**
Azzera le varibile usate per le ricerche
*/
function Reset(){
	AMC  = "";	
	AMC1 = "";
	AMC2 = "";
	AMC3 = "";
	AMC4 = "";
	AMC5 = "";
	AMD4 = "";
	ADDR = "";
	search = 0;
	scala  = 0;
	puntox = 0;
	puntoy = 0;	
	}

/**
Richiesta di una mappa a partire da un indirizzo
*/
function SearchMapbyCoord() {

	search = 1;  // Parametro per l'appletwindows
	searchtype=1;
	
	var country = eval("document."+acountry[searchtype]+"[document."+acountry[searchtype]+".selectedIndex].value");
	var city    = eval("document."+acity[searchtype]+".value;");	
	var address = eval("document."+aaddress[searchtype]+".value;");	
	var numero  = eval("document."+anumber[searchtype]+".value;");

	// risoluzione dell'indirizzo
	if (!Search(country,city,address,numero,1))
		return;
		
	// Richiesta centratura mappa
	if (puntox!=0 && puntoy!=0){
		document.uemapvw.GetMapByCoord(parseInt(scala),parseInt(puntox),parseInt(puntoy),0);
		}
	
	// Reset parametri 
	Reset();
	
	city    = eval("document."+acity[searchtype]   +".value=\"\";");
	address = eval("document."+aaddress[searchtype]+".value=\"\";");
	numero  = eval("document."+anumber[searchtype] +".value=\"\";");	
	searchtype=0;

}// SearchMapbyCoord



/**
Esempio di funzione "calcolo percorso" tra due punti 
*/
// Varibile che seleziona il primo punto o il secondo
confirm1 = 0;	

function SearchGetPath2(){ 
 
   search = 1;
	// controllo esistenza percorso
   if (document.uemapvw.GetPathID()!=null && document.uemapvw.GetPathID()!="") document.uemapvw.DeletePath();
   
   var country = "";
	var city    = "";
	var address = "";
	var mumero  = "";	
  	
  	var algo=0;
  
	if (confirm1==0){	
		
		searchtype=2;		
		
		country = eval("document."+acountry[searchtype]+"[document."+acountry[searchtype]+".selectedIndex].value;");
		city    = eval("document."+acity[searchtype]+".value;");	
		address = eval("document."+aaddress[searchtype]+".value;");	
		numero  = eval("document."+anumber[searchtype]+".value;");
            
		// risoluzione dell'indirizzo
		if (!Search(country,city,address,numero,1))
			return;
  		
  		confirm1=1;
  		if (puntox!=0 && puntoy!=0)
			document.uemapvw.AddStopSt(parseInt(puntox),parseInt(puntoy),0);
  		
  		// Reset parametri 
		Reset();
	
		city    = eval("document."+acity[searchtype]   +".value=\"\";");
		address = eval("document."+aaddress[searchtype]+".value=\"\";");
		numero  = eval("document."+anumber[searchtype] +".value=\"\";");	
		
		searchtype=0;
	   SearchGetPath2();		  	
  		} 
  	else {
  		
  		searchtype=3;
		country = eval("document."+acountry[searchtype]+"[document."+acountry[searchtype]+".selectedIndex].value;");
		city    = eval("document."+acity[searchtype]+".value;");	
		address = eval("document."+aaddress[searchtype]+".value;");	
		numero  = eval("document."+anumber[searchtype]+".value;");

		// risoluzione dell'indirizzo
		if (!Search(country,city,address,numero,1))
			return;

  		confirm1=0;
	  	if (puntox!=0 && puntoy!=0)
			document.uemapvw.AddStopSt(parseInt(puntox),parseInt(puntoy),0);
	  	
  		//document.uemapvw.GetPath(0,0,'');
  		GetPath();
  		
  		// Reset parametri 
		Reset(); 	  	
		
		city    = eval("document."+acity[searchtype]   +".value=\"\";");
		address = eval("document."+aaddress[searchtype]+".value=\"\";");
		numero  = eval("document."+anumber[searchtype] +".value=\"\";");
		
		searchtype=0;		

  	} 
  	// End confirm1
  
}// SearchGetPath2




/**
Richiesta di una mappa a partire da un indirizzo più 
l'aggiunta di una bandierina(tappa per un successivo percorso)
su quel'indirizzo
*/
function SearchAddStopSt() {
	
	search = 1;  // Parametro per l'appletwindows
	searchtype=4;	
	
	var country = eval("document."+acountry[searchtype]+"[document."+acountry[searchtype]+".selectedIndex].value;");
	var city    = eval("document."+acity[searchtype]+".value;");	
	var address = eval("document."+aaddress[searchtype]+".value;");	
	var numero  = eval("document."+anumber[searchtype]+".value;");
	
	// risoluzione dell'indirizzo
	if (!Search(country,city,address,numero,1))
		return;
	
	// Richiesta centratura mappa con aggiunta bandierina
	if (puntox!=0 && puntoy!=0){
		document.uemapvw.AddStopSt(parseInt(puntox),parseInt(puntoy),0);
		document.uemapvw.GetMapByCoord(parseInt(scala),parseInt(puntox),parseInt(puntoy),0);		
		}
	
	// Reset parametri  		 
	Reset(); 	  	
		
	city    = eval("document."+acity[searchtype]   +".value=\"\";");
	address = eval("document."+aaddress[searchtype]+".value=\"\";");
	numero  = eval("document."+anumber[searchtype] +".value=\"\";");
		
	searchtype=0;			
}// SearchAddStopSt	 


/**
Richiesta di una mappa a fronte di una ricerca di prossimità
di un gruppo o un singolo P.O.I
*/
function SearchPoi(){

	var a = document.poi.Xpoi_group.selectedIndex+1;   // indice gruppo P.O.I selezionato
	var SearchType;  // da gestire  	
  	
  	// Controllo se il gruppo già attivo più eventuale attivazione di tale gruppo 
  	if (a!= 0 && !document.uemapvw.GetPoiCategoryStatus(arraycategory0[a], arraycategory1[a])){
		document.uemapvw.ActivatePoiCategoryStatus(arraycategory0[a],arraycategory1[a], true);
		eval("document."+arraycategory3[a]+ ".checked=true;");
  	}		
	
	//Richiesta mappa con POI
	document.uemapvw.Search("","","","", "","",arraycategory0[a],arraycategory1[a], document.poi.Xpoi_description.value, "", /*parseInt(SearchType)*/ 22222,  document.poi.Xpoi_ray.value != "" ? parseInt(document.poi.Xpoi_ray.value) : 0,"","");	

	document.poi.Xpoi_description.value="";
	document.poi.Xpoi_ray.value="";

}// SearchPoi

/**
Richiesta della mappa contenente un percorso calcolato
*/
function SearchGetPath(){

	search = 1;  // Parametro per l'appletwindows	
	searchtype=5;
		
	var country = eval("document."+acountry[searchtype]+"[document."+acountry[searchtype]+".selectedIndex].value;");
	var city    = eval("document."+acity[searchtype]+".value;");	
	var address = eval("document."+aaddress[searchtype]+".value;");	
	var numero  = eval("document."+anumber[searchtype]+".value;");
	
	var algo=0;  // Parametro per il calcolo del percorso

	// risoluzione dell'indirizzo
	if (!Search(country,city,address,numero,1))
		return;
	
	if (puntox!=0 && puntoy!=0){
		document.uemapvw.AddStopSt(parseInt(puntox),parseInt(puntoy),0);
	   }
 	
 	//document.uemapvw.GetPath(0,0,'');
 	GetPath();
 	
	// Reset parametri 
	Reset();
	
	city    = eval("document."+acity[searchtype]   +".value=\"\";");
	address = eval("document."+aaddress[searchtype]+".value=\"\";");
	numero  = eval("document."+anumber[searchtype] +".value=\"\";");	
	searchtype=0; 	
}// SearchGetPath

/**
Funzione di calcolo percorso
*/
function GetPath(){

	 // se calcolo il percorso con Da A
    if (searchtype==3 && document.percorsi.PathType!= null && document.percorsi.PathDetail!=null){
		 if (document.percorsi.PathType[0].checked)
		    algo = parseInt(document.percorsi.PathType[0].value);
		 else
		    algo = parseInt(document.percorsi.PathType[1].value);
		 
		 if (document.percorsi.Highway.checked)
		    algo +=parseInt(document.percorsi.Highway.value);
		    
		 if (document.percorsi.Path[1].checked)
		    algo = parseInt(document.percorsi.Path[1].value);	 	
		 
		 document.uemapvw.GetPath(algo,parseInt(document.percorsi.PathDetail[document.percorsi.PathDetail.selectedIndex].value),'');
	 	 algo=0;
		}
	 // se calcolo il percorso con aggiungi tappa	
    else if (searchtype==5 && document.percorsi2.PathType!= null && document.percorsi2.PathDetail!=null){
		 if (document.percorsi2.PathType[0].checked)
		    algo = parseInt(document.percorsi2.PathType[0].value);
		 else
		    algo = parseInt(document.percorsi2.PathType[1].value);
		    
		 if (document.percorsi2.Highway.checked)
		    algo +=parseInt(document.percorsi2.Highway.value);
		    
		 if (document.percorsi2.Path[1].checked)
		    algo = parseInt(document.percorsi2.Path[1].value);	 	
		    	 	
		 document.uemapvw.GetPath(algo,parseInt(document.percorsi2.PathDetail[document.percorsi2.PathDetail.selectedIndex].value),'');
	 	 algo=0;
		}				
  	 else{
  		document.uemapvw.GetPath(0,0,'');
  		}		
	
	}// GetPath()



//------------------------------------------------------ricerca-----------------------------------------------------




//--------------------------------------------------------EventiApplet--------------------------------------------------------
/**
Obbligatorio per la partenza dell'Applet setta i parametri 
necessari per il suo funzionamento
*/
function UMJA_AppletLoaded(){

// setto lingua
document.uemapvw.SetLanguage('ENG');

// impostazione broker
document.uemapvw.AddPoiBrokerData('UBIEST','','NAV_2_1001/0,NAV_2_1002/0,NAV_1_992/0,NAV_1_993/0,NAV_1_994/0,NAV_1_995/0'); 
document.uemapvw.AddPoiBrokerData('CUSTOM','/common/include/poi_custom.asp?pIn=','HOTEL_DL_VILLE/1');

document.uemapvw.SetLocalLayer(1,10,2,43,"logohotel","",-1,-1);

// impostazione aspect ratio
document.uemapvw.SetPoiCategoryRenderRatio('UBIEST','',2000,5000,0.75,true); 
document.uemapvw.SetPoiCategoryRenderRatio('UBIEST','',5001,20000,0.5,true); 
document.uemapvw.SetPoiCategoryRenderRatio('UBIEST','',20001,50000,0.35,true); 

document.uemapvw.SetPoiCategoryRenderRatio('CUSTOM','',2000,5000,0.75,true); 
document.uemapvw.SetPoiCategoryRenderRatio('CUSTOM','',5001,20000,0.6,true); 
document.uemapvw.SetPoiCategoryRenderRatio('CUSTOM','',20001,50000,0.40,true); 

ScaleMaxPoi = 50000;
StatusCheck = true;

// imposta Poi
categoriepoi();
// sicronizzazione Poi
PoiCategoryStatus();
// imposta le form per le ricerche
categoryform();
// Tool-tip multipli
document.uemapvw.SetStreetInfoFlag(1);
// Street Info flag
document.uemapvw.SetStopInfoFlag(1);

document.uemapvw.SetScaleSt(10000);
document.uemapvw.SetPoint(2167396,1468441,0);
document.uemapvw.SetLocalLayer(100, 0, 2167396,1468441,'gr_pin', '', -1, -1);

document.uemapvw.GetMapSt();
}// UMJA_AppletLoaded


/*
Salvataggio dei dati relativi al centro mappa coordinate e indirizzo
*/
function UMJA_ConfirmPoint(){
/*

Simile alla UMJA_StreetInfo()	in più :
// ritorna la coord X del centro mappa o dell'ultimo punto selezionato da un click
GetPosX(int PosType, int CoordSys) 
// ritorna la coord Y del centro mappa o dell'ultimo punto selezionato da un click
GetPosY(int PosType, int CoordSys)

*/
}// UMJA_ConfirmPoint


/*
Evento scatenato al click del mouse sulla mappa nella modalità
Fly distence
*/
function UMJA_FlyDistMouseClicked(){
/*

// ritorna la lunghezza totale o parziale???
GetDistance()

*/
}// FlyDistMouseClicked


/*
Evento ottenuto dalla ricerca di un indirizzo
*/
function UMJA_LocationList(){
/*

// ritorna l'XML a fronte di una ricerca di indirizzo
GetXmlLocationList()

*/
setxmla(document.uemapvw.GetXmlLocationList());
}// UMJA_LocationList


/*
Evento scateneto al caricamento di ogni mappa
*/
function UMJA_MapLoaded(){

CurrentScale();
//var x, y;
//x = document.uemapvw.GetPosX (1, 0);
//y = document.uemapvw.GetPosY (1, 0);
//alert (x + " " + y);
if (document.Applet_Form.DoveSei.value==""){
	OnloadDoveSei();
}else{
	var dovesei = document.uemapvw.GetCurrentLocation(4)+' '+document.uemapvw.GetCurrentLocation(5)+' '+document.uemapvw.GetCurrentLocation(6) ; 
	document.Applet_Form.DoveSei.value=dovesei.toLowerCase();
}

}// UMJA_MapLoaded


function MMS_swapImage() { //v3.0
  var i,j=0,x,a=MMS_swapImage.arguments; document.MM_srs=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_srs[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MMS_swapImgRestore() { //v3.0
  var i,x,a=document.MM_srs; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) {x.src=x.oSrc;}
}

function CurrentScale(){
  var CurScale;
  CurScale  = document.uemapvw.GetScale();
  MMS_swapImgRestore();
  if (CurScale <= 2000) 
  	MMS_swapImage('uno_zoom','','images/zoom1_c.gif',1);
  else if (CurScale <= 10000)
  	MMS_swapImage('due_zoom','','images/zoom2_c.gif',1);
  else if (CurScale <= 25000)
  	MMS_swapImage('tre_zoom','','images/zoom3_c.gif',1);
  else if (CurScale <= 50000)
	MMS_swapImage('quattro_zoom','','images/zoom4_c.gif',1);
  else if (CurScale <= 250000)
	MMS_swapImage('cinque_zoom','','images/zoom5_c.gif',1);
  else if (CurScale <= 500000)
	MMS_swapImage('sei_zoom','','images/zoom6_c.gif',1);
  else if (CurScale <= 1000000)
	MMS_swapImage('sette_zoom','','images/zoom7_c.gif',1);
  else if (CurScale <= 2000000)
	MMS_swapImage('otto_zoom','','images/zoom8_c.gif',1);
  else if (CurScale <= 5000000)
	MMS_swapImage('nove_zoom','','images/zoom9_c.gif',1);
  else if (CurScale <= 10000000)
	MMS_swapImage('dieci_zoom','','images/zoom10_c.gif',1);   
	
  if (CurScale > ScaleMaxPoi && StatusCheck==true){
	CheckStatus(true);
	StatusCheck=false;
	}		
  else if (CurScale <= ScaleMaxPoi && StatusCheck==false){
  	CheckStatus(false);
  	StatusCheck=true;
  	}		

}

/*
Evento ottenuto dopo un calcolo percorso
*/
function UMJA_MapPathLoaded(){
/*
// ritorna il codice dell'ultimo percorso calcolato e ancora presente sulla mappa 
GetPathID()
// ritorna l'xml con il dettagli del percorso testuale appena calcolato
GetXmlPath()

*/
  if (document.uemapvw.GetCustomerID() != "" && document.uemapvw.GetPathID() != "" && document.uemapvw.GetPathID() != null) {
      //alert('PathID= '+document.uemapvw.GetPathID());
      var lsRegExp =/\+/g; 
      var x; 
      testx=document.uemapvw.GetXmlPath();
      if (testx==" "){ return;}
/*
     	if(effectnetscape==0) {		 
     			x=  unescape(String(testx).replace(lsRegExp,' '));
     			//effectnetscape2=1;
     		}
     	else {
     			x=  unescape(String(testx).replace(lsRegExp,'  '));    			
     		}
*/     		
     	x=  unescape(String(testx).replace(lsRegExp,' '));
      setxml(x);
  		ubitag();
  }
}// UMJA_MapPathLoaded


/*
Cambio modalità di funzionamento dell'applet
*/
function UMJA_ModeChanged(){
/*

// ritona la modatità di funzinamento attuale o precedente
GetMode(int type)

*/
}// UMJA_ModeChanged


/*
Evento per la gestione e la segnalazione di eventuali errori o
di assenza di risultatio in caso di ricerche
*/
function UMJA_OnError(){
/*
GetErrorCode()        // ritorna il codice dell'errore
GetErrorDescription() // ritorna la descrizione dell'errore
*/
//alert('Error Code :'+document.uemapvw.GetErrorCode()+'\n Error : '+document.uemapvw.GetErrorDescription());
alert(document.uemapvw.GetErrorDescription());
}// UMJA_OnError


/*
Evento scatenato a fronte di una ricerca di P.O.I
*/

var effectnetscape=0;
function UMJA_PoiLoadedOnMap(){
/*

// ritorna l'xml contenente i dati dei P.O.I effettuando una ricerca
GetXmlPoiList()
*/
   var ns4 = (document.layers)? true:false
	var lsRegEx =/\+/g; 
	var x; 
  	var testx=document.uemapvw.GetXmlPoiList();
   
  	if (testx==" "){ return;}
   if(opc!=null){opc.close()}  	
	// Netscape  la seconda volta non si apre
	if (effectnetscape==0) {
		x= unescape(new String(testx).replace(lsRegEx,' ')); 
		effectnetscape=1;
   	}
	else { 
		if (ns4)
			x= unescape(new String(testx).replace(lsRegEx,'  '));	
		else
			x= unescape(new String(testx).replace(lsRegEx,' '));					
   	}
  	
  	//x= unescape(new String(testx).replace(lsRegEx,' '));
  	setxmlc(x);
   if (arrayelemc.length > 1)	visuac();
}// UMJA_PoiLoadedOnMap


/*
Evento scatenato al click del mouse sopra un P.O.I
*/
function UMJA_PoiMouseClicked(){
/*

// ritorna il broker del Poi selezionato
GetPoiBrokerID()
// ritorna la categoria del Poi selezionato
GetPoiCategoryID()
// ritorna l'identificatico ID del Poi selezionato
GetPoiID()
// ritorna l'URL se specificata (link) 
GetPoiURL()
// ritorna il nome o una descrizione del Poi  
GetPoiToolTip()

*/
if(document.uemapvw.GetPoiBrokerID()=='NAV')
    	window.open("http://maps.ubiest.com/Product/JGate/Ext/GetPoiDetail.php?XidPOI="+document.uemapvw.GetPoiID()+"&XidPoiBroker="+document.uemapvw.GetPoiBrokerID(), "Percorso","height=320,width=560,scrollbars=no");
else{

  if(document.uemapvw.GetPoiURL() == "" || document.uemapvw.GetPoiURL() == null){
    	window.open("/it/mapbroker/jmap/poi_detail.aspx", "Percorso","height=320,width=560,scrollbars=no");
     	}
  else{
   	
   	window.open(document.uemapvw.GetPoiURL(), "Percorso","height=320,width=560,scrollbars=no");
  		}
}
}// UMJA_PoiMouseClicked


/*
Evento ottenuto alla pressione del tasto destro del mouse
*/
function UMJA_RightMouseClicked(){
/*

// con PosType=2 ritorna la coord. X dell'ultimo click sulla mappa
GetPosX(int PosType, int CoordSys)
// con PosType=2 ritorna la coord. Y dell'ultimo click sulla mappa
GetPosY(int PosType, int CoordSys)

*/
}// UMJA_RightMouseClicked


/*
Evento causato dal posizionamento di una bandierina sulla mappa
*/
function UMJA_StopSelected(){

/*
alert(document.uemapvw.GetFlagNumber());
alert(document.uemapvw.GetCurrentLocation(5));
alert(document.uemapvw.GetModeFlag());
*/

/*
// ritorna il numero di tappe(bandierine) attualmente selezionate
GetStopNumber()
// ritoena il numero della tappa(bandierine) attualmente selzionata
GetFlagNumber()

*/
}// UMJA_StopSelected

/*
Evento di cancellazione di una bandierina
*/
function UMJA_DeleteStop(){
//alert("cancello = "+document.uemapvw.GetFlagNumber());
	}

/*
Evento scatenato dalla richiesta di visualizzazione dell'intero
indirizzo al click del mouse su una determinata via o piazza
*/
function UMJA_StreetInfo(){
/*

metodi utilizzabili dall'applet
GetCountry()     // ritorna lo stato della mappa attuale
GetCity()        // ritorna la città della mappa attuale
GetAddress()     // ritorna l'indirizzo della mappa attuale
GetCivicNumber() // retorna il civico della mappa attuale

GetCurrentLocation(int i)
i = 1 come GetCountry()
i = 4 come GetCity() 
i = 5 come GetAddress()
i = 6 come GetCivicNumber(

*/
}// UMJA_StreetInfo

//------------------------------------------------------------------Indirizzi---------------------------------------------------------
var arrayelema ; //array indirizzi

/*
Effetua il parser dell'xml passato e inserisce gli elementi
in un array divisi per Tag
*/
function setxmla(xmldatpass1){
  xmldatpass = new String(xmldatpass1);
  if (xmldatpass!=""){
    arrayelema= xmldatpass.split('<');
    i=0;
    index=0;
    // sto ricercando solo la città
    if (searchcity == 1)
    	index = presencea(eval("document."+acity[searchtype]+".value;"));
    
    if (index!=-1 && searchcity==1 && CityPopup==0){   // se premuto ...
    	AddrLookup=0;
  	  	setarray(index);
    }else{
	  	CityPopup=0;		
  	  	visuaa();
  		}
    searchcity = 0;
  	 }
  else{
    search = 0;
  }
}

/*
Ricerca all'interno di un tag il valore di un attributo 
*/
function findtaga(number,attribute1) {
	//attribute=new String(attribute1);
	attribute=attribute1;
	pass = arrayelema[number];
	pass =new String(pass);
	re= /\=+/g; 
	gender = pass.replace(re,' ');
	//splitto per "
	arrayattributi = gender.split('"');
	//correggo il primo elemento
	firstelem= arrayattributi[0].split(' ');
	arrayattributi[0]=firstelem[1];
	re= /b/g; 
	var testa;
	for(i=0;i<arrayattributi.length;i++){
  		testa=lTrim(arrayattributi[i].replace(re,""));
  		testa=rTrim(testa.replace(re,""));
    	if(testa==attribute){ return(arrayattributi[i+1]); }
	}
	return "-1";
	}

function lTrim(str){
  return (new String(str)).replace(/^\s*/, "")
}

function rTrim(str){
  //return (new String(str)).replace(/\s*$/, "") Non funziona con NS
  return (new String(str)).replace(/\s+$/, "")
}

/*
Funzione di creazione e visualizzazione del pop-up in
caso di più indirizzi con possibilità di scelta
*/
var op = null;
function visuaa() {
var aba=0;
var amd4t="";
halter=arrayelema.length
if (halter > 2) {
  	op=window.open("","","width=300,height=300,scrollbars=yes,screenX=520,screenY=375,left=520,top=375") ;
  	op.document.write("<HTML>");
  	op.document.write("<HEAD>");
	op.document.write("<TITLE>UbiEst: risultato ricerca</TITLE>");
//op.document.write("<LINK REL='stylesheet' type='text/css' href='Styles.css'>"); Da problemi con Nestcape se mancante Styles.css
  	op.document.write("</HEAD>");
  	op.document.write("<BODY>");
  	op.document.write("<FONT FACE='Verdana' SIZE='2'><B>Risultato ricerca</B></font><BR>");
  	op.document.write('<FONT FACE="Verdana" SIZE="1" color="#000000"><UL>');
	for(aba=1;aba<halter;aba++){
  	   if(findtaga(aba,'AMD4')!="-1"){amd4t = findtaga(aba,'AMD4');}else{amd4t=""; }
  	     op.document.write("<LI><A NAME='A"+aba+"' ID='A"+aba+"' HREF='javascript:opener.setarray("+aba+");op=self;op.close();'>"+amd4t);
  	   // if (findtaga(aba,'ADDR')!="-1" && (AddrLookup != 1)) {
  	   if (findtaga(aba,'ADDR')!="-1") {
  	     if (AddrLookup == 1)
  	       op.document.write(" ("+findtaga(aba,'ADDR')+")</A><br>");
  	     else
  	       op.document.write(" "+findtaga(aba,'ADDR')+"</A><br>");
  	   }
  	   else op.document.write("</A><br>");  		
  	   } // End for
  	op.document.write("</UL></FONT>");
  	op.document.write("</BODY>");
  	op.document.write("</HTML>");
  	op.document.close();
    }
  else{
  	setarray(1);
  }
}


/*
Ricerca se all'interno dell'xml è riporato il nome di una
particolare città
*/
function presencea(pres) {
	pres= new String(pres) ; 
	pres=pres.toUpperCase();
	var xer=0;
	for(xer=1 ;xer <arrayelema.length ; xer++){
		if (findtaga(xer,'AMD4')==pres) {/*alert("ci sta");*/ return xer;}
		}
	return -1;
	}


/*
Setta le variabili di ricerca indirizzo con le variabili contenute
in un tag dell'xml di risultato 
*/
function setarray(numb){
AMC1 = findtaga(numb,'AMC1');
AMC2 = findtaga(numb,'AMC2');
AMC3 = findtaga(numb,'AMC3');
AMC4 = findtaga(numb,'AMC4');
AMC5 = findtaga(numb,'AMC5');
AMC  = AMC1+','+AMC2+','+AMC3+','+AMC4+','+AMC5;
var citta = findtaga(numb,'AMD4');
var indirizzo = findtaga(numb,'ADDR');
scala  = findtaga(numb,'SC');
puntox = findtaga(numb,'X');
puntoy = findtaga(numb,'Y');


if (indirizzo==-1 && search!=1){
	//eval("document."+aaddress[searchtype]+".value=ADDR=indirizzo;");	 
	eval("document."+aaddress[searchtype]+".value=ADDR=indirizzo=\"\";");	 
	}

if ( indirizzo==-1 && (AddrLookup==0 || (AddrLookup==1 && citta==eval("document."+acity[searchtype]+".value")  )) )
	eval("document."+aaddress[searchtype]+".value=ADDR=indirizzo=\"\";");	

if (indirizzo!="-1" && indirizzo!="" /*&& indirizzo.charAt(0)!='@'*/ && citta!="-1" && citta!=""){
	if (indirizzo.charAt(0)=='@'){indirizzo ="";}
	eval("document."+aaddress[searchtype]+".value=ADDR=indirizzo;");
	eval("document."+acity[searchtype]+".value=AMD4=citta;");
	}
else if (indirizzo!="-1" && indirizzo!=""){
	if (indirizzo.charAt(0)=='@'){indirizzo ="";}
	eval("document."+aaddress[searchtype]+".value=ADDR=indirizzo;");	 
	 }
else if (citta!="-1" && citta!="" ){
	eval("document."+acity[searchtype]+".value=AMD4=citta;");
	 }
   
if (op!=null){
	op.close();
	op = null;
	}

if(search==1){
	switch(searchtype){
		case 1:
			SearchMapbyCoord();	
			break;
		case 2:
			SearchGetPath2();
			break;
		case 3:
			SearchGetPath2();
			break;			
		case 4:
			SearchAddStopSt();
			break;		
		case 5:
			SearchGetPath();
			break;									
		}
	
	}
}// End setarray

//------------------------------------------------------------------Percorsi---------------------------------------------------------
var arrayelem =null; //array percorsi

function setxml(xmldatpass){  	
arrayelem= xmldatpass.split('<');
arrayelem=arrayelem.slice(1,arrayelem.length);
//alert(arrayelem);
halter=arrayelem.length
var aba=0;
i=0;
}

var actuawin=null;  // variabile finestra percorso
function chiusuraactuawin(){
actuawin=null;
}

//finestra principale
function ubitag(){
//visualizziamo la pagina 
if (actuawin!=null){  actuawin.close();}
if ((arrayelem!=null)) {
	actuawin=window.open("XmlPathTemplate.html","","width=650,height=400,scrollbars=yes"); 
}
else{
	UMJA_MapPathLoaded();
	}
}

var xs=0; //indice di partenza ricerca

function resetindex() {
xs=0;
}

function actuaindex() {
xs--;
}

function getindex() {
return xs;
}

function centermap(centrax1,centray1,centrax2,centray2) {
document.uemapvw.CenterTextPath(centrax1,centray1,centrax2,centray2,0,'');
}

function cancella() {
arrayelem=null;
if (actuawin!=null){actuawin.close();}
}

function findtag(tag,attribute2) {
attribute=attribute2;
re= /\=+/g;
gender=new Array() ;
arrayattributi=new Array() ;
for(tas =xs ; tas<arrayelem.length ;tas++) {
  	xs++;
  	pass = arrayelem[tas]; //"becco" l'elemento 
  	//tolgo uguale
  	//alert('pass='+pass);
  	gender = pass.replace(re,'');
  	arrayattributi=gender.split('"');
	firstelem= arrayattributi[0].split(' ');
  	pass =new Array() ;
  	//rappresenta l'attributo
  	pass[0]=firstelem[0]
  	arrayattributi[0]=firstelem[1];
  	pass=pass.concat(arrayattributi);	
  	testtag = lTrim(pass[0]);
  	testtag = rTrim(pass[0]);
  	if (testtag==tag) {break;}
}
arrayattributi=pass;
if (arrayattributi[0]=="/PINFO>") { return "-1"; }
re= /b/g; 
//try{
for(i=0;i<arrayattributi.length;i++){
  	testa=lTrim(arrayattributi[i].replace(re,""));
  	testa=rTrim(testa.replace(re,""));
  	//alert('testa'+testa+'!');
  	//alert('att'+attribute+'!');
    if(testa==attribute){ return(arrayattributi[i+1]); }
    }
//}catch(er){return("-1"); }
return "-1";
}

function visua() {
op=window.open("","","width=100,heigth=199") ;
halter=arrayelem.length
var aba=0;
for(aba=1;aba<halter;aba++){
     op.document.write(findtag(aba,'AMD4')+"<p>");
     }
}

function visualength(lung) {
var st ;
var unit ;
if(lung>1000 ) {lung= lung/1000; unit="km";}
          else
  			   {lung/=1; unit="m" ;}
  
pass=parseInt(lung);
st= new String(pass+" "+unit);
return st;
}

function visuatime(tempo) {
var st ;
var ore;
var minuti;
var secondi;
var ns4 = (document.layers)? true:false
if (ns4 && parseInt(tempo)<60)
	return "00:00:"+tempo
if ((tempo/3600)>1){ore = parseInt(tempo/3600);}
  		else{ore=0;}
if ((tempo%3600)!=0) {
		   minuti =(tempo-ore*3600);
  		   minuti/=60;
  		   minuti=parseInt(minuti);
  		}else{
            minuti=0;
  	    }
if ((tempo%60)!=0) {
			secondi=(tempo-ore*3600-minuti*60);       // minuti*60 		
  		}else{
		    secondi=0 ;
  		}
ores=new String(ore);
minutis=new String(minuti);
secondis=new String(secondi);
if (ores.length<2) {   ores="0"+ores;}
if (minutis.length<2) { minutis="0"+ minutis; }
if (secondis.length<2) { secondis="0"+secondis ;}
return ores+":"+minutis+":"+secondis
}

//--------------------------------------------------------Ricerca dei POI--------------------------------------------------------------
<!--
var arrayelemc ; //array ricerca Poi

function setxmlc(xmldatpass2){
//alert(xmldatpass);
arrayelemc=new Array();
//alert(xmldatpass2);
arrayelemc= xmldatpass2.split('<');
//alert(arrayelemc);
i=0;
}

function findtagc(number,attribute3) {
//alert(arrayelemc);
attribute=attribute3;
pass = arrayelemc[number];
pass=new String(pass);
//tolgo gli uguale
re= /\=+/g; 
gender = pass.replace(re,'');
//splitto per "
arrayattributi = gender.split('"');
//correggo il primo elemento
firstelem= arrayattributi[0].split(' ');
arrayattributi[0]=firstelem[1];
re= /b/g; 
for(i=0;i<arrayattributi.length;i++){
  	 testa=lTrim(arrayattributi[i].replace(re,""));
  	 testa=rTrim(testa.replace(re,""));
     if(testa==attribute){ return(arrayattributi[i+1]); }
}
return "-1";
}

var opc = null; // variabile finestra poi

function chiusuraopc() {
//alert("chiuso");
opc=null;
}

function visuac() {
var aba=0;
halter=arrayelemc.length
if(opc!=null){opc.close(); opc=null;}

if (halter > 1){  	
	opc=window.open("","","width=640,height=300,scrollbars=yes,screenX=500,screenY=375,left=500,top=375") ;
  	opc.document.write("<HTML><HEAD><META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html;\"><TITLE>Ubiest - List POI result -</title></HEAD><BODY onunload=\"opener.chiusuraopc()\"><TD WIDTH=\"100%\" VALIGN=\"top\" ALIGN=\"left\"> <DIV ALIGN=\"left\"> ");
   opc.document.write("<TABLE cellpadding=\"2\" cellspacing=\"1\" border=\"0\" width=600 Bgcolor=#DADCDE>");
   opc.document.write("<TR><TD ALIGN=right valign=top WIDTH=10 bgcolor=eeeef5 class=micro><font FACE=\"Verdana\" SIZE=\"2\"><b>No.</b></FONT></TD>");
   opc.document.write("<TD ALIGN=center valign=top WIDTH=200 bgcolor=eeeef5 class=micro><font FACE=\"Verdana\" SIZE=\"2\"><b>Description</b></FONT></TD>");
   opc.document.write("<TD ALIGN=center valign=top WIDTH=290 bgcolor=eeeef5 class=micro><font FACE=\"Verdana\" SIZE=\"2\"><b>Address</b></FONT></TD>");
   opc.document.write("<TD ALIGN=center valign=top WIDTH=100 bgcolor=eeeef5 class=micro><font FACE=\"Verdana\" SIZE=\"2\"><b>Icon</b></FONT></TD></TR>");

  	for(aba=1;aba<halter;aba++){
		if ((mass=findtagc(aba,'ADDR'))!="-1") {addr=", "+mass;}else{addr="";}
		if (findtagc(aba,'NUM')!="-1") { num="N° "+findtagc(aba,'NUM'); } else {num=""; }
	   if((aba % 2)==0) {colore='#FFFFFF';}else(colore='#CACACA');
    	if (findtagc(aba,'TY')!="-1") { desc= findtagc(aba,'NAME'); }else{desc= findtagc(aba,'DESC');}
    	if ((icon=findtagc(aba,'ICON'))!="-1") {geticon="<img src=\""+"/en/hotels/mapbroker/PoiIcons/"+icon+".gif\" width=\"16\" height=\"16\">";}else{geticon="";}  //inserimento dell'icona
		if (findtagc(aba,'X')=="-1"){break}
		if (desc=="-1"){desc="Centra"; desc=desc.italics(); desc=desc.big();}
	   opc.document.write("<TR><TD WIDTH=10 valign=top align=right bgcolor="+colore+"><font FACE=\"Verdana\" SIZE=\"1\">"+aba+".</font></td>");
      opc.document.write("<TD id=\"T$Ucount\" NAME=\"T$Ucount\" WIDTH=150 valign=top bgcolor="+colore+" nowrap><font FACE=\"Verdana\" SIZE=\"1\">");
	   opc.document.write('<a name=\"c"+aba+"\" id=\"c"+aba+"\" href=\"javascript:opener.centermapc('+findtagc(aba,'X')+','+findtagc(aba,'Y')+',\''+findtagc(aba,'ID')+'\');\">'+desc+'</a>');      
	   opc.document.write("</FONT>");
      opc.document.write("</TD><TD WIDTH=240 valign=top align=left bgcolor="+colore+"><font FACE=\"Verdana\" SIZE=\"1\">"+ findtagc(aba,'AMD4') + addr +" " +num+"</font></td>");	    
      opc.document.write("<TD WIDTH=100 valign=top align=left bgcolor="+colore+"><font FACE=\"Verdana\" SIZE=\"1\"><center>"+geticon+"</center></FONT></td></TR>");
   } // End for 

	opc.document.write("</TABLE></DIV></TD>"); //inseriamo
  	opc.document.write("</BODY>");
  	opc.document.write("</HTML>");
  	opc.document.close();
    }
else{
  	setarray(1);
	}

}


function centermapc(a,b,c){
document.uemapvw.CenterTextPath(a,b,0,0,0,c);
}


