var smilie_vote_url = '/wp-content/plugins/smilie-vote';

var ajaxurl = '/wp-admin/admin-ajax.php';

function smilie_vote(pid,act){

	var data = {

		action: 'smilie_vote',

		post_id: pid,

		rating_action:act

	};

	jQuery.post(ajaxurl, data, function(response) {

		if(response=='VOTED'){

			alert('您已经投过票了');

		}else if(response=='ERROR'){

			alert('参数错误');

		}else{

			jQuery('.sv_'+pid).replaceWith(response);

		}

	});

	return false;

}

function sv_get(divid){

	var data = {

		action: 'sv_get',

		divid: divid

	};

	jQuery.post(ajaxurl, data, function(response) {

		jQuery('#'+divid).replaceWith(response);

	});

	return false;

}

jQuery(document).ready(function(){

	jQuery('.sv_mark').each(function(){

		sv_get(jQuery(this).attr('id'));

	});

});
