// JavaScript Document

up = 1;
down = -1;

vote = function(id, type){
		url = "/vote.php";
		pars = "fact_id="+id+"&type="+type;
		opts = { parameters:pars, method:"get", onSuccess: voteCb, onError: sorry };
		var myAjax = new Ajax.Request(url,  opts);
	}

voteCb = function (e) {
		if(e.responseText.include("Error"))
			sorry(e);
		else
			alert("Your vote was registered correctly. Thanks");
		
	
	}
	
sorry = function(e){
	
		alert("Sorry, there was an error. Try again later");
		
	}
