function getPageSizeWithScroll() { if (window.innerHeight && window.scrollMaxY) { // Firefox yWithScroll = window.innerHeight + window.scrollMaxY; xWithScroll = window.innerWidth + window.scrollMaxX; } else if (document.body.scrollHeight > document.body.offsetHeight) { // all but Explorer Mac yWithScroll = document.body.scrollHeight; xWithScroll = document.body.scrollWidth; } else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari yWithScroll = document.body.offsetHeight; xWithScroll = document.body.offsetWidth; if(window.innerHeight > yWithScroll) yWithScroll = window.innerHeight; } arrayPageSizeWithScroll = new Array(xWithScroll,yWithScroll); //alert( 'The height is ' + yWithScroll + ' and the width is ' + xWithScroll ); return arrayPageSizeWithScroll; } last = ''; photos = new Array(); function switchImage(offset, times) { var found = -1; for(var i =0; i < photos.length; i++) { if(last == photos[i]) { found = i; break; } } nOffset = found + offset; if(nOffset < 0) nOffset = photos.length - 1; if(nOffset > photos.length - 1) nOffset = 0; // if photos are same try next if(photos[nOffset] == last) { if(times == 1) return; switchImage(2*offset, 1); } showIt(photos[nOffset]); } running = 0; function slide() { if(running == 0) { return; } switchImage(1); setTimeout('slide();', 3000); } function showDivs() { document.getElementById('showphoto').style.display = ''; var sz = getPageSizeWithScroll(); document.getElementById('blackbg').style.width = sz[0] + 'px'; document.getElementById('blackbg').style.height = sz[1] + 'px'; document.getElementById('blackbg').style.display = ''; } var lastImg = ''; function showImage(img, myImage) { if(myImage == undefined) myImage = lastImg; else lastImg = myImage; if(window.innerWidth) width = window.innerWidth; else width = document.body.offsetWidth; if((myImage.width == 0) || (myImage.height == 0)) { setTimeout('showImage(\'' + img + '\');', 300); } else { var left = (width/2 - myImage.width/2); document.getElementById('showphoto').style.left = left + 'px'; //document.getElementById('closeButton').style.left = (myImage.width/2 - 25) + 'px'; document.getElementById('buttonsPannel').style.width = myImage.width + 'px'; var top = 10; if(window.pageYOffset) top += window.pageYOffset; else if(document.body.scrollTop > 0) top += document.body.scrollTop; else top += document.documentElement.scrollTop; document.getElementById('showphoto').style.top = top + 'px'; document.getElementById('photoImg').src = img; setTimeout('showDivs();', 300); } } function showIt(img) { //if(!document.getElementById('fgCont')) // constructGallery(); // zobrazi loading if(window.innerWidth) { width = window.innerWidth; height = window.innerHeight; } else { width = document.body.offsetWidth; height = document.body.offsetHeight; } // postara sa o zobrazenie obrazka if(document.getElementById('showphoto').style.display == 'none') { var myImage = new Image; myImage.src = img; myImage.onLoad = showImage(img, myImage); } else { if(img == '') { running = 0; document.getElementById('showphoto').style.display = 'none'; document.getElementById('blackbg').style.display = 'none'; } else if(last == img) { //document.getElementById('showphoto').style.display = 'none'; //document.getElementById('blackbg').style.display = 'none'; //img = ''; } else { var myImage = new Image; myImage.src = img; myImage.onLoad = showImage(img, myImage); } } last = img; } function constructGallery() { alert('construct'); var divCont = document.createElement("div"); divCont.id = 'fgCont'; txt = ''; txt += ''; txt += ''; divCont.innerHTML = txt; document.body.appendChild(divCont); }