// live preview start var mouseX = 0; var mouseY = 0; var is_mozilla = (document.getElementById&&!document.all); if (is_mozilla){ document.addEventListener('mousemove',getMouseCoordinates, true); } if(document.all){ document.onmousemove = getMouseCoordinates; } function getMouseCoordinates(e){ if (document.all) e = window.event; ele = (document.all) ? e.srcElement : e.target; mouseX = (document.all) ? e.screenX : e.clientX; mouseY = (document.all) ? e.screenY : e.clientY; // window.status = (document.all) ? "e.screen" : "e.client"; } // current preview image height var img_width = 0; var img_height = 0; // coordinates where to move picture var img_pos_x = 0; var img_pos_y = 0; // current mouse position var mouse_x = 0; var mouse_y = 0; // last mouse click var mouse_click_x; var mouse_click_y; // tag if preview image is displayed var displayed_image = ''; // preview image div if (document.getElementById || document.all){ document.write('
'); } // returns preview image object function getPreviewObj(){ if (document.getElementById) return document.getElementById("livePreviewImage"); else if (document.all) return document.all.livePreviewImage; } // detect body of document function getRealBody(){ return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body; } // counts new picture coordinates function countImgCoords() { // fetch body properties b = 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 img_pos_x = Math.round((mouse_x - (img_width / 2))); img_pos_y = Math.round((mouse_y - (img_height / 2))); // preview in the bottom right corner /* img_pos_x = mouse_x + 10; img_pos_y = mouse_y + 10; */ // check if any of coordinates is not away from document if (img_pos_x < doc_left) img_pos_x = doc_left; if (img_pos_y < doc_top) img_pos_y = doc_top; if ((img_pos_x + img_width) > doc_right) img_pos_x = doc_right - img_width; if ((img_pos_y + img_height) > doc_bottom) img_pos_y = doc_bottom - img_height; } // displays preview image function showImgPreview(imagename, title, width, height){ // don't show the same preview twice if (displayed_image == imagename) { // window.status = "Already displayed"; return ; } // don't show after click on the same place getMouseCoords(window.event); if ((Math.abs(mouse_x - mouse_click_x) < 10) && (Math.abs(mouse_y - mouse_click_y) < 10)) { // window.status = "Same click!"; return ; } // new preview HTML var oHTML = '