
function getFlickr(userid, target, numberToDisplay) {

var url = "http://api.flickr.com/services/feeds/photos_public.gne?id=" 
 + userid + "&lang=en-us&format=json&jsoncallback=?";

    $.getJSON(url, displayImages);

    function displayImages(data) {
        var htmlString = "";

        var ctr = 0;
        $.each(data.items, function(i, item) {

            if (ctr < numberToDisplay) {
                var sourceSquare = 
                    (item.media.m).replace("_m.jpg", "_s.jpg");
                var sourceOrig = 
                    (item.media.m).replace("_m.jpg", ".jpg");

                htmlString += '<a href="' + sourceOrig + 
                    '" class="preview" title="' + item.title + 
                    '" target="_blank" style= "opacity:1;">';
                htmlString += '<img style="padding-right:10px; padding-top:5px; width:86px; border:0;" title="' + item.title + 
                    '" src="' + sourceSquare + '" ';
                htmlString += 'alt="' + item.title + 
                    '" style= "opacity: 1;" onmouseover="this.style.opacity=0.6;" onmouseout="this.style.opacity=1;"/>';
                htmlString += '</a>';
                ctr = ctr + 1
            }
        });

        $('#' + target).append(htmlString);

        //update image preview so we get 
        //the nice popup mouseovers on the images
        //Note: this uses the Image Preview Script, 
        //if not using it remove the below line.



        imagePreview();            
    }
}


