var toponimo="";


function cercaToponimo(valore){
   
    toponimo = valore; 
	var theString = '<ARCXML VERSION="1.1">\n<REQUEST>\n<GET_FEATURES outputmode="xml" geometry="false" envelope="true"';
	theString += ' compact="true" featurelimit="'+featureLimit+'" beginrecord="'+beginRecord+'">\n';
	theString += '<LAYER id="TOPONIMI"/>';
	theString += '<QUERY subfields="';
	theString += selFieldList[activeLayerIndex];
	theString += '"';                     
	theString += ' where="';
	theString += 'DESCRIZION LIKE &apos;%';
	theString += valore; //.toLowerCase();
	theString += '%&apos; ';
	theString += 'OR NOME_MAI LIKE &apos;%';
	theString += valore.toUpperCase();
	theString += '%&apos; ';
	theString += '"/>';
	theString += '</GET_FEATURES>';
	theString += '</REQUEST>';
	theString += '</ARCXML>';
	strPoly += addSelQuery(valore);
	sendToServer(imsURL + CustomService,theString,3);

}

function openQuery(){
    delSelection();
	var queryWindow = false;
    if (queryWindow){
	      var Win1 = window.open("","QueryWindow","width=600,height=400,scrollbars=yes,resizable=yes");
	      var frame = 'opener.parent.MapFrame';
	}else{
	      var Win1 = parent.textFrame;
		  var frame = 'parent.MapFrame';
	}	
	Win1.location = path + "findQuery.htm";  	  
    
    
}

function addSelQuery(valore) {

    var theString = '<LAYER type="featureclass" name="selezione" id="selezione">\n'; 
    theString += '<DATASET fromlayer="' + ID + '" />\n';
    theString += '<QUERY subfields="';
	theString += selFieldList[activeLayerIndex];
	theString += '"';                     
	theString += ' where="';
	theString += 'NOME LIKE &apos;%';
	theString += valore; //.toLowerCase();
	theString += '%&apos; ';
	theString += 'OR NOME_MAI LIKE &apos;%';
	theString += valore.toUpperCase();
	theString += '%&apos; ';
	theString += '"/>';
	theString += '<SIMPLERENDERER>\n';
	switch (lyrThematization){
	   case "line" :
	            theString += lineThema;
	   case "point" :
	            theString += pointThema;
	   case "polygon" :
	            theString += polygonThema;
	}
	
	theString += '</SIMPLERENDERER>\n';
    theString += '</LAYER>\n';
    //alert(theString);
    return theString;


} 
