function checkRapporto(){
  document.getElementById('FormRicerca').bottCerca.value = 'Wait...';
  document.getElementById('FormRicerca').bottCerca.disabled = true;
  if (document.getElementById('FormRicerca').rapporto.value == ''){
    alert("Select what you are looking for...");
    document.getElementById('FormRicerca').bottCerca.disabled = false;
    document.getElementById('FormRicerca').bottCerca.value = 'Search';
    return false
    }
  else{
    document.getElementById('loading').style.display = 'block';
    return true
    }
  }

function Ricerca1(scelta){
  var FormRicerca = document.getElementById('FormRicerca');
  var SelTipologia = FormRicerca.tipologia;
  var SelVani = FormRicerca.vani;
  switch (scelta){
    case 1: {
      SelTipologia.disabled = false;
      SvuotaSel(SelTipologia);
      AddOpt(SelTipologia, 'any');
      AddOpt(SelTipologia, 'apartments');
      AddOpt(SelTipologia, 'villas');
      AddOpt(SelTipologia, 'terrains');
      AddOpt(SelTipologia, 'chalet');
      AddOpt(SelTipologia, 'rural');
      AddOpt(SelTipologia, 'business r.e.');
      AddOpt(SelTipologia, 'activities');
      AddOpt(SelTipologia, 'other');
      break
      }
    case 2: {
      SelTipologia.disabled = false;
      SvuotaSel(SelTipologia);
      AddOpt(SelTipologia, 'any');
      AddOpt(SelTipologia, 'apartments');
      AddOpt(SelTipologia, 'villas');
      AddOpt(SelTipologia, 'chalet');
      AddOpt(SelTipologia, 'business r.e.');
      AddOpt(SelTipologia, 'other');
      break
      }
    case 3: {
      SelTipologia.disabled = false;
      SvuotaSel(SelTipologia);
      AddOpt(SelTipologia, 'any');
      AddOpt(SelTipologia, 'apartments');
      AddOpt(SelTipologia, 'villas');
      AddOpt(SelTipologia, 'chalet');
      AddOpt(SelTipologia, 'other');
      break
      }
    default: {
      SvuotaSel(SelTipologia);
      AddOpt(SelTipologia, '. . .');
      SvuotaSel(SelVani);
      AddOpt(SelVani, '. . .');
      SelTipologia.disabled = true;
      SelVani.disabled = true
      }
    }
  }
  
function Ricerca2(scelta){
  var FormRicerca = document.getElementById('FormRicerca');
  var SelTipologia = FormRicerca.tipologia;
  var SelVani = FormRicerca.vani;
  switch (scelta){
    case 1: {
      SelVani.disabled = false;
      SvuotaSel(SelVani);
      AddOpt(SelVani, 'any');
      AddOpt(SelVani, '1');
      AddOpt(SelVani, '2');
      AddOpt(SelVani, '3');
      AddOpt(SelVani, '4');
      AddOpt(SelVani, '5+');
      break
      }
    default: {
      SvuotaSel(SelVani);
      AddOpt(SelVani, '. . .');
      SelVani.disabled = true
      }
    }
  }
  
function SvuotaSel(Sel){
  for (i = Sel.length - 1; i>=0; i--) {
      Sel.remove(i);
    }
  }
  
function AddOpt(Sel, Opt){
  var newOpt = document.createElement('option');
  newOpt.text = Opt;
  newOpt.value = Opt;
  try { Sel.add(newOpt, null) }
  catch(ex) { Sel.add(newOpt) }
  }
  
function SbloccaTasti(){
  document.getElementById('FormRicerca').bottCerca.value = 'avvia ricerca';
  document.getElementById('FormRicerca').bottCerca.disabled = false
  }
  
function CambiaFoto(cod){
  document.getElementById('FotoScheda').src = 'http://www.acquamarinaimmobiliare.com/public/' + cod + '.jpg';
  
  }
  
 function inizializzaxml(metodo, paginaxml){
	var xmlhttp=false;
	/*@cc_on @*/
	/*@if (@_jscript_version >= 5)

	 try {
	  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	 } catch (e) {
	  try {
	   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	  } catch (E) {
	   xmlhttp = false;
	  }
	 }
	@end @*/
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') { xmlhttp = new XMLHttpRequest() }
	xmlhttp.open(metodo, paginaxml, true);
	return xmlhttp;
}
