//***************************************************************** // icIndex.js //***************************************************************** var tranTimer = null; var activeSelct = ''; var tranTimer = null; var tranPercent = 50; var tranPercentHotspot = 100; var marker_x1 = 0; var marker_y1 = 0; var marker_obj = null; var marker_down = false; var index_visible = true; //================================================================================== // setMode //================================================================================== function setMode(name) { var i; for (i = 0; i < indexList.length; ++i) indexList[i].setMode(name); } //================================================================================== // hideIndex //================================================================================== function hideIndex() { var i; index_visible = false; } //================================================================================== // updateIndex //================================================================================== function updateIndex() { var i; var obj; for (i = 0; i < indexList.length; ++i) indexList[i].moveMarker(); } //================================================================================== // moveTo //================================================================================== function moveTo(viewID,x,y) { var i; var obj; if (indexList.length == 0) { obj = document.getElementById(viewID); // if (obj) obj.goXY(x,y); view_a_frame.goXY(x,y); return; } for (i = 0; i < indexList.length; ++i) if (indexList[i].contains(viewID)) indexList[i].moveTo(x,y); } //================================================================================== // setLevelAll //================================================================================== function setLevelAll(lev) { var i; for (i = 0; i < indexList.length; ++i) indexList[i].setLevel(lev); } //================================================================================== // toLevel //================================================================================== function goLevel(viewID,lev) { var i; for (i = 0; i < indexList.length; ++i) if (indexList[i].contains(viewID)) indexList[i].goLevel(lev); } //================================================================================== // transparent //================================================================================== function transparent(value,layer) { if (tranTimer != null) clearTimeout(tranTimer); tranTimer = null; setTransparent(value,true,layer); } //================================================================================== // transparentDone //================================================================================== function transparentDone() { if (tranTimer != null) clearTimeout(tranTimer); tranTimer = null; } //================================================================================== // setTransparent //================================================================================== function setTransparent(value,first,layer) { var next,time; var obj; obj = getObject('percent' + layer); if (! obj) return; if (first) { tranPercent = parseInt(obj.innerText); if (tranPercent < 0) tranPercent = 0; if (tranPercent > 100) tranPercent = 100; } if (value < 0) { if (tranPercent <= 0) return; tranPercent = tranPercent + value; if (tranPercent < 0) tranPercent = 0; } else { if (tranPercent >= 100) return; tranPercent = tranPercent + value; if (tranPercent > 100) tranPercent = 100; } obj.innerText = tranPercent + ' %'; for (i=0; i < indexList.length; ++i) indexList[i].setTransparent(tranPercent,layer); one = 2; if (value <0) one = -2; next = value + one; time = 200; if (first) time = 300; tranTimer = setTimeout("setTransparent(" + next + ",false,'" + layer + "')",time); } //====================================================== // onIndexMouseDown //====================================================== function onIndexMouseDown(evt,idx) { var index; sx = eventX(evt); sy = eventY(evt); if (idx) index = idx else index = evt; if (index) index.moveToScreen(sx,sy); } //================================================================================== // clearMarker //================================================================================== function clearMarker() { var i; for (i = 0; i < indexList.length; ++i) indexList[i].marker.clear(); } //========================================================================= // toggleBasemap //========================================================================== function toggleBasemap(checked) { var i; for (i = 0; i < indexList.length; ++i) { indexList[i].toggleBasemap(checked); } } //========================================================================= // toggleForeground //========================================================================== function toggleForeground(checked) { var i; for (i = 0; i < indexList.length; ++i) indexList[i].toggleForeground(checked); } //========================================================================= // toggleBackground //========================================================================== function toggleBackground(checked) { var i; for (i = 0; i < indexList.length; ++i) indexList[i].toggleBackground(checked); } //========================================================================= // toggleHotspot //========================================================================== function toggleHotspot(checked) { var i; for (i = 0; i < indexList.length; ++i) indexList[i].toggleHotspot(checked); } //========================================================================= // basemapAsBackground //========================================================================== function basemapAsBackground(checked) { var i,z; z = 20; if (checked) z = 5; for (i = 0; i < indexList.length; ++i) indexList[i].basemapZIndex(z); } //========================================================================== // showBackground //=========================================================================== function showBackground(checked,name) { var i; for (i = 0; i < indexList.length; ++i) if (checked) { indexList[i].setBackgroundName(name) } else { indexList[i].setBackgroundName('') } } //================================================================================== // setHotspotName //================================================================================== function setHotspotName(name) { var i; for (i = 0; i < indexList.length; ++i) indexList[i].setHotspotName(name); } //================================================================================== // setForegroundName //================================================================================== function setForegroundName(name) { var i; for (i = 0; i < indexList.length; ++i) indexList[i].setForegroundName(name); } //================================================================================== // setBasemapName //================================================================================== function setBasemapName(name) { var i; for (i = 0; i < indexList.length; ++i) indexList[i].setBasemapName(name); } //================================================================================== // setBackgroundName //================================================================================== function setBackgroundName(name) { var nam; var i; for (i = 0; i < indexList.length; ++i) indexList[i].setBackgroundName(name); nam = name.toLowerCase(); activeSelect = name; } //============================================================= // ic$Index (Constructor) //============================================================== function ic$Index(ID,root,parent,children,ixmin,iymax,iupp,height,width,isHover) { this.ID = ID; this.parent = parent; // parent view/index; this.children = children; // array of children; this.img = getObject(ID + "_img"); this.marker = null; this.root = root; this.upp = parseFloat(iupp); this.xmin = parseFloat(ixmin); this.ymax = parseFloat(iymax); this.height = height; this.width = width; this.isHover = isHover; this.activeSelect = ""; this.moveToScreen = index$moveToScreen; this.moveTo = index$moveTo; this.moveMarker = index$moveMarker; this.goLevel = index$goLevel; // go to Level only this.setLevel = index$setLevel; // go to Level and Draw this.toggleBasemap = index$toggleBasemap; this.toggleBackground = index$toggleBackground; this.toggleForeground = index$toggleForeground; this.toggleHotspot = index$toggleHotspot; this.setTransparent = index$setTransparent; this.clearMarker = index$clearMarker; this.setBasemapName = index$setBasemapName; this.setBackgroundName = index$setBackgroundName; this.setForegroundName = index$setForegroundName; this.setHotspotName = index$setHotspotName; this.basemapZIndex = index$basemapZIndex; this.screenToX = index$screenToX; this.screenToY = index$screenToY; this.xToScreen = index$xToScreen; this.yToScreen = index$yToScreen; this.contains = index$contains; this.setMode = index$setMode; } //================================================================================== // index$contains //================================================================================== function index$contains(ID) { var i; for (i = 0; i < this.children.length; ++i) if (this.children[i].ID == ID) return true; return false; } //================================================================================== // index$screenToX //================================================================================== function index$screenToX(sx) { var rx; var tx; tx = sx; if (tx < 0) tx = 0; if (tx > this.width) tx = this.width; rx = (tx * this.upp) + this.xmin return rx; } //================================================================================== // index$screenToY //================================================================================== function index$screenToY(sy) { var ry; var ty; ty = sy; if (ty < 0) ty = 0; if (ty > this.height) ty = this.height; ry = this.ymax - (ty * this.upp); return ry; } //================================================================================== // index$xToScreen //================================================================================== function index$xToScreen(rx) { var sx; var tx; sx = (rx - this.xmin) / this.upp; if (sx < 0) sx = 0; if (sx > this.width) sx = this.width; return sx; } //================================================================================== // index$yToScreen //================================================================================== function index$yToScreen(ry) { var sy; var ty; sy = (this.ymax - ry) / this.upp; if (sy < 0) sy = 0; if (sy > this.height) sy = this.height; return sy; } //================================================================================== // index$onMoveScreen //================================================================================== function index$moveToScreen(sx,sy) { var rx,ry; rx = this.screenToX(sx); ry = this.screenToY(sy); this.moveTo(rx,ry); } //================================================================================== // index$moveTo //================================================================================== function index$moveTo(rx,ry) { var i; for (i = 0; i < this.children.length; ++i) { this.children[i].goXY(rx,ry); this.children[i].draw(); } if (isNaN(rx) || isNaN(ry)) return; window.status = rx + ' ' + ry; } //================================================================================== // index$setMode //================================================================================== function index$setMode(name) { var i; for (i = 0; i < this.children.length; ++i) this.children[i].setMode(name); } //================================================================================== // index$goLevel //================================================================================== function index$goLevel(lev) { var i; for (i = 0; i < this.children.length; ++i) this.children[i].goLevel(lev); } //================================================================================== // index$setLevel //================================================================================== function index$setLevel(lev) { var i; for (i = 0; i < this.children.length; ++i) this.children[i].setLevel(lev); } //================================================================================== // index$toggleBasemap //================================================================================== function index$toggleBasemap(checked) { var i; for (i = 0; i < this.children.length; ++i) { this.children[i].toggleBasemap(checked); } } //================================================================================== // index$toggleForeground //================================================================================== function index$toggleForeground(checked) { var i; for (i = 0; i < this.children.length; ++i) this.children[i].toggleForeground(checked); } //================================================================================== // index$draw //================================================================================== function index$draw() { var i; for (i = 0; i < this.children.length; ++i) this.children[i].draw(); } //================================================================================== // index$toggleBackground //================================================================================== function index$toggleBackground(checked) { var i; for (i = 0; i < this.children.length; ++i) this.children[i].toggleBackground(checked); } //================================================================================== // index$toggleHotspot //================================================================================== function index$toggleHotspot(checked) { var i; for (i = 0; i < this.children.length; ++i) this.children[i].toggleHotspot(checked); } //================================================================================== // index$setBackgroundName //================================================================================== function index$setBackgroundName(name) { var i; for (i = 0; i < this.children.length; ++i) this.children[i].setBackgroundName(name); } //================================================================================== // index$basemapZIndex //================================================================================== function index$basemapZIndex(z) { var i; for (i = 0; i < this.children.length; ++i) this.children[i].basemapZIndex(z); } //================================================================================== // index$setTransparent //================================================================================== function index$setTransparent(percent,layer) { var next,time,i; for (i = 0; i < this.children.length; ++i) this.children[i].setTransparent(percent,layer); } //================================================================================== // index$clearMarker //================================================================================== function index$clearMarker() { var i; for (i = 0; i < this.children.length; ++i) this.children[i].marker.clear(); } //================================================================================== // index$MouseDown //================================================================================== function index$MouseDown(sx,sy) { var x,y,i; x = (sx * this.Upp) + this.xmin; y = this.ymax - (sy * this.upp); for (i = 0; i < this.children.length; ++i) { this.children[i].drawCentered(x,y); } } //================================================================================== // index$setHotspotName //================================================================================== function index$setHotspotName(name) { var i; for (i = 0; i < this.children.length; ++i) this.children[i].setHotspotName(name); } //================================================================================== // index$setForegroundName //================================================================================== function index$setForegroundName(name) { var i; for (i = 0; i < this.children.length; ++i) this.children[i].setForegroundName(name); } //================================================================================== // index$setBasemapName //================================================================================== function index$setBasemapName(name) { var i; for (i = 0; i < this.children.length; ++i) this.children[i].setBasemapName(name); } //================================================================================== // index$setBackgroundName //================================================================================== function index$setBackgroundName(name) { var nam; var i; for (i = 0; i < this.children.length; ++i) this.children[i].setBackgroundName(name); nam = name.toLowerCase(); activeSelect = name; } //================================================================================== // index$moveMarker //================================================================================== function index$moveMarker() { var offX, offY; var tx,ty; var sx,sy; var dx,dy; var text; var obj; try { if (this.viewMarker) this.viewMarker.style.visibility = 'false'; } catch (e) { }; if (! index_visible) return; if (this.children.length < 1) return; rng = this.children[0].getVisibleRange(); sxmin = this.xToScreen(rng[0]); symin = this.yToScreen(rng[1]); sxmax = this.xToScreen(rng[2]); symax = this.yToScreen(rng[3]); dx = Math.abs(sxmax - sxmin); dy = Math.abs(symax - symin); if (dx < 4) dx = 4; if (dy < 4) dy = 4; if (! this.viewMarker) { text = "" this.viewMarker = document.createElement(text); this.viewMarker.onmousedown = markerDown; this.viewMarker.onmouseup = markerUp; this.viewMarker.onmousemove = markerMove; // this.viewMarker.onmouseout = markerUp; this.viewMarker.tag = this; document.body.appendChild(this.viewMarker); } offX=getLeft(this.img); offY=getTop(this.img); this.viewMarker.style.left = sxmin + offX; this.viewMarker.style.top = symax + offY; this.viewMarker.style.scrollHeight = dy; this.viewMarker.style.scrollWidth = dx; this.viewMarker.style.height = dy; this.viewMarker.style.width = dx; this.viewMarker.style.visibility = ''; this.viewMarker.style.display = ''; if (this.isHover) this.viewMarker.style.display = 'none'; } //================================================================================== // markerDown //================================================================================== function markerDown(e) { marker_x1 = event.x; marker_y1 = event.y; marker_down = true; marker_obj = window.event.srcElement; window.event.cancelBubble = true; window.event.returnValue = false; } //================================================================================== // markerUp //================================================================================== function markerUp(e) { var i; var t,l,h,w; var cx,cy; var ih,iw; if (! marker_down) return; marker_down = false; window.event.cancelBubble = true; window.event.returnValue = false; offX = getLeft(indexList[0].img); offY = getTop(indexList[0].img); t = parseInt(marker_obj.style.top) - offY; l = parseInt(marker_obj.style.left) - offX; h = parseInt(marker_obj.style.height); w = parseInt(marker_obj.style.width); cx = l + Math.round(w / 2) + 1; cy = t + Math.round(h / 2); for (i = 0; i < indexList.length; ++i) indexList[i].moveToScreen(cx,cy) } //================================================================================== // markerMove //================================================================================== function markerMove(e) { var dx,dy; var obj; var t,l; var offX; var offY; if (! marker_down) return; window.event.cancelBubble = true; window.event.returnValue = false; dx = event.x - marker_x1; dy = event.y - marker_y1; if ((dx == 0) && (dy == 0)) return; offX = getLeft(indexList[0].img); offY = getTop(indexList[0].img); marker_x1 = event.x; marker_y1 = event.y; t = parseInt(marker_obj.style.top); l = parseInt(marker_obj.style.left); h = parseInt(marker_obj.style.height); w = parseInt(marker_obj.style.width); ih = indexList[0].img.height + offY; iw = indexList[0].img.width + offX; if (isNaN(t)) t = 0; if (isNaN(l)) l = 0; t = t + dy; l = l + dx; if ((t + h) > ih) t = ih - h; if ((l + w) > iw) l = iw - w; if (t < offY) t = offY; if (l < offX) l = offX; event.srcElement.style.top = t; event.srcElement.style.left = l; }