// JavaScript Document
<!--

function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}


function apriportale() {
 if (theForm.goportale.options[theForm.goportale.selectedIndex].value == 1) { alert("premuto agrutrismo"); }
return (false);  
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function checkTop2004(theForm) { 
	if (theForm.nome.value == "") { alert("Inserisci il tuo Nome, grazie"); theForm.nome.focus(); return (false); } 
	if (theForm.emailg.value.indexOf('@', 0) == -1) { alert("Inserisci il tuo indirizzo Email corretto, grazie"); theForm.emailg.focus(); return (false); } 
	if (theForm.emailg.value.indexOf('.', 0) == -1) { alert("Inserisci il tuo indirizzo Email corretto, grazie"); theForm.emailg.focus(); return (false); }
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}

MM_reloadPage(true);

// -->

function cancellaNomeDefault(str) {
 if (str == "nome")
  document.formTop2004.nome.value = "";
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function LoadDestinations(rlm) {
//Questa funzione viene caricata all'avvio delal pagina e riempe la combobox
if (document.FormRicerca.Ricerca_in[1].checked) {
	for (var i=0;i<=globalc;i++) {
		document.FormRicerca.Destinazione.options[i] = new Option(Destinazioni[i],Destinazioni[i],false,false);
		document.FormRicerca.Destinazione.options[i].selected = false;
	}
	document.FormRicerca.Destinazione.options.length = i;
}
else {
	var maxrlm=0;
	for (var i=0;i<=globalc;i++) {
		if (reallastminute[i] == "s") {
			document.FormRicerca.Destinazione.options[maxrlm] = new Option(Destinazioni[i],Destinazioni[i],false,false);
			document.FormRicerca.Destinazione.options[maxrlm].selected = false;
			maxrlm++;
		}
	}
	document.FormRicerca.Destinazione.options.length = maxrlm;
}
document.FormRicerca.Destinazione.options[0].selected = true;
}

function popUp(z){
	window.open(z,'','scrollbars=1,statusbar=0,personalbar=0,toolbar=0,menubar=0,width=640,height=500,screenX=20,screenY=20,top=20,left=20');
}

//se queste due funzioni hanno lo scopo di verificare 
//la validità di una da
function VerificaDataDal() {
	giorno = document.FormRicerca.da_g.options.selectedIndex + 1;
	mese = document.FormRicerca.da_m.options.selectedIndex + 1;
	anno = document.FormRicerca.da_a.options[document.FormRicerca.da_a.options.selectedIndex].value;
	if ((mese==4 || mese == 6 || mese == 9 || mese == 11) && giorno>30 ) {
		document.FormRicerca.da_g.options.selectedIndex = 29;
	}
	if (mese == 2) {
		if (anno%4 == 0) {
			if (giorno > 29) document.FormRicerca.da_g.options.selectedIndex = 28;
		}
		else {
			if (giorno > 28) document.FormRicerca.da_g.options.selectedIndex = 27;
		}
	}
}

function VerificaDataAl() {
	giorno = document.FormRicerca.a_g.options.selectedIndex + 1;
	mese = document.FormRicerca.a_m.options.selectedIndex + 1;
   anno = document.FormRicerca.a_a.options[document.FormRicerca.a_a.selectedIndex].value;
	if ((mese==4 || mese == 6 || mese == 9 || mese == 11) && giorno>30 ) {
		document.FormRicerca.a_g.selectedIndex = 29;
	}
	if (mese == 2) {
		if (anno%4 == 0) {
			if (giorno > 29) document.FormRicerca.a_g.selectedIndex = 28;
		}
		else {
			if (giorno > 28) document.FormRicerca.a_g.selectedIndex = 27;
		}
	}
}

function ImpostaData() {
	oggi = new Date();
	gg = oggi.getDate();
	mm = oggi.getMonth();
	yy = 0;
	document.FormRicerca.da_g.options[gg-1].selected = true;
	document.FormRicerca.da_m.options[mm].selected = true;
	document.FormRicerca.da_a.options[yy].selected = true;
	document.FormRicerca.a_g.options[gg-1].selected = true;
	document.FormRicerca.a_m.options[mm].selected = true;
	document.FormRicerca.a_a.options[yy].selected = true;
}

function goportali(theForm) {
	var goportale = theForm.elements[0];
	if (goportale.selectedIndex == 0) {
		switch (theForm.name) {
			case 'form-vai01':
				alert('Scegli un alloggio!');
				break;
			case 'form-vai02':
				alert('Scegli un tema!');
				break;
			case 'form-vai03':
				alert('Scegli una localit&agrave;!');
				break;
		}
		return false;
	} else {
		theForm.action = goportale.options[goportale.selectedIndex].value;
		alert(theForm.action);
		goportale.selectedIndex = 0;
		return true;
		//MM_openBrWindow(theForm.goportale01.options[theForm.goportale01.selectedIndex].value,'','');
	}
}
//-->