onresize=Set_Resize; var zooming,insideMap= false; var Map_X =0 var Map_Y =0 var z_index=100; var boxLineWidth=1; //Ширина линии var zoomColor= '#ff0000'; //Цвет var windowX =0; var windowY =0; function setEvents(){ if (isNav) { document.captureEvents(Event.MOUSEMOVE); document.captureEvents(Event.MOUSEUP); document.onmousemove= getMouse; document.onmouseup =msStop; } else { document.onmousemove = getMouse; document.onmouseup =msStop; } } function clipLayer(name, clipleft, cliptop, clipright, clipbottom){ var layer = getLayer(name); if (isIE){ layer.clip='rect('+cliptop+' '+clipright+' '+clipbottom+' '+clipleft+')'; } else if (isNav){ layer.clip.left = clipleft; layer.clip.top = cliptop; layer.clip.right = clipright; layer.clip.bottom = clipbottom; } } function setClip() { var tempX=startX; var tempY=startY; if (startX>x2) { zright=startX; zleft=x2; } else { zleft=startX; zright=x2; } if (startY>y2) { zbottom=startY; ztop=y2; } else { ztop=startY; zbottom=y2; } if ((startX != x2) && (startY != y2)) { var ovBoxSize = boxLineWidth; //clipLayer("Box",zleft,ztop,zright,zbottom); clipLayer('BoxTop',zleft,ztop,zright,ztop+ovBoxSize); clipLayer('BoxLeft',zleft,ztop,zleft+ovBoxSize,zbottom); clipLayer('BoxRight',zright-ovBoxSize,ztop,zright,zbottom); clipLayer('BoxBottom',zleft,zbottom-ovBoxSize,zright,zbottom); } } // Нажали на карте .... function msBegin(e){ insideMap =1; startBox(e); visibl_hint(0); set_show('BoxTop',1); set_show('BoxLeft',1); set_show('BoxRight',1); set_show('BoxBottom',1); } // Отпустили ... function msStop(){ if (insideMap){ Viewreg_param(); set_show('BoxTop',0); set_show('BoxLeft',0); set_show('BoxRight',0); set_show('BoxBottom',0); insideMap=0; } } // Перечитать карту ... function Viewreg_param(){ x1=Math.min(startX,x2); x2=Math.max(startX,x2); y1=Math.min(startY,y2); y2=Math.max(startY,y2); if(x1<0) x1=0; if(y1<0) y1=0; if(x2>Map_Width) x2=Map_Width; if(y2>Map_Height) y2=Map_Height; if ((x2-x1>5) && (y2-y1>5)) { w_cmd=tool_cmd; w_cmd_param=x1+','+y1+';'+x2+','+y2; } else { w_cmd=3; w_cmd_param ='0&uamap_x='+x1+'&uamap_y='+y1; } req_new(); } // Получить текущие координаты курсора function getMouse(e){ getImageXY(e); if (zooming){ if (mouseX<0) mouseX = 0; if (mouseX>Map_Width) mouseX = Map_Width; if (mouseY<0) mouseY = 0; if (mouseY>Map_Height)mouseY = Map_Height; x2=mouseX; y2=mouseY; setClip(); return false; } return true; } function getImageXY(e){ if (isIE){ windowX=event.clientX + document.body.scrollLeft; windowY=event.clientY + document.body.scrollTop; } else { windowX=e.pageX; windowY=e.pageY; } mouseX = x2 =windowX-Map_X; mouseY = y2 =windowY-Map_Y; } // Функция вызывается при изменении размера окна. function Set_Resize(){ (isIE)?mapPospage():set_mapsize(index_img_size,1); } // Создаём 4 лэера для Zoomboxa function addZoombox() { createLayer('BoxTop',zoomColor); createLayer('BoxLeft',zoomColor); createLayer('BoxRight',zoomColor); createLayer('BoxBottom',zoomColor); mapPospage(); setEvents(); } // start zoom in.... box displayed function startBox(e) { if (insideMap) { getImageXY(e); startX=mouseX; startY=mouseY; x2=startX++; y2=startY++; clipLayer('BoxTop',startX,startY,x2,y2); clipLayer('BoxLeft',startX,startY,x2,y2); clipLayer('BoxRight',startX,startY,x2,y2); clipLayer('BoxBottom',startX,startY,x2,y2); zooming=true;} }