/*
function importContacts() {
	var mail = $("#email").val();
	var pwd = $("#password").val();
	var mode = $("#service").val();
	$("#importer_contacts").slideUp(300, function() {
		$("#importer_loading").slideDown(300, function() {	
			if(mode=="") {													   
				$.ajax({
				   type: "POST",
				   url: "/ajax_importer_home.php",
				   data: 'email='+mail+'&password='+pwd+'&post=1',
				   success: function(html){
					   $('#importer_contacts').html(html);
					   $("#importer_loading").slideUp(300, function() {
						   $("#importer_contacts").slideDown(300);
						});
				   }
				 });
			} else {
				var statevars = $("#statevars").val();
				var state = $("#state").val();
				var posttype = $("#posttype").val();
				var captchaSuccessMsg = $("#captchaSuccessMsg").val();
				var captchaFailMsg = $("#captchaFailMsg").val();
				$("#statevars").remove();
				$("#state").remove();
				$("#posttype").remove();
				$("#captchaSuccessMsg").remove();
				$("#captchaFailMsg").remove();
				
				$.ajax({
				   type: "POST",
				   url: "/ajax_importer_msg.php",
				   data: 'email='+mail+'&password='+pwd+'&mode='+mode+'&login=1&post=1&statevars='+statevars+'&state='+state+'&posttype='+posttype+'&captchaSuccessMsg='+captchaSuccessMsg+'&captchaFailMsg='+captchaFailMsg,
				   success: function(html){
					   $('#importer_contacts').html(html);
					   $("#importer_loading").slideUp(300, function() {
						   $("#importer_contacts").slideDown(300);
						});
				   }
				 });
			}
		});
	});
}

function search_profili() {
	var cerca = $("#search_name").val();
	window.location = "/go/esplora/profili/?view_profili&type=cerca&q="+cerca;
}
*/

function checkUsr() {
	var user = $("#user").val();
	$.ajax({
	   type: "POST",
	   url: "/ajax_checkusr_home.php",
	   data: 'url='+user+'&o=1',
	   success: function(html){
		   $('#usrcheked').html(html);
	   }
	 });
}

function checkMail() {
	var mail = $("#email").val();
	$.ajax({
	   type: "POST",
	   url: "/ajax_checkusr_home.php",
	   data: 'url='+mail+'&o=2',
	   success: function(html){
		   $('#mailcheked').html(html);
	   }
	 });
}

function goStep2() {
	var user = document.modulo.user.value;
	var password = document.modulo.password.value;
	var email_reg_exp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
	var email = document.modulo.email.value;
	
	var day = document.modulo.day.value;
	var month = document.modulo.month.value;
	var year = document.modulo.year.value;
	
	var usrcheck = document.modulo.usrch.value;
	var mailcheck = document.modulo.mailch.value;
	
	if (document.modulo.termini.checked==false) {
	   alert("Devi Accettare i Termini e le Condizioni");
	   document.modulo.termini.focus();
	   return false;
	}
	
	else if ((user == "") || (user == "undefined")) {
	   alert("Il campo User è obbligatorio.");
	   document.modulo.user.focus();
	   return false;
	}
	
	else if (usrcheck != "1") {
	   alert("L'UserName che hai inserito non è disponibile");
	   document.modulo.user.focus();
	   return false;
	}
	
	else if ((password == "") || (password == "undefined")) {
	   alert("Il campo Password è obbligatorio.");
	   document.modulo.password.focus();
	   return false;
	}
		
	else if ((day == "") || (day == "-1") || (isNaN(day)) || (day<1) || (day>31)) {
	   alert("Il campo Giorno di Nascita è obbligatorio.");
	   document.modulo.day.focus();
	   return false;
	}
	
	else if ((month == "") || (month == "-1") || (isNaN(month)) || (month<1) || (month>12)) {
	   alert("Il campo Mese di Nascita è obbligatorio.");
	   document.modulo.month.focus();
	   return false;
	}
	
	else if ((year == "") || (year == "-1") || (isNaN(year)) || (year<1900)) {
	   alert("Il campo Anno di Nascita è obbligatorio.");
	   document.modulo.year.focus();
	   return false;
	}
	
	else if (!email_reg_exp.test(email) || (email == "") || (email == "undefined")) {
	   alert("Inserire un indirizzo email corretto.");
	   document.modulo.email.select();
	   return false;
	}
	
	else if (mailcheck != 1) {
	   alert("L'Email che hai inserito non è disponibile");
	   document.modulo.email.focus();
	   return false;
	}
	
	else {
	  //document.modulo.action = "/go/join/?step=2";
	  document.modulo.submit();
	}
}
