	function updateRating( str )
	{
		arr = str.split("|");

		if( arr.length == 2 )
		{
			$("span#good_rating").html(arr[0]);
			$("span#bad_rating").html(arr[1]);
		}
		else
			alert(str);
	}

	function sendRating( pageId, vote )
	{
		var randomnumber=Math.floor(Math.random()*11);

		if( vote == 'yes' )
			tail = '&vote=yes';
		else if (vote == 'no')
			tail = '&vote=no';
		else
			tail = '&getvote=true';

		$.get("/ajax/vote.asp?page_id=" + pageId + tail + "&" + randomnumber,function(resp){
		//		alert(resp)
	  		    updateRating( resp );
		});
	}

	function initRating( pageId )
	{
		sendRating( pageId, 'getvote' );

		$("#vote_yes").click( function() {
			sendRating( pageId, 'yes' );
			return false;
		});

		$("#vote_no").click( function() {
			sendRating( pageId, 'no' );
			return false;s
		});
	}


