var ns6=document.getElementById&&!document.all
var ie=document.all

var dayarray=new Array("Domenica","Lunedì","Martedì","Mercoledì","Giovedì","Venerdì","Sabato")
var montharray=new Array("Gennaio","Febbraio","Marzo","Aprile","Maggio","Giugno","Luglio","Agosto","Settembre","Ottobre","Novembre","Dicembre")

preload1 = new Image(48,48);
preload1.src = 'images/next5.png';

preload2 = new Image(48,48);
preload2.src = 'images/prev5.png';


function change_page(iNumPage) {
	document.ricerca.num_page.value=iNumPage;
	document.ricerca.submit();
}

function reload_page() {
	document.ricerca.submit();
}

function reload_page_richiesta() {
	document.contatto.action.value = "";
	document.contatto.submit();
}


function CheckForm() {	
	if ((document.contatto.Nome.value == "") || 
	    (document.contatto.Cognome.value == "") || 	    
	    (!document.contatto.privacy.checked) || 
	    (document.contatto.Email.value == "")) {		
		if (document.contatto.language.value == "ita") {
		  alert('Impossibile inviare il modulo. Alcuni parametri sono necessari.');
		} else {
		  alert('Sorry, it was impossible to send the module. Some parameters are missing.');
		}
		return false;
	} else {
	  return true;
	}
}

function CheckFormRichiestaImmobile() {	
	if ((document.contatto.Nome.value == "") || 
	    (document.contatto.Cognome.value == "") || 	
   	    (document.contatto.cod_provincia.selectedIndex == 0) ||
	    (document.contatto.cod_categoria.selectedIndex == 0) ||    
	    (!document.contatto.privacy.checked) || 
	    (document.contatto.Email.value == "")) {	
		if (document.contatto.language.value == "ita") {
		  alert('Impossibile inviare il modulo. Alcuni parametri sono necessari. La categoria e la provincia devono essere selezionate.');
		} else {
		  alert('Sorry, it was impossible to send the module. Some parameters are missing. Province and category should be selected');
		}
		return false;
	} else {
	  document.contatto.action.value = "send";
	  if (document.contatto.cod_categoria.value == 'R') {document.contatto.categoria.value = 'Residenziale';}
	  if (document.contatto.cod_categoria.value == 'C') {document.contatto.categoria.value = 'Commerciale';}
	  if (document.contatto.cod_categoria.value == 'T') {document.contatto.categoria.value = 'Rustici e terreni';}
	  if (document.contatto.cod_categoria.value == 'U') {document.contatto.categoria.value = 'Uffici e fondi';}
	  document.contatto.tipologia.value = document.contatto.cod_tipologia.options[document.contatto.cod_tipologia.selectedIndex].text;
	  document.contatto.provincia.value = document.contatto.cod_provincia.options[document.contatto.cod_provincia.selectedIndex].text;
	  document.contatto.comune.value = document.contatto.cod_comune.options[document.contatto.cod_comune.selectedIndex].text;
	  return true;
	}
}


function submit_page() {	
	if ((document.richiesta_immobile.nominativo.value == "") || 
		(document.richiesta_immobile.Email.value == "") || 
		(!document.richiesta_immobile.privacy.checked) |
		(document.richiesta_immobile.testo_richiesta.value == "")) {		
		if (document.richiesta_immobile.language.value == "ita") {
		  alert('Impossibile inviare il modulo. Alcuni parametri sono necessari.');
		} else {
		  alert('Sorry, it was impossible to send the module. Some parameters are missing.');
		}
		return false;
	} else {
	  return true;
	}
}
function roll_over(oggetto, immagine) {
  oggetto.src = immagine;
}

function OpenDiv (oggetto) {
  var obj = document.getElementById(oggetto);
  if (obj.style.display == 'block') {
    obj.style.display = 'none';
  } else {
    obj.style.display = 'block';
  }
  document.location.href='#'+oggetto;
}
