YAHOO.example.ACFlatData = new function(){
    // Define a custom formatter function
    this.fnCustomFormatter = function(oResultItem, sQuery) {
    var sKey = oResultItem[0];
    var nQuantity = oResultItem[1];
    var sKeyQuery = sKey.substr(0, sQuery.length);
    var sKeyRemainder = sKey.substr(sQuery.length);
    var aMarkup = ["<div class='sample-result'><div class='sample-quantity'>",
    "",
    "</div><span class='sample-query'>",
    sKeyQuery,
    "</span>",
    sKeyRemainder,"</div>"];
    return (aMarkup.join(""));
};

// Instantiate one XHR DataSource and define schema as an array:
this.oACDS = new YAHOO.widget.DS_XHR("/usweb/utenza/UniversitaAjaxCerca.asp", ["\n", "\t"]);
this.oACDS.responseType = YAHOO.widget.DS_XHR.TYPE_FLAT;
this.oACDS.scriptQueryParam = "n";
this.oACDS.maxCacheEntries = 60;
this.oACDS.queryMatchSubset = true;

this.oACDS.scriptQueryAppend = "AutoCompleteTabella=NazioniLingue";

 
// Instantiate AutoComplete
var myInput = document.getElementById('ysearchinput20');
var myContainer = document.getElementById('ysearchcontainer20');
this.AC20 = new YAHOO.widget.AutoComplete(myInput, myContainer, this.oACDS);

this.AC20.queryDelay = 0.2;
this.AC20.formatResult = this.fnCustomFormatter;
this.AC20.maxResultsDisplayed = 200;
 
this.AC20.minQueryLength = 1;

this.AC20.forceSelection = true;
this.AC20.animSpeed = 0;
this.AC20.animVert = false;
this.AC20.animHoriz = false;
this.AC20.useShadow = false;
this.AC20.useIFrame = true;
this.AC20.doBeforeSendQuery = function(sQuery) {
 
     sQuery = sQuery + '&Country=IT&Language='+CurrentNation+'&tutteLeCountry='
 
     return sQuery;
};
this.AC20.itemSelectEvent.subscribe(function(type, args) {
 /* this line works around Opera's preventDefault
 bug: */
 
 //alert(args[2][0] + ':' + args[2][1] ); 
 
 YAHOO.util.Dom.get("id_r_sitecountry").value = args[2][1]; 
 
 
 onChangeCittaH (args[2][1]);
 
  
 }); 
this.AC20.unmatchedItemSelectEvent.subscribe(function(type, args) {
 /* this line works around Opera's preventDefault
 bug: */
 
 
 YAHOO.util.Dom.get("id_r_sitecountry").value = YAHOO.util.Dom.get("ysearchinput20").value; 
 });
};



function HideDiv(ID){
document.getElementById(ID).style.display='none';
}

function ShowDiv(ID){
document.getElementById(ID).style.display='';
}

function ShowHideDiv(ID){
if(document.getElementById(ID).style.display==''){
HideDiv(ID);
}else{
HideAll("user",1);
ShowDiv(ID);
}
}

function HideAll(prefix,iterations){
for (i=1;i<=iterations;i++){
HideDiv(prefix+i);
}
}

function clearText(thefield){
if (thefield.defaultvalue==thefield.value)
thefield.value = ""
}  



