var USED_FOR_PAGE=".";document.write("<style type=\"text/css\" media=\"screen\">@import \"/aspinclude/vismoWeb5/html/voliviewer.css\";<\/style>");var voliviewerVersion="1.6.3";var IS_VOLIVIEWER_OPENED_ON_IMAGE_CLICK=eval(getCookie("isImgOpenOnClick"))||false;var IS_OLDIMGMOVE_ALLOWED=false;var IS_OVER_IMAGE_LAYOUT=false;var MIN_IMGPANEL_WIDTH=420;var MIN_IMGPANEL_HEIGHT=400;var SLIDESHOW_STATES=[['doleva','12s',"left"],['doleva','8s',"left"],['doleva','5s',"left"],['doleva','3s',"left"],['doleva','1s',"left"],['doprava','1s',"right"],['doprava','3s',"right"],['doprava','5s',"right"],['doprava','8s',"right"],['doprava','12s',"right"]];var MIN_TIME_TO_SHOW_IMAGE_IN_SLIDESHOW=800;var IMAGE_DESCRIPTION_PLACE=0;var navigationButtons=['první','doleva','doprava','poslední','zavřít','otevřít prohlížeč obrázků','zmenšit do okna prohlížeče','zvětšit do původní velikosti','vypnout centrování obrázku','zapnout centrování obrázku','načítání obrázku...'];var request=null;var isCacheStarted=false;var connAsynchronous=false;var areImagesLoaded=false;var ANIMATION_TIME=10;var DEFAULT_OPACITY_VALUE=80;var MAX_OPACITY_OVERIMGLAYOUT=10;var MIN_STEP_OLDIMAGE=40;var BORDER_AROUND_IMAGE=20;var opacityValue=100;var images=Array();var imagesObj=null;var imgL=new Image();var timer1=null;var timer2=null;var timer3=null;var timer4=null;var timer5=null;var timer6=null;var timer7=null;var timer8=null;var timer9=null;var timer10=null;var oldScrollPosY;var isSetScrollPos=false;var screenWidth;var screenHeight;var browserWidth;var browserHeight;var actualObjectID=null;var oldImgSrc=null;var oldImgPosX=0;var oldImgPosY=0;var oldImgPosX_step=0;var oldImgWidth=0;var oldImgHeight=0;var isViewerOpened=false;var isViewerStarting=false;var isMoveLeft=true;var arrowLeft=null;var arrowRight=null;var slideshowWay="right";var slideshowInfo="--";var floatInfoPanelText="";var errorsCount=0;var img_pos=0;var imagesTestingCount=0;var areImagesCached=false;var areImagesPrepared=false;var isOneCycleError_Slideshow=false;var slideshow_imagesLoadErrorsCount=0;var isImageShowed=false;var slideshowTime=0;var cont_0=null;var cont_1=null;var cont=null;var wasSlideshow=false;var slideshowDefColor="";var isImageInfoWorking=false;var isFirstImg=true;var nextGalleryPages={previous:null,next:null};var isNextPageCrossingEnabled=true;var galleryPagesCount=1;var pagesURL=new Array();var slideshowSeconds=0;var actualPageIndex=getActualPageIndex(location.href);var isAnyAvailableImage=false;timer4=setTimeout(function(){if(location.href.indexOf(USED_FOR_PAGE)>-1){createRequestObject();prepareImages(0);}},0);function prepareTitles(v1,v2,v3,v4,v5,v6){SLIDESHOW_STATES=[[v1,'12s',"left"],[v1,'8s',"left"],[v1,'5s',"left"],[v1,'3s',"left"],[v1,'1s',"left"],[v2,'1s',"right"],[v2,'3s',"right"],[v2,'5s',"right"],[v2,'8s',"right"],[v2,'12s',"right"]];navigationButtons=[v3,v1,v2,v4,v5.split(';')[0],v6,v5.split(';')[1]?v5.split(';')[1]:navigationButtons[6],v5.split(';')[2]?v5.split(';')[2]:navigationButtons[7],v5.split(';')[3]?v5.split(';')[3]:navigationButtons[8],v5.split(';')[4]?v5.split(';')[4]:navigationButtons[9],v5.split(';')[5]?v5.split(';')[5]:navigationButtons[10]];}
function prepareImages(beginFrom){areImagesCached=false;if(!document.body){timer4=setTimeout(function(){prepareImages(beginFrom);},5);return;}
img_pos=0;try{if(location.href.indexOf(USED_FOR_PAGE)>-1){cont_1=document.body.getElementsByTagName("div");cont=null;for(var j=0;j<cont_1.length;j++){if(cont_1[j].className=="kontnahledy"){cont=cont_1[j];if(cont){var imgs=cont.getElementsByTagName("a");for(i=0;i<imgs.length;i++){if(imgs[i].getElementsByTagName("img").length>0){images[img_pos]=cont.getElementsByTagName("a")[i];img_pos++;}}}
if(!images){timer4=setTimeout(function(){prepareImages(beginFrom);},0);return;}
for(i=beginFrom;i<images.length;i++,beginFrom++){try{if(images[i].getAttribute("href").length>0){images[i].setAttribute("url",images[i].getAttribute("href"));images[i].setAttribute("id",i);if(IS_VOLIVIEWER_OPENED_ON_IMAGE_CLICK){images[i].onclick=function(e){getImageInfo(parseInt(this.id));return false;}}}}catch(e){}}}}}}
catch(e2){timer4=setTimeout(function(){prepareImages(beginFrom);},0);return;}
clearTimeout(timer4);areImagesPrepared=true;setTimeout(function(){cacheImages();},0);}
function cacheImages(){if(!images)return;try{var params=null;var id_obce=0;var id_galerie=0;var imagesIDs="";imagesObj=null;imagesObj=new Array();for(var i=0;i<images.length;i++){imagesObj[i]=new Image();params=parseURL(images[i].getAttribute("url"));try{params[0]=images[i].getElementsByTagName("img")[0].getAttribute("src").split("id_org=")[1].split("&")[0];}catch(err){}
id_obce=params[0];id_galerie=parseURL(window.location.href)[2];imagesIDs+=params[1]+",";if(params[3].length>0){imagesObj[i].src="/VismoOnline_ActionScripts/Image.aspx?id_org="+params[0]+"&id_obrazky="+parseInt(params[3]);}
else if(params[1].length>0&&params[3].length==0){var tempImgSrc="/VismoOnline_ActionScripts/Image.aspx?id_org="+params[0]+"&id_obrazky="+createRequest(1,params[0],params[1]);imagesObj[i].src=tempImgSrc.substring(0,tempImgSrc.length-1);}
else{imagesObj[i].src="";}}}catch(e){}
areImagesCached=true;if(imagesTestingCount==3)return;else imagesTestingCount++;if(verifyImgsCount()>0&&cont==null){timer4=setTimeout(function(){prepareImages(0);},0);return;}
if(imagesObj.length!=verifyImgsCount()){timer4=setTimeout(function(){prepareImages(0);},0);return;}
if(parseURL(window.location.href)[4]==1||getCookie("vhned")==1||getCookie("vhned")==4){getImageInfo(0,getCookie("vslideshow")!=-1?true:false,"begin");}
else if(parseURL(window.location.href)[4]==2||getCookie("vhned")==2||getCookie("vhned")==3){getImageInfo(images.length-1,getCookie("vslideshow")!=-1?true:false,"end");}
getNextPages();isAnyAvailableImage=false;for(var i=0;i<imagesObj.length;i++){if(imagesObj[i].src.indexOf("id_obrazky=")>-1){isAnyAvailableImage=true;break;}}}
function verifyImgsCount(){var imgsCount=0;for(var j=0;j<cont_1.length;j++){if(cont_1[j].className=="kontnahledy"){imgsCount+=cont_1[j].getElementsByTagName("a").length;}}
for(var j=0;j<cont_1.length;j++){if(cont_1[j].className=="kontnahledy"){var elems_help=cont_1[j].getElementsByTagName("a");for(var k=0;k<elems_help.length;k++){if(elems_help[k].parentNode.className=="popisek"){imgsCount--;}}}}
return imgsCount;}
function getImageInfo(objLink,isSlideshow){isImageInfoWorking=true;clearInterval(timer1);if(cont==null){prepareImages(0);return;}
if(imagesObj==null){prepareImages(0);return;}
if(imagesObj.length!=verifyImgsCount()){prepareImages(0);return;}
if(!areImagesPrepared){prepareImages(0);return;}
if(!isAnyAvailableImage){return;}
if(!isViewerOpened)createEventListeners();if(!isSetScrollPos){oldScrollPosY=document.body.scrollTop;isSetScrollPos=true;}
try{actualObjectID=objLink;isViewerStarting=true;var params=parseURL(document.getElementById(objLink).getAttribute("url"));try{params[0]=document.getElementById(objLink).getElementsByTagName("img")[0].getAttribute("src").split("id_org=")[1].split("&")[0];}catch(err){}
imgL.src=imagesObj[actualObjectID].src;if((imgL.src.indexOf("id_obrazky=")==-1&&arguments.length>2)||(imgL.src.indexOf("id_obrazky=")==-1&&arguments.length==1&&actualObjectID==0)){if(imgL.src.indexOf("id_obrazky=")==-1&&arguments.length==1&&actualObjectID==0){arguments[1]="false";arguments[2]="right";if(!isViewerOpened){var imgLWidth=imgL.width;var imgLHeight=imgL.height;showImage(objLink);isImageInfoWorking=false;changeImage(arguments[2],isSlideshow);return;}}
if(arguments[2]=="left"||arguments[2]=="right"){changeImage(arguments[2],isSlideshow);isImageInfoWorking=false;return;}
else if(arguments[2]=="begin"){changeImage("right",isSlideshow);isImageInfoWorking=false;return;}
else if(arguments[2]=="end"){changeImage("left",isSlideshow);isImageInfoWorking=false;return;}}
var imgLWidth=imgL.width;var imgLHeight=imgL.height;timer5=setTimeout(function(){showImage(objLink);isImageInfoWorking=false;},ANIMATION_TIME+50);}catch(e){}}
function parseURL(urlToParse){var arrayPos=0;parsedData_help=urlToParse.split("#");parsedData_help=parsedData_help[0].split("&");var parsedData=new Array(5);for(var i=0;i<5;i++){parsedData[i]="";}
for(var i=0;i<parsedData_help.length;i++){if(parsedData_help[i].indexOf("id_org=")>-1){parsedData[0]=parsedData_help[i].split("=")[1];}
if(parsedData_help[i].indexOf("id_fotopary=")>-1){parsedData[1]=parsedData_help[i].split("=")[1];}
if(parsedData_help[i].indexOf("id_galerie=")>-1){parsedData[2]=parsedData_help[i].split("=")[1];}
if(parsedData_help[i].indexOf("id_obrazky=")>-1){parsedData[3]=parsedData_help[i].split("=")[1];}
if(parsedData_help[i].indexOf("vhned=")>-1){parsedData[4]=parsedData_help[i].split("=")[1];}}
return parsedData;}
function areImgsLoaded(){var areImagesLoaded_help=true;for(var i=0;i<imagesObj.length;i++){if(images[i].getAttribute("href")!="javascript:void(0);"){areImagesLoaded_help=false;break;}}
areImagesLoaded=areImagesLoaded_help;}
function showImage(objLink){clearTimeout(timer5);clearTimeout(timer8);clearInterval(timer10);if(!areImagesLoaded)areImgsLoaded();document.body.scrollTop=0;window.document.body.style.overflow="hidden";var MAX_OPACITY=80;var MAX_OPACITY_INFOPANEL=80;try{var isIE=(navigator.userAgent.indexOf("MSIE ")>-1);var isFF=(navigator.userAgent.indexOf("Firefox/")>-1);var isSAF=(navigator.userAgent.indexOf("Safari/")>-1);screenWidth=window.innerWidth;screenHeight=window.innerHeight;browserWidth=document.body.clientWidth;browserHeight=isSAF?window.innerHeight:document.body.clientHeight;var imgPanel=null;if(document.getElementById("imgPanel")==null){imgBgPanel=document.createElement("div");imgPanel=document.createElement("div");navigationPanel=document.createElement("div");infoPanel=document.createElement("div");floatInfoPanel=document.createElement("div");document.getElementsByTagName("body")[0].appendChild(imgBgPanel);document.getElementsByTagName("body")[0].appendChild(imgPanel);document.getElementsByTagName("body")[0].appendChild(navigationPanel);document.getElementsByTagName("body")[0].appendChild(infoPanel);document.getElementsByTagName("body")[0].appendChild(floatInfoPanel);imgBgPanel.id="imgBgPanel";imgBgPanel.style.top=document.body.scrollTop;imgBgPanel.style.MozOpacity=MAX_OPACITY/100;imgBgPanel.style.opacity=MAX_OPACITY/100;imgBgPanel.style.filter="alpha(opacity="+MAX_OPACITY+")";imgBgPanel.onclick=function(e){if(!verifySecretEvents(e))return;closeImgPanel();}
imgPanel.id="imgPanel";navigationPanel.id="navigationPanel";navigationPanel.style.fontWeight="bold";var initImage_info=document.createElement("span");initImage_info.id="initImage_info";initImage_info.style.fontSize="10px";initImage_info.style.color="#FFFFFF";initImage_info.innerHTML=navigationButtons[10];navigationPanel.appendChild(initImage_info);infoPanel.id="infoPanel";if(IMAGE_DESCRIPTION_PLACE==0)infoPanel.innerHTML="<span class='voliviewer-info' id='voliviewer-info'>"+document.getElementById(actualObjectID).getElementsByTagName("img")[0].alt.toString()+"<\/span>";else if(IMAGE_DESCRIPTION_PLACE==1)infoPanel.innerHTML="<span class='voliviewer-info' id='voliviewer-info'>"+document.getElementById(actualObjectID).getElementsByTagName("span")[0].innerHTML.toString()+"<\/span>";infoPanel.innerHTML+="<div style='sf'><!-- --><\/div>";infoPanel.innerHTML+="<span class='voliviewer-counter' id='voliviewer-counter'>"+(getOnlyImagePosition()+1)+"/"+(getOnlyImagesCount()[0])+"<\/span>";var collectedCode="<div class='voliviewer-buttons'>";collectedCode+="<div class='voliviewer-slideshowInfo' id='slideshowInfo'><\/div>";collectedCode+="<div id='voliviewer-slideshow'>";for(var i=0;i<SLIDESHOW_STATES.length;i++){collectedCode+="<a href='javascript:void(0);' class='voliviewer-slideshow' onclick='setAsActiveSlideshowType(this);slideshowInfo=\""+SLIDESHOW_STATES[i][0]+"\";slideshow("+parseInt(SLIDESHOW_STATES[i][1])+",\""+SLIDESHOW_STATES[i][2]+"\");' onmouseover='floatInfoPanelText=\"SLIDESHOW: "+SLIDESHOW_STATES[i][0]+","+SLIDESHOW_STATES[i][1]+"\";setOverBackgroundColor(this,\"#339900\");' onmouseout='setOverBackgroundColor(this,\"#FFCC66\");'>&nbsp;&nbsp;<\/a>";}
collectedCode+="<\/div>";collectedCode+="&nbsp;&nbsp;<a href='javascript:void(0)' onclick='changeImage(\"begin\",false);' id='buttonBegin' onmouseover='floatInfoPanelText=\""+navigationButtons[0]+"\";'>|\<&nbsp;<\/a>";collectedCode+="&nbsp;&nbsp;<a href='javascript:void(0)' onclick='changeImage(\"left\",false);' id='buttonLeft' onmouseover='floatInfoPanelText=\""+navigationButtons[1]+"\";'>\<&nbsp;<\/a>";collectedCode+="&nbsp;&nbsp;<a href='javascript:void(0)' onclick='changeImage(\"right\",false);' id='buttonRight' onmouseover='floatInfoPanelText=\""+navigationButtons[2]+"\";'>\>&nbsp;<\/a>";collectedCode+="&nbsp;&nbsp;<a href='javascript:void(0)' onclick='changeImage(\"end\",false);' id='buttonEnd' onmouseover='floatInfoPanelText=\""+navigationButtons[3]+"\";'>\>|&nbsp;<\/a>";collectedCode+="&nbsp;&nbsp;&nbsp;<a href='javascript:void(0)' onclick='closeImgPanel();' id='buttonClose' onmouseover='floatInfoPanelText=\""+navigationButtons[4]+"\";'>X<\/a>";collectedCode+="<\/div>";infoPanel.innerHTML+=collectedCode;var controlButtons=["buttonBegin","buttonLeft","buttonRight","buttonEnd","buttonClose","voliviewer-slideshow"];for(var j=0;j<controlButtons.length;j++){document.getElementById(controlButtons[j]).onmousemove=function(e){setFloatInfoPanel(e,document.getElementById("floatInfoPanel"));}
document.getElementById(controlButtons[j]).onmouseout=function(e){document.getElementById("floatInfoPanel").style.display="none";}}
setSlideshowInfo(slideshowInfo);floatInfoPanel.id="floatInfoPanel";floatInfoPanel.style.position="absolute";floatInfoPanel.style.display="none";floatInfoPanel.style.zIndex=200;floatInfoPanel.className="voliviewer-floatInfoPanel";}
else{imgBgPanel=document.getElementById("imgBgPanel");navigationPanel=document.getElementById("navigationPanel");infoPanel=document.getElementById("infoPanel");imgPanel=document.getElementById("imgPanel");}
imgBgPanel.style.width=browserWidth;imgBgPanel.style.height=browserHeight;var imgPanelType=0;var tmpImgHeight=0;var AROUND_IMAGE_RESERVE=90;var max_top_offset=0;var act_image_height=0;if(IMAGE_DESCRIPTION_PLACE==0)document.getElementById("voliviewer-info").innerHTML=document.getElementById(actualObjectID).getElementsByTagName("span")[0].innerHTML.toString();else if(IMAGE_DESCRIPTION_PLACE==1)document.getElementById("voliviewer-info").innerHTML=document.getElementById(actualObjectID).getElementsByTagName("span")[0].innerHTML.toString();if(parseInt(imgL.height)+parseInt(document.getElementById("infoPanel").offsetHeight)+AROUND_IMAGE_RESERVE>parseInt(browserHeight)){var percents=90;imgPanelType=0;max_top_offset=0;act_image_height=((browserHeight*percents)/100)-document.getElementById("infoPanel").offsetHeight-BORDER_AROUND_IMAGE*2;max_top_offset=((browserHeight-document.getElementById("infoPanel").offsetHeight-BORDER_AROUND_IMAGE-act_image_height)/2);tmpImgHeight=act_image_height;while(tmpImgHeight>parseInt(imgL.height)){percents-=10;tmpImgHeight=(parseInt(browserHeight)*percents)/100;}
if(tmpImgHeight+AROUND_IMAGE_RESERVE>browserHeight){}
setImgPanelSizes(imgPanel,imgPanelType,tmpImgHeight);}
else{imgPanelType=1;max_top_offset=0;act_image_height=imgL.height;tmpImgHeight=act_image_height;setImgPanelSizes(imgPanel,imgPanelType,tmpImgHeight);max_top_offset=((browserHeight-document.getElementById("infoPanel").offsetHeight-BORDER_AROUND_IMAGE-document.getElementById("imgPanel").offsetHeight)/2);}
imgPanel.style.left=(browserWidth-parseInt(imgPanel.style.width))/2;imgPanel.style.top=document.body.scrollTop+max_top_offset+BORDER_AROUND_IMAGE;if(IMAGE_DESCRIPTION_PLACE==0)imgPanel.innerHTML="<img height="+tmpImgHeight+" src='"+imgL.src+"' alt='"+document.getElementById(actualObjectID).getElementsByTagName("img")[0].alt.toString()+"'>";else if(IMAGE_DESCRIPTION_PLACE==1)imgPanel.innerHTML="<img height="+tmpImgHeight+" src='"+imgL.src+"' alt='"+document.getElementById(actualObjectID).getElementsByTagName("span")[0].innerHTML.toString()+"'>";navigationPanel.style.width=parseInt(imgPanel.style.width)+(BORDER_AROUND_IMAGE*2);navigationPanel.style.height=parseInt(imgPanel.style.height)+BORDER_AROUND_IMAGE;navigationPanel.style.left=((browserWidth-parseInt(imgPanel.style.width))/2)-BORDER_AROUND_IMAGE;navigationPanel.style.top=max_top_offset;infoPanel.style.width=parseInt(imgPanel.style.width)+(BORDER_AROUND_IMAGE*2);infoPanel.style.left=((browserWidth-parseInt(imgPanel.style.width))/2)-BORDER_AROUND_IMAGE;infoPanel.style.top=max_top_offset+parseInt(imgPanel.style.height)+BORDER_AROUND_IMAGE;if(IMAGE_DESCRIPTION_PLACE==0)document.getElementById("voliviewer-info").innerHTML=document.getElementById(actualObjectID).getElementsByTagName("img")[0].alt.toString();else if(IMAGE_DESCRIPTION_PLACE==1)document.getElementById("voliviewer-info").innerHTML=document.getElementById(actualObjectID).getElementsByTagName("span")[0].innerHTML.toString();document.getElementById("voliviewer-counter").innerHTML=(getOnlyImagePosition()+1)+"/"+(getOnlyImagesCount()[0]);window.onscroll=function(){if(isViewerStarting){document.body.scrollTop=0;}}
window.onresize=function(){if(isViewerOpened&&wasSlideshow==false){showImage(null);return;}}
if(IS_OVER_IMAGE_LAYOUT)showOverImageLayout(imgPanel);else isViewerOpened=true;imgPanel.onclick=function(e){changeImage(e,false);}}
catch(e){}
setButtonsStates();setTimeout(function(){setImgPanelSizes(imgPanel,imgPanelType,tmpImgHeight);imgPanel.style.left=(browserWidth-parseInt(imgPanel.style.width))/2;navigationPanel.style.width=parseInt(imgPanel.style.width)+(BORDER_AROUND_IMAGE*2);navigationPanel.style.height=parseInt(imgPanel.style.height)+BORDER_AROUND_IMAGE;navigationPanel.style.left=((browserWidth-parseInt(imgPanel.style.width))/2)-BORDER_AROUND_IMAGE;infoPanel.style.width=parseInt(imgPanel.style.width)+(BORDER_AROUND_IMAGE*2);infoPanel.style.left=((browserWidth-parseInt(imgPanel.style.width))/2)-BORDER_AROUND_IMAGE;},800);if(getCookie("vhned")==1&&getCookie("vslideshow").split("_")[0]==1){slideshowInfo=navigationButtons[2];slideshow(getCookie("vslideshow").split("_")[1],"right");document.cookie="vhned=-1";document.cookie="vslideshow=-1";}
else if(getCookie("vhned")==2&&getCookie("vslideshow").split("_")[0]==1){slideshowInfo=navigationButtons[1];slideshow(getCookie("vslideshow").split("_")[1],"left");document.cookie="vhned=-1";document.cookie="vslideshow=-1";}
timer7=setInterval(function(){verifyImageInitialisation();},5);isImageShowed=false;document.getElementById("imgPanel").getElementsByTagName("img")[0].src=imgL.src;timer10=setInterval(function(){if(wasSlideshow&&areImagesCached&&imgL.width>0&&imgL.height>0){clearInterval(timer10);timer8=setTimeout(function(){isImageShowed=true;},slideshowTime*1000);}},5);}
function setImgPanelSizes(imgPanel,type,imgHeight){imgPanel.style.width=parseInt(imgL.width)<MIN_IMGPANEL_WIDTH?MIN_IMGPANEL_WIDTH:imgL.width;if(type==0){imgPanel.style.height=imgHeight;}
else{imgPanel.style.height=parseInt(imgL.height)<MIN_IMGPANEL_HEIGHT?MIN_IMGPANEL_HEIGHT:imgL.height;}}
function verifyImageInitialisation(){if(imgL.width>0&&imgL.height>0){clearInterval(timer7);showHideInitImageInfo("none");}}
function showHideInitImageInfo(infoState){if(document.getElementById("initImage_info"))document.getElementById("initImage_info").style.display=infoState;}
function showOverImageLayout(imgPanel){try{var overImgLayout=document.createElement("div");overImgLayout.id="overImgLayout";overImgLayout.style.width=imgPanel.style.width;overImgLayout.style.height=imgPanel.style.height;overImgLayout.style.left=imgPanel.style.left;overImgLayout.style.top=imgPanel.style.top;overImgLayout.style.MozOpacity=1;overImgLayout.style.opacity=1;overImgLayout.style.filter="alpha(opacity=100)";overImgLayout.onclick=function(e){try{changeImage(e,false);}catch(e){}}
opacityValue=DEFAULT_OPACITY_VALUE;document.getElementsByTagName("body")[0].appendChild(overImgLayout);oldImgPosX_step=0;timer1=setInterval(function(){changeImgOverLayoutTransparency();},ANIMATION_TIME);}
catch(e){}}
function changeImgOverLayoutTransparency(){try{var overImgLayout=document.getElementById("overImgLayout");if(overImgLayout){if(document.getElementById("overImgLayout").style.MozOpacity<=0||document.getElementById("overImgLayout").style.opacity<=0||opacityValue<=0){oldImgSrc=imgL.src;isViewerOpened=true;window.document.getElementsByTagName("body")[0].removeChild(document.getElementById("overImgLayout"));window.document.getElementsByTagName("body")[0].removeChild(document.getElementById("oldImg"));clearInterval(timer1);return;}}
if(document.getElementById("overImgLayout")){document.getElementById("overImgLayout").style.MozOpacity-=MAX_OPACITY_OVERIMGLAYOUT/100;document.getElementById("overImgLayout").style.opacity-=MAX_OPACITY_OVERIMGLAYOUT/100;opacityValue-=MAX_OPACITY_OVERIMGLAYOUT;document.getElementById("overImgLayout").style.filter="alpha(opacity:"+opacityValue+")";}
if(IS_OLDIMGMOVE_ALLOWED&&isViewerOpened&&!isFirstImg)moveOldImg();}
catch(e){}}
function setFloatInfoPanel(e,obj){var posX=0;var posY=0;if(e){posX=e.clientX;posY=e.clientY;}
else if(event){posX=event.x;posY=event.y;}
obj.style.left=posX+BORDER_AROUND_IMAGE;obj.style.top=posY;obj.innerHTML=floatInfoPanelText;obj.style.display="block";}
function setAsActiveSlideshowType(obj){for(var i=0;i<document.getElementById("voliviewer-slideshow").childNodes.length;i++){document.getElementById("voliviewer-slideshow").childNodes[i].className="voliviewer-slideshow";document.getElementById("voliviewer-slideshow").childNodes[i].style.backgroundColor='#FFCC66';}
if(obj){obj.className="voliviewer-slideshow-act";obj.style.backgroundColor='#339900';}}
function setSlideshowInfo(slideshowInfo){document.getElementById("slideshowInfo").innerHTML="SLIDESHOW: "+slideshowInfo+"&nbsp;&nbsp;";}
function slideshow(seconds,way){clearInterval(timer2);clearInterval(timer3);clearTimeout(timer8);clearTimeout(timer9);clearInterval(timer10);if(seconds==0){return;}
slideshowWay=way;isImageShowed=true;var seconds_help=seconds;var seconds_help2=seconds;slideshowSeconds=parseInt(seconds);document.getElementById("slideshowInfo").innerHTML="SLIDESHOW: "+slideshowInfo+", "+(parseInt(seconds_help--))+"s&nbsp;";if(isOneCycleError_Slideshow){seconds_help=seconds=1;}
timer3=setInterval(function(){document.getElementById("slideshowInfo").innerHTML="SLIDESHOW: "+slideshowInfo+", "+(parseInt(seconds_help--))+"s&nbsp;";},1000);timer9=setTimeout(function(){timer2=setInterval(function(){if(isImageShowed||parseInt(seconds_help)<0){isImageShowed=false;var tmpImg=document.getElementById("imgPanel").getElementsByTagName("img")[0];if(slideshow_imagesLoadErrorsCount<3&&!(tmpImg.width>0)){document.getElementById("stred").innerHTML=document.getElementById("stred").innerHTML+" zapinam ";slideshow_imagesLoadErrorsCount++;isOneCycleError_Slideshow=true;slideshow(seconds_help2,way);return;}
else if(slideshow_imagesLoadErrorsCount==3){slideshow_imagesLoadErrorsCount=0;}
if(!isImageInfoWorking){if(actualObjectID==images.length-1&&slideshowWay=="right"&&(!isNextPageCrossingEnabled||(isNextPageCrossingEnabled&&nextGalleryPages.next==null)))actualObjectID=-1;else if(actualObjectID==0&&slideshowWay=="left"&&(!isNextPageCrossingEnabled||(isNextPageCrossingEnabled&&nextGalleryPages.previous==null)))actualObjectID=images.length;seconds_help=seconds;slideshowTime=seconds_help2;changeImage(slideshowWay,true);}
if(isOneCycleError_Slideshow){document.getElementById("stred").innerHTML=document.getElementById("stred").innerHTML+" vypinam ";isOneCycleError_Slideshow=false;slideshow(seconds_help2,way);return;}}},20);},seconds*1000);}
function changeImage(e,isSlideshow){var posX=0;var posY=0;var newImage;showHideInitImageInfo("block");isFirstImg=false;oldImgSrc=imgL.src;oldImgWidth=imgL.width;oldImgHeight=imgL.height;oldImgPosX=document.getElementById("imgPanel").style.left;oldImgPosY=document.getElementById("imgPanel").style.top;isViewerOpened=true;clearInterval(timer1);if(!isSlideshow&&wasSlideshow){clearInterval(timer2);clearInterval(timer3);setSlideshowInfo(" --");setAsActiveSlideshowType(null);wasSlideshow=false;showHideInitImageInfo("none");return;}
if(!isSlideshow){clearInterval(timer2);clearInterval(timer3);clearTimeout(timer8);clearInterval(timer10);setSlideshowInfo(" --");setAsActiveSlideshowType(null);wasSlideshow=false;}
else wasSlideshow=true;if(document.getElementById("oldImg")!=null)window.document.getElementsByTagName("body")[0].removeChild(document.getElementById("oldImg"));if(document.getElementById("overImgLayout")!=null)window.document.getElementsByTagName("body")[0].removeChild(document.getElementById("overImgLayout"));oldImgStep=(parseInt(document.getElementById("imgPanel").style.left)+parseInt(document.getElementById("imgPanel").style.width))/(100/MAX_OPACITY_OVERIMGLAYOUT);if(oldImgStep<MIN_STEP_OLDIMAGE)oldImgStep=MIN_STEP_OLDIMAGE;if(e=="begin"){try{if(galleryPagesCount>1&&isCrossToNextGalleryImage(true,false,-4))return;isMoveLeft=true;newImage=document.getElementById(0).id;getImageInfo(newImage,isSlideshow,"begin");}catch(e){}
return;}
else if(e=="end"){try{if(galleryPagesCount>1&&isCrossToNextGalleryImage(false,false,-4))return;isMoveLeft=false;newImage=document.getElementById(images.length-1).id;getImageInfo(newImage,isSlideshow,"end");}catch(e){}
return;}
if(!(e=="left"||e=="right")){if(e){posX=e.clientX;posY=e.clientY;}
else if(event){posX=event.x;posY=event.y;}}
else{if(e=="left")posX=0;else if(e=="right")posX=browserWidth;}
if(posX<=browserWidth/2&&(actualObjectID>0||(actualObjectID==0&&isNextPageCrossingEnabled))){try{if(getOnlyImagePosition()<=0&&actualPageIndex==1&&!isSlideshow&&!isCrossToNextGalleryImage(isMoveLeft,isSlideshow,parseInt(actualObjectID)-1)){showHideInitImageInfo("none");return;}
isMoveLeft=true;if((actualObjectID==0&&galleryPagesCount==1&&actualPageIndex==1)||(actualObjectID==0&&actualPageIndex==1)){showHideInitImageInfo("none");}
if(isCrossToNextGalleryImage(isMoveLeft,isSlideshow,parseInt(actualObjectID)-1)){return;}
if(document.getElementById(actualObjectID-1)){newImage=document.getElementById(actualObjectID-1).id;getImageInfo(newImage,isSlideshow,"left");}
if(actualObjectID<0&&isSlideshow&&actualPageIndex==1){getImageInfo(getOnlyImagesCount()[1],isSlideshow,true);}}catch(err){}
return;}
else if(posX>browserWidth/2&&(actualObjectID<images.length-1||(actualObjectID<images.length&&isNextPageCrossingEnabled))){try{if(((getOnlyImagePosition()==getOnlyImagesCount()[0]&&galleryPagesCount==1&&getOnlyImagesCount()[0]>1)||(getOnlyImagePosition()>getOnlyImagesCount()[0]-1&&galleryPagesCount>1))&&!isSlideshow&&!isCrossToNextGalleryImage(isMoveLeft,isSlideshow,parseInt(actualObjectID)+1)){showHideInitImageInfo("none");return;}
isMoveLeft=false;if((actualObjectID==images.length-1&&galleryPagesCount==1)||(actualObjectID==images.length-1&&actualPageIndex==galleryPagesCount)){showHideInitImageInfo("none");}
if(isCrossToNextGalleryImage(isMoveLeft,isSlideshow,parseInt(actualObjectID)+1)){return;}
if(document.getElementById(parseInt(actualObjectID)+1)){newImage=document.getElementById(parseInt(actualObjectID)+1).id;getImageInfo(newImage,isSlideshow,"right");}
if(getOnlyImagePosition()>=getOnlyImagesCount()[0]&&isSlideshow){getImageInfo(getOnlyFirstImageID(),isSlideshow,true);}}catch(err){}
return;}
showHideInitImageInfo("none");}
function closeImgPanel(){clearInterval(timer1);clearInterval(timer2);clearInterval(timer3);clearTimeout(timer8);clearTimeout(timer9);clearInterval(timer10);isViewerOpened=false;isViewerStarting=false;isSetScrollPos=false;document.cookie="vhned=-1";document.body.scrollTop=oldScrollPosY;removeEventListeners();window.document.body.style.overflow="auto";slideshowInfo="--";var objectsToRemove=["navigationPanel","infoPanel","imgPanel","overImgLayout","oldImg","floatInfoPanel"];for(var i=0;i<objectsToRemove.length;i++){if(document.getElementById(objectsToRemove[i])!=null){window.document.getElementsByTagName("body")[0].removeChild(document.getElementById(objectsToRemove[i]));}}
timer6=setTimeout(function(){if(document.getElementById("imgBgPanel")!=null)window.document.getElementsByTagName("body")[0].removeChild(document.getElementById("imgBgPanel"));clearTimeout(timer6);},300);}
function moveOldImg(){var MAX_OPACITY=60;var oldImg=null;if((document.getElementById("oldImg")!=null)&&(parseInt(document.getElementById("oldImg").style.left)>browserWidth)||(document.getElementById("oldImg")!=null)&&(parseInt(document.getElementById("oldImg").style.left)+parseInt(document.getElementById("oldImg").style.width)<0)){return;}
if(document.getElementById("oldImg")==null){oldImg=document.createElement("div");oldImg.id="oldImg";oldImg.style.zIndex="160";oldImg.style.position="absolute";oldImg.style.width=oldImgWidth;oldImg.style.height=oldImgHeight;oldImg.style.top=oldImgPosY;oldImg.style.backgroundColor="black";oldImg.innerHTML="<img src='"+oldImgSrc+"'>";window.document.getElementsByTagName("body")[0].appendChild(oldImg);}
else{if(document.getElementById("oldImg"))oldImg=document.getElementById("oldImg");}
oldImgPosX_step+=oldImgStep*(isMoveLeft==true?1:-1);oldImg.style.left=parseInt(oldImgPosX)+oldImgPosX_step;}
function setButtonsStates(){var bRight=document.getElementById("buttonRight");var bEnd=document.getElementById("buttonEnd");var bLeft=document.getElementById("buttonLeft");var bBegin=document.getElementById("buttonBegin");if(getOnlyImagesCount()[0]==1){bRight.style.visibility="hidden";bEnd.style.visibility="hidden";bLeft.style.visibility="hidden";bBegin.style.visibility="hidden";document.getElementById("slideshowInfo").style.visibility="hidden";document.getElementById("voliviewer-slideshow").style.visibility="hidden";}
else if((getOnlyImagePosition()==getOnlyImagesCount()[0]-1&&galleryPagesCount==1)||(getOnlyImagePosition()==getOnlyImagesCount()[0]-1&&actualPageIndex==galleryPagesCount)){bRight.style.visibility="hidden";bEnd.style.visibility="hidden";bLeft.style.visibility="visible";bBegin.style.visibility="visible";}
else if((getOnlyImagePosition()==0&&galleryPagesCount==1)||(getOnlyImagePosition()==0&&actualPageIndex==1)){bLeft.style.visibility="hidden";bBegin.style.visibility="hidden";bRight.style.visibility="visible";bEnd.style.visibility="visible";}
else{bLeft.style.visibility="visible";bBegin.style.visibility="visible";bRight.style.visibility="visible";bEnd.style.visibility="visible";}}
function keyPressed_handler(e){if(isViewerOpened){try{document.body.scrollLeft=0;var charCode=e.keyCode?e.keyCode:e.which;switch(charCode){case 27:closeImgPanel();break;case 37:changeImage("left",false);break;case 39:changeImage("right",false);break;case 36:changeImage("begin",false);break;case 35:changeImage("end",false);break;}}
catch(e){}}}
function createEventListeners(){if(window.addEventListener){window.document.addEventListener("keyup",keyPressed_handler,false);}
if(window.attachEvent){window.document.attachEvent("onkeyup",keyPressed_handler);}}
function removeEventListeners(){if(window.addEventListener){window.document.removeEventListener("keyup",keyPressed_handler,false);}
else if(window.attachEvent){window.document.detachEvent("onkeyup",keyPressed_handler);}
window.onkeyup=null;}
function createRequestObject(){if(window.XMLHttpRequest){request=new XMLHttpRequest();}
else if(window.ActiveXObject){try{request=new ActiveXObject("Msxml2.XMLHTTP");}
catch(e){try{request=new ActiveXObject("Microsoft.XMLHTTP");}
catch(e){xmlhttp=false;}}}}
function createRequest(queryIndex,id_obce,id_fotopary,id_galerie){var result=null;try{request.open("POST","/VismoOnline_ActionScripts/voliviewer.asp",connAsynchronous);request.setRequestHeader('Content-type','application/x-www-form-urlencoded');request.send("queryIndex="+queryIndex+"&id_obce="+id_obce+"&id_fotopary="+id_fotopary+"&id_galerie="+id_galerie);result=request.responseText;}
catch(e){}
return result;}
function getNextPageContent(pageURL){try{request.open("GET",pageURL,connAsynchronous);request.setRequestHeader('Content-type','application/x-www-form-urlencoded');request.send(null);return request.responseText;}
catch(e){}}
function setOverBackgroundColor(obj,color){if(obj.className=='voliviewer-slideshow')obj.style.backgroundColor=color;}
function verifySecretEvents(e){if(e==null)e=window.event;if(e.clientX<5&&e.clientY<5){document.cookie="isImgOpenOnClick="+(!IS_VOLIVIEWER_OPENED_ON_IMAGE_CLICK)+'';window.location.href=window.location.href;return false;}
return true;}
function getCookie(ck){if(document.cookie.length>0){var cookieList_begin=document.cookie.indexOf(ck+"=");if(cookieList_begin!=-1){cookieList_begin=cookieList_begin+ck.length+1;cookieList_end=document.cookie.indexOf(";",cookieList_begin);if(cookieList_end==-1)cookieList_end=document.cookie.length;return unescape(document.cookie.substring(cookieList_begin,cookieList_end));}}
return false;}
function getNextPages(){nextGalleryPages.previous=null;nextGalleryPages.next=null;var nextGalleryPage=document.getElementById("fgvypis");if(nextGalleryPage){nextGalleryPage=nextGalleryPage.getElementsByTagName("span");if(nextGalleryPage){for(var i=0;i<nextGalleryPage.length;i++){if(nextGalleryPage[i].className=="strzpet"){nextGalleryPages.previous=nextGalleryPage[i].getElementsByTagName("a")[0];var parNode=nextGalleryPage[i].parentNode;var urlIndex=0;chNodes=parNode.getElementsByTagName("a");galleryPagesCount=1;pagesURL=new Array();for(var j=0;j<chNodes.length;j++){if(chNodes[j].parentNode.className.indexOf("strzpet")==-1&&chNodes[j].parentNode.className.indexOf("strvpred")==-1){if(chNodes[j].href.split("stranka=")[1].length>0){galleryPagesCount=parseInt(chNodes[j].href.split("stranka=")[1].split("&")[0]);pagesURL[urlIndex++]=chNodes[j].href;}}}}
if(nextGalleryPage[i].className=="strvpred"){nextGalleryPages.next=nextGalleryPage[i].getElementsByTagName("a")[0];}}}}
if(parseInt(actualPageIndex)-1==galleryPagesCount){galleryPagesCount+=1;}}
function isCrossToNextGalleryImage(isMoveLeft,isSlideshow,objId){if(objId==-4){if(crossToNextGalleryImage(isMoveLeft,isSlideshow,objId))return true;}
else if(isNextPageCrossingEnabled&&(nextGalleryPages.previous||nextGalleryPages.next)&&((images.length==objId&&!isMoveLeft)||(-1==objId&&isMoveLeft))){if(crossToNextGalleryImage(isMoveLeft,isSlideshow,objId))return true;}
return false;}
function crossToNextGalleryImage(isMoveLeft,isSlideshow,objId){var nextPageUrl=null;var vstate=-1;if(isMoveLeft&&nextGalleryPages.previous){if(objId==-4){nextPageUrl=pagesURL[0];vstate="4";}else{nextPageUrl=nextGalleryPages.previous;vstate="2";}}
else if(!isMoveLeft&&nextGalleryPages.next){if(objId==-4){nextPageUrl=pagesURL[pagesURL.length-1];vstate="3";}else{nextPageUrl=nextGalleryPages.next;vstate="1";}}
if(nextPageUrl){document.cookie="vslideshow="+(isSlideshow?("1_"+slideshowSeconds):-1);document.cookie="vhned="+vstate;actualPageIndex=getActualPageIndex(nextPageUrl);createNextPage(getNextPageContent(nextPageUrl));}
return false;}
function createNextPage(pageContent){var onlyBody=document.createElement("div");onlyBody.innerHTML=pageContent;onlyBody=onlyBody.getElementsByTagName("div");for(var i=0;i<onlyBody.length;i++){if(onlyBody[i].id=="fgvypis"){document.getElementById("fgvypis").innerHTML=onlyBody[i].innerHTML;imagesTestingCount=0;images=null;images=Array();prepareImages(0);break;}}}
function getActualPageIndex(nextPageUrl){var tmp=nextPageUrl.toString().split('stranka=');if(tmp.length>1){return parseInt(tmp[1].split('&')[0]);}
return 1;}
function getOnlyImagePosition(){var isImagesTesting=true;var actualPos=0;var itemsCount=0;while(isImagesTesting){if(document.getElementById(actualPos)){if(actualPos==actualObjectID){isImagesTesting=false;}
else if(document.getElementById(actualPos).getAttribute("href").indexOf("id_obrazky=")>-1){itemsCount++;}}
else{isImagesTesting=false;}
actualPos++;}
return itemsCount;}
function getOnlyImagesCount(){var isImagesTesting=true;var actualPos=0;var itemsCount=0;var lastItemId=-1;while(isImagesTesting){if(document.getElementById(actualPos)){if(document.getElementById(actualPos).getAttribute("href").indexOf("id_obrazky=")>-1){itemsCount++;lastItemId=document.getElementById(actualPos).id;}}
else{isImagesTesting=false;}
actualPos++;}
return[itemsCount,lastItemId];}
function getOnlyFirstImageID(){var isImagesTesting=true;var actualPos=0;var itemsCount=0;var itemId=-1;while(isImagesTesting){if(document.getElementById(actualPos)){if(document.getElementById(actualPos).getAttribute("href").indexOf("id_obrazky=")>-1){itemId=document.getElementById(actualPos).id;isImagesTesting=false;}}
else{isImagesTesting=false;}
actualPos++;}
return itemId;}
