var loadMouseHandler=true;var thumbWindow=null;var adminWindow=null;var timer=null;var thumbs=null;var elev=0;var animwidth=0;var animheight=0;var prevmousex=0;var frame_load_count=0;var frames_loaded=false;var start_on_load=false;var stopLoad=false;var frameNumber=0;var animIncrement=1;var frames=[];var firstimage=new Image();var anim_area={};var hs_area={};var min_x_delta=4;var spinOnMouseMove=false;function basename(c){var b=/^(.*\/)?(.*)/;var a=c.match(b);return a[2]}function makeThumb(b){var c=$("imgload").src;var d=basename(c);var a="/makethumb.php?ID="+prodID+"&thumb="+d;if(b===true){a=a+"&save=1"}thumbWindow=window.open(a,"thumbwin","toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=700,height=400,left=10,top=10")}function popAdmin(){var a="/admin.php?ID="+prodID;adminWindow=window.open(a,"adminwin","toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=700,height=400,left=10,top=10")}function popUp(b,a,e,c,d){day=new Date();id=day.getTime();window.open(b,"FULL_VIEW","toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width="+a+",height="+e+",left="+c+",top="+d)}function newZoom(g){if(isNaN(g)){g=40}var f=/^(.*\.)+(.*)/;var c=$("imgload").src;var b=basename(c);var a=b.match(f);var j=baseURL+prodID+"/zoom/"+g+"/"+b;var d=baseURL+prodID+"/zoom/"+zoomFactor+"/"+b;var e=new Image();e.src=d;var h=(e.height>280)?e.height:280;var i=e.width+280;window.open("newzoom.php?img_lg="+j+"&img_sm="+d,"Hoverzoom","width="+i+",height="+h+",resizable=no,toolbar=no,location=no,directories=no")}function printanim(){var d=/^(.*\.)+(.*)/;var c=$("imgload").src;var e=basename(c);var b=e.match(d);var a=baseURL+prodID+"/zoom/100/"+e;popUp(a,800,600,0,0);anim_area.pan_on=true;trackGA("NAVIGATION","View100","NA",0)}function displayNextFrame(c,b){var d=/^.*\/(\d{1,2})\/(\d{1,3})-(\d{1,3})\.([a-zA-Z]+)/;if(viewerType===0){return}if(isNaN(frameNumber)){frameNumber=0}if(isNaN(animIncrement)){animIncrement=1}var f=frameNumber+animIncrement;if(f>=frame_count){f=0}else{if(f<0){f=frame_count-1}}frameNumber=f;var e=frames[frameNumber].src;$("imgload").src=e;var g=e.match(d);var a=g[2]+"-"+g[3];slide_update_val=g[3];if(c>=0){slide_update_val=c}if(!(b===0&&c===0)){A_SLIDERS[0].f_setValue(slide_update_val,null,1)}if(0){if(c!=g[3]){document.getElementById("slidedebug").style="color:red;"}else{document.getElementById("slidedebug").style="color:white;"}document.getElementById("slidedebug").innerHTML="DBG: slider val: "+c+"; photo angle: "+g[3]}if(0){document.getElementById("slidedebug").innerHTML="DBG: slider val: "+c+"; photo angle: "+g[3]}checkHotSpots(g[1],a);return(g[3])}function animationStart(a,b){if(frames_loaded===false){return}if(viewerType===0){return}if(isNaN(b)||(typeof(b)=="undefined")||(b<=0)){b=10}anim_area.pan_on=false;prevmousex=0;animIncrement=a;if(timer!==null){return}if(!frames_loaded){start_on_load=true}else{displayNextFrame(-1);if((!gStopAfterFrame)&&(!gStopAnimAfterThisFrame)){timer=setInterval("displayNextFrame(-1)",(1000/b))}else{gStopAnimAfterThisFrame=false}}if(a==-1){trackGA("NAVIGATION","Rotate.Left","NA",0)}else{trackGA("NAVIGATION","Rotate.Right","NA",0)}}function repositionImage(){var b=firstimage.width;var a=firstimage.height;var c=anim_area.center_x-Math.round(b/2);var d=anim_area.center_y-Math.round(a/2);anim_area.img_pos_left=c;anim_area.img_pos_top=d;$("imgload").src=firstimage.src;$("imgload").style.left=c+"px";$("imgload").style.top=d+"px";initHotspots(c,d);if(debug){$("xval").innerHTML="anim_area.width: "+anim_area.dimensions.width+"\nanim_area.height: "+anim_area.dimensions.height+"\nwidth: "+b+"\nheight: "+a+"\nxoffset: "+c+"\nyoffset: "+d+"\nApp: "+navigator.appName+"\nVer: "+navigator.appVersion}}function countLoadedFrames(){frame_load_count++;if(frame_load_count==frame_count){var a=frameNumber*step;checkHotSpots(zoomFactor+"",elev+"-"+a);min_x_delta=Math.ceil(144/frame_count);frames_loaded=true;documentOnloadHandler("imagesLoaded");if(gAutoSpin==1){start_on_load=true}if(start_on_load){animationStart(-1,fps)}else{anim_area.pan_on=true}}}function animationStop(){if(timer){clearInterval(timer)}timer=null;prevmousex=0}function mouseHandler(b){var f=/^(\d*)px/;var e=Event.pointerX(b);var d=Event.pointerY(b);if(anim_area.prev_mouse_x===undefined){anim_area.prev_mouse_x=e;anim_area.prev_mouse_y=d}var c=e-anim_area.prev_mouse_x;var a=d-anim_area.prev_mouse_y;if(debug){$("xval").innerHTML="x: "+e+"\ny: "+d+"\ndeltax: "+c+"\ndeltay: "+a}if(drag==1){$("animarea").style.cursor="move"}else{$("animarea").style.cursor="default"}switch(b.type){case"mousedown":if(clickStopsSpin==1){animationStop()}if(drag==1){anim_area.pan_on_save=anim_area.pan_on;anim_area.pan_on=false;anim_area.drag_on=true;c=0;a=0;anim_area.prev_mouse_x=e;anim_area.prev_mouse_y=d}trackGA("NAVIGATION","Mouse.Click","NA",0);break;case"mouseup":if(Math.abs(c)<10){anim_area.pan_on=(anim_area.pan_on_save?false:true)}else{anim_area.pan_on=true}anim_area.drag_on=false;break;case"mousemove":if(spinOnMouseMove){if(Math.abs(c)>=min_x_delta){anim_area.prev_mouse_x=e;anim_area.prev_mouse_y=d;if(c>0){animIncrement=1}else{animIncrement=-1}displayNextFrame()}}else{if(anim_area.drag_on){anim_area.prev_mouse_x=e;anim_area.prev_mouse_y=d;anim_area.center_x+=c;anim_area.img_pos_left+=c;$("imgload").style.left=anim_area.img_pos_left+"px";anim_area.center_y+=a;anim_area.img_pos_top+=a;$("imgload").style.top=anim_area.img_pos_top+"px";hs_area.left+=c;hs_area.top+=a;$("hslayer").style.left=hs_area.left+"px";$("hslayer").style.top=hs_area.top+"px"}}break}Event.stop(b)}function buildAnim(){var a;showHelpTip(true);hideAllHotspots();if(gShowZoom==2){gShowZoom=0}if(anim_area.dimensions===undefined){anim_area.dimensions=$("animarea").getDimensions();anim_area.center_x=Math.round(anim_area.dimensions.width/2);anim_area.center_y=Math.round(anim_area.dimensions.height/2);anim_area.pan_on=true;anim_area.drag_on=false;hs_area.left=0;hs_area.top=0}animationStop();repositionB360();if(loadMouseHandler){Event.observe($("animarea"),"mousemove",mouseHandler);Event.observe($("animarea"),"mousedown",mouseHandler);Event.observe($("animarea"),"mouseup",mouseHandler);loadMouseHandler=false}Position.absolutize("hslayer");if(viewerType>0){stopLoad=false;frame_load_count=0;var d=frameNumber*step;var c=frameNumber;for(var b=0;b<frame_count;b++){if(stopLoad){stopLoad=false;break}else{a=baseURL+prodID+"/zoom/"+zoomFactor+"/"+elev+"-"+d+"."+anim_ext;frames[c]=new Image();frames[c].src=a;if((frames[c].complete===true)&&(frames[c].width>0)){countLoadedFrames()}else{frames[c].onload=countLoadedFrames}c=(c+1)%frame_count;d=(d+step)%(frame_count*step);if(b===0){firstimage.src=a;if((firstimage.complete===true)&&(firstimage.width>0)){repositionImage()}else{firstimage.onload=repositionImage}}}}}if(gMouseFunctionInitialized===false){hsButtonInit();gMouseFunctionInitialized=true}}function stillimg(d){var e=true;var h;var g=/^(\d{1,3})-(\d{1,3})\.([a-zA-Z]+)/;animationStop();if(prodID==thumbs[d][0]){e=false}prodID=thumbs[d][0];viewerType=thumbs[d][1];var c=basename(thumbs[d][2]);fullwid=thumbs[d][3];fullht=thumbs[d][4];frame_count=thumbs[d][5];max_elev=thumbs[d][6];var j=zoomFactor*0.01*fullwid;var i=zoomFactor*0.01*fullht;$("imgload").width=j;$("imgload").height=i;var f=anim_area.center_x-Math.round(fullwid/2);var a=anim_area.center_y-Math.round(fullht/2);anim_area.img_pos_left=f;anim_area.img_pos_top=a;$("imgload").style.left=f+"px";$("imgload").style.top=a+"px";h=baseURL+prodID+"/zoom/"+zoomFactor+"/"+c;firstimage.src=h;if((firstimage.complete===true)&&(firstimage.width>0)){repositionImage()}else{firstimage.onload=repositionImage}$("imgload").src=h;var b=c.match(g);frameNumber=b[2]/step;if(e){buildAnim()}}function zoomIn(){drag=1;if((typeof(maxZoom)=="undefined")||(maxZoom<=0)){maxZoom=100}if((typeof(zoomStep)=="undefined")||(zoomStep<5)){zoomStep=5}if(zoomFactor<maxZoom){stopLoad=true;zoomFactor+=zoomStep;var b=zoomFactor*0.01*fullwid;var a=zoomFactor*0.01*fullht;$("imgload").width=b;$("imgload").height=a;var c=anim_area.center_x-Math.round(b/2);var d=anim_area.center_y-Math.round(a/2);anim_area.img_pos_left=c;anim_area.img_pos_top=d;$("imgload").style.left=c+"px";$("imgload").style.top=d+"px";hideAllHotspots();buildAnim()}trackGA("NAVIGATION","Zoom.In","NA",0)}function zoomOut(){drag=1;if((typeof(minZoom)=="undefined")||(minZoom<5)){minZoom=5}if((typeof(zoomStep)=="undefined")||(zoomStep<5)){zoomStep=5}if(zoomFactor>minZoom){stopLoad=true;zoomFactor-=zoomStep;var b=zoomFactor*0.01*fullwid;var a=zoomFactor*0.01*fullht;$("imgload").width=b;$("imgload").height=a;var c=anim_area.center_x-Math.round(b/2);var d=anim_area.center_y-Math.round(a/2);anim_area.img_pos_left=c;anim_area.img_pos_top=d;$("imgload").style.left=c+"px";$("imgload").style.top=d+"px";hideAllHotspots();buildAnim()}trackGA("NAVIGATION","Zoom.Out","NA",0)}function tiltDown(){if(elev<max_elev){elev+=10;buildAnim()}}function tiltUp(){if(elev>0){elev-=10;buildAnim()}}function changeview(b){var c=b.value;var d="";for(var a=1;a<=5;a++){d="lvl"+a;$(d).style.display="none"}$(c).style.display="inline"}function showview(c){var d="";var b=c.substring(3);anim_area.pan_on=true;for(var a=1;a<=5;a++){d="lvl"+a;$(d).style.display="none"}$("descriptor").selectedIndex=Number(b-1);$(c).style.display="inline"}function resetImg(){history.go(0);trackGA("NAVIGATION","Reset","NA",0)}function measure(){animationStop()}function resizeThumbs(){var a=$("thumbbox").getHeight();a-=2;var c=$("thumbbox").immediateDescendants();for(var b=0;b<c.length;b++){if(c[b].hasClassName("snapshot")){c[b].setStyle({height:(a)})}}};
