function checkCompability(){var a=false;var b=BrowserDetect.version;var c=BrowserDetect.browser;if(c=="Safari"){if(b<4)a=true}if(c=="Explorer"){if(b<8)a=true}if(a)document.getElementById("compabilityBox").style.display="block"}function close(a){document.getElementById("compabilityBox").style.display="none"}function Gallery(){this.rows=[];this.rowPrototypes=[];this.target=null;this.getGalleryRows=function(){$.ajax({url:"api/gallery.php",context:this,success:function(a){if(BrowserDetect.version<8&&BrowserDetect.browser=="Explorer"){inc("js/json2-min.js")}this.rowPrototypes=JSON.parse(a);this.doRender()}})};this.doRender=function(){var a=this.rowPrototypes;for(var b=0;b<a.length;b++){var c=new ImageRow(a[b]);c.getRowObj();this.rows[b]=c;c.index=b;c.parent=this}};this.renderInBox=function(a){this.target=a;this.getGalleryRows()}}function ImageRow(a){this.index=-1;this.images=[];this.rowPrototype=a;this.parent=null;this.rowObj=function(){var a=document.createElement("div");a.setAttribute("class","imageRow");return a};this.getRowObj=function(){var a=this.rowPrototype["images"];var b=[];var c=this.rowObj();var d=0;for(var e=0;e<a.length;e++){var f=new ImageBox(a[e]);f.parent=this;f.index=e;this.images[e]=f;f.process();d+=f.thumbWidth+4}return}}function ImageBox(a){this.index=-1;this.name=null;this.imagePrototype=a;this.src=null;this.width=0;this.height=0;this.thumbHeight=0;this.thumbWidth=0;this.parent=null;this.comment=null;this.process=function(){this.name=this.imagePrototype["name"];this.src=this.imagePrototype["src"];this.width=this.imagePrototype["width"];this.height=this.imagePrototype["height"];this.comment=this.imagePrototype["comment"];this.processThumbSize(this.width,this.height)};this.processThumbSize=function(a,b){var c=thumbHeight/b;this.thumbWidth=a*c;this.thumbHeight=thumbHeight};this.getFullSizeSrc=function(){var a=window.innerHeight;if(this.width<this.height){if(a<700){return this.src.replace("/rows/","/rows-630/")}}return this.src};this.getThumbSrc=function(){var a=/\/rows\/(.+?)\//;var b=this.src.match(a);var c=this.src.replace(b[0],"/thumbs/");return c.replace("jpg","png")};this.getThumbObj=function(){this.process();var a=new Image;a.src=this.getThumbSrc();a.onclick=this.displayImage;a.index=this.index;a.fullSizeSrc=this.getFullSizeSrc();a.parent=this;return a};this.displayImage=function(){var a=this.parent.parent.rows;var b=[];var c=0;var d=0;var e=this.parent.index;var f=this.index;for(var g=0;g<a.length;g++){var h=a[g];for(var i=0;i<h.images.length;i++){b[c]=new Array(h.images[i].getFullSizeSrc(),h.images[i].comment);if(g==e&&i==f)d=c;c++}}jQuery.slimbox(b,d)}}function activate(a,b){if(!sharedGallery){alert("Error loading gallery tree information");return}var c=sharedGallery.rows[a];var d=c.images[b];d.displayImage()}function inc(a){var b=document.getElementsByTagName("body").item(0);script=document.createElement("script");script.src=a;script.type="text/javascript";b.appendChild(script)}var thumbHeight=90;var sharedGallery=null;var BrowserDetect={init:function(){this.browser=this.searchString(this.dataBrowser)||"An unknown browser";this.version=this.searchVersion(navigator.userAgent)||this.searchVersion(navigator.appVersion)||"an unknown version";this.OS=this.searchString(this.dataOS)||"an unknown OS"},searchString:function(a){for(var b=0;b<a.length;b++){var c=a[b].string;var d=a[b].prop;this.versionSearchString=a[b].versionSearch||a[b].identity;if(c){if(c.indexOf(a[b].subString)!=-1)return a[b].identity}else if(d)return a[b].identity}},searchVersion:function(a){var b=a.indexOf(this.versionSearchString);if(b==-1)return;return parseFloat(a.substring(b+this.versionSearchString.length+1))},dataBrowser:[{string:navigator.userAgent,subString:"Chrome",identity:"Chrome"},{string:navigator.userAgent,subString:"OmniWeb",versionSearch:"OmniWeb/",identity:"OmniWeb"},{string:navigator.vendor,subString:"Apple",identity:"Safari",versionSearch:"Version"},{prop:window.opera,identity:"Opera",versionSearch:"Version"},{string:navigator.vendor,subString:"iCab",identity:"iCab"},{string:navigator.vendor,subString:"KDE",identity:"Konqueror"},{string:navigator.userAgent,subString:"Firefox",identity:"Firefox"},{string:navigator.vendor,subString:"Camino",identity:"Camino"},{string:navigator.userAgent,subString:"Netscape",identity:"Netscape"},{string:navigator.userAgent,subString:"MSIE",identity:"Explorer",versionSearch:"MSIE"},{string:navigator.userAgent,subString:"Gecko",identity:"Mozilla",versionSearch:"rv"},{string:navigator.userAgent,subString:"Mozilla",identity:"Netscape",versionSearch:"Mozilla"}],dataOS:[{string:navigator.platform,subString:"Win",identity:"Windows"},{string:navigator.platform,subString:"Mac",identity:"Mac"},{string:navigator.userAgent,subString:"iPhone",identity:"iPhone/iPod"},{string:navigator.platform,subString:"Linux",identity:"Linux"}]};BrowserDetect.init()
