/* Free version provided by Gproxy, commercial version without Gproxy link are available at www.gproxy.com Owner: Gproxy Design Inc. Copyright (c) 2008, Gproxy Design Inc. All rights reserved. Agreement Redistribution and use of this software in source and binary forms, with or without modification, are permitted provided that all of the following conditions are met: (1) Redistributions of source code must retain: (i) the above copyright notice, (ii) this list of redistribution conditions, and (iii) the disclaimer appearing below. (iiii) the logos, hyperlinks or publicity provided in the original version. (2) Redistributions in binary form must retain: (i) the above copyright notice, (ii) this list of redistribution conditions, and (iii) the disclaimer appearing below in the documentation and/or any other materials provided with the distribution. (iiii) the logos, hyperlinks or publicity provided in the original version. (3) Neither the name of the Gproxy Design nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * Company Gproxy Design Inc - www.gproxy.com * Name of Script (freezoom.js) * Date 08/11/2008 * Version 1.0 * Type Client * Sub-Type Item Template * Categories Zoom the item image * Description: When you click at the item image, show's a pop up with the image zoomed, and, when you roll over the mouse over the image, you will see the image magnified like a magnifier glass. * NetSuite Ver. 11.0.4 or later * * Installation: -You have to call the function zoom(); in the link to zoom the image, this could be the item image itself, or a link. -Item template "add to head" field, yo have to call this script flie: -Item temaple HTML: you will use severals divisions (DIV) -> zoomPopUp, contains the entire zoom -> zoomTitle, contains zoom name and the close link -> other 2 divs that will display the large image and the zoom it self * * * License THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * COMMERCIAL VERSIONS WITH MORE FUNCTIONS and WITHOUT LOGO, WATERMARKS OR PUBLICITY ARE AVAILABLE CONTACT WWW.GPROXY.COM FOR DETAILS **/ // Use the following variables to set the zoom appearance var zoomw=200; // zoom width var zoomh=200; // zoom height var defzoomamount=3; var zoomamountstep=1.2; var zoomsizemin=1000; var zoomsizemax=100000; var zoomsizestep=1.2; var zoomamountmin=1; var zoomamountmax=12; var omo=""; function zoom_set(evt) { var evt = evt?evt:window.event?window.event:null; if(!evt){ return;} if(zoomid=='' || parseInt(document.getElementById('zoomid_container').style.width) == 0) {return true;} if(evt.keyCode==37 || evt.keyCode==100) {zoomw/=zoomsizestep; zoomh/=zoomsizestep; if(zoomw*zoomhzoomsizemax) {zoomh=Math.sqrt(zoomsizemax/zoomratio); zoomw=zoomh*zoomratio;} if(zoomw>objw) {zoomw=objw; zoomh=objw/zoomratio;} else if(zoomh>objh) {zoomh=objh; zoomw=objh*zoomratio} zoom_init(); zoom_move(); return; } //right if(evt.keyCode==40 || evt.keyCode==98) {zoomamount/=zoomamountstep; if(zoomamountzoomamountmax) {zoomamount=zoomamountmax;} zoom_init(); zoom_move(); return;} //up return; } function zoom_init() { document.getElementById('zoomid_clip').style.width=objw*zoomamount+'px'; document.getElementById('zoomid_clip').style.height=objh*zoomamount+'px'; } function zoom_move(evt) { if(typeof(evt) == 'object') { var evt = evt?evt:window.event?window.event:null; if(!evt){ return;} if(evt.pageX) { xx=evt.pageX - ffox; yy=evt.pageY - ffoy; } else { if(typeof(document.getElementById(zoomid)+1) == 'number') {return true;} //mert az ie egy ocska kurva // xx=evt.x - ieox; // yy=evt.y - ieoy; xx=evt.clientX - ieox; yy=evt.clientY - ieoy; } } else { xx=lastxx; yy=lastyy; } lastxx=xx; lastyy=yy; document.getElementById('zoomid_clip').style.margin=((yy-zoomh/2 > 0)?(zoomh/2-yy*zoomamount):(yy*(1-zoomamount)))+'px 0px 0px '+((xx-zoomw/2 > 0)?(zoomw/2-xx*zoomamount):(xx*(1-zoomamount)))+'px'; document.getElementById('zoomid_container').style.margin=((yy-zoomh/2 > 0)?(yy-zoomh/2):(0))+'px 0px 0px '+((xx-zoomw/2 > 0)?(xx-zoomw/2):(0))+'px'; w2=((xx+zoomw/2'; if(zoomw>objw) {zoomw=objw; zoomh=objw/zoomratio;} else if(zoomh>objh) {zoomh=objh; zoomw=objh*zoomratio} zoom_init(); zoom_move(''); if(document.all) { document.onkeydown=zoom_set; } else { window.captureEvents(Event.KEYDOWN); window.onkeydown = zoom_set; } return false; } var zoomamount=defzoomamount; var objw;var objh;var zoomid=''; var zoomratio=zoomw/zoomh; var ieox=0; var ieoy=0; var ffox=0; var ffoy=0; // confirm there's at least one image to zoom if(document.getElementById('linkZoomGallery')) { var hasEnlarged = false; for (h=0;h "; //more settings to put the blur in the right position in IE if (document.all) div.style.width=(document.body.offsetWidth-20)+"px"; var tt=document.createTextNode(" "); div.appendChild(tt); document.getElementsByTagName("body")[0].appendChild(div) window.scroll(0,0) resizeBlur(); addEvent(window, 'resize', resizeBlur, false); } } function resizeBlur(){ var pageDimentions = getPageSize(); document.getElementById("Blur").style.width=pageDimentions[0]+'px'; document.getElementById("Blur").style.height=pageDimentions[1]+'px'; } function removeBlur(){ if (document.getElementById("BlurWrapper")) { popOBJ(document.getElementById("BlurWrapper")); // here the blur is removed removeEvent(window, 'resize', resizeBlur, false); } } function closePopUpImg(){ document.getElementById('zoomPopUp').style.display = 'none'; removeBlur(); showInterferingElements(); } function getPageSize(){ var xScroll, yScroll; if (window.innerHeight && window.scrollMaxY) { xScroll = document.body.scrollWidth; yScroll = window.innerHeight + window.scrollMaxY; } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac xScroll = document.body.scrollWidth; yScroll = document.body.scrollHeight; } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari xScroll = document.body.offsetWidth; yScroll = document.body.offsetHeight; } var windowWidth, windowHeight; if (self.innerHeight) { // all except Explorer windowWidth = self.innerWidth; windowHeight = self.innerHeight; } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode windowWidth = document.documentElement.clientWidth; windowHeight = document.documentElement.clientHeight; } else if (document.body) { // other Explorers windowWidth = document.body.clientWidth; windowHeight = document.body.clientHeight; } // for small pages with total height less then height of the viewport if(yScroll < windowHeight){ pageHeight = windowHeight; } else { pageHeight = yScroll; } // for small pages with total width less then width of the viewport if(xScroll < windowWidth){ pageWidth = windowWidth; } else { pageWidth = xScroll; } arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) return arrayPageSize; } function addEvent(obj, evType, fn, useCapture){ if (obj.addEventListener){ obj.addEventListener(evType, fn, useCapture); return true; } else if (obj.attachEvent){ return (obj.attachEvent("on"+evType, fn)); } else return false; } function removeEvent(obj, evType, fn, useCapture){ if (obj.removeEventListener){ obj.removeEventListener(evType, fn, useCapture); return true; } else if (obj.detachEvent){ return (obj.detachEvent("on"+evType, fn)); } else return false; } function popOBJ(pObj){ if (pObj) pObj.parentNode.removeChild(pObj); } function hideInterferingElements(){ displaySelectBoxes(false); } function showInterferingElements(){ displaySelectBoxes(true); } function displaySelectBoxes(state){ selects = document.getElementsByTagName("select"); for (i = 0; i != selects.length; i++) { selects[i].style.display = (state)?"":"none"; } } function zoom(){ document.getElementById("zoomPopUp").style.display=""; hideInterferingElements(); placeBlur(); } // Is this code below needed .... Gerald says it is already called in the theme function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0;a&&i0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i\"Zoomed"; divZfl=document.getElementById("zcont").innerHTML=divzf1; document.getElementById("zoomPopUp").style.width=imgW+"px"; }