var mouseOnList = false;
var mouseOnMondo = false;

//RICERCA IN ITALIANO
function caricaLista()
{
	//alert(i);
	var f = document.mainForm;
	
	var vsTesto = document.getElementById('icao').value;
	//alert(vsTesto);
	if(vsTesto.length<3)
	{
		document.getElementById("descDiv").className="divhidden";
		return;
	}	
	
	var o = new Object();
	o.testo=vsTesto
	webCall("jsComboSearch",o);		
}


function displayLista(lista)
{
	var combo = document.getElementById("descCombo");
	var div = document.getElementById("descDiv");
	var text = document.getElementById("icao");
  
	combo.options.length=0;
	var vbOne = false;

	for (i in lista)
	{
		vbOne=true;
		if (i>=0) combo.options.add(new Option(lista[i].text,lista[i].placeid),0);
	}
	if(vbOne)
		div.className="divvisible";
	else
		div.className="divhidden";
}




function setSelezione()
{

	
	var combo = document.getElementById("descCombo");
	var div = document.getElementById("descDiv");
	var text = document.getElementById("icao");
	var codText = document.getElementById("codText");
	var idText = document.getElementById("idText");
	div.className="divhidden";	
	// prendo il codice prodotto selezionato
	var sel = combo.options[combo.selectedIndex];
	value = sel.value;
	text.value=sel.text;
  var prova=text.value.split("("); 
	var sel="meteo_"+prova[0];
	document.location = sel;

}

function webCall(op,ob)
{
      var i, x, n;
		//var uri;
		var post_data;
		url = "modules"+".php?name=Meteovid"+String.fromCharCode(38)+"op="+op+"Home"+String.fromCharCode(38)+"obj=" + escape(myEncode(ob));	
		//alert(url);	
		myInclude(url);
		
}

function myEncode(o)
{
  return JSON.stringify(o);
}

function myInclude(src)
{
	loadjs(src);
}


function loadjs(src)
{
  // If button 1 is pressed then i will be 1 else i will be 2

  //Create a 'script' element	
  var scrptE = document.createElement("script");

  //Set 'type' and 'language' attribs 
  scrptE.setAttribute("type", "text/javascript");
  scrptE.setAttribute("language", "JavaScript");

  // Now set it's 'src' attribute based on the value of i
  scrptE.setAttribute("src", src);

  // create an object of the head element of current page
  var hdEl = document.getElementsByTagName("head")[0];

  //check for previously appended child 
  //(it ensures that each time the button is pressed it
  // removes the previously loaded script element)
  if (hdEl.childNodes.length > 50) {
   hdEl.removeChild(hdEl.lastChild);
  }

  // Now add this new element to the head tag
  hdEl.appendChild(scrptE);

}

//RICERCA IN INGLESE
function caricaListaEn()
{
	//alert(i);
	var f = document.mainForm;
	
	var vsTesto = document.getElementById('icaoEn').value;
	//alert(vsTesto);
	if(vsTesto.length<3)
	{
		document.getElementById("descDivEn").className="divhidden";
		return;
	}	
	
	var o = new Object();
	o.testo=vsTesto
	webCallEn("jsComboSearch",o);		
}
function displayListaEn(lista)
{
	var combo = document.getElementById("descComboEn");
	var div = document.getElementById("descDivEn");
	var text = document.getElementById("icaoEn");
  
	combo.options.length=0;
	var vbOne = false;

	for (i in lista)
	{
		vbOne=true;
		if (i>=0) combo.options.add(new Option(lista[i].text,lista[i].placeid),0);
	}
	if(vbOne)
		div.className="divvisible";
	else
		div.className="divhidden";
}

function setSelezioneEn()
{
	var combo = document.getElementById("descComboEn");
	var div = document.getElementById("descDivEn");
	var text = document.getElementById("icaoEn");
	var codText = document.getElementById("codTextEn");
	var idText = document.getElementById("idTextEn");
	div.className="divhidden";	
	// prendo il codice prodotto selezionato
	var sel = combo.options[combo.selectedIndex];
	value = sel.value;
	text.value=sel.text;
  var prova=text.value.split("("); 
	var sel="weather_"+prova[0];
	//var sel="modules.php?name=Previ"+String.fromCharCode(38)+"location="+value+String.fromCharCode(38)+"langV=EN";
	document.location = sel;
}

