var _____WB$wombat$assign$function_____=function(name){return (self._wb_wombat && self._wb_wombat.local_init && self._wb_wombat.local_init(name))||self[name];};if(!self.__WB_pmw){self.__WB_pmw=function(obj){this.__WB_source=obj;return this;}}{
let window = _____WB$wombat$assign$function_____("window");
let self = _____WB$wombat$assign$function_____("self");
let document = _____WB$wombat$assign$function_____("document");
let location = _____WB$wombat$assign$function_____("location");
let top = _____WB$wombat$assign$function_____("top");
let parent = _____WB$wombat$assign$function_____("parent");
let frames = _____WB$wombat$assign$function_____("frames");
let opens = _____WB$wombat$assign$function_____("opens");
jQuery(function($) {
	
	$('.cmmrm-rating li').click(function() {
		
		var obj = $(this);
		var container = obj.parents('ul').first();
		var wrapper = container.parents('.cmmrm-route-rating').first();
		
		if (container.attr('data-can-rate') == '0') return;
		
		var routeId = obj.parents('.cmmrm-route-single').data('routeId');
		if (!routeId) routeId = obj.parents('.cmmrm-route-snippet').data('routeId');
		
		$.post(CMMRM_Route_Rating.url, {
			action: 'cmmrm_route_rating',
			nonce: CMMRM_Route_Rating.nonce,
			routeId: routeId,
			rate: obj.data('rate')
		}, function(response) {
			console.log(response);
			if (response.success == '1') {
				container.attr('data-rating', Math.round(response.rate));
				container.attr('data-can-rate', 0);
				var number = wrapper.find('.cmmrm-votes-number');
				console.log(number);
				var num = parseInt(number.text().replace(/[^0-9]/g, '')) + 1;
				number.text('(' + num + ')');
			}
		});
		
	});
	
});
}