function addCaption( oImgElem, bUseCaptionMarker ) { // Check that image element not already have a div.imgblock as parent. if( oImgElem.parentNode && oImgElem.parentNode.className=="imgblock") return; // Create the div.imgblock element var oImgBlockElem = document.createElement("div"); oImgBlockElem.className = "imgblock"; oImgBlockElem.style.styleFloat = oImgElem.style.styleFloat; oImgElem.style.styleFloat = "none"; if( oImgElem.className.search("leftjust") >= 0 ) { oImgBlockElem.className = oImgBlockElem.className + " leftjust"; oImgElem.className = oImgElem.className.replace("leftjust",""); } if( oImgElem.className.search("rightjust") >= 0 ) { oImgBlockElem.className = oImgBlockElem.className + " rightjust"; oImgElem.className = oImgElem.className.replace("rightjust",""); } var oHandle = oImgElem; // oHandle is element that should be moved into our div.imgblock element // If the current image has a parent A (anchor/hyperlink) element then // we would also like that to go into our div.imgblock, therefore the oHandle // is adjusted to point to the A element. if( oImgElem.parentNode.tagName == "A" ) { oHandle = oImgElem.parentNode; } // alert("Before for '" + oImgElem.alt + "'"); // Replace the oHandle node (the img or a) with our new div.imgblock element. var oOldHandle = oHandle.parentNode.replaceChild(oImgBlockElem,oHandle); // This line sometimes crash in IE with error R6025! if( false ) //bUsePhotoShadow ) { var oPhotoShadowElem = document.createElement("div"); oPhotoShadowElem.className = "photoshadow"; oImgBlockElem.appendChild(oPhotoShadowElem); oPhotoShadowElem.appendChild(oOldHandle); } else { oImgBlockElem.appendChild(oOldHandle); } //oImgBlockElem.appendChild(oOldHandle); oHandle=null; // alert("After for '" + oImgElem.alt + "'"); // Create div.caption element var oCaptionElem = document.createElement("div"); oCaptionElem.className = "imgcaption"; oCaptionElem.style.marginLeft = oImgElem.style.marginLeft; if( /*false &&*/ bUseCaptionMarker ) { // Create div.caption-marker element var oCaptionMarkerElem = document.createElement("div"); oCaptionMarkerElem.className = "captionmarker"; var oCaptionMarkerTextElem = document.createTextNode("\u00bb"); oCaptionMarkerElem.appendChild(oCaptionMarkerTextElem); oCaptionElem.appendChild(oCaptionMarkerElem ); } if( /*false*/true ) { // Create div.caption-text element with appropriate alt text var oCaptionTextElem = document.createElement("div"); oCaptionTextElem.className = "captiontext"; var oCaptionText = document.createTextNode( oImgElem.alt ); oCaptionTextElem.appendChild(oCaptionText ); oCaptionElem.appendChild(oCaptionTextElem); } // Check whether copyright element should be handled... if( /*false &&*/ oImgElem.getAttribute("copyright") != null ) { // Create div.copyright element with appropriate bolded text according to | delimiter (if any)... var oCopyrightElem = document.createElement("div"); oCopyrightElem.className = "copyright"; //var oCopyrightText = document.createTextNode( oImgElem.getAttribute("copyright") ); var oCopyrightText = document.createElement("span"); // Convert all texts before a possible '|' character into a bold-face... ostr = oImgElem.getAttribute("copyright").replace(new RegExp("[^|]* |"),"$&"); oCopyrightText.innerHTML = ostr; oCopyrightElem.appendChild(oCopyrightText); oCaptionElem.appendChild(oCopyrightElem ); } if( oImgElem.getAttribute("camera") != null ) { // Adds extra