function labsGallery(){}labsGallery.prototype.notes=new Array();labsGallery.prototype.reload=0;labsGallery.prototype.timer=null;labsGallery.prototype.divs=new Array();labsGallery.prototype.images=new Array();labsGallery.prototype.thumbsOnly=false;labsGallery.prototype.init=function(a,d){this.images=a;labsElement.forceDisplayStyle(this.images.length>=2&&this.thumbsOnly==false,["contentGalleryM"]);if(this.images.length==0){return true}if(d>0){this.reload=d+1}else{this.reload=0}if(this.thumbsOnly==true){this.loadThumbnail(0);return true}var c=new RegExp("#(play|pause)(\\d+)");var b=document.location.hash.match(c);if(b!=null){this.load(labsUtils.toInt(b[2]));labsFader.init("contentGallery",labsUtils.toInt(b[2]));if(b[1]=="play"){labsElement.get("contentGalleryPP").src="/galleryPause.png?"+oaService.release;window.setTimeout(function(){labsGallery.play()},labsFader.playTempo)}window.setTimeout(function(){var e=labsElement.getPosition("contentGallery");window.scrollTo(0,e[1])},1000)}else{this.load(0);
labsFader.init("contentGallery")}labsFader.callback.contentGallery=function(e){labsGallery.drawNotes(e);labsGallery.load(e)};this.drawNotes(labsFader.current.contentGallery)};labsGallery.prototype.checkReload=function(a){if(this.reload>0){if(this.reload==1){if(labsFader.play.contentGallery!=false){document.location.href="#play"+labsFader.current.contentGallery}else{document.location.href="#pause"+labsFader.getId("contentGallery",a)}document.location.reload();return false}this.reload--}return true};labsGallery.prototype.hideNotes=function(){for(var a in this.divs){labsElement.get("contentGallery").removeChild(labsElement.get(a))}this.divs=new Array()};labsGallery.prototype.drawNotes=function(b){this.hideNotes();if(labsFader.play.contentGallery!=false){if((labsFader.nodes.contentGallery.length-1)==b){this.play()}this.checkReload()}for(var a in this.notes[b]){this.drawNote(labsFader.nodes.contentGallery[b].childNodes[0],a,this.notes[b][a])}};labsGallery.prototype.drawNote=function(e,c,j){var a=document.createElement("div");
var f=labsElement.getPosition(e);var d=Math.floor(j.x1/100*e.width)+f[0];var i=Math.floor(j.y1/100*e.height)+f[1];var b=Math.floor(j.x2/100*e.width)+f[0];var h=Math.floor(j.y2/100*e.height)+f[1];a.id="cntGalleryDiv"+c;a.style.width=(b-d)+"px";a.style.height=(h-i)+"px";a.style.margin="0";a.style.padding="0";a.style.position="absolute";a.style.border="1px solid #000";a.style.left=d+"px";a.style.top=i+"px";a.onmouseover=function(){labsGallery.note(j.t,d,h+5)};var g=document.createElement("div");g.style.width=(b-d-2)+"px";g.style.height=(h-i-2)+"px";g.style.margin="0";g.style.padding="0";g.style.border="1px solid #fff";a.appendChild(g);labsElement.get("contentGallery").appendChild(a);this.divs[a.id]=true};labsGallery.prototype.note=function(b,a,c){if(this.timer){window.clearTimeout(this.timer)}b=b||false;labsElement.forceDisplayStyle((b!=false),["contentGalleryN"]);if(b==false){return}this.timer=window.setTimeout(function(){labsGallery.note(false)},3000);labsElement.get("contentGalleryN").style.left=a+"px";
labsElement.get("contentGalleryN").style.top=c+"px";labsElement.setValue("contentGalleryN",b)};labsGallery.prototype.show=function(a){if(this.thumbsOnly==true){var b=this.images.images[a].match(/labsLightBox\.open\('(.+?)','(.+?)','img'\);/);if(b!=null){labsLightBox.open(b[1],b[2],"img")}return false}if(typeof(a)!="boolean"){this.load(a);labsFader.fade("contentGallery",a);this.hideNotes();a=true}if(a==false&&this.images.loaded==false){this.loadThumbnail(0)}labsElement.forceDisplayStyle(a,["contentGalleryP","contentGallery"],["contentGalleryT"])};labsGallery.prototype.loadThumbnail=function(a){if(this.images.thumbnails[a]==undefined){this.images.loaded=true;return false}labsElement.setValue("contentGalleryA-"+a,this.images.thumbnails[a].replace(/<ignore/g,"<img src"));window.setTimeout(function(){labsGallery.loadThumbnail(a+1)},50)};labsGallery.prototype.load=function(a){for(var b=Math.max(a-1,0);b<=Math.min(a+1,this.images.length-1);b++){if(this.images.images[b]!=false){labsElement.setValue("contentGallery-"+b,this.images.images[b].replace(/<ignore/g,"<img src"));
this.images.images[b]=false}}};labsGallery.prototype.next=function(a){this.hideNotes();if(this.checkReload(a)==true){labsFader.fade("contentGallery",a)}this.pause()};labsGallery.prototype.play=function(){if(labsFader.play.contentGallery!=false){this.pause()}else{labsElement.get("contentGalleryPP").src="/galleryPause.png?"+oaService.release;this.hideNotes();labsFader.play("contentGallery")}};labsGallery.prototype.pause=function(){labsElement.get("contentGalleryPP").src="/galleryPlay.png?"+oaService.release;labsFader.pause("contentGallery")};var labsGallery=new labsGallery();