function save_vote(id_articolo, id_element, type_vote) {
	//alert("saving vote on " + id_element + " of ID " + id_articolo);
	
	if (type_vote == "link") {
		
		$.get("http://www.personalreport.it/wp-content/themes/personal03/extra/vote_link.php?id=" + id_articolo, function(data){ 
		$("#" + id_element).html("<strong>" + data + "</strong>");
		});
		
	} else {
		$.get("http://www.personalreport.it/wp-content/themes/personal03/extra/vote_article.php?id=" + id_articolo, function(data){ 
		$("#" + id_element).html("<strong>" + data + "</strong>");
		});
	}
	
	
	
}




function checkForm(){  

description = $("#description").attr("value");
linkAddress = $("#link").attr("value");
validate = 0;

if (linkAddress.indexOf("http://") < 0) {
	alert ("L'indirizzo deve includere http://");
	return false;
}

if (description.length < 15) {
	alert ("Il testo deve avere almeno 15 caratteri.");
	return false;
}


if($("#description").attr("value") && $("#link").attr("value")) {
        return true;  
} else {  
	alert("Entrambi i campi sono obbligatori!");  
	return false;  
}  


}




function updateShoutbox(){  
    /*messageList.hide();  
    loading.fadeIn();  
    $.ajax({  
        type: "POST", url: "shoutbox.php", data: "action=update",  
        complete: function(data){  
            loading.fadeOut();  
            messageList.html(data.responseText);  
            messageList.fadeIn(2000);  
        }  
    });  */
}  



$(document).ready(function() {
	$(".scrollableEventi").scrollable({prev:'.prevEventi', next:'.nextEventi'});
	$(".scrollableMusthave").scrollable({prev:'.prevMust', next:'.nextMust'});
	$(".scrollableBest").scrollable({prev:'.prevBest', next:'.nextBest'});
	$(".scrollableSpeciale").scrollable({prev:'.prevSpeciale', next:'.nextSpeciale'});
	$(".scrollableShoutbox").scrollable({prev:'.prevShout', next:'.nextShout', vertical:true});
	$(".scrollableLink").scrollable({prev:'.prevLink', next:'.nextLink'});
	
	
	$("#shoutbox").submit(function(){  
	if(checkForm()){  
		
        var desc = $("#description").attr("value");  
        var linkAddress = $("#link").attr("value");  
		$(".shoutbox .items").hide();
        $("#send").attr({ disabled:true }); 
		
     $.ajax({  
            type: "POST", url: "http://www.personalreport.it/wp-content/themes/personal03/shoutbox.php", data: "&desc=" + desc + "&link=" + linkAddress,  
            complete: function(data){  
				$(".shoutbox .items").html(data.responseText);
                $("#send").attr({ disabled:false });
				$("#description").attr({ value:"Descrizione" });  
				$("#link").attr({ value:"Link (facoltativo)" });  
				$(".shoutbox .items").fadeIn(1000);
			 }  
         });   
    }  
		return false;  
	});  

	
	
});            

