//FUNZIONE HOME PAGE X MUOVERE IMMOBILI

  var intervalRight;
  var intervalLeft;

  function scrollFoto_Right()
  {
			var objDiv = document.getElementById("divScheda");
			var larghezzaClip = objDiv.scrollWidth-740;
			
			objDiv.scrollLeft += 4;
			
			document.getElementById("imgLeft").src="img/scai_24.jpg";
			
			if (objDiv.scrollLeft >= larghezzaClip)
			{
			document.getElementById("imgRight").src="img/scai_26Roll.jpg";
			}
  }

  function scrollFoto_Left()
  {
			var objDiv = document.getElementById("divScheda");
			var larghezzaClip = objDiv.scrollWidth-740;
			
			objDiv.scrollLeft -= 4;

			document.getElementById("imgLeft").src="img/scai_24.jpg";
			
			if (objDiv.scrollLeft == 0)
			{
			document.getElementById("imgLeft").src="img/scai_24Roll.jpg";
			}
			
			if (objDiv.scrollLeft <= larghezzaClip)
			{
			document.getElementById("imgRight").src="img/scai_26.jpg";
			}
  }

  function CreaMovimentoRight(velocita)
  {
  intervalRight=window.setInterval('scrollFoto_Right()',velocita);
  }

  function CreaMovimentoLeft(velocita)
  {
  intervalLeft=window.setInterval('scrollFoto_Left()',velocita);
  }



//POPUP
function new_window(url)
{ 
link = window.open(url,"Contatti","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=600,height=450,left=0,top=0"); 
} 


// FUNZIONE SCROLL FOTO X SCHEDA 
function scrollFoto_Bottom()
{
		var objDiv = document.getElementById("divScheda");
		var altezzaClip = objDiv.scrollHeight-103;
		
		document.getElementById("imgTOP").src="img/top.gif";
		
		objDiv.scrollTop = objDiv.scrollTop+108;
		
		if (objDiv.scrollTop >= altezzaClip)
			document.getElementById("imgBOT").src="img/bottom2.gif";
}

function scrollFoto_Top()
{
		var objDiv = document.getElementById("divScheda");
		var altezzaClip = objDiv.scrollHeight-103;
		
		objDiv.scrollTop = objDiv.scrollTop-108;

		document.getElementById("imgTOP").src="img/top.gif";
		
		if (objDiv.scrollTop == 0)
		{
		document.getElementById("imgTOP").src="img/top2.gif";
		}
		
		if (objDiv.scrollTop <= altezzaClip)
		{
		document.getElementById("imgBOT").src="img/bottom.gif";
		}
}



// FUNZIONE X ATTESA
function loader ()
{
  	if (window.innerHeight)
  	{
		document.getElementById('sloSplas').style.top = window.innerHeight / 2 - 50;
		document.getElementById('sloSplas').style.left = window.innerWidth / 2 - 50;
  	}
  	else if (document.documentElement.clientHeight)
  	{
		document.getElementById('sloSplas').style.top = document.documentElement.clientHeight / 2 - 50;
		document.getElementById('sloSplas').style.left = document.documentElement.clientWidth / 2 - 50;
  	}
  	else if (document.body)
  	{
		document.getElementById('sloSplas').style.top = document.body.clientHeight / 2 - 50;
		document.getElementById('sloSplas').style.left = document.body.clientWidth / 2 - 50;
  	}

		document.getElementById('sloSplas').style.display = "block";
}


//DISABILITA SUBMIT CERCA
function disabilitasubmitcerca (VALLORE)
{
	if (VALLORE!=0)
	{
	document.form.bottSUBMITcerca.disabled=false;
	}
	else
	{
	document.form.bottSUBMITcerca.disabled=true;
	}
}

//BOX CERCA X ATTIVO SOSPESO
function boxcerca ()
{
	if (document.getElementById('boxSEARCH').style.display=="none")
	{
	document.getElementById('boxSEARCH').style.display="block";
	document.getElementById('imgSEARCH').src="img/meno.gif";
	}
	else
	{
	document.getElementById('boxSEARCH').style.display="none";
	document.getElementById('imgSEARCH').src="img/piu.gif";
	}
	
}

//BOX CERCA X ATTIVO SOSPESO
function boxComuni ()
{
	if (document.getElementById('tuttiComuni').style.overflow=="hidden")
	{
	document.getElementById('tuttiComuni').style.overflow="";
	}
	else
	{
	document.getElementById('tuttiComuni').style.overflow="hidden";
	}
	
}


//ZOOM
function openWin(content,w,h,isscroll,isresize)
{
		finestra=window.open(content,'zoom','scrollbars=' + isscroll + ',resizable=' + isresize + ',width=' + w + ',height=' + h + ',status=no,location=no,toolbar=no');
		finestra.focus();
}


//SCELTA CAMPI TRADUZIONE IMMOBILE SU INSERIMENTO
function sceltaDispo(linguaSCELTA)
{
	if (linguaSCELTA == 1)
	{
		document.getElementById('DISPeng').style.display='block';
		document.getElementById('DISPfra').style.display='none';
		document.getElementById('DISPger').style.display='none';
		document.getElementById('DISPspa').style.display='none';
	}
	else if (linguaSCELTA == 2)
	{
		document.getElementById('DISPeng').style.display='none';
		document.getElementById('DISPfra').style.display='block';
		document.getElementById('DISPger').style.display='none';
		document.getElementById('DISPspa').style.display='none';
	}
	else if (linguaSCELTA == 3)
	{
		document.getElementById('DISPeng').style.display='none';
		document.getElementById('DISPfra').style.display='none';
		document.getElementById('DISPger').style.display='block';
		document.getElementById('DISPspa').style.display='none';
	}
	else if (linguaSCELTA == 4)
	{
		document.getElementById('DISPeng').style.display='none';
		document.getElementById('DISPfra').style.display='none';
		document.getElementById('DISPger').style.display='none';
		document.getElementById('DISPspa').style.display='block';
	}

}



/* AJAX REGIONE/PROVINCIA/COMUNE + MACRO CATEGORIE/CATEGORIE */
function CodicePrezzo(value)
{
     RefreshFinestra('cod', 'comuni.php?action=codiceprezzo&id='+value);
}

//  Invia un form
function Submit(nome_form_temp) {
  nome_form = document.getElementById(nome_form_temp);
  
  //  Invia
  nome_form.submit();
}

