//Enable ajax/colorbox for .ajax_colorbox
$(".ajax_colorbox").colorbox();

//Logout
$(".logout").click(function() {
  $.ajax({
    type: "GET",
    url: "/odjava/",
    success: function(m) {
        window.location.reload();
    }
  });
  
  return false;
});

$(function() {
    $('a[rel*=external]').click( function() {
        window.open(this.href);
        return false;
    });
});

//Poll
function mod_poll_vote(poll,template) {
	x = $("#poll_"+poll+"_form input[name='answer']:checked").val();
	
	if(x) {
		//vote & get results
		 $.ajax({
	    type: "POST",
	    data: ""+poll+"_vote="+x,
	    url: "/ajax/poll_vote?poll="+poll+"&template="+template,
	    success: function(m) {
	        $("#poll_"+poll).html(m);
	    }
	  });
	}
	
}

