If there is just one gallery per page (just one loadarea):
Code:
init:function(){ //Initialize thumbnail viewer script
this.iefiltercapable=(this.iefiltercapable && this.enableTransition) //True or false: IE filters supported and is enabled by user
var pagelinks=document.getElementsByTagName("a")
for (var i=0; i<pagelinks.length; i++){ //BEGIN FOR LOOP
if (pagelinks[i].getAttribute("rel") && /enlargeimage:/i.test(pagelinks[i].getAttribute("rel"))){ //Begin if statement: Test for rel="enlargeimage"
var initType=pagelinks[i].getAttribute("rel").split("::")[1] //Get display type of enlarged image ("click" or "mouseover")
if (initType=="mouseover"){ //If type is "mouseover", preload the enlarged image for quicker display
this.preloadedimages[this.preloadedimages.length]=new Image()
this.preloadedimages[this.preloadedimages.length-1].src=pagelinks[i].href
pagelinks[i]["onclick"]=function(){ //Cancel default click action
return false
}
}
pagelinks[i]["on"+initType]=function(){ //Load enlarged image based on the specified display type (event)
thumbnailviewer2.loadimage(this) //Load image
return false
}
if (this.hideimgmouseout)
pagelinks[i]["onmouseout"]=function(){
thumbnailviewer2.hideimage(this)
}
this.targetlinks[this.targetlinks.length]=pagelinks[i] //store reference to target link
} //end if statement
} //END FOR LOOP
thumbnailviewer2.loadimage(this.targetlinks[Math.floor(Math.random()*this.targetlinks.length)]);
} //END init() function
For multiple loadareas on a page (will also work with only one loadarea):
Code:
} //END FOR LOOP
for (var ars=[], t=this.targetlinks, i = t.length-1; i > -1; --i)
if(!thumbnailviewer2[t[i].rev.split('::')[0]+'_ar']){
thumbnailviewer2[t[i].rev.split('::')[0]+'_ar']=[t[i]];
ars[ars.length]=thumbnailviewer2[t[i].rev.split('::')[0]+'_ar'];
}
else
thumbnailviewer2[t[i].rev.split('::')[0]+'_ar'][thumbnailviewer2[t[i].rev.split('::')[0]+'_ar'].length]=t[i];
for (i = ars.length-1; i > -1; --i)
thumbnailviewer2.loadimage(ars[i][Math.floor(Math.random()*ars[i].length)]);
} //END init() function
Bookmarks