function windowSize(){var b=0,a=0;if(typeof(window.innerWidth)=="number"){b=window.innerWidth;a=window.innerHeight}else{if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){b=document.documentElement.clientWidth;a=document.documentElement.clientHeight}else{if(document.body&&(document.body.clientWidth||document.body.clientHeight)){b=document.body.clientWidth;a=document.body.clientHeight}}}return{height:a,width:b}}function openZoomViewer(a){GK_ZoomViewer.open(a)}function MM_findObj(f,e){var c,b,a;if(!e){e=document}if((c=f.indexOf("?"))>0&&parent.frames.length){e=parent.frames[f.substring(c+1)].document;f=f.substring(0,c)}if(!(a=e[f])&&e.all){a=e.all[f]}for(b=0;!a&&b<e.forms.length;b++){a=e.forms[b][f]}for(b=0;!a&&e.layers&&b<e.layers.length;b++){a=MM_findObj(f,e.layers[b].document)}if(!a&&e.getElementById){a=e.getElementById(f)}return a}function swapImage(){var e,d=0,b,c=swapImage.arguments;document.MM_sr=new Array;for(e=0;e<(c.length-2);e+=3){if((b=MM_findObj(c[e]))!=null){document.MM_sr[d++]=b;if(!b.oSrc){b.oSrc=b.src}b.src=c[e+2];b.alt=c[e+2]}}}GK_ImageZoomer={minWidth:300,maxWidth:2400,zoomIn:function(e,a){if($(e).getWidth()>=this.maxWidth){return}if(!a){a={x:($(e).up().getWidth())/2,y:($(e).up().getHeight())/2}}var f={height:Math.round($(e).getHeight()),width:Math.round($(e).getWidth()),x:Position.positionedOffset($(e))[0],y:Position.positionedOffset($(e))[1]};var g={x:(f.width*1.1)-f.width,y:(f.height*1.1)-f.height};var c={x:(a.x-f.x)/f.width,y:(a.y-f.y)/f.height};var b=f.y-(g.y*c.y);var d=f.x-(g.x*c.x);$(e).setStyle({width:(f.width*1.1)+"px",top:b+"px",left:d+"px"})},zoomOut:function(e,a){if($(e).getWidth()<=this.minWidth){return}if(!a){a={x:($(e).up().getWidth())/2,y:($(e).up().getHeight())/2}}var f={height:Math.round($(e).getHeight()),width:Math.round($(e).getWidth()),x:Position.positionedOffset($(e))[0],y:Position.positionedOffset($(e))[1]};var g={x:f.width-(f.width*0.85),y:f.height-(f.height*0.85)};var c={x:(a.x-f.x)/f.width,y:(a.y-f.y)/f.height};var b=f.y+(g.y*c.y);var d=f.x+(g.x*c.x);$(e).setStyle({width:(f.width*0.85)+"px",top:b+"px",left:d+"px"})},moveUp:function(b){var a=Position.positionedOffset($(b))[1]-60;$(b).setStyle({top:a+"px"})},moveDown:function(b){var a=Position.positionedOffset($(b))[1]+60;$(b).setStyle({top:a+"px"})},moveLeft:function(b){var a=Position.positionedOffset($(b))[0]-60;$(b).setStyle({left:a+"px"})},moveRight:function(b){var a=Position.positionedOffset($(b))[0]+60;$(b).setStyle({left:a+"px"})},moveCenter:function(a){}};GK_InnerZoom={container:"innerZoom",standardWidth:300,standardHeight:300,standardTop:10,standardLeft:10,width:300,height:300,top:10,left:10,targetWidth:700,targetHeight:300,targetTop:10,targetLeft:10,large:false,inserted:false,running:false,processId:null,swapImage:function(b,a){$(b).src=$(a).alt;$(b).alt=$(a).up().href},open:function(){if(window.addEventListener){window.addEventListener("DOMMouseScroll",GK_InnerZoom.wheel,false)}window.onmousewheel=document.onmousewheel=GK_InnerZoom.wheel;if($("itemTable")==null){this.targetWidth=windowSize().width-50;this.targetTop=15;this.targetLeft=15;this.targetHeight=windowSize().height-50;this.showLocalZoom("mainImage")}else{this.targetWidth=Element.getWidth("itemsTable");this.targetTop=10;this.targetLeft=36;this.targetHeight=Position.cumulativeOffset($("itemTable"))[1]-48;this.showLocalZoom("mainImage")}return false},init:function(){if($("mainImage")){($("mainImage").up()).onclick=function(){GK_InnerZoom.open();return false};var c='<div id="innerZoom" style="z-index: 10000; overflow: hidden; border: 1px solid #000; position:absolute; background-color: #fff">';c+='	<a style="z-index: 1001" id="zoomClose" onclick="GK_InnerZoom.showLocalZoom();"><span>close</span></a>';c+='	<a style="z-index: 1002" id="innerZoomIn" onclick="GK_ImageZoomer.zoomIn($(\'innerZoomImage\'))"><span>Zoom In</span></a>';c+='	<a style="z-index: 1003" id="innerZoomOut" onclick="GK_ImageZoomer.zoomOut($(\'innerZoomImage\'))"><span>Zoom Out</span></a>';c+='	<img id="innerZoomImage" src="../Common/images/backWhite.jpg">';c+="</div>";new Insertion.Top("page",c);var b=Position.cumulativeOffset($("mainImage"));this.standardTop=b[1];this.standardLeft=b[0];this.width=this.standardWidth;this.height=this.standardHeight;this.top=this.standardTop;this.left=this.standardLeft;$(GK_InnerZoom.container).setStyle({width:this.standardWidth+"px",height:this.standardHeight+"px",top:this.standardTop+"px",left:this.standardLeft+"px"});$("innerZoom").hide();var a=$("thumbViewer").getElementsBySelector("a");for(i=0;i<a.length;i++){a[i].immediateDescendants()[0].onmouseover=function(){GK_InnerZoom.swapImage("mainImage",this)};a[i].onclick=function(){GK_InnerZoom.open();return false}}}},showLocalZoom:function(a){if(!this.large){this.running=true;this.large=true;$("innerZoomImage").src=$("mainImage").alt;$("innerZoom").setStyle({background:"#fff"});$("innerZoom").show();$("innerZoomImage").makePositioned();$("innerZoomImage").setStyle({width:"70%",left:"15%",top:(this.targetHeight/2)-250+"px"});$("innerZoomImage").show();this.processId=window.setInterval(function(){if(Math.abs(GK_InnerZoom.targetWidth-GK_InnerZoom.width)<1){GK_InnerZoom.stopAnimation();new Draggable("innerZoomImage",{starteffect:function(){},endeffect:function(){}})}var c=GK_InnerZoom.getAnimatedDim()[0];var e=GK_InnerZoom.getAnimatedDim()[1];var d=GK_InnerZoom.getAnimatedDim()[2];var b=GK_InnerZoom.getAnimatedDim()[3];GK_InnerZoom.width=c;GK_InnerZoom.height=e;GK_InnerZoom.top=d;GK_InnerZoom.left=b;$(GK_InnerZoom.container).setStyle({width:c+"px",height:e+"px",top:d+"px",left:b+"px"})},30)}else{if(!this.running){this.large=false;this.targetWidth=this.standardWidth;this.targetHeight=this.standardHeight;this.targetTop=this.standardTop;this.targetLeft=this.standardLeft;$("innerZoomImage").hide();$("innerZoom").setStyle({background:"transparent"});this.processId=window.setInterval(function(){if(Math.abs(GK_InnerZoom.targetWidth-GK_InnerZoom.width)<1){GK_InnerZoom.stopAnimation();$("innerZoom").hide();try{window.removeEventListener("DOMMouseScroll",GK_InnerZoom.wheel,false)}catch(f){}window.onmousewheel=document.onmousewheel=null}var c=GK_InnerZoom.getAnimatedDim()[0];var e=GK_InnerZoom.getAnimatedDim()[1];var d=GK_InnerZoom.getAnimatedDim()[2];var b=GK_InnerZoom.getAnimatedDim()[3];GK_InnerZoom.width=c;GK_InnerZoom.height=e;GK_InnerZoom.top=d;GK_InnerZoom.left=b;$(GK_InnerZoom.container).setStyle({width:c+"px",height:e+"px",top:d+"px",left:b+"px"})},30)}}},stopAnimation:function(){if(this.processId){window.clearInterval(this.processId);this.processId=null;this.running=false}},getAnimatedDim:function(){var a=4;if(this.targetWidth>this.width){return[Math.ceil((this.targetWidth-this.width)/a)+this.width,Math.ceil((this.targetHeight-this.height)/a)+this.height,Math.ceil((this.targetTop-this.top)/a)+this.top,Math.ceil((this.targetLeft-this.left)/a)+this.left]}else{return[Math.floor((this.targetWidth-this.width)/a)+this.width,Math.floor((this.targetHeight-this.height)/a)+this.height,Math.floor((this.targetTop-this.top)/a)+this.top,Math.floor((this.targetLeft-this.left)/a)+this.left]}},getCenter:function(){return{x:((this.width)/2)+this.left,y:((this.height)/2)+this.top}},handle:function(b,a){if(b<0){GK_ImageZoomer.zoomOut("innerZoomImage",this.getCenter())}else{GK_ImageZoomer.zoomIn("innerZoomImage",this.getCenter())}},wheel:function(a){var b=0;if(!a){a=window.event}if(a.wheelDelta){b=a.wheelDelta/120;if(window.opera){b=-b}}else{if(a.detail){b=-a.detail/3}}if(Event.element(a).id+""=="innerZoom"||Event.element(a).id+""=="innerZoomImage"){if(b){GK_InnerZoom.handle(b,a)}a.returnValue=false;a.preventDefault()}else{a.returnValue=true}}};Event.observe(window,"load",function(){GK_InnerZoom.init()});
