function add_tag_to_event(exp_entry_id, tag_title) {
    $.ajax({
        url: site_url+'ajax/add_tag_to_event/' + exp_entry_id + '/' + encodeURIComponent(tag_title),
        dataType: 'xml',
        success: function (result) {

            if ($(result).find("result success").text() == "true") {
                $("div#tag-message-container").removeClass("error");
	            $("div#tag-message-container").html("<p>De tag '"+tag_title+"' is toegevoegd.</p>");
				$("div#tag-message-container").fadeIn("fast").delay(5000).fadeOut("slow");
                /*window.location.reload();*/
                			
				tag_holder = $("div.event-info > div.tags-block");
				tags_list = $("div.event-info > div.tags-block > ul.tags");
				popup_close_link = $('.popup-close-link');
				// Start IE8 fix
				// This is only here because IE8 is a crappy browser!
				IE_hides = $("div.overflower, div.tags-box, div.tags-box > ul.tags > li > a");
				IE_hides.animate({opacity: 0.0},'fast'); 
				// End IE8 fix
				
				/*var popup_close_link = $(this);*/
            	var popup_open_link = $('.popup-open-link');
          		var popup_close = $(popup_close_link.attr('href'));
       			
       			tag_holder.animate({
					opacity: 0.0
				}, 'fast', function() {
					 popup_close.animate({
                    	height: "11px"
                    }, 'slow', function () {
                    
						tag_holder.css("height","11px");
						popup_close.css("display","none");
						$("span.fb_login_status").css("display","inline");
						tags_list.fadeIn(1);
						popup_open_link.fadeIn(1, function() {
							tag_holder.animate({
								opacity: 1.0,
								height: '1%'
							},'fast');
							
							IE_hides.removeAttr("style"); // IE8 fix
						});

                    });
				});
            	
                //popup_close_link.removeClass(open_class);
                //popup_close.removeClass(open_class);

                $("input#event-tag-input").val("Vul de tags voor deze voorstelling in...");
                
                return true;
            }
            else {
                //alert($(result).find("result message").text());                
	            $("div#tag-message-container").addClass("error");
	            $("div#tag-message-container").html("<p>"+$(result).find("result message").text()+"</p>");
				$("div#tag-message-container").fadeIn("fast").delay(5000).fadeOut("slow");
                return false;
            }
        }
        ,
        error: function (XMLHttpRequest, textStatus, errorThrown) {
            //alert(textStatus + '\n\n' + errorThrown);
            $("div#tag-message-container").addClass("error");
            $("div#tag-message-container").html("<p>Er is een probleem opgetreden met het toevoegen van de tag. Probeert u het later nog eens.</p>");
			$("div#tag-message-container").show().delay(5000).fadeOut("slow");
        }
    });
}

