function isloggedin(id_utente)
 	{
 		if(id_utente== 0)
		{
			showModal();
			return false;                        
		}
		else
		{ $("#Fase1").hide();
			$("#Fase2").fadeIn("slow");
			return true;
		}
 	}
 	function display(nomeDiv)
 	{
 		  $(".hideStep2").hide();
 		  $(".hideStep2 form div input").html("");
 		  $("#Div" + nomeDiv).fadeIn('slow');
	}
	function clearTxt(post_id)
	{
		$("#messaggio_" + post_id).html("");
		$("#messaggio_" + post_id).focus();
		return true;
	}
	function commenta(id_utente,id_post)
	{
 		if(id_utente== 0)
		{
			showModal();
			return false;                        
		}
		else
		{
			$('.hide_commenti').hide(); 
			$('#form_commento_'+id_post).fadeIn('slow'); 
			$('#form_commento_'+id_post).focus();
			return true;
		}
	}
	function mi_piace(id_utente,id_post)
	{
 		if(id_utente== 0)
		{
			showModal();
			return false;                        
		}
		else
		{
			return true;
		}
	}
	function isPostFormReady(form)
	{
		
		id_categoria = form.id_categoria.options[form.id_categoria.selectedIndex].value;
		errMsg = "";
		
		if(id_categoria== -1)
			errMsg += "Devi selezionare una categoria \n";
		if (id_categoria==0)
			location.href = "/contatti.asp?id_tipo=3";
		if( form.post.value == "")
		 errMsg += "E' obbligatorio inserire del testo \n";
		
		if(errMsg != "")
			{
				alert(errMsg);
				return false;
			}	
			else
				return true; 
		
	}
	
	function selectCategoria(val)
	{
		if (val==0)
			location.href = "/contatti.asp?id_tipo=3";
			
	};


function ContaCaratteri()
{  
	//alert("sjhaskdh");
    $("#conta").value = massimo - $("#post").value().length;
    if ($("#post").value().length > massimo)
    {
        $("#post").value = $("#post").value.substr(0, massimo);
        $("#conta").value = 0;
        alert("Massimo " + massimo + " caratteri!");
    }

}
