window.onload = function(){
	var dot = 0;
}

vote = new Object();
vote.down = function(blog_id, article_url, caller){
	this.onclick = "return false;"
	$.ajax({
		type: "POST",
		url: "/scripts/vote.php",
		data: "blog_id=" + blog_id + "&url=" + article_url + "&vote=0",
		success: function(msg){
			if(msg != 'vfound'){
				var elementR = $(caller).parent().parent().parent().find("span")[0];
				var curVote = parseInt(elementR.innerHTML.replace("&nbsp;", ""));
				elementR.innerHTML = String(curVote - 1);
				$(elementR).parent().find(".vt").animate({opacity: 'toggle'}, "slow");
			}
		}
	});
}
vote.up = function(blog_id, article_url, caller){
	this.onclick = "return false;"
	$.ajax({
		type: "POST",
		url: "/scripts/vote.php",
		data: "blog_id=" + blog_id + "&url=" + article_url + "&vote=1",
		success: function(msg){
			if(msg != 'vfound'){
				var elementR = $(caller).parent().parent().parent().find("span")[0];
				var curVote = parseInt(elementR.innerHTML.replace("&nbsp;", ""));
				elementR.innerHTML = String(curVote + 1);
				$(elementR).parent().find(".vt").animate({opacity: 'toggle'}, "slow");
			}
		}
	});
}
vote.add_fav = function(sub_id, user_id, caller) {
        this.onclick = "return false;"
        $.ajax({
                type: "POST",
                url: "/scripts/favorite.php",
                data: "sub_id=" + sub_id + "&user_id=" + user_id,
                success: function(msg){
                        if(msg != 'vfound'){
                                $(caller).animate({opacity: 'toggle'}, "slow");
                        }
                }
        });
}
