var successColor = "#00FF00";
var errorColor = "#FF0000";

/**
 * Loads in a URL into a specified divName, and applies the function to
 * all the links inside the pagination div of that page (to preserve the ajax-request)
 * @param string href The URL of the page to load
 * @param string divName The name of the DOM-element to load the data into
 * @return boolean False To prevent the links from doing anything on their own.
 */
function loadPiece(href, divName, divClassName) {
	$(divName).attr('innerHTML','<center><img src="/img/loadingAnimation.gif" alt="Please wait. Loading ..."/></center>');
    $(divName).load(href, {}, function(){
        var divPaginationLinks = divName+" "+divClassName+" a";
        $(divPaginationLinks).click(function() {     
            var thisHref = $(this).attr("href");
            loadPiece(thisHref,divName, divClassName);
            return false;
        });
    });
}

function loadingImage(divName) {
	$(divName).attr('innerHTML','<center><img src="/img/loadingAnimation.gif" alt="Please wait. Loading ..."/></center>');
}