<!--

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

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_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_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 setTipologiaImmobile() {
	if(document.RicercaImmobile.tipCasa.selectedIndex==0){
		document.RicercaImmobile.action='vendita.asp';
	}
	else{
		document.RicercaImmobile.action='affitto.asp';
	}
}

function reloadRicercaImmobili(sendTo) {
	//alert(document.RicercaImmobile.regione.options[document.RicercaImmobile.regione.selectedIndex].value);
	sendTo+='?regione='+document.RicercaImmobile.regione.options[document.RicercaImmobile.regione.selectedIndex].value;
	if(sendTo.indexOf("vendita.asp")>0)
		sendTo+='&vendita='+document.getElementById("pagCorrente").value;
	if(sendTo.indexOf("affitto.asp")>0)
		sendTo+='&affitto='+document.getElementById("pagCorrente").value;
	if(document.RicercaImmobile.regione.selectedIndex==0){
		sendTo+='&provincia=-1';
	}
	else{
		sendTo+='&provincia='+document.RicercaImmobile.provincia.options[document.RicercaImmobile.provincia.selectedIndex].value;
	}
	//alert(sendTo);
	document.location=sendTo;
}

function visualizzaCasa(pID) {
	MM_openBrWindow('visualizza_casa.asp?casa='+pID, '', 'width=700,height=700,scrollbars=yes');
}

function imagePopup(url){
	if(typeof(url)!="object"){
		window.golarge = window.open("","","top=0,left=0,scrollbars=yes,resizable=yes");
		window.golarge.document.open();
		window.golarge.document.write('<html>');
		window.golarge.document.write('<head>');
		window.golarge.document.write('<title>Zoom</title>');
		window.golarge.document.write('</head>');
		window.golarge.document.write('<style>\n');
		window.golarge.document.write('.link {font-family: Verdana, Arial, Helvetica; font-size: 10pt; color: #4F8FCF; font-weight: bold;}');
		window.golarge.document.write('.link:hover {color: gray;}');
		window.golarge.document.write('</style>\n');
		window.golarge.document.write('<body topmargin="0" leftmargin="0" marginwidth="0" marginheight="0" >\n');
		window.golarge.document.write('<table height="100%"><tr><td align="center" valign="top"><img name="imgCasa" id="imgCasa" border="1" src="'+url+'" onLoad="opener.imagePopup(this);"></td></tr></table>\n');
		window.golarge.document.write('</body>\n');
		window.golarge.document.write('</html>\n');
		window.golarge.document.close();
	}
	else{	
		imageWidth=url.width;
		imageHeight=url.height;
		
		if(imageWidth > screen.width || imageHeight > screen.height){
			if(imageWidth > imageHeight){
				//imageHeight=imageHeight*(Math.round(100/imageWidth*screen.width)/100);
				//imageWidth=screen.width;
				url.width=screen.width;
			}
			else{
				//imageWidth=imageWidth*Math.round((100/imageHeight*screen.height)/100);
				//imageHeight=screen.height;
				url.height=screen.height;
			}
		}
		
		imageWidth=url.width;
		imageHeight=url.height;
		
		if(document.layers)
			window.golarge.resizeTo(imageWidth,imageHeight);
		else
			window.golarge.resizeTo(imageWidth+25,imageHeight+60);
	}
}

function goVendiImmobile(x) {
	MM_openBrWindow(x, '', 'width=390,height=550,scrollbars=no');
}

function goAcquistaImmobile(x) {
	MM_openBrWindow(x, '', 'width=390,height=550,scrollbars=no');
}

function goNormativaPrivacy(x) {
	MM_openBrWindow(x, '', 'width=405,height=550,scrollbars=yes');
}

function goAnteprima(x) {
	document.anteprima.src=x;
}

function validateForm(xForm) {
	if(xForm.nominativo.value!=''){
		if(xForm.telefono.value!=''){
			if(xForm.immobile.value!=''){
				if(xForm.privacy.checked){
					xForm.immobile.disabled=false;
					return true;
				}
				else{
					alert('Leggete l\'informativa sul trattamento dei dati personali ed accettatela per poter proseguire.');
				}
			}
			else{
				alert('Inserite una descrizione del Vostro immobile.');
				xForm.immobile.focus();
			}
		}
		else{
			alert('Inserite un Vostro contatto telefonico.');
			xForm.telefono.focus();
		}
	}
	else{
		alert('Inserite il Vostro nominativo.');
		xForm.nominativo.focus();
	}
	return false;
}

//-->
