var fotogallery={time:null,moveTrack:6,moveDirection:0,tapeLength:0,gCont:null,imgBigArray:new Array,imgGallery:'foto',imgDescribe:'desc-title',imgAuthor:'desc-author',bigZoom:'zoom',bigLink:'big-url',bigBox:'foto-velke',bigCont:'velke-spoj',iB:null,_gE:function(o){return document.getElementById(o)},init:function(){var gallery=fotogallery._gE('gallery');fotogallery.gCont=fotogallery._gE('gs');function countTapeLenght(){var gHeight=parseInt(fotogallery._getstyle(gallery,'','height',1));var oneImgHeight=parseInt(fotogallery._getstyle(fotogallery.gCont.getElementsByTagName('img')[0],'','height',1));var oneDivMargin=parseInt(fotogallery._getstyle(fotogallery.gCont,'div','marginTop',1));var imgCount=fotogallery.gCont.getElementsByTagName('img').length;fotogallery.tapeLength=-((imgCount*oneImgHeight)+((imgCount+1)*oneDivMargin)+(imgCount*2)-gHeight)}if(navigator.userAgent.indexOf('KHTML')!=-1){fotogallery.gCont.getElementsByTagName('img')[0].onload=countTapeLenght}else{countTapeLenght()}},_getstyle:function(o,w,a,t){if(t==1){return o.currentStyle?o.currentStyle[a]:document.defaultView.getComputedStyle?document.defaultView.getComputedStyle(o,null).getPropertyValue(a):window.getComputedStyle(o,null)[a]}else{return o.getElementsByTagName(w)[0].currentStyle?o.getElementsByTagName(w)[0].currentStyle[a]:document.defaultView.getComputedStyle?document.defaultView.getComputedStyle(o.getElementsByTagName(w)[0],null).getPropertyValue("margin-top"):window.getComputedStyle(o.getElementsByTagName(w)[0],null)[a]}},fillBigArray:function(urlBig,widthBig,heightBig,desc,auth,authUrl){for(i=0;i<this.imgBigArray.length;i++){if(urlBig==this.imgBigArray[i].url){return 0}}var im=new Object();im.url=urlBig;im.width=widthBig;im.height=heightBig;im.desc=desc;im.auth=auth;im.authUrl=authUrl;this.imgBigArray[this.imgBigArray.length++]=im},_moveScroll:function(){if(fotogallery.gCont.style.marginTop){if(fotogallery.tapeLength<0){if((parseInt(fotogallery.gCont.style.marginTop)>=fotogallery.tapeLength&&fotogallery.moveDirection==-1)||(parseInt(fotogallery.gCont.style.marginTop)<=0&&fotogallery.moveDirection==1)){fotogallery.gCont.style.marginTop=(parseInt(fotogallery.gCont.style.marginTop)+(fotogallery.moveTrack*fotogallery.moveDirection))+'px'}else{clearInterval(fotogallery.time)}}}else
fotogallery.gCont.style.marginTop='0px'},scroll:function(move){this.moveDirection=move;fotogallery.time=setInterval(fotogallery._moveScroll,50)},endScroll:function(){clearInterval(this.time)},changeMedium:function(urlGallery,wGallery,hGallery,urlLarge,wLarge,hLarge,popis,author,authorUrl){var iG=this._gE(this.imgGallery);var iD=this._gE(this.imgDescribe);var iA=this._gE(this.imgAuthor);var bZ=this._gE(this.bigZoom);var bL=this._gE(this.bigLink);if(iG.src==urlGallery){return false};iG.style.visibility='hidden';iD.innerHTML=popis;if(authorUrl!=''){iA.innerHTML='<a href="'+authorUrl+'" target="_blank">'+author+'</a>'}else{iA.innerHTML=author}iG.src=urlGallery;iG.width=wGallery;iG.height=hGallery;iG.onload=show;function show(){iG.style.visibility='visible'}if(urlLarge!=''){iG.onclick=function(e){return fotogallery.viewBig(urlLarge,wLarge,hLarge,popis,author,e,authorUrl)};iG.title='ZVĚTŠIT.';bZ.className='';bL.href=urlLarge;bL.onclick=function(e){return fotogallery.viewBig(urlLarge,wLarge,hLarge,popis,author,e,authorUrl)};bL.title='ZVĚTŠIT'}else{bZ.className='hide';iG.onclick=null;bL.onclick=null;iG.title='ZAVŘÍT';bL.title=''}return false},viewBig:function(url,width,height,desc,auth,e,authUrl){var bB=this._gE(this.bigBox);bB.innerHTML='';bB.innerHTML='<div id="velke-spoj" class="foto"></div>';var bC=this._gE(this.bigCont);var HTML='';if(!e){e=window.event}if(e.preventDefault){e.preventDefault();e.stopPropagation()}else{e.returnValue=false}HTML='<div id="slide">';if(fotogallery.imgBigArray.length>=1){HTML+='<img src="" width="" height="" alt="" onclick="fotogallery.slide(-1)" id="arr-back" />';HTML+='<img src="" width="" height="" alt="" onclick="fotogallery.slide(1)" id="arr-next" />'}HTML+='</div>';HTML+='<div class="close" onclick="return fotogallery.closeBig();"><a href="#"></a></div>';HTML+='<img onclick="return fotogallery.closeBig();" src="'+url+'" width="'+width+'" height="'+height+'" id="bimg" style="visibility:hidden;" title="ZAVŘÍT" />';HTML+='<div class="popis"><strong id="b-desc-title">'+desc+'</strong>';if(desc!=''){HTML+='<br>'}if(authUrl!=''){HTML+='<small>© foto: <span id="b-desc-author"><a href="'+authUrl+'" target="_blank">'+auth+'</a></span></small></div>'}else{HTML+='<small>© Martin Čerňanský, www.lidova-architektura.cz<span id="b-desc-author">'+auth+'</span></small></div>'}bC.innerHTML=HTML;if(fotogallery.imgBigArray.length>0){if(url==fotogallery.imgBigArray[0].url){fotogallery._gE('arr-back').style.visibility='hidden'}if(url==fotogallery.imgBigArray[fotogallery.imgBigArray.length-1].url){fotogallery._gE('arr-next').style.visibility='hidden'}}fotogallery.iB=fotogallery._gE('bimg');if(!(document.all&&!window.opera)){bC.style.width=(width)+'px';bB.style.width=(width+10)+'px'}fotogallery.iB.style.visibility='hidden';if(fotogallery._gE('video-player')){fotogallery._gE('video-player').style.visibility='hidden'}function showB(){fotogallery.iB.style.visibility='visible'};fotogallery.iB.onload=showB;bB.style.display='block';return false},closeBig:function(){this._gE(this.bigBox).style.display='none';if(fotogallery._gE('video-player')){fotogallery._gE('video-player').style.visibility='visible'}return false},slide:function(move){var actUrl=fotogallery.iB.src;var desc=fotogallery._gE('b-desc-title');var author=fotogallery._gE('b-desc-author');var bB=this._gE(this.bigBox);var bC=this._gE(this.bigCont);for(i=0;i<fotogallery.imgBigArray.length;i++){if(fotogallery.imgBigArray[i].url==actUrl){if((i+move)<0||(i+move)>(fotogallery.imgBigArray.length-1)){}else{if(move==-1&&typeof(fotogallery.imgBigArray[i-2])=='undefined'){fotogallery._gE('arr-back').style.visibility='hidden'}else{fotogallery._gE('arr-back').style.visibility='visible'}if(move==1&&typeof(fotogallery.imgBigArray[i+2])=='undefined'){fotogallery._gE('arr-next').style.visibility='hidden'}else{fotogallery._gE('arr-next').style.visibility='visible'}fotogallery.iB.style.visibility='hidden';fotogallery.iB.src=fotogallery.imgBigArray[i+move].url;if(!(document.all&&!window.opera)){bC.style.width=(parseInt(fotogallery.imgBigArray[i+move].width))+'px';bB.style.width=(parseInt(fotogallery.imgBigArray[i+move].width)+10)+'px'}function showS(){fotogallery.iB.style.visibility='visible'}fotogallery.iB.onload=showS;fotogallery.iB.width=fotogallery.imgBigArray[i+move].width;fotogallery.iB.height=fotogallery.imgBigArray[i+move].height;desc.innerHTML=fotogallery.imgBigArray[i+move].desc;author.innerHTML=fotogallery.imgBigArray[i+move].auth;if(fotogallery.imgBigArray[i+move].authUrl!=''){author.innerHTML='<a href="'+fotogallery.imgBigArray[i+move].authUrl+'" target="_blank">'+fotogallery.imgBigArray[i+move].auth+'</a>'}else{author.innerHTML=fotogallery.imgBigArray[i+move].auth}}}}}}