Unable to retrieve Featured Content at this time.
")
);
});
// add the loading message
$("#featuredImage").empty().append(
$("
").addClass("largeLoading")
.html("
Loading...")
);
// get our thumbnails
// pass the date/time in order to keep IE and Firefox from caching the page
$.get("/featuredContent.action",
{cacheFix : new Date().getTime()},
function(data){
// get our JSON data
imageData = unwrapJson(data);
var imagesRetrieved = false;
// display each image
$.each(imageData.lightboxContents.damResults,
function(i, metadata) {
var imageRef = "";
if (imageData.useStaticImagery) {
imageRef = "filename=" + metadata.fileName;
}
else {
imageRef = "guid=" + metadata.GUID;
}
imagesRetrieved = true;
var url = "/imageRetrieve.action"
+ "?" + imageRef
+ "&type=0"
+ "&imageHeight=77";
// use thumbnail type and add the image
$("
").addClass("thumb")
.click(imageClicked)
.load(function () {
$(this).fadeIn();
})
.hide()
.attr("id", "image"+i)
.attr("alt", "Thumbnail with VIRIN: "+metadata.VIRIN)
.attr("title", "Click to view this image (VIRIN: "+metadata.VIRIN+")")
.attr("longdesc", metadata.captionTruncated)
.appendTo($("#featuredThumbnails"))
.attr("src", url);
});
if (imagesRetrieved) {
// switch the image to the 1st one
switchImage(0);
}
});
}
/**
* Switches the featured image to the given image index
*/
function switchImage(arrayIndex) {
if ($("#featuredImage .largeLoading").length === 0) {
// change the featured image to the loading message
$("#featuredImage").empty().append(
$("
").addClass("largeLoading")
.html("
Loading...")
);
}
// deselect all thumbnails
$(".thumb").removeClass("selected");
// apply the "selected" class to the clicked image
var thumbnailID = "image"+arrayIndex;
$("#"+thumbnailID).addClass("selected");
// get the metadata for this image
var metadata = imageData.lightboxContents.damResults[arrayIndex];
var imageRef = "";
var isStatic = false;
if (imageData.useStaticImagery) {
imageRef = "filename=" + metadata.fileName;
isStatic = true;
}
else {
imageRef = "guid=" + metadata.GUID;
}
// update the image source to use the preview sized image
var url = "/imageRetrieve.action"
+ "?" + imageRef
+ "&type=1"
+ "&imageWidth=380"
+ "&imageHeight=240";
// Generate the asset details URL (unused if isStatic is true)
var assetDetailsURL = "/assetDetails.action" + "?guid=" + metadata.GUID;
$("
").addClass("feature")
.load(function () {
$("#featuredImage").empty();
if (!isStatic) {
var assetDetailsLink = document.createElement("a");
assetDetailsLink.href = assetDetailsURL;
$("#featuredImage").append(assetDetailsLink);
var appendElt = $("#featuredImage>a");
}
else {
var appendElt = $("#featuredImage");
}
appendElt.append($(this));
$(this).fadeIn();
})
.hide()
.attr("alt", "Featured image with VIRIN: "+metadata.VIRIN)
.attr("title", "Featured image with VIRIN: "+metadata.VIRIN+((!isStatic)?" (Click to view still image details)":""))
.attr("longdesc", metadata.captionTruncated)
.attr("src", url);
// update all the metadata fields
$(".titleText").text(metadata.VIRIN);
$(".captionText").text(metadata.captionTruncated);
$("#dateTaken").text(metadata.dateTakenFormatted);
$("#photographerName").text(metadata.photographerName);
$("#assetLocation").text(metadata.location);
if (!isStatic) {
//var assetDetailsLink = $("
").attr("href", assetDetailsURL);
// line above doesn't work in IE; the 3 lines below are an ugly hack to fix this
// jQuery syntax restored in the 4th line below
var assetDetailsLink = document.createElement("a");
assetDetailsLink.href = assetDetailsURL;
$(".captionText").append(" ").append(assetDetailsLink);
$(".captionText>a").text("More Details")
.addClass("arrowLink");
// Add the asset details link to the media type icon
$("#imageTypeIcon").attr("href", assetDetailsURL);
var imageDownloadURL = "javascript:downloadPopUp('/imageDownload.action" + "?guid=" + metadata.GUID + "')";
// update the image download link
$("#imageDownloadLink").attr("href", imageDownloadURL);
}
else {
// Remove the link from the Still Image icon
$("#imageTypeIcon").before(
$("#imageTypeIcon img").attr("alt", "Still Image").attr("title", "Still Image"))
.remove();
// Remove the Download Image icon
$("#imageDownloadLink").remove();
}
}
/**
* Callback/event handler for when images are clicked
*/
function imageClicked() {
// what image was clicked?, trim off the leading "image"
var arrayIndex = $(this).attr("id").substring(5);
switchImage(arrayIndex);
executeContentsChangedAlert("instant");
}
// Run initialLoad
$(document).ready(initialLoad);