var Watched_handler = {
		init : function() {
			$('.wached a').bind('click', function(event) { Watched_handler.check_vote(event, $(this), null, null); });
		},
		check_vote : function(event, obj, xhr, pr_tr) {
			if(xhr == null){
				var pr_id = obj.attr('id').substr(6);
				var pr_tr = obj.parent().parent();
				xhr = $.get("index.php", { module: "ajax", action: "count_vote", cont: "ajax", pr_id: pr_id });
				setTimeout(function() { Watched_handler.check_vote(event, obj, xhr, pr_tr) }, 100);
			}
			else{
				if(xhr.readyState != 4){
					setTimeout(function() { Watched_handler.check_vote(event, obj, xhr, pr_tr) }, 100);
				}
				else{
					pr_tr.remove();
				}
			}
			event.preventDefault();
		}
}

$(document).ready(Watched_handler.init );
