// JavaScript Document

<!--//
		var filtroNum = /^\d{1,}$/;
		
		function RicercaCodice()
		{
			var codice = window.document.homepage.txtCodice;
			
			if(Trim(codice.value)!="")
			{
				if(!filtroNum.test(Trim(codice.value))){
					alert("Il Codice deve essere un numero intero.");
					codice.focus();
					return false;
				}
			}
			else 
			{
				alert("Nessun Codice specificato.");
				codice.focus();
				return false;
			}
			
			return true;
		}
		
		
		function Ricerca()
		{
			var camere = window.document.homepage.txtCamere;
			var bagni = window.document.homepage.txtBagni;
			
			if(Trim(camere.value)!="")
			{
				if(!filtroNum.test(Trim(camere.value))){
					alert("Il campo Camere deve essere un numero intero.");
					camere.focus();
					return false;
				}
			}
				
			if(Trim(bagni.value)!="")
			{
				if(!filtroNum.test(Trim(bagni.value))){
					alert("Il campo Bagni deve essere un numero intero.");
					bagni.focus();
					return false;
				}
			}
			
			return true;
		}	
			
		function RicercaAvanzata()
		{
			if(window.document.getElementById('divRicercaAvanzata').style.display == "block")
			{
				window.document.getElementById('divRicercaAvanzata').style.display = "none";
				window.document.homepage.imgRicercaAvanzata.src = "grafica/scrolldown.gif";
			}
			else
			{
				window.document.getElementById('divRicercaAvanzata').style.display = "block";
				window.document.homepage.imgRicercaAvanzata.src = "grafica/scrollup.gif";
			}
		}		
		
		function Trim(stringa){
				
			reTrim=/\s+$|^\s+/g;
			return stringa.replace(reTrim,"");
			
		}
			
//-->