
function Ricarica(){
	document.forms['frmMotore'].submit();
}

function Avvia(){
	document.forms['frmMotore'].action = 'we_elenco.php';
	/* document.forms['frmMotore'].target = '_top'; */
	document.forms['frmMotore'].submit();
}

function AvviaPop(){
    window.open('about:blank','ElencoRicerca','height=600,width=800, scrollbars=yes');
	document.forms['frmMotore'].action = 'we_elenco.php';
	document.forms['frmMotore'].target = 'ElencoRicerca';
	document.forms['frmMotore'].popup.value = '1';
	document.forms['frmMotore'].submit();
	document.forms['frmMotore'].target = '';
	document.forms['frmMotore'].action = '';
}

function Contapagine(Orderby,Limit){
    document.forms['frmElenco'].orderby.value = Orderby;
    document.forms['frmElenco'].limit.value = Limit;
    document.forms['frmElenco'].submit();
}

function CheckFormImm(){

	if(document.forms['frmContatti'].nome.value == '' && document.forms['frmContatti'].cognome.value == ''){
		alert("Gentile visitatore, per poterla ricontattatre la preghiamo di inserire il suo nome");
		document.forms['frmContatti'].nome.focus();
		
	}else if(document.forms['frmContatti'].telefono.value == '' && document.forms['frmContatti'].email.value == ''){
		alert("Gentile visitatore, per poterla ricontattatre la preghiamo di inserire un numero di telefono o un indirizzo email");
		document.forms['frmContatti'].telefono.focus();
		
	}else if(document.forms['frmContatti'].privacy.checked == false){
		alert("Gentile visitatore, per effettuare l'invio della richiesta deve prendere visione dell'informativa sulla privacy");
		document.forms['frmContatti'].privacy.focus();
		
	}else{
		document.forms['frmContatti'].submit();	
		
	}
	
}

/* Ajax call */
var http1 = false;

if(navigator.appName == "Microsoft Internet Explorer"){
	http1 = new ActiveXObject("Microsoft.XMLHTTP");
}else{
	http1 = new XMLHttpRequest();
}

function ChangePhotos(ID){
	document.getElementById('box_photos').innerHTML = '';  
	document.getElementById('box_photos').innerHTML = '<img src="we_images/ajax-loader.gif" border="0">';  
	setTimeout('ChangePhotosGo('+ID+')',300);
}
function ChangePhotosGo(ID){
	http1.abort();
	http1.open("GET", "we_change_photo.php?id="+ID, true);
	http1.onreadystatechange=function(){
		if(http1.readyState == 4){        		    
		  document.getElementById('box_photos').innerHTML = http1.responseText;        
		}
	}
	http1.send(null);
}
/* End - Ajax call */