function webCallEn(op,ob)
{
      var i, x, n;
		//var uri;
		var post_data;
		url = "modules"+".php?name=Meteovid"+String.fromCharCode(38)+"op="+op+"HomeEn"+String.fromCharCode(38)+"obj=" + escape(myEncode(ob));	
		//alert(url);	
		myIncludeEn(url);
		
}

function myEncodeEn(o)
{
  return JSON.stringify(o);
}

function myIncludeEn(src)
{
	loadjsEn(src);
}


function loadjsEn(src)
{
  // If button 1 is pressed then i will be 1 else i will be 2

  //Create a 'script' element	
  var scrptE = document.createElement("script");

  //Set 'type' and 'language' attribs 
  scrptE.setAttribute("type", "text/javascript");
  scrptE.setAttribute("language", "JavaScript");

  // Now set it's 'src' attribute based on the value of i
  scrptE.setAttribute("src", src);

  // create an object of the head element of current page
  var hdEl = document.getElementsByTagName("head")[0];

  //check for previously appended child 
  //(it ensures that each time the button is pressed it
  // removes the previously loaded script element)
  if (hdEl.childNodes.length > 50) {
   hdEl.removeChild(hdEl.lastChild);
  }

  // Now add this new element to the head tag
  hdEl.appendChild(scrptE);

}

function cancella(){
var combo = document.getElementById("descDiv");
combo.className='divhidden';
}
function cancellaEn(){
var combo = document.getElementById("descDivEn");
combo.className='divhidden';
}

function BusinnesBanner(){

<!--//<![CDATA[
   var m3_u = (location.protocol=='https:'?'https://www.lrcser.net/openad/www/delivery/ajs.php':'http://www.lrcser.net/openad/www/delivery/ajs.php');
   var m3_r = Math.floor(Math.random()*99999999999);
   if (!document.MAX_used) document.MAX_used = ',';
   document.write ("<scr"+"ipt type='text/javascript' src='"+m3_u);
   document.write ("?zoneid=10");
   document.write ('&amp;cb=' + m3_r);
   if (document.MAX_used != ',') document.write ("&amp;exclude=" + document.MAX_used);
   document.write (document.charset ? '&amp;charset='+document.charset : (document.characterSet ? '&amp;charset='+document.characterSet : ''));
   document.write ("&amp;loc=" + escape(window.location));
   if (document.referrer) document.write ("&amp;referer=" + escape(document.referrer));
   if (document.context) document.write ("&context=" + escape(document.context));
   if (document.mmm_fo) document.write ("&amp;mmm_fo=1");
   document.write ("'><\/scr"+"ipt>");
//]]>-->


}

function BusinnesBannerNesa(){

<!--//<![CDATA[
   var m3_u = (location.protocol=='https:'?'https://www.lrcser.net/openad/www/delivery/ajs.php':'http://www.lrcser.net/openad/www/delivery/ajs.php');
   var m3_r = Math.floor(Math.random()*99999999999);
   if (!document.MAX_used) document.MAX_used = ',';
   document.write ("<scr"+"ipt type='text/javascript' src='"+m3_u);
   document.write ("?zoneid=15");
   document.write ('&amp;cb=' + m3_r);
   if (document.MAX_used != ',') document.write ("&amp;exclude=" + document.MAX_used);
   document.write (document.charset ? '&amp;charset='+document.charset : (document.characterSet ? '&amp;charset='+document.characterSet : ''));
   document.write ("&amp;loc=" + escape(window.location));
   if (document.referrer) document.write ("&amp;referer=" + escape(document.referrer));
   if (document.context) document.write ("&context=" + escape(document.context));
   if (document.mmm_fo) document.write ("&amp;mmm_fo=1");
   document.write ("'><\/scr"+"ipt>");
//]]>-->


}


