var current_image_id;

$(document).ready(function($) {

//    logMessage('loading: image-effects.js');

/*
    //bind all anchor tags with rel="facebox" to load in a facebox popup
    var bindBehaviors = function() {
        logMessage('bindBehaviors');
        $('a[rel*=facebox]').facebox();
    }

    //bind facebox events when page first loaded
    bindBehaviors();
*/
    //add hover effect to thumbnails
    $("a.thumb", this).click(function() 
    {
        var image_id = this.id;

        if (current_image_id != image_id) 
        {
            //logMessage('thumb clicked ' + image_id);

            jQuery.ajax({
                type: "POST",
                url: "/image/index/" + image_id,
                dataType : "html",
                success: function(xml){
                    $("#featured").remove();
                    $("#image_midsize_container").prepend(xml);

                    //logMessage('server response: ' + xml);
                    current_image_id = image_id;
                }
            });
        }

        //bind click events on the new 'enlarge image' links
        //bindBehaviors();

        return false;
    });


});// document ready


/**
 * append a message to the messages div in website_template
 */
function logMessage(msg) {
    $("#messages").append('<span>'+ msg +'</span>');
}
