function showImage(url, w, h){
  $("#galleryImage").attr("src",url);

  $("#galleryImage").attr("width", w);
  $("#galleryImage").attr("height", h);

  $("div.galleryOverlay").overlay({
        top: 'center',
        left: 'center',

        expose: {
            color: '#000000',
            opacity: 0.75
        },
        api: true
    }).load();

    $("div.galleryOverlay").click( function() {
        $("div.galleryOverlay").overlay({api:true}).close();
        }
    );
}

$(document).ready(function() {
    if(typeof(ImagePaths) != 'undefined') {
    if(ImagePaths.length > 0) {
        jQuery.each(ImagePaths,function(i, l) {
            $('#travelImages').prepend('<li><img src="' + l + '" /></li>');
        });

        $("#travelImages img").hover(function() {
            $(this).css({'z-index' : '10'});
            $(this).stop()
                .animate({
                    marginTop: '0px',
                    width: '180px'
                }, 250);
            } , function() {
            $(this).css({'z-index' : '0'});
            $(this).stop()
                .animate({
                    marginTop: '13px',
                    width: '120px'
                }, 200);
        });

        $("#travelImages img").each(function() {
            $(this).click(function() {
                showImage($(this).attr("src"), 800, 400);
            })
        });
    }
    }
});

