window.onload=function(){ initImages(); }; // for preloading images and rollovers var aryLoadImg = new Array(); var ncImgOver = '_over'; // naming convention for image files ie. "img1.jpg" rolls to "img1_over.jpg" var ncClsRoll = 'roll'; // the class name that designates the image has rollover functionality var ncClsRollSel = 'roll_selected'; // the class name that designates the image has rollover functionality returning to FL's selected mode function loadImg(imgFile, imgType){ var i = aryLoadImg.length; aryLoadImg[i] = new Image(); aryLoadImg[i].src = imgFile + '.' + imgType; return i; } function swapImg(imgId, imgSrc){ if(document.images){ document.images[imgId].src = imgSrc; } } function initImages() { if (!document.getElementsByTagName) return; var aryImages = document.getElementsByTagName('img'); var regex_roll = new RegExp('\\b'+ncClsRoll+'\\b'); var regex_rolls = new RegExp('\\b'+ncClsRollSel+'\\b'); for (var i = 0; i < aryImages.length; i++) { var currentselid = 0; var thisImg = aryImages[i]; // this is used for single image roll overs if(thisImg.className.match(regex_roll)){ var imgFile = thisImg.src.substr(0, thisImg.src.length-4); var imgType = thisImg.src.substr(thisImg.src.length-3, thisImg.src.length); var roll_idx = loadImg(imgFile+ncImgOver, imgType); thisImg.roll_idx = roll_idx; thisImg.onmouseover = function(){ try { swapImg( this.id, aryLoadImg[this.roll_idx].src ); } catch(e) { /*alert(e);*/ } }; thisImg.onmouseout = function(){ try { var regex_ncImgOver = new RegExp(ncImgOver+'\.'); swapImg( this.id, this.src.replace(regex_ncImgOver, '.') ); } catch(e) { /*alert(e);*/ } }; } else if(thisImg.className.match(regex_rolls)){ var imgFile = thisImg.src.substr(0, thisImg.src.length-5); var imgType = thisImg.src.substr(thisImg.src.length-3, thisImg.src.length); var roll_idx = loadImg(imgFile+ncImgOver, imgType); thisImg.roll_idx = roll_idx; thisImg.onmouseover = function(){ try { swapImg( this.id, aryLoadImg[this.roll_idx].src ); } catch(e) { /*alert(e);*/ } }; thisImg.onmouseout = function(){ try { var regex_ncImgOver = new RegExp(ncImgOver+'\.'); swapImg( this.id, this.src.replace(regex_ncImgOver, 's.') ); } catch(e) { /*alert(e);*/ } }; } } } function videobox(url){ window.open("http://www.pbs.org/mormons/view/"+url+".html","video","toolbar=no,location=no,directories=no,menubar=no,width=680,height=700,scrollbars=yes"); }