function vote2(userid,item,amnt,artnum){
	var r=false;
	$.ajax({
		async: false,
		type: "POST",
		url: "_ajaxsave_artstar.txt",
		data: "user=" +userid+ "&item=" +escape(item)+ "&vote=" +amnt,
		dataType: "json",
		success: function(res){
			$('#current-rating_'+artnum).width(res.width);
			$('#current-rating-result_'+artnum).html(res.status);
			r=confirm('vuoi condividere il tuo giudizio su Facebook?');
		}
	});
	return r;
}

function vote(userid,item,amnt,artnum,desc,pic,description){
	alert('voted');
	$.ajax({
		type: "POST",
		url: "_ajaxsave_artstar.txt",
		data: "user=" +userid+ "&item=" +escape(item)+ "&vote=" +amnt,
		dataType: "json",
		success: function(res){
			$('#current-rating_'+artnum).width(res.width);
			$('#current-rating-result_'+artnum).html(res.status);
			if (confirm('vuoi condividere il tuo giudizio su Facebook?')) fbshare1("http://www.enotecawineshop.it/?art="+item,"ha dato "+amnt+(amnt==1?" stella a ":" stelle a ")+desc,desc,pic,description);
		}
	});
}

function fbshare(url,text){
	var url="http://www.facebook.com/sharer.php?u="+escape(url)+"&m="+escape(text)+"&s="+escape(text)+"&a="+escape(text)+"&b="+escape(text)+"&c="+escape(text);
//	var url="http://www.facebook.com/connect/prompt_feed.php?message="+escape(text)+"&link="+escape(url);
//	var url="http://www.facebook.com/connect/prompt_feed.php?message=stelle&action_links="+escape("[{text:'5 stelle',href:'"+url+"'}]");
//	prompt('URL',url);
	location.href=url;
}

function fbshare1(url,status,title,img,desc){
if (desc=='') desc="Abbiamo selezionato per te alcuni tra i migliori prodotti del panorama enologico italiano. Con l'Esperienza di quasi 80 anni di attività, il nostro nuovo servizio di E-Commerce ti propone anche su Facebook oltre 1700 vini di Qualità!";
if (img=='') img='http://www.enoteca-italiana.it/enosito2/img/logo.gif';
/*   method: 'feed',
     display: 'popup',
     message: status,
     name: title,
     link: url,
     caption: 'Enoteca Italiana - Wine Shop',
     picture: img,
     description: desc,
*/
/*
FB.ui(
   {
	method: 'feed',
	attachment: {
		name: title,
		caption: 'Enoteca Italiana - Wine Shop',
		description: (
		'A small JavaScript library that allows you to harness ' +
		'the power of Facebook, bringing the user\'s identity, ' +
		'social graph and distribution power to your site.'
		),
		href: url
	},
	action_links: [ { text: title, href: url } ]
	},
	function(response) {
		if (response && response.post_id) {
			alert('Link pubblicato.');
		} else {
			alert('Il link non e\' stato pubblicato.');
		}
	}
 );
*/
alert('facebook done');
}
