function thumbViewInit(id) {
	suppressErrors();
	cellBlockId = id;
	context = "thumbview";
	initContext();
	setRefreshContentsMethod(thumbRefreshContents);
    setGetPhotosMethod(thumbGetPhotos);
	setShowThumbVidOverlayMethod(thumbShowThumbVidOverlay);
    setGetTotalMethod(thumbGetTotal);
    setMiddleDivNamer(function() { return "thumbCaptionFull";});
	showThumbPane();
	
	setTimeout("updateThumbNails('"+id+"')", updateTimer);
}

function thumbRefreshContents(){
	getThumbNails(cellBlockId);
	getThumbNailCount(cellBlockId);
}

function thumbGetPhotos() {
    return thumbViewPhotos;
}

function thumbShowThumbVidOverlay(pic, thumbWrap1) {
	var overlayRight = _div(null, "overlayRight");
	var overlay = _div(null, "overlay");
	var vidOverlayImg = image("cellblock/vidIcon7.png");
	createThumbHover(overlayRight, pic.USER, pic.CAPTION);
	overlayRight.onclick = function(){if(locked!=true){launchMugShotPopup(pic.ID);}};
	thumbWrap1.appendChild(overlayRight);
	overlayRight.appendChild(overlay);
	overlay.appendChild(vidOverlayImg);
}

function thumbGetTotal() {
    return thumbviewTotalCount;
}

function getThumbNails(id){
	cellBlockController.getThumbNails(id, currentPage*perPage, perPage, {
		callback:function(data) {
			//alert("In getThumbNails  " + DWRUtil.toDescriptiveString(data, 2));
			thumbViewPhotos = data;
		},
		async:false
	});
}

function getThumbNailCount(id){
	cellBlockController.getThumbNailCount( id, {
		callback:function(data) {
			thumbviewTotalCount = data;	
		},
		async:false
	});
}

function updateThumbNails(id){
	refreshContents();
	refreshThumbs();
	
	setTimeout("updateThumbNails('"+id+"')", updateTimer);
}
	
