/**
* 3D Rotate Tool by YoFLA.com
*
* @author Matus Laco, www.yofla.com
* @description Script for rotating images to provide a 3D look of an object
* @sicne 06/2010
* @updated 2019-01-29
* @version 2.4.3
* @homepage http://www.yofla.com/3d-rotate/
*
* @license : You many not delete/modify this license or authorship info
* @license_type : Free License, You may not remove the YoFLA link in the top left corner.
* @licensed_to : Licensed to user who downloaded the 3DRT SetupUtility from http://www.yofla.com/3d-rotate/
* @authorized_domains : Free version can be run on unlimited websites.
*
* 3rd Party licenses:
* Wave Pre-loader: MIT (https://github.com/tobiasahlin/SpinKit)
*
*/
var RotateTool="object"===typeof RotateTool?RotateTool:{instances:{},logLevel:"info",logLevel:"none",isLogEnabled:!1,isLogToScreen:!1,isInitialized:!1,isTouchDevice:!1,isSupportedBrowser:null,isFullscreenBrowserAPISupported:!1,isCustomEventSupported:!1,isCanvasSupported:!1,isChrome:!1,isIE:!1,isFF:!1,authorizedDomains:"Free version can be run on unlimited websites.",scriptVersion:"2.4.3",licenseType:"Free License, You may not remove the YoFLA link in the top left corner.",eventsTouchStart:{forMouse:"mousedown",forTouch:"touchstart"},eventsTouchEnd:{forMouse:"mouseup",
forTouch:"touchend"},eventsTouchMove:{forMouse:"mousemove",forTouch:"touchmove"},eventsMouseOver:{forMouse:"mouseover",forTouch:void 0},eventsMouseOut:{forMouse:"mouseout",forTouch:void 0},eventsMouseLeave:{forMouse:"mouseleave",forTouch:void 0},listeners:[],ON_IMAGE:"3drt_on_image",ROTATION_START:"3drt_rotation_start",ROTATION_STOP:"3drt_rotation_stop",ZOOM_START:"3drt_zoom_start",ZOOM_STOP:"3drt_zoom_stop",ZOOM_CHANGE:"3drt_zoom_change",ZOOM_RESET:"3drt_zoom_reset",PAN_START:"3drt_pan_start",PAN_STOP:"3drt_pan_stop",
TURN_START:"3drt_turning_start",TURN_STOP:"3drt_turning_stop",HOTSPOT_HOVER:"3drt_hotspot_hover",HOTSPOT_HOVER_OUT:"3drt_hotspot_hover_out",HOTSPOT_OPEN:"3drt_hotspot_open",TOOLTIP_SHOW:"3drt_tooltip_show",TOOLTIP_HOVER:"3drt_tooltip_hover",TOOLTIP_HOVER_OUT:"3drt_tooltip_hover_out",PRELOADER_LOADED:"3drt_preloader_image_loaded",PRELOADER_PROGRESS:"3drt_preloader_progress",IMAGES_LOADED:"3drt_images_loaded",IMAGESLARGE_LOADED:"3drt_imageslarge_loaded",TOGGLE_ROTATE_MODE:"3drt_toggle_rotate_mode",
TOGGLE_PAN_MODE:"3drt_toggle_pan_mode",MOUSEWHEEL_ZOOM:"3drt_mousewheel_zoom",CLICK_OBJECT:"3drt_click_object",BUTTON_PLAY_PAUSE_CLICK:"3drt_button_play_pause_click",BUTTON_ARROW_LEFT_CLICK:"3drt_button_arrow_left_click",BUTTON_ARROW_RIGHT_CLICK:"3drt_button_arrow_right_click",BUTTON_FULLSCREEN_CLICK:"3drt_button_fullscreen_click",BUTTON_ZOOMSLIDER_CLICK:"3drt_button_zoomslider_click",BUTTON_ROTATE_CLICK:"3drt_button_toggle_rotate_click",BUTTON_PAN_CLICK:"3drt_button_toggle_pan_click",BUTTON_ZOOM_OUT_CLICK:"3drt_button_toggle_zoom_out_click",
BUTTON_ZOOM_IN_CLICK:"3drt_button_toggle_zoom_in_click",BUTTON_START_CLICK:"3drt_start_click",CONTEXMENU_SHOW:"3drt_contex-menu_show",zIndex:{images:5,imageShown:6,imageHidden:4,canvas:7,preloaderImage:9,preloader:10,customLayer:15,clickPane:20,buttons:30,hotspots:40,preloaderLarge:45,toolTip:50,overlay:100,hotspotImage:110,hotspotVideo:110,hotspotIframe:110,hotspotTitle:120,customLogo:130,contexMenu:150,hotspotCloseButton:1100,info:900},initialize:function(){this.isInitialized||(this.defaultGAevents=
[this.CLICK_OBJECT,this.BUTTON_PLAY_PAUSE_CLICK,this.BUTTON_ARROW_LEFT_CLICK,this.BUTTON_ARROW_RIGHT_CLICK,this.BUTTON_FULLSCREEN_CLICK,this.BUTTON_ZOOMSLIDER_CLICK,this.BUTTON_ROTATE_CLICK,this.BUTTON_PAN_CLICK,this.HOTSPOT_HOVER,this.HOTSPOT_OPEN,this.CONTEXMENU_SHOW,this.ZOOM_START],this.addPolyFills(),this.detectBrowsers(),this.isSupportedBrowser=this.supportedBrowserCheck(),this.isTouchDevice="ontouchstart"in document.documentElement,this.isMobileDevice=this.mobileCheck(),this.isFullscreenBrowserAPISupported=
this.fullscreenBrowserCheck(),this.isRunningInIframe=this.isInIframe(),this.isCustomEventSupported=this.detectCustomEventSupport(),this.isCanvasSupported=this.detectCanvasSupport(),this.yofla_360_is_preview=!1,this.addDefaultStyleSheets(),this.addTabInactivityObserver(),window.addEventListener?window.addEventListener("load",this.onPageLoaded,!1):window.attachEvent("onload",this.onPageLoaded),this.addGlobalFunctions(),this.isInitialized=!0)},addDefaultStyleSheets:function(){var a;a="div.rotate-tool-instance{";
a+="}";a+="img.rotate-tool-image";a+="{";a+=" max-width: none;";a+=" vartical-align: none;";a+=" -moz-box-sizing: none;";a+="}";a+="div.rotate-tool-spacer{";a+=" background-repeat: no-repeat";a+="}";a+="div.rotate-tool-hotspot-default{";a+="}";a+=".rotate-tool-unselectable{";a+=" -moz-user-select: none;";a+=" -webkit-user-select: none;";a+=" -ms-user-select: none;";a+=" user-select: none;";a+=" -webkit-user-drag: none;";a+=" user-drag: none;";a+="}";a+="\t\t.yp_wave {";
a+="\t\t\tmargin: 100px auto;";a+="\t\t\twidth: 50px;";a+="\t\t\theight: 30px;";a+="\t\t\ttext-align: center;";a+="\t\t\tfont-size: 10px;";a+="\t\t}";a+="\t\t.yp_wave > div {";a+="\t\t\tbackground-color: #333;";a+="\t\t\theight: 100%;";a+="\t\t\twidth: 6px;";a+="\t\t\tdisplay: inline-block;";a+="\t\t\t-webkit-animation: stretchdelay 1.2s infinite ease-in-out;";a+="\t\t\tanimation: stretchdelay 1.2s infinite ease-in-out;";a+="\t\t}";a+="\t\t.yp_wave .rect2 {";a+="\t\t\t-webkit-animation-delay: -1.1s;";
a+="\t\t\tanimation-delay: -1.1s;";a+="\t\t}";a+="\t\t.yp_wave .rect3 {";a+="\t\t\t-webkit-animation-delay: -1.0s;";a+="\t\t\tanimation-delay: -1.0s;";a+="\t\t}";a+="\t\t.yp_wave .rect4 {";a+="\t\t\t-webkit-animation-delay: -0.9s;";a+="\t\t\tanimation-delay: -0.9s;";a+="\t\t}";a+="\t\t.yp_wave .rect5 {";a+="\t\t\t-webkit-animation-delay: -0.8s;";a+="\t\t\tanimation-delay: -0.8s;";a+="\t\t}";a+="\t\t@-webkit-keyframes stretchdelay {";a+="\t\t\t0%, 40%, 100% { -webkit-transform: scaleY(0.4) }";a+="\t\t20% { -webkit-transform: scaleY(1.0) }";
a+="\t\t}";a+="\t\t@keyframes stretchdelay {";a+="\t\t\t0%, 40%, 100% {";a+="\t\t\t\ttransform: scaleY(0.4);";a+="\t\t\t-webkit-transform: scaleY(0.4);";a+="\t\t} 20% {";a+="\t\t\ttransform: scaleY(1.0);";a+="\t\t\t-webkit-transform: scaleY(1.0);";a+="\t\t\t}";a+="\t\t}";a+="span.rotate-tool-tooltip{";a+=" font-family: sans-serif;";a+=" font-size: 13px;";a+=" color: #0c0c0c;";a+=" padding: 5px;";a+=" opacity: 0.85;";a+=" filter: Alpha(Opacity=85);";a+=" border-radius: 5px;";a+=
" border: 1px solid gray;";a+=" background-color: rgba(230,230,230,0.5);";a+="}";a+="ul.rotate-tool-contex-menu {";a+="border:0px solid #666;";a+="min-width:150px;";a+="max-width:350px;";a+="list-style:none;";a+="padding:0;";a+="margin:0;";a+="cursor:pointer;";a+="}";a+="ul.rotate-tool-contex-menu li {";a+="text-align:left;";a+="padding:3px 10px 3px 5px;";a+="margin:0;";a+="cursor:pointer;";a+='font-family: "Lucida Grande", Verdana, Arial, "Bitstream Vera Sans", sans-serif;';a+="text-decoration:none;";
a+="color:#fff;";a+="font-size:12px;";a+="border-top:1px solid #fff;";a+="border-left:1px solid #fff;";a+="border-bottom:1px solid #999;";a+="border-right:1px solid #999;";a+="background-color: rgba(0,0,0,.7);";a+="}";a+="ul.rotate-tool-contex-menu li.selected,";a+="ul.rotate-tool-contex-menu li:hover {";a+="color:#fff;";a+="background-color: rgba(56,117,215,.7);";a+="cursor:pointer;";a+="}";a+="ul.rotate-tool-contex-menu li.selected:hover {";a+="color:#333;";a+="background-color:#eee;";a+="cursor:pointer;";
a+="}";a+="ul.rotate-tool-contex-menu li.disabled,";a+="ul.rotate-tool-contex-menu li:hover.disabled {";a+="background-color: #eee;";a+="color:#999;";a+="cursor:pointer;";a+="}";var d=document.getElementsByTagName("head")[0],b=document.createElement("style");b.type="text/css";b.styleSheet?b.styleSheet.cssText=a:b.appendChild(document.createTextNode(a));d.appendChild(b)},onPageLoaded:function(){RotateTool.execRotateTool()},create:function(a,d){if(document.getElementById(a))return rotationData={target:a,
path:d.path,id:a,configFile:d.configFile,themeUrl:d.themeUrl,size:d.size,useCanvas:d.useCanvas,preloadLargeImages:d.preloadLargeImages,gaData:d.gaData?d.gaData:{}},this.add(rotationData),this.get(a);console&&console.log("3DRT: target div must be in DOM before .create() is called.")},execRotateTool:function(){if(!1!=RotateTool.isObjectEmpty(RotateTool.instances)&&document.querySelectorAll)for(var a=document.querySelectorAll("[data-rotate-tool]"),d,b,g,c,h=0;h"+this.logTarget.innerHTML:this.createLogTarget()},createLogTarget:function(){var a=this.get();
a&&a.target&&(this.logTarget=document.createElement("div"),this.logTarget.className="rotate-tool-log-target",this.logTarget.style.position="absolute",this.logTarget.style.width="50%",this.logTarget.style.height="50%",this.logTarget.style.border="1px solid red;",this.logTarget.style.zIndex=999,this.logTarget.style.backgroundColor="yellow",this.logTarget.style.opacity="0.65",this.logTarget.style.filter="alpha(Opacity=65)",this.logTarget.style.overflow="scroll",this.logTarget.style.color="black",this.logTarget.style.fontSize=
"11px",this.logTarget.style.textAlign="left",this.logTarget.innerHTML="test",a.target.appendChild(this.logTarget))},validateRotationData:function(a){return a.target?!0:"Target not defined!"},rotateToolFactory:function(a){var d={rotationData:a,THRESHOLD_TIME_ROTATE_PAN_DIF:500,THRESHOLD_TIME_DRAG_STOP_ROTATE:100,elementId:a.target,target:document.getElementById(a.target),path:a.path,configFile:a.configFile?a.configFile:"config.js",isConfigJsLoaded:!1,productId:a.id,themeUrl:a.themeUrl,forcedSize:a.size,
settings:{},originalTargetWidth:null,originalTargetHeight:null,originalTargetRatio:null,targetWidth:400,targetHeight:300,targetRation:null,zIndex:{},buttons:{},vSteps:null,hSteps:null,imageNodes:null,rotateIntervalDuration_original:null,rotateIntervalDuration_current:null,rotateIntervalThresholdStop:null,rotateInterval:null,rotateImages:[],imagesGrid:[],lastImgH:null,lastImgV:null,newImgH:null,newImgV:null,dx:0,dy:0,previousDx:0,isRotating:!1,wasRotating:!1,currentImage:null,previousImage:null,rotateOnceCounter:0,
timeLastImageShown:0,durationMultiplier:1,isZoomed:!1,scaleInPercent:100,relativeX:0.5,relativeY:0.5,isRotationWhenZoomed:!1,zoomStepInPercent:100,zoomStepInRatio:100,zoomSteps:4,maxZoomThreshold:105,objectWidth:400,objectHeight:400,dragInterval:null,touchStart:null,touchMove:null,touchMovePrevious:null,touchMovePreviousDrag:null,isGestureStart:!1,gestureStartValue:null,lastYatDyChange:null,touchEnd:null,mouseWheelZooms:!1,currentZoomValue:0,zoomInPercent:100,isMouseMoved:!1,imageLoadErrorsString:"",
imageLoadErrorCount:0,imagesToLoad:null,imagesLoaded:0,largeImagesLoaded:0,imagesProcessed:0,isImagesLoaded:!1,preloader:null,usingSmallImages:null,startButtonToggled:!1,loadImagesInSequence:!1,hotspotInstances:null,activeHotspot:null,hotspotOverlay:null,hotspotImage:null,isHotspotsVisible:!0,tooltips:{},rotateToCallback:null,daggedObject:null,clickPaneTouchMoveReference:null,clickPaneTouchEndReference:null,requestRescaleFlag:!1,mouseWheelCounter:0,clickPane:null,sliderHandle:null,handleMaxX:null,
infoPanel:null,clickPane:null,sliderHandle:null,silderContainer:null,isGAenabled:a.gaData.isEnabled&&"true"==a.gaData.isEnabled.toLowerCase(),gaEnabledEvents:a.gaData.enabledEvents instanceof Array?a.gaData.enabledEvents:RotateTool.defaultGAevents,gaTrackingId:a.gaData.trackingId,gaCategory:a.gaData.category,gaLabel:a.gaData.label,setLevel:function(b){!1!==this.isImagesLoaded&&(this.lastImgV=b,b=this.dx,this.dx=this.dy=0,this.showNextImage(),this.dx=b)},setImage:function(b,a){a="undefined"!==typeof a?
a:!0;if(!isNaN(b)&&!1!==this.isImagesLoaded){var c=this.dx;this.stopRotation();b>this.imagesToLoad-1||(1==this.vSteps||bRotateTool.authorizedDomains.indexOf(c)&&"localhost"!==
c&&b.unshift({title:"Domain not authorized!",action:"URL_OPEN",data:"http://www.yofla.com/3d-rotate/support/domain-not-authorized/"})}0"};this.positionToolTip=function(){var c=10,k=10,l,n=this.htmlElement.offsetWidth,m=this.htmlElement.offsetHeight;if(!(n>=d.targetWidth||m>=d.targetHeight)){a instanceof Array&&2==a.length?(c=a[0],k=a[1],l=20):("IMG"==a.tagName&&(a=a.parentNode),k=a.offsetTop,c=a.offsetLeft,l=a.offsetWidth);switch(this.positioning){case "CENTER_TO_HOTSPOT":c=Math.floor(c-0.5*n);k=Math.floor(k-0.5*m);break;default:c=c+l+
5,"mousewheel_tooltip"==b.id&&(k+=10)}c=Math.max(c,10);k=Math.max(k,10);c=Math.min(c,d.targetWidth-n-10);k=Math.min(k,d.targetHeight-m-10)}this.htmlElement.style.left=c+"px";this.htmlElement.style.top=k+"px"};this.createToolTipWrapper=function(){var b=document.createElement("div");d.target.appendChild(b);b.className="rotate-tool-tooltip-wrapper rotate-tool-unselectable";b.style.position="absolute";b.style.zIndex=RotateTool.zIndex.toolTip;b.style.display="none";b.style.opacity=0;b.style.cursor="pointer";
RotateTool.addClickOrTouchListener(b,RotateTool.eventsTouchEnd,RotateTool.bind(this,this.mouseOrTouchEnd));RotateTool.addClickOrTouchListener(b,RotateTool.eventsMouseLeave,RotateTool.bind(this,this.mouseLeave));RotateTool.addClickOrTouchListener(b,RotateTool.eventsMouseOver,RotateTool.bind(this,this.mouseOver));return b};this.mouseOrTouchEnd=function(){this.hide();RotateTool.isTouchDevice||(this.activeHotspot=null,d.executeHotspot(b))};this.mouseLeave=function(){this.hide();c.dispatchEvent(RotateTool.TOOLTIP_HOVER_OUT,
{tooltipObject:this})};this.mouseOver=function(){clearTimeout(d.hideToolTipsInterval);c.dispatchEvent(RotateTool.TOOLTIP_HOVER,{tooltipObject:this})};this.show=function(a){this.htmlElement&&(d.hideToolTips(b.id),this.timeoutToolTipOnHideCompleted?(this.htmlElement.style.opacity=1,this.htmlElement.style.display="block",clearTimeout(this.timeoutToolTipOnHideCompleted),this.timeoutToolTipOnHideCompleted=null):(this.htmlElement.style.display="block",this.positionToolTip(),this.htmlElement.style.MozTransition=
"opacity 0.4s ease-in-out",this.htmlElement.style.WebkitTransition="opacity 0.4s ease-in-out",this.htmlElement.style.opacity=1,this.timeoutToolTipOnHideCompleted=null,c.dispatchEvent(RotateTool.TOOLTIP_SHOW,{hotspotData:b,tooltipElement:this.htmlElement}),a&&(a=parseInt(a),this.autoHideTimout=setTimeout(RotateTool.bind(this,this.hide),a))))};this.hide=function(){this.htmlElement.style.MozTransition="opacity 0.3s ease-in-out";this.htmlElement.style.WebkitTransition="opacity 0.3s ease-in-out";this.htmlElement.style.opacity=
0;this.timeoutToolTipOnHideCompleted=setTimeout(RotateTool.bind(this,this.onHideCompleted),300)};this.onHideCompleted=function(){this.htmlElement.style.display="none";this.timeoutToolTipOnHideCompleted=null};this.initialize=function(){!0==b.keepVisible&&(this.keepVisible=!0);b.toolTip&&typeof("object"==b.toolTip.html)?this.createHtmlToolTip():b.title&&this.createSimpleToolTip()};this.initialize()}(b,this)},hotspotTouchStartListener:function(b,a){},hotspotTouchEndListener:function(b,a){},getCurrentImageId:function(){return this.currentImage?
this.currentImage.idNumber:null},getHotspotDataById:function(b){var a=this.settings.hotspots;return a&&a[b]?a[b]:null},executeHotspot:function(b,a){},executeJavascriptHotspot:function(b,a){},executeUrlHotspot:function(b){},executeIframeHotspot:function(b){},showIframe:function(b){},hideIframeHotspot:function(){this.hideHotspotCloseButton();this.target.removeChild(this.hotspotOverlay);this.target.removeChild(this.iframe);this.iframe=null},executeImageHotspot:function(b){},executeVideoHotspot:function(b){},
showHotspotCloseButton:function(b){this.closeHotspotButton||this.createHotspotCloseButton();this.closeHotspotButton.style.display="block";this.hotspotCloseButtonCallback=b?b:null},hideHotspotCloseButton:function(){this.closeHotspotButton&&(this.closeHotspotButton.style.display="none")},createHotspotCloseButton:function(){var b=document.createElement("div");b.className="rotate-tool-close-hotspot-button-wrapper";var a=document.createElement("div");a.className="rotate-tool-close-hotspot-button-content";
a.innerHTML="✖";b.appendChild(a);b.style.zIndex=this.zIndex.hotspotCloseButton;b.style.display="none";this.target.appendChild(b);RotateTool.addClickOrTouchListener(b,{forTouch:"touchend",forMouse:"click"},RotateTool.bind(this,this.onButtonHotspotCloseListener));this.closeHotspotButton=b},onButtonHotspotCloseListener:function(){this.hotspotCloseButtonCallback?this.hotspotCloseButtonCallback():(this.hideHotspotCloseButton(),this.hideVideoHotspot())},createHotspotOvelay:function(){},loadHotspotImage:function(b){},
hotspotImageError:function(b){},hotspotImageLoaded:function(b){},fitHotspotImageToTarget:function(b){},addHotspotTitle:function(b){},hideImageHotspot:function(){},hideVideoHotspot:function(){},redrawHotspots:function(){},hideAllHotspots:function(){},showFixedHotspots:function(){},showHotspot:function(b){},getWorkingDx:function(){return 0!=this.previousDx?this.previousDx:0>this.settings.rotation.rotateDirection?-1:1},startRotation:function(){this.dispatchEvent(RotateTool.ROTATION_START);0==this.dx&&
(this.dx=this.getWorkingDx());this.isRotating=!0;this.rotateIntervalDuration_current=this.rotateIntervalDuration_original},stopRotation:function(){0!=this.dx&&(this.dispatchEvent(RotateTool.ROTATION_STOP),this.isRotating=!1,this.previousDx=this.dx,this.dx=0,this.rotateToCallback=this.targetImagePosH=null,this.setScale(this.scaleInPercent,this.currentImage))},stopRotationSmooth:function(){this.dispatchEvent(RotateTool.ROTATION_STOP);this.durationMultiplier=1.05},startRotationSmooth:function(){this.dispatchEvent(RotateTool.ROTATION_START);
this.dx=this.getWorkingDx();this.rotateIntervalDuration_current=1.5*this.rotateIntervalDuration_original;this.durationMultiplier=0.95},rotateTo:function(b,a){var c,d;if(!(b>=this.imagesLoaded)){1==this.vSteps||bc&&(f=k-c,e=this.hSteps-k+c),this.lastImgV=d,this.targetImagePosH=c,this.dx=ethis.rotateIntervalDuration_original&&(this.rotateIntervalDuration_current=this.rotateIntervalDuration_original,this.durationMultiplier=1));window.requestAnimationFrame&&window.requestAnimationFrame(RotateTool.bind(this,this.rotateLoop));this.okNextImage()&&this.showNextImage()},showNextImage:function(b){null==this.lastImgH?this.newImgV=this.newImgH=0:
(this.newImgH=this.lastImgH+this.dx,this.newImgV=this.lastImgV+this.dy);this.newImgH>=this.hSteps&&(this.newImgH=0,this.bounce&&(this.newImgH=this.hSteps-1,this.dx=-this.dx));0>this.newImgH&&(this.newImgH=this.hSteps-1,this.bounce&&(this.newImgH=0,this.dx=-this.dx));this.newImgV>=this.vSteps&&(this.newImgV=this.vSteps-1);0>this.newImgV&&(this.newImgV=0);this.targetImagePosH&&this.newImgH==this.targetImagePosH&&(this.rotateToCallback&&"function"==typeof this.rotateToCallback&&this.rotateToCallback(),
this.stopRotation());try{if(this.currentImage=this.rotateImages[this.imagesGrid[this.newImgV][this.newImgH]],!this.currentImage)return}catch(a){return}if(!this.isDragging||!this.currentImage||this.currentImage!=this.previousImage){this.requestRescaleFlag&&this.setRescaleFlag();var c={imgH:this.newImgH,imgV:this.newImgV,imgSrc:this.currentImage.src,imageId:this.currentImage.idNumber,fileName:this.currentImage.fileName};!1===("undefined"===typeof b?!1:b)&&this.dispatchEvent(RotateTool.ON_IMAGE,c);this.setScale(this.scaleInPercent,
this.currentImage);this.useCanvas?(this.setScale(this.scaleInPercent,this.currentImage),this.redrawCanvas()):this.targetImage&&this.redrawTargetImage();this.hideToolTips();this.previousImage=this.currentImage;this.redrawHotspots();this.lastImgH=this.newImgH;this.lastImgV=this.newImgV;this.settings.rotation.rotateOnce&&(this.rotateOnceCounter++,this.settings.rotation.bounce?this.rotateOnceCounter==2*(this.hSteps+1)&&(this.stopRotation(),this.settings.rotation.rotateOnce=!1):this.rotateOnceCounter==
this.hSteps+1&&(this.stopRotation(),this.settings.rotation.rotateOnce=!1));this.timeLastImageShown=Date.now()}},redrawTargetImage:function(){this.targetImage.src=this.currentImage.src;this.targetImage.srcLarge=this.currentImage.srcLarge;this.targetImage.style.width=this.currentImage.style.width;this.targetImage.style.top=this.currentImage.style.top;this.targetImage.style.left=this.currentImage.style.left;this.targetImage.correctLeft=this.currentImage.correctLeft},redrawCanvas:function(){this.useCanvas&&
this.currentImage&&this.currentImage.complete&&(this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.ctx.drawImage(this.currentImage,parseInt(this.currentImage.style.left)||0,parseInt(this.currentImage.style.top)||0,parseInt(this.currentImage.style.width),parseInt(this.currentImage.style.height)))},okNextImage:function(){var b=Date.now()-this.timeLastImageShown;if(!this.previousImage)return!0;if(0==this.dx&&0==this.dy)return!1;if(b>this.rotateIntervalDuration_current)return!0},setScale:function(b,
a){if(a&&!a.scaled&&b){b=Math.max(100,b);this.scaleInPercent=b=Math.min(b,this.settings.control.maxZoom);var c=1,c=this.targetRatiothis.targetWidth&&(c=Math.min(c,0),c=Math.max(c,k));f>this.targetHeight&&
(d=Math.min(d,0),d=Math.max(d,l));a.style.top=""+d+"px";a.style.left=""+c+"px"}else this.relativeY=this.relativeX=0.5,cthis.THRESHOLD_TIME_DRAG_STOP_ROTATE||!1==this.settings.control.enableSwing)this.dy=this.dx=0,this.rotateIntervalDuration_current=this.rotateIntervalDuration_original},dragListener:function(a){var d=a=0,c=0.5;this.bounce&&(c=1);if(!this.isGestureStart&&this.touchStart&&this.touchMove){a=this.touchStart.y-this.touchMove.y;var d=this.touchStart.x-this.touchMove.x,h=RotateTool.signum(this.touchMovePreviousDrag.x-
this.touchMove.x);this.previousDx=h;0==this.previousDx&&(this.previousDx=RotateTool.signum(d));this.settings.control.reverseDrag&&(d*=-1,this.previousDx*=-1);c=Math.floor(this.hSteps*(d/this.objectWidth)*c);c=0<=c?c%this.hSteps:-(Math.abs(c)%this.hSteps);c=this.touchStart.lastImgH+c;0>c?(c+=this.hSteps,this.bounce&&(c=0)):c>=this.hSteps&&(c%=this.hSteps,this.bounce&&(c=this.hSteps-1));var e=this.lastImgV;if(1e&&(e=0),e>=this.vSteps&&(e=this.vSteps-1))}if(1==this.vSteps&&25>Math.abs(d)&&100==this.scaleInPercent&&!0==RotateTool.isTouchDevice){d=window;RotateTool.isRunningInIframe&&(d=window.parent);try{d.scrollTo(this.windowXPositionAtTouchStart,this.windowYPositionAtTouchStart+a)}catch(l){}}this.dy=this.dx=0;this.lastImgH=c;this.lastImgV=e;a=this.timeLastImageShown;
this.showNextImage();this.rotateIntervalDuration_current=Date.now()-a;this.touchMovePreviousDrag=this.touchMove}},evalClickPaneTouchEnd:function(a,d){var c=!1,h=1;if(d&&a){var e=Math.abs(d.x-a.x),f=Math.abs(d.y-a.y);RotateTool.isTouchDevice&&(h=8);e+f<=h&&(c=!0);return c}},evalClickPaneTouchMove:function(a,d){var c=d.x-a.x,h=d.y-a.y,e=!1;if(!(RotateTool.isTouchDevice&&10>=Math.abs(c)+Math.abs(h))){Math.abs(h)>Math.abs(c)&&1==this.vSteps&&(e=!0);var f=d.timeStamp-a.timeStamp;!1==this.isMouseMoved&&
(f>this.THRESHOLD_TIME_ROTATE_PAN_DIF||e&&this.settings.control.switchToPanOnYmovement)&&this.isRotationWhenZoomed&&(this.wasRotationWhenZoomed=!0,this.toggleRotationInZoomMode(!1));if(!this.isRotationWhenZoomed){var c=this.currentImage.startOffsetX+c,h=this.currentImage.startOffsetY+h,e=parseInt(this.currentImage.style.width),f=parseInt(this.currentImage.style.height),k=this.targetWidth-e-0,l=this.targetHeight-f-0;e>this.targetWidth&&(c=Math.min(c,0),c=Math.max(c,k));f>this.targetHeight&&(h=Math.min(h,
0),h=Math.max(h,l));c>0.5*this.targetWidth&&(c=Math.floor(0.5*this.targetWidth));h>0.5*this.targetHeight&&(h=Math.floor(0.5*this.targetHeight));c+e<0.5*this.targetWidth&&(c=Math.floor(0.5*this.targetWidth)-e);h+f<0.5*this.targetHeight&&(h=Math.floor(0.5*this.targetHeight)-f);if(this.currentImage)try{this.currentImage.style.left=c+"px",this.currentImage.style.top=h+"px",this.relativeX=-(c-0.5*this.targetWidth)/parseInt(e),this.relativeY=-(h-0.5*this.targetHeight)/parseInt(f),this.useCanvas&&(this.ctx.clearRect(0,
0,this.canvas.width,this.canvas.height),this.ctx.drawImage(this.currentImage,parseInt(this.currentImage.style.left),parseInt(this.currentImage.style.top),parseInt(this.currentImage.style.width),parseInt(this.currentImage.style.height))),this.targetImage&&this.redrawTargetImage()}catch(n){}this.setRescaleFlag()}this.redrawHotspots();this.isMouseMoved=!0}},evalClickOnPane:function(a){this.dispatchEvent(RotateTool.CLICK_OBJECT);this.settings.control.clickUrl?(this.stopRotation(),this.openClickUrl()):
(this.dx=this.wasRotating?this.getWorkingDx():0,this.checkDoubleClick(a)&&100!=this.scaleInPercent&&this.resetZoom(),!1==this.settings.control.rotateOnClick&&(this.dx=this.wasRotating?0:this.getWorkingDx()),this.toggleRotation())},checkDoubleClick:function(a){var d=a.timeStamp;if(this.previousTouchEndTime&&(a=d-this.previousTouchEndTime,300>a))return!0;this.previousTouchEndTime=d;return!1},openClickUrl:function(){var a=this.settings.control.clickUrl,d=this.settings.control.clickUrlTarget;a&&(d||(d=
"_top"),window.open(a,d))},MouseWheelHandler:function(a){a=window.event||a;var d=Math.max(-1,Math.min(1,a.wheelDelta||-a.detail));try{a.preventDefault()}catch(c){}this.settings.control.mouseWheelZooms||a.ctrlKey||a.metaKey?(a=this.settings.control.maxZoom,this.settings.control.zoomInStopsRotation&&this.stopRotation(),d=1/(a-100)*(this.scaleInPercent-10*d)-100*(1/(a-100)),isNaN(d)||this.zoomRatioChangeListener(d,"mouseWheel")):(!0!==this.toolTipOnMouseWheelShown&&!1==RotateTool.isTouchDevice&&(a=RotateTool.getLocalMousePosition(a),
this.showToolTip({id:"mousewheel_tooltip",keepVisible:!0,title:{text:"Tip: use MouseWheel+Ctrl for Zooming"}},[a.x,a.y],3E3),this.toolTipOnMouseWheelShown=!0),this.stopRotation(),this.dx=d,this.mouseWheelCounter++,0==this.mouseWheelCounter%4&&this.showNextImage())},toggleRotation:function(){0==this.dx?this.startRotation():this.stopRotation()},windowResizeListener:function(a){this.wasRotating=0!=this.dx;this.stopRotation();this.resetZoom();this.updateTargetStyles();this.updateMaxZoom();this.imagesLoaded&&
(this.currentImage&&(this.currentImage.scaled=!1),this.updateScalesOfImages(),this.redrawCanvas(),this.wasRotating?(this.dx=this.getWorkingDx(),this.startRotation()):(this.setScale(100,this.currentImage),this.showNextImage()),this.repositionFixedHotspots())},repositionFixedHotspots:function(){if(this.hotspotInstances)for(var a in this.hotspotInstances)this.hotspotInstances[a].isFixed&&this.positionFixedHotspot(this.hotspotInstances[a])},updateScalesOfImages:function(){if(this.imagesLoaded)for(var a,
d=0;da.normalImageWidth)a.srcCurrent!=a.srcLarge&&(a.largeImageWidth?(a.originalWidth=a.largeImageWidth,a.originalHeight=a.largeImageHeight,a.scaled=!1,RotateTool.setImageSource(a,a.srcLarge),!1==this.isSpinning()&&a.srcLarge==this.currentImage.srcLarge&&this.showNextImage()):this.loadLargeImage(a,!0));else if(a.srcCurrent!=a.srcNormal&&
(RotateTool.setImageSource(a,a.srcNormal),a.originalWidth=a.normalImageWidth,a.originalHeight=a.normalImageHeight,wasScaled=a.scaled=!1,!1==this.isSpinning()&&a.srcNormal==this.currentImage.srcNormal)){var d=this;setTimeout(function(){d.currentImage.onload=function(){d.showNextImage()};d.currentImage.src=d.currentImage.srcNormal},300)}},fullscrentChangedListener:function(){RotateTool.isFullscreen();this.windowResizeListener()},zoomRatioChangeListener:function(a,d){if("undefined"!=typeof a&&!isNaN(a)){this.settings.control.zoomInStopsRotation&&
this.stopRotation();a=Math.max(0,a);this.currentZoomValue=a=Math.min(1,a);var c=100+(this.settings.control.maxZoom-100)*a;this.dispatchEvent(RotateTool.ZOOM_CHANGE,this.lastImgH);0==a&&this.dispatchEvent(RotateTool.ZOOM_RESET,this.lastImgH);this.currentImage&&(this.currentImage.scaled=!1,this.setScale(c,this.currentImage),this.currentImage.scaled=!1,this.useCanvas?(this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.ctx.drawImage(this.currentImage,parseInt(this.currentImage.style.left),
parseInt(this.currentImage.style.top),parseInt(this.currentImage.style.width),parseInt(this.currentImage.style.height))):this.redrawTargetImage());this.requestRescaleFlag=!0;this.isZoomed=0!==a;"sliderHandle"!=d&&this.updateSliderHandlePosition(a);"zoom"==this.settings.userInterface.showToggleRotateButton&&this.toggleToggleRotatePanButtons(0!=a)}},toggleToggleRotatePanButtons:function(a){this.buttons["rotate-tool-button-toggle-pan"]&&this.buttons["rotate-tool-button-toggle-rotate"]&&(a?(this.buttons["rotate-tool-button-toggle-pan"].style.display=
"block",this.buttons["rotate-tool-button-toggle-rotate"].style.display="block"):(this.buttons["rotate-tool-button-toggle-pan"].style.display="none",this.buttons["rotate-tool-button-toggle-rotate"].style.display="none"))},resetZoom:function(){this.zoomRatioChangeListener(0,null);this.requestRescaleFlag=!0},reportBrowserNotSupported:function(){this.target.innerHTML='Your browser does not support this 360° object rotation script.'},addPlayerInfo:function(){var a=
document.createElement("div"),d=document.createElement("a");d.href="http://www.yofla.com/3d-rotate/player-about/";d.target="_blank";d.innerHTML="360 by YoFLA";d.style.textDecoration="none";d.style.color="navy";d.style.fontFamily="sans-serif";d.style.fontSize="10px";d.style.paddingLeft="5px";d.style.paddingRight="5px";a.appendChild(d);this.target.appendChild(a);a.style.position="absolute";a.style.top="2px";a.style.right="4px";a.style.zIndex=this.zIndex.info+1;a.style.background="white";a.style.borderRadius=
"5px";a.style.opacity=0.75;a.style.filter="alpha(Opacity=75)";setTimeout(function(){a.style.display="none"},5500)},addEventListener:function(a,d,c){c="undefined"===typeof c?!1:c;!1===RotateTool.isCustomEventSupported?document.addEventListener(a,d,c):this.target.addEventListener(a,d,c)},removeEventListener:function(a,d,c){c="undefined"===typeof c?!1:c;!1===RotateTool.isCustomEventSupported?document.removeEventListener(a,d,c):this.target.removeEventListener(a,d,c)},dispatchEvent:function(a,d){this.detectZoomStart(a);
this.isGAenabled&&this.reportGAevent(a,d);if(!1===RotateTool.isCustomEventSupported)try{var c=document.createEvent("Event");c.initEvent(a,!0,!0);c.detail=d;document.dispatchEvent(c)}catch(h){}else c=new CustomEvent(a,{detail:d}),c.bubbles=!0,this.target.dispatchEvent(c)},detectZoomStart:function(a){a==RotateTool.ZOOM_CHANGE&&this.lastEventName!=RotateTool.ZOOM_CHANGE&&this.dispatchEvent(RotateTool.ZOOM_START);this.lastEventName=a},reportGAevent:function(a,d){},rotateToolInstanceLast:"no colon"};d.initialize();
return d},fixPathVariable:function(a){if(a&&0a&&(b=" ");this.percentDiv&&(this.percentDiv.innerHTML=b+a+"%");this.progressBar&&(this.progressBar.style.width=a+"%")},destroy:function(){this.percentDiv.innerHTML="";this.percentDiv.style.display="none";this.containerDiv.removeChild(this.percentDiv);this.containerDiv.removeChild(this.backgroundDiv);this.containerDiv.removeChild(this.progressBar);this.targetDiv.removeChild(this.containerDiv);this.containerDiv=this.targetDiv=this.percentDiv=this.progressBar=this.backgroundDiv=
null}};e.initialize(a);return e},wavePreloader:function(a,d){var b=this,g=Number(d.background.alpha),c=Math.floor(100*g),h={percentDiv:null,targetDiv:null,containerDiv:null,initialize:function(a,f){this.containerDiv=document.createElement("div");this.containerDiv.className="rotate-tool-preloader";this.containerDiv.style.webkitTransform="translateZ(0)";this.containerDiv.style.MozTransform="translateZ(0)";this.containerDiv.style.msTransform="translateZ(0)";this.containerDiv.style.OTransform="translateZ(0)";
this.containerDiv.style.transform="translateZ(0)";this.containerDiv.style.width="100%";this.containerDiv.style.height="100%";this.containerDiv.style.position="absolute";this.containerDiv.style.zIndex=b.zIndex.preloader;this.targetDiv=document.getElementById(a);this.targetDiv.appendChild(this.containerDiv);this.backgroundDiv=document.createElement("div");this.backgroundDiv.style.left="0px";this.backgroundDiv.style.zIndex=b.zIndex.preloader;this.backgroundDiv.style.position="absolute";this.backgroundDiv.style.top=
Math.round(this.targetDiv.offsetHeight/2)-33+"px";this.backgroundDiv.style.width="100%";this.backgroundDiv.style.height="50px";d.background.enabled&&(this.backgroundDiv.style.backgroundColor=d.background.color,this.backgroundDiv.style.opacity=g,this.backgroundDiv.style.filter="alpha(Opacity="+c+")");this.containerDiv.appendChild(this.backgroundDiv);this.percentDiv=document.createElement("div");this.percentDiv.style.zIndex=b.zIndex.preloader+1;this.percentDiv.style.position="relative";var k;k=""+('');k=k+('\t
')+('\t
');k+='\t
';k+='\t
';k+='\t
';k+="
";this.percentDiv.innerHTML=k;this.percentDiv.setAttribute("id","preloader_"+this.targetDiv.id);this.containerDiv.appendChild(this.percentDiv)},
update:function(a){},destroy:function(){this.percentDiv.innerHTML="";this.percentDiv.style.display="none";this.containerDiv.removeChild(this.percentDiv);this.containerDiv.removeChild(this.backgroundDiv);this.targetDiv.removeChild(this.containerDiv);this.containerDiv=this.targetDiv=this.percentDiv=this.progressBar=this.backgroundDiv=null}};h.initialize(a,d.color1);return h},addClickOrTouchListener:function(a,d,b){this.isTouchDevice?void 0!==d.forTouch&&this.addEventSimple(a,d.forTouch,b):void 0!==
d.forMouse&&this.addEventSimple(a,d.forMouse,b)},removeClickOrTouchListener:function(a,d,b){this.isTouchDevice?this.removeEventSimple(a,d.forTouch,b):this.removeEventSimple(a,d.forMouse,b)},bind:function(a,d,b){return function(){d.apply(a,arguments)}},signum:function(a){return 0a?-1:0},detectBrowsers:function(){var a=navigator.userAgent,d;this.isChrome=-1>>0,g=Number(d)||0,g=0>g?Math.ceil(g):Math.floor(g);for(0>g&&(g+=b);g