var visualsoftZoom_ua = 'msie'; var W = navigator.userAgent.toLowerCase(); if(W.indexOf("opera") != -1) { visualsoftZoom_ua = 'opera'; } else if(W.indexOf("msie") != -1) { visualsoftZoom_ua = 'msie'; } else if(W.indexOf("mozilla") != -1) { visualsoftZoom_ua = 'gecko'; } var zoom_loaded = false; var VisualsoftZoom_zooms = new Array(); function _el(id) { return document.getElementById(id) }; function visualsoftView_ia() { return false }; function visualsoftZoom_addEventListener(obj,event,listener) { if(visualsoftZoom_ua == 'gecko' || visualsoftZoom_ua == 'opera') { obj.addEventListener(event,listener,false); } else if(visualsoftZoom_ua == 'msie') { obj.attachEvent("on"+event,listener); } }; function visualsoftZoom_removeEventListener(obj,event,listener) { if(visualsoftZoom_ua == 'gecko' || visualsoftZoom_ua == 'opera') { obj.removeEventListener(event,listener,false); } else if(visualsoftZoom_ua == 'msie') { obj.detachEvent("on"+event,listener); } }; function visualsoftZoom_createMethodReference(object,methodName) { var args = arguments; return function() { object[methodName].apply(object,arguments,""); } }; function visualsoftZoom(smallImageContId,smallImageId,bigImageContId,bigImageId,settings) { this.recalculating = false; this.smallImageCont = _el(smallImageContId); this.smallImage = _el(smallImageId); this.bigImageCont = _el(bigImageContId); this.bigImage = _el(bigImageId); this.pup = 0; this.settings = settings; this.bigImageSizeX = 0; this.bigImageSizeY = 0; this.smallImageSizeX = 0; this.smallImageSizeY = 0; this.popupSizeX = 20; this.popupSizey = 20; this.positionX = 0; this.positionY = 0; this.baseuri = ''; this.safariOnLoadStarted = false; VisualsoftZoom_zooms.push(this); }; visualsoftZoom.prototype.checkcoords = function(e) { var y=0; var x=0; if(visualsoftZoom_ua == 'msie') { y = e.clientY; x = e.clientX; if(document.body && (document.body.scrollLeft || document.body.scrollTop)) { y = e.clientY + document.body.scrollTop; x = e.clientX + document.body.scrollLeft } else if(document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop)) { y= e.clientY + document.documentElement.scrollTop; x= e.clientX + document.documentElement.scrollLeft; } } else { y = e.clientY; x = e.clientX; if(W.indexOf("safari") == -1) { y += window.pageYOffset; x += window.pageXOffset } } smallY = smallX = 0; var tag = this.smallImage; while(tag.tagName != "BODY" && tag.tagName != "HTML") { smallY += tag.offsetTop; smallX += tag.offsetLeft; tag = tag.offsetParent } if(x > parseInt(smallX + this.smallImageSizeX)) { this.hiderect(); return false; } if(x < parseInt(smallX)) { this.hiderect(); return false; } if(y > parseInt(smallY + this.smallImageSizeY)) { this.hiderect(); return false; } if(y < parseInt(smallY)) { this.hiderect(); return false; } return true }; /* visualsoftZoom.prototype.mousedown = function(e) { if (this.bigImage.src != 'http://www.feedem.co.uk/images/nopic.gif') { if(visualsoftZoom_ua == 'gecko') { e.cancelBubble = true; e.preventDefault(); e.stopPropagation(); } else if(visualsoftZoom_ua == 'msie' || visualsoftZoom_ua == 'opera') { window.event.cancelBubble = true; } this.smallImageCont.style.cursor = 'move'; } }; visualsoftZoom.prototype.mouseup = function(e) { if (this.bigImage.src != 'http://www.feedem.co.uk/images/nopic.gif') { if(visualsoftZoom_ua == 'gecko') { e.cancelBubble = true; e.preventDefault(); e.stopPropagation(); } else if(visualsoftZoom_ua == 'msie' || visualsoftZoom_ua == 'opera') { window.event.cancelBubble = true; } this.smallImageCont.style.cursor = 'default'; } }; */ visualsoftZoom.prototype.mousemove = function(e) { if (this.bigImage.src != 'http://www.feedem.co.uk/images/nopic.gif') { if(visualsoftZoom_ua == 'gecko') { e.cancelBubble = true; e.preventDefault(); e.stopPropagation(); } else if(visualsoftZoom_ua == 'msie' || visualsoftZoom_ua == 'opera') { window.event.cancelBubble = true; } for(i=0; i < VisualsoftZoom_zooms.length; i++) { if(VisualsoftZoom_zooms[i] != this) { VisualsoftZoom_zooms[i].checkcoords(e); } } if(this.settings && this.settings["drag_mode"] == true) { if(this.smallImageCont.style.cursor != 'move') { return } } if(this.recalculating) { return } if(!this.checkcoords(e)) { return } this.recalculating = true; var smallImg = this.smallImage; var smallX = 0; var smallY = 0; if(visualsoftZoom_ua == 'gecko' || visualsoftZoom_ua == 'opera') { var tag=smallImg; while(tag.tagName != "BODY" && tag.tagName != "HTML") { smallY += tag.offsetTop; smallX += tag.offsetLeft; tag = tag.offsetParent; } } if(visualsoftZoom_ua == 'msie') { this.positionX = event.x - this.smallImage.offsetLeft; var scrollTop = 0; this.positionY = event.y + scrollTop; } else { this.positionX = e.clientX - smallX; this.positionY = e.clientY - smallY; if(W.indexOf("safari") == -1) { this.positionX += window.pageXOffset; this.positionY += window.pageYOffset; } } if((this.positionX + this.popupSizeX / 2) >= this.smallImageSizeX) { this.positionX = this.smallImageSizeX - this.popupSizeX / 2; } if((this.positionY + this.popupSizeY / 2) >= this.smallImageSizeY) { this.positionY = this.smallImageSizeY - this.popupSizeY / 2; } if((this.positionX - this.popupSizeX / 2) <= 0) { this.positionX = this.popupSizeX / 2; } if((this.positionY - this.popupSizeY / 2) <= 0) { this.positionY=this.popupSizeY / 2; } setTimeout(visualsoftZoom_createMethodReference(this,"showrect"),10); } }; visualsoftZoom.prototype.showrect = function() { this.pup.style.left = (this.positionX - this.popupSizeX / 2) + 'px'; this.pup.style.top = (this.positionY - this.popupSizeY / 2) + 'px'; this.pup.style.visibility = "visible"; this.pup.onclick = document.getElementById('sim2_link').onclick; perX = parseInt(this.pup.style.left) * (this.bigImageSizeX / this.smallImageSizeX); perY = parseInt(this.pup.style.top) * (this.bigImageSizeY / this.smallImageSizeY); this.bigImage.style.left = (-perX)+ 'px'; this.bigImage.style.top = (-perY)+ 'px'; this.bigImageCont.style.display = 'block'; this.bigImageCont.style.visibility = 'visible'; this.bigImage.style.display = 'block'; this.bigImage.style.visibility = 'visible'; this.recalculating = false; }; visualsoftZoom.prototype.hiderect=function() { this.pup.style.visibility = "hidden"; this.bigImageCont.style.display = 'none'; this.bigImageCont.style.visibility = 'visible'; }; visualsoftZoom.prototype.initPopup = function() { pups = document.getElementsByName('zoomPup'); if(pups.length) { for(i=0;i'; //zoom = null; zoom = new visualsoftZoom('sc2', 'sim2', 'bc2', 'bim2'); zoom.initZoom(); if(!preload_image_object.complete) { setTimeout("changeBigImg('"+src+"')",100); return; } } */ zoom.bigImageCont.removeChild(document.getElementById('zoomPup_ar1')); var ar1 = document.createElement("DIV"); ar1.setAttribute("name", "zoomPup_ar1"); ar1.setAttribute("id", "zoomPup_ar1"); ar1.style.overflow = "hidden"; zoom.bigImageCont.appendChild(ar1); zoom.bigImage=document.createElement("IMG"); zoom.bigImage.setAttribute("name", "zoomPup_bigimage"); zoom.bigImage.setAttribute("id", "zoomPup_bigimage"); zoom.bigImage.src=src; zoom.bigImage.style.position='relative'; ar1.appendChild(zoom.bigImage); if(!zoom.bigImage.complete) { setTimeout("checkBigImg('"+src+"')",100); } return true; } function checkImg(src) { var sim2 = _el('sim2'); if(!sim2.complete) { //alert("reloading small image"); document.images.sim2.src = src; var imgcheck = setTimeout("checkImg('"+src+"')",500); } else { //alert("small image is loaded"); clearTimeout(imgcheck); document.images.sim2.src = src; } } function checkBigImg(src) { if(!zoom.bigImage.complete) { zoom.bigImage.src=src; var bigimgcheck = setTimeout("checkBigImg('"+src+"')",500); } else { clearTimeout(bigimgcheck); } } function changePopLink(image_id,product_id) { document.getElementById('sim2_link').onclick = function(){popupWindow(image_id,product_id);}; }