var image_timeout = 1000; 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.inspirations4u.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.inspirations4u.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.inspirations4u.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; att_list = document.getElementById('attribute_list'); if(typeof att_list == 'object') { att_list.style.display='none'; att_list.style.visibility='hidden'; } }; visualsoftZoom.prototype.hiderect=function() { this.pup.style.visibility = "hidden"; this.bigImageCont.style.display = 'none'; this.bigImageCont.style.visibility = 'visible'; att_list = document.getElementById('attribute_list'); if(typeof att_list == 'object') { att_list.style.display='block'; att_list.style.visibility='visible'; } }; visualsoftZoom.prototype.initPopup = function() { pups = document.getElementsByName('zoomPup'); if(pups.length) { for(i=0;i