function GallerySetup(mainId,aSrc,aTitles,aIDs){imageDetails[mainId]=[];imageDetails[mainId].oLookup=[];imageDetails[mainId].aTitles=aTitles;imageDetails[mainId].aSrc=aSrc;for(var i=0;i<aIDs.length;i++){imageDetails[mainId].oLookup[aIDs[i]]=i;}}
function collectImage(mainId,ImageID,secondaryImageURL){if(!imageDetails[mainId]){imageDetails[mainId]=[];imageDetails[mainId].oLookup=[];imageDetails[mainId].aTitles=[];imageDetails[mainId].aSrc=[];}
var imageObject=document.getElementById(ImageID);if(imageObject.title){imageDetails[mainId].aTitles.push("'"+imageObject.title+"'");}else{imageDetails[mainId].aTitles.push("'"+"'");}
imageDetails[mainId].oLookup[ImageID]=imageDetails[mainId].aSrc.length;imageDetails[mainId].aSrc.push("'"+secondaryImageURL+"'");imageObject.setAttribute("mainID",mainId,0);}
function oI(imageID,event){var imageObject=document.getElementById(imageID);var IMD=imageDetails[imageObject.getAttribute("mainID")];var win=window.open('','_blank','status=yes,menubar=no,toolbars=no,scrollbars=yes,resizable=yes,height=500,width=500');win.document.write('<html><head><title>Image Gallery</title>');win.document.write('<script>var arrayofImages = new Array('+IMD.aSrc+');var arrayofAlts = new Array('+IMD.aTitles+');</script>');win.document.write('<script>var position = '+IMD.oLookup[imageObject.id]+';</script>');for(var i=0;i<document.styleSheets.length;i++){if(document.styleSheets[i].href){win.document.write('<link rel="StyleSheet" href="'+document.styleSheets[i].href+'" type="text/css" />');}}
win.document.write('</head><body class="ImageGalleryPopup">');win.document.write("<script>maxWidth = 0;maxHeight = 0;function resizeToWindow(width, height){var myWidth = 0, myHeight = 0;if( typeof( window.innerWidth ) == 'number' ) {myWidth = window.innerWidth;myHeight = window.innerHeight;");win.document.write("} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {myWidth = document.documentElement.clientWidth;myHeight = document.documentElement.clientHeight;}");win.document.write("else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {myWidth = document.body.clientWidth;myHeight = document.body.clientHeight;}");win.document.write('newmaxWidth = Math.max(width, Math.max(myWidth, maxWidth));newmaxHeight = Math.max(height, myHeight);if(newmaxWidth > maxWidth || newmaxHeight > maxHeight){window.resizeTo(newmaxWidth, newmaxHeight);}maxWidth = newmaxWidth;maxHeight = newmaxHeight;}');win.document.write("function getNextImage(direction){position = Math.min(Math.max(position + direction, 0), arrayofImages.length - 1);checkPreviousNext();document.getElementById('mainImage').src = arrayofImages[position];}");win.document.write("function checkPreviousNext(){if(position == 0){document.getElementById('previousImage').style.display = 'none';}else{document.getElementById('previousImage').style.display = 'inline';}if(position == arrayofImages.length - 1){");win.document.write("document.getElementById('nextImage').style.display = 'none';}else{document.getElementById('nextImage').style.display = 'inline';}document.getElementById('counterSpan').innerHTML = '(' + (position + 1) + '/' + arrayofImages.length + ')';");win.document.write("document.getElementById('altDiv').innerHTML = arrayofAlts[position];}");win.document.write('</script>');win.document.write('<div align=center><a onclick="getNextImage(-1);" class="ImageGalleryPopupNextPrevious" style="cursor:pointer;" id="previousImage">Previous</a>&nbsp;<span id="counterSpan">( )</span>&nbsp;');win.document.write('<a class="ImageGalleryPopupNextPrevious" style="cursor:pointer;" onclick="getNextImage(1);" id="nextImage">Next</a></div><div align=center id=altDiv></div><div align="center" class="mainImageSurround">');win.document.write('<img align="middle" id="mainImage" onload="resizeToWindow(this.offsetWidth+100, this.offsetHeight+150)" src=""></div>');win.document.write('<script>document.getElementById("mainImage").src = arrayofImages[position];checkPreviousNext();</script>');win.document.write('</body></html>');win.document.close();if(event){event.cancelBubble=true;}
return false;}
function imagePopup2(imageSrc,imageAlt,imageTitle){var win=window.open(imageSrc,'_blank','menubar=no,toolbars=no,scrollbars=yes');win.document.write('<html><head><title>image:: '+imageAlt+'</title></head><body class="ImageGalleryPopup"><table width="100%" height="100%"><tr><td valign="middle" align="center"><img onload="window.resizeTo(this.width+100, this.height+150)" alt="'+imageAlt+'" title="'+imageTitle+'" src="'+imageSrc+'"></td></tr></table></body></html>');win.document.close();}
function imageSwap(imageID,imageSrc){document.getElementById(imageID).src=imageSrc;}

