var buttonCloseName = "Close"; var buttonEnlargeName = "Open Window"; var luc_backingphoto_url = "http://www.backingphoto.com/backingphoto.php"; var luc_backingphoto_salon_url = "http://www.backingphoto.com/salon.php"; var luc_backingphoto_comment_url = "http://www.backingphoto.com/comment_rss"; var luc_backingphoto_img_url = "http://www.backingphoto.com/img_clickphoto.png"; var luc_auto_flg = 1; var LucBackingPhoto = { init: function() { var images = document.getElementsByTagName("img"); if (!images) { return; } var image, imagetype, src; var check_classname = false; if (typeof backingphoto_image_classname != 'undefined' && backingphoto_image_classname != "") { check_classname = backingphoto_image_classname; } for (var i = 0; i < images.length; i++) { image = images[i]; src = image.src; if (src.indexOf("?") > -1) { src = src.substring(0, src.indexOf("?")); } imagetype = src.substring(src.lastIndexOf(".") + 1, src.length).toLowerCase(); if (imagetype == "jpg" || imagetype == "tiff") { if (check_classname && (!image.className || !image.className.match("(^| )" + check_classname + "( |$)"))) { continue; } LucBackingPhoto.addbutton(image); } } }, addbutton: function(image) { if (image.getAttribute("luc_backingphoto")) { return; } image.setAttribute("luc_backingphoto", "1"); var unique_id = (new Date()).getTime(); image.style.border = "3px solid #3f6"; image.style.cursor = "pointer"; image.id = "luc_image_" + (new Date()).getTime() + unique_id; image.style.paddingTop = "16px"; image.style.background = "#3f6 url(" + luc_backingphoto_img_url + ") scroll no-repeat"; // Output commens if (typeof backingphoto_show_comment != 'undefined' && backingphoto_show_comment == "1") { LucBackingPhoto.show_comment(image); } var parent = image.parentNode; if (parent.tagName.toLowerCase() == "a") { parent.style.textDecoration = "none"; } // Go BACKINGPHOTO image.onclick = function(event) { LucBackingPhoto.stopEvent(event); var url = luc_backingphoto_url + "?i=" + escape(image.src); url += "&auto=" + luc_auto_flg; url += "&p=" + escape(window.location); var image_width = image.offsetWidth + 20; var image_height = image.offsetHeight + 20; // Control Panel var panel = document.createElement("div"); panel.id = "luc_panel_" + (new Date()).getTime() + unique_id; panel.style.width = image_width + "px"; panel.style.backgroundColor = "#3f6"; panel.style.border = "3px solid #3f6"; panel.style.textAlign = "left"; // Close Button var buttonClose = document.createElement("input"); buttonClose.type = "button"; buttonClose.value = buttonCloseName; buttonClose.onclick = function() { LucBackingPhoto.reset(image.id, iframe.id, panel.id); } panel.appendChild(buttonClose); // Enlarge Button var buttonEnlarge = document.createElement("input"); buttonEnlarge.type = "button"; buttonEnlarge.value = buttonEnlargeName; buttonEnlarge.onclick = function() { var salon_url = luc_backingphoto_salon_url + "?i=" + escape(image.src); LucBackingPhoto.reset(image.id, iframe.id, panel.id); window.open(salon_url, "backingphoto_salon"); } panel.appendChild(buttonEnlarge); // Main Iframe var iframe = document.createElement("iframe"); iframe.id = "luc_iframe_" + (new Date()).getTime() + unique_id; iframe.src = url; iframe.width = image_width; iframe.height = image_height; iframe.style.display = "block"; iframe.style.width = image_width + "px"; iframe.style.height = image_height + "px"; iframe.style.border = "3px solid #3f6"; iframe.style.backgroundColor = "#fff"; var parent = image.parentNode; LucBackingPhoto.insertAfter(parent, panel, image); LucBackingPhoto.insertAfter(parent, iframe, image); image.style.display = "none"; return false; } if (typeof backingphoto_autoload != 'undefined' && backingphoto_autoload == "1") { image.onclick(); } }, reset: function(image_id, iframe_id, panel_id) { LucBackingPhoto.deleteNode(document.getElementById(iframe_id)); LucBackingPhoto.deleteNode(document.getElementById(panel_id)); var image = document.getElementById(image_id); image.style.display = "block"; }, insertAfter: function(parent, node, referenceNode) { parent.insertBefore(node, referenceNode.nextSibling); }, copyStyle: function(from, to, style) { var value = from.style[style]; if (!value && document.defaultView && document.defaultView.getComputedStyle) { var css = document.defaultView.getComputedStyle(from, null); value = css ? css[style] : null; } to.style[style] = value; }, stopEvent: function(event) { if (event && event.preventDefault) { event.preventDefault(); event.stopPropagation(); } else if (event) { event.returnValue = false; event.cancelBubble = true; } }, deleteNode: function(node) { if (document.createRange) { var range = document.createRange(); range.selectNodeContents(node); range.deleteContents(); } else { while(node.childNodes.length > 0){ node.removeChild(node.childNodes[0]); } } return node.parentNode.removeChild(node); }, show_comment: function(image) { var url = luc_backingphoto_comment_url + "?js=1&id=" + image.id + "&i=" + escape(image.src); if (typeof backingphoto_comment_color != 'undefined' && backingphoto_comment_color != "") { url += "&cmcolor=" + escape(backingphoto_comment_color); } if (typeof backingphoto_comment_height != 'undefined' && backingphoto_comment_height != "") { url += "&cmheight=" + escape(backingphoto_comment_height); } var script = document.createElement('SCRIPT'); script.setAttribute('type', 'text/javascript'); script.setAttribute('charset', 'UTF-8'); script.setAttribute('src', url); document.body.appendChild(script); } } var luc_winonload = window.onload; if (luc_winonload) { window.onload = function() { luc_winonload(); LucBackingPhoto.init(); } } else { window.onload = LucBackingPhoto.init; }