$(document).ready(function() {
    $('.thumbnail > a').bind('click', function(e) {
        changeImage('zoom1', this.href, this.name);
        return false;
    });
    $('.thumbnail > a:first').click();  
});

function changeImage(id, img_b, img_s) {
    $("#" + id).attr('href', img_b);
    $("#" + id + " > img").attr('src', img_s);
    refresh(id);
}

function refresh(id) {
    $("#" + id).unbind();
    $("#" + id).magiczoom({
        zoomWidth: 350,
        zoomHeight: 350,
        zoomType: 'standard',
        xOffset: 30, 
        title: false,
        preloadText: ''
    });
}
