var fa_mouseX = 0; var fa_mouseY = 0; var fa_is_mozilla = (document.getElementById&&!document.all); if (fa_is_mozilla){ document.addEventListener('mousemove',fa_getMouseCoordinates, true); } if(document.all){ document.onmousemove = fa_getMouseCoordinates; } function fa_getMouseCoordinates(e){ if (document.all) e = window.event; fa_ele = (document.all) ? e.srcElement : e.target; fa_mouseX = (document.all) ? e.screenX : e.clientX; fa_mouseY = (document.all) ? e.screenY : e.clientY; // window.status = (document.all) ? "e.screen" : "e.client"; } function fa_zoomImage(src, w, h, alt, id) { prop = ''; l = undefined; t = undefined; if (document.layers){ browseWidth=window.outerWidth; browseHeight=window.outerHeight; } if (document.all){ browseWidth=document.body.clientWidth; browseHeight=document.body.clientHeight; } if ((w != '') && (w > 0)) { // w += 32; if (w > screen.width) { w = screen.width; l = 0; prop += 'scrollbars,'; } prop += 'width=' + w + ','; } if ((h != '') && (h > 0)) { // h += 40; //22; if (h > screen.height) { h = screen.height; t = 0; prop += 'scrollbars,'; } prop += 'height=' + h + ','; } if ((l == undefined)) l = fa_mouseX - w/2; if ((t == undefined)) t = fa_mouseY - h/2; if (l < 0) l = (w - screen.width)/2; if (t < 0) t = (h - screen.heigth)/2; if (l+w > screen.width) l = screen.width - w; if (t+h > screen.heigth) t = screen.heigth - h; if (l < 0) l = 0; if (t < 0) t = 0; if (l != undefined) prop += 'left=' + l + ','; if (t != undefined) prop += 'top=' + t + ','; prop += 'resizable,'; w = window.open('http://www.penzion-mt.cz/album/zoom.php?src=' + src + "&alt=" + alt + "&id=" + id, 'zoom', prop); w.focus(); } function fa_slideShow3(id_albumu, id, sec) { sec = prompt("Počet sekund, po kterých promítat fotografie (0 = posun po kliknutí) ?", sec); if (sec >= 0) { window.open("http://www.penzion-mt.cz/album/slideshow.php?act=slideshow&id_albumu=" + id_albumu + "&id=" + id + "&tm=" + sec); } } function fa_slideShow(id_albumu, sec) { sec = prompt("Počet sekund, po kterých promítat fotografie (0 = posun po kliknutí) ?", sec); if (sec >= 0) { window.open("http://www.penzion-mt.cz/album/slideshow.php?act=slideshow&id_albumu=" + id_albumu + "&tm=" + sec); } } function fa_odesliAlbumForm(id_albumu) { w = window.open('?act=odesli_album_form&id_albumu=' + id_albumu, 'odesli_emailem', 'width=550,height=340,scrollbars=1'); w.focus(); } function fa_pridejFotoForm(id_albumu) { w = window.open('?act=pridej_foto_form&id_albumu=' + id_albumu, 'pridej_foto', 'width=600,height=470,scrollbars=1'); w.focus(); } // live preview start // current preview image height var fa_img_width = 0; var fa_img_height = 0; // coordinates where to move picture var fa_img_pos_x = 0; var fa_img_pos_y = 0; // current mouse position var fa_mouse_x = 0; var fa_mouse_y = 0; // last mouse click var fa_mouse_click_x; var fa_mouse_click_y; // tag if preview image is displayed var fa_displayed_image = ''; // preview image div if (document.getElementById || document.all){ document.write('
'); } // returns preview image object function fa_getPreviewObj(){ if (document.getElementById) return document.getElementById("fotoalbumPreviewImage"); else if (document.all) return document.all.fotoalbumPreviewImage; } // detect body of document function fa_getRealBody(){ return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body; } // counts new picture coordinates function fa_countImgCoords() { // fetch body properties b = fa_getRealBody(); doc_top = b.scrollTop; doc_right = (document.all? b.scrollLeft + b.clientWidth : pageXOffset + window.innerWidth-15); doc_left = b.scrollLeft; doc_bottom = (document.all? b.scrollTop + Math.min(b.scrollHeight, b.clientHeight) : Math.min(window.innerHeight)); // cursor in center fa_img_pos_x = (fa_mouse_x - (fa_img_width / 2)); fa_img_pos_y = (fa_mouse_y - (fa_img_height / 2)); // preview in the bottom right corner /* fa_img_pos_x = fa_mouse_x + 10; fa_img_pos_y = fa_mouse_y + 10; */ // check if any of coordinates is not away from document if (fa_img_pos_x < doc_left) fa_img_pos_x = doc_left; if (fa_img_pos_y < doc_top) fa_img_pos_y = doc_top; if ((fa_img_pos_x + fa_img_width) > doc_right) fa_img_pos_x = doc_right - fa_img_width; if ((fa_img_pos_y + fa_img_height) > doc_bottom) fa_img_pos_y = doc_bottom - fa_img_height; } // displays preview image function fa_showImgPreview(imagename, title, width, height){ // don't show the same preview twice if (fa_displayed_image == imagename) { /* window.status = "Already displayed"; */ return ; } // don't show after click on the same place fa_getMouseCoords(window.event); if ((Math.abs(fa_mouse_x - fa_mouse_click_x) < 10) && (Math.abs(fa_mouse_y - fa_mouse_click_y) < 10)) { /* window.status = "Same click!"; */ return ; } // new preview HTML var oHTML = '
'; oHTML = oHTML + '
'; oHTML = oHTML + ''; oHTML = oHTML + '
'; // remember current image width and height fa_img_width = width; fa_img_height = height; // count coordinates of image preview fa_countImgCoords(); // move and show preview var o = fa_getPreviewObj(); o.innerHTML = oHTML; o.style.left = fa_img_pos_x + "px"; o.style.top = fa_img_pos_y + "px"; o.style.display = "inline"; // add mouse handler to move preview // document.onmousemove = trackMouse; // fetch latest mouse coords fa_getMouseCoords(window.event); fa_displayed_image = imagename; } // moves img preview function fa_moveImgPreview() { var o = fa_getPreviewObj(); o.style.left = fa_img_pos_x + "px"; o.style.top = fa_img_pos_y + "px"; } function fa_trackMouse(e) { if (fa_displayed_image != '') { fa_getMouseCoords(e); fa_countImgCoords(); fa_moveImgPreview(); } } // hides preview function fa_hideImgPreview(){ var o = fa_getPreviewObj(); o.innerHTML = ""; // clear html o.display = "none"; // hide o.left = "-500px"; // move away // document.onmousemove="" // reset mouse capture fa_displayed_image = ''; } // hides preview and remembers mouse click position function fa_hideImgPreviewWithMouseClick() { fa_getMouseCoords(window.event); fa_mouse_click_x = fa_mouse_x; fa_mouse_click_y = fa_mouse_y; fa_hideImgPreview(); } // hides preview function fa_hideImgPreviewWithMouseOut() { fa_hideImgPreview(); } // stores mouse coordinates function fa_getMouseCoords(e){ if (!e) { if (window.event) { e = window.event; } else { e = window; } } if (e) { if (e.clientX) { // window.status = "e.clientX"; b = fa_getRealBody(); fa_mouse_x = b.scrollLeft + e.clientX fa_mouse_y = b.scrollTop + e.clientY; } else { if (e.pageX){ // window.status = "e.pageX"; fa_mouse_x = e.pageX; fa_mouse_y = e.pageY; } else { if (e.x) { // window.status = "e.X"; fa_mouse_x = e.X; fa_mouse_y = e.Y; } else { // other possibility - see getCoordinates // window.status = "other"; fa_mouse_x = fa_mouseX; fa_mouse_y = fa_mouseY; // window.status = "None e=" + e; } } } } else { // window.status = "No e!"; } // window.status = fa_mouse_x + ", " + fa_mouse_y; } // document.onmousemove=getMouseCoords; // live preview end