function jGallery(garray,cols,rows){gcount=(typeof gcount=="undefined")?1:gcount+1;this.gcount=gcount;this.galleryarray=garray;this.cols=cols;this.rows=rows;this.pagecount=Math.ceil(this.galleryarray.length/(cols*rows));document.write('<div class="screen"><div class="images" id="gallery-'+gcount+'">');for(var r=0;r<rows;r++){for(var c=0;c<cols;c++)document.write('<div class="thumb"></div>')};document.write('</div>');document.write('</div><div class="inbox"><div class="nav" id="page-'+gcount+'"></div></div>');var gdiv=document.getElementById("gallery-"+this.gcount);var pdiv=document.getElementById("page-"+this.gcount);gdiv.onselect=function(imgobj,linkobj){return true};this.showpage(gdiv,startpage);this.createNav(gdiv,pdiv);gdiv.onclick=function(e){return jGallery.defaultselectaction(e,this)};return gdiv}jGallery.prototype.createImage=function(imgparts){var lnkt;if(linkinfo!=''){lnkt=linkinfo;}else{lnkt=imgparts[1];}var imageHTML='<IMG src="'+imgparts[0]+'" title="'+lnkt+'" border="0"/>';if(typeof imgparts[2]!="undefined"&&imgparts[2]!=""){var linktarget=imgparts[3];imageHTML='<A href="'+geturl+imgparts[2]+'" target="'+linktarget+'" onfocus="blur();">'+imageHTML+'</A>'}if(typeof imgparts[1]!="undefined"&&imgparts[1]!="");imageHTML+='<b>'+imgparts[1]+'</b>';return imageHTML};jGallery.prototype.showpage=function(gdiv,pagenumber){var totalitems=this.galleryarray.length;var showstartindex=pagenumber*(this.rows*this.cols);var showendindex=showstartindex+(this.rows*this.cols);var tablecells=gdiv.getElementsByTagName("DIV");for(var i=showstartindex,currentcell=0;i<showendindex&&i<totalitems;i++,currentcell++)tablecells[currentcell].innerHTML=this.createImage(this.galleryarray[i]);while(currentcell<tablecells.length){tablecells[currentcell].innerHTML="";currentcell++}};jGallery.prototype.createNav=function(gdiv,pdiv){var instanceOfGallery=this;var navHTML="";for(var i=0;i<this.pagecount;i++){if(i!=0){pginf=i}else{pginf=int}if(i>fin){zp=''}else{zp='<A href="'+linkpage+i+'" rel="'+i+'" onfocus="javascript:pageTracker._trackPageview(\'jGallery/Page-'+i+'\')">'+pginf+'</A>'}navHTML+=zp;pdiv.innerHTML=navHTML;var navlinks=pdiv.getElementsByTagName("A");navlinks[0].className="on";this.previouspage=navlinks[0]}for(var i=0;i<navlinks.length;i++){navlinks[i].onclick=function(){instanceOfGallery.previouspage.className="ov";this.className="on";instanceOfGallery.showpage(gdiv,this.getAttribute("rel"));instanceOfGallery.previouspage=this;return false}}};jGallery.defaultselectaction=function(e,gdiv){var evtobj=e||window.event;var clickedobj=evtobj.target||evtobj.srcElement;if(clickedobj.tagName=="IMG"){var linkobj=(clickedobj.parentNode.tagName=="A")?clickedobj.parentNode:null;return gdiv.onselect(clickedobj,linkobj)}};