function checkVoteform(val)
{
	var i=0;
	var j=0;
	
	var ris=$('input[name="param1"]:checked').val() ==undefined 
			|| $('input[name="param2"]:checked').val() ==undefined
			|| $('input[name="param3"]:checked').val() ==undefined
			|| $('input[name="param4"]:checked').val() ==undefined
			|| $('input[name="param5"]:checked').val() ==undefined
			|| $('input[name="param6"]:checked').val() ==undefined;
	
	if (val>=7){
		ris=ris || $('input[name="param7"]:checked').val() ==undefined;
	}
	
	if (val>=8){
		ris=ris || $('input[name="param8"]:checked').val() ==undefined;
	}
	if (val>=9){
		ris=ris || $('input[name="param9"]:checked').val() ==undefined;
	}
	if (val>=10){
		ris=ris || $('input[name="param10"]:checked').val() ==undefined;
	}
	if (val>=11){
		ris=ris || $('input[name="param11"]:checked').val() ==undefined;
	}
	if (val>=12){
		ris=ris || $('input[name="param12"]:checked').val() ==undefined;
	}
	
	if (ris){
		vip.itemPage.voteAllItem();
		return false;		
	}
	
	if(document.Vote.comment.value.trim() == '')
	{	
		vip.itemPage.insertComment();
		return false;
	}
	else
		return true;
		
}
String.prototype.trim = function () {
    return this.replace(/^\s*/, "").replace(/\s*$/, "");
}

function checkQuestionform()
{
	var ris=document.Question.question_text.value.trim() =='' 
	
	if (!document.Question.type_user.value == '1'){
		alert('Devi essere uno studente loggato. Registrati se non lo hai gia\' fatto ');
			return false;
		}
		
	if (!ris){
		return true;
	}
	
	alert('Non hai inserito nessuna domanda! ');
	return false;
		
}
function checkInsTesiform()
{
	if (!document.InsTesi.type_user.value == '1'){
		alert('Devi essere uno studente loggato. Registrati se non lo hai gia\' fatto ');
		}
	else
	{
		var object_id = document.formPaypal.item_number.value;
		var user_id = document.formPaypal.custom.value;
		var amount = document.formPaypal.amount.value;
		var author = document.formPaypal.author.value;
		
		$.ajax({
	        type: "POST"
	        ,url: createEzUrl(urlModuloVipAjax+"/forms/action/setBuyTesiWait")
	        ,data: 'user_id=' + user_id +'&tesi_id=' +object_id+'&author=' +author+'&amount=' +amount
	        ,success: function(msg) {
				document.formPaypal.submit();
	        }
	    });
	}	
	return false;
}
function checkInsTesiform2()
{
	if (!document.InsTesi.type_user.value == '1'){
		alert('Devi essere uno studente loggato. Registrati se non lo hai gia\' fatto ');
		return false;
	}
	else
	{
		return true;
	}	
	return false;
}
function checkInsComment()
{
	if (document.form_commento.type_user.value == '1'){
		return true;
	}
	else
	{
		alert('Devi essere uno studente loggato. Registrati se non lo hai gia\' fatto ');
		return false;
	}	
	return false;
}