// Copyright and licensing information in this Javascript source code is declared at the beginning of each section of code (and ends at the occurence of the next copyright notice). var PEnvironment = { apiUrl: 'http://api.gis.policymap.com', apiVersion: '1.3', chartUrl: 'http://indicator.gis.policymap.com/servlet', custId: 284, geocoderUrl: 'http://geocode.gis.policymap.com', indicatorUrl: 'http://indicator.gis.policymap.com/servlet', kamapUrl: 'http://api.gis.policymap.com/api/1.3/kamap4p/htdocs/', lineUrl: 'http://line.gis.policymap.com/api/1.3/kamap4p/htdocs', pinUrl: 'http://pin.gis.policymap.com', placeUrl: 'http://place.gis.policymap.com', printUrl: 'http://print.gis.policymap.com/api/1.3', restUrl: 'http://rest.gis.policymap.com', tileDirect: 'api/1.3/kamap4p/htdocs/tile_r.pl', tileUrls: ['http://dl1.gis.policymap.com/tilecache','http://dl2.gis.policymap.com/tilecache','http://dl3.gis.policymap.com/tilecache','http://dl4.gis.policymap.com/tilecache'] }; /* *********************************************************** Example 4-3 (DHTMLapi.js) "Dynamic HTML:The Definitive Reference" 2nd Edition by Danny Goodman Published by O'Reilly & Associates ISBN 1-56592-494-0 http://www.oreilly.com Copyright 2002 Danny Goodman. All Rights Reserved. ************************************************************ */ // DHTMLapi.js custom API for cross-platform // object positioning by Danny Goodman (http://www.dannyg.com). // Release 2.0. Supports NN4, IE, and W3C DOMs. // Global variables var isCSS, isW3C, isIE4, isNN4; // initialize upon load to let all browsers establish content objects function initDHTMLAPI() { if (document.images) { isCSS = (document.body && document.body.style) ? true : false; isW3C = (isCSS && document.getElementById) ? true : false; isIE4 = (isCSS && document.all) ? true : false; isNN4 = (document.layers) ? true : false; isIE6CSS = (document.compatMode && document.compatMode.indexOf("CSS1") >= 0) ? true : false; } } // set event handler to initialize API //window.onload = initDHTMLAPI; // Seek nested NN4 layer from string name function seekLayer(doc, name) { var theObj; for (var i = 0; i < doc.layers.length; i++) { if (doc.layers[i].name == name) { theObj = doc.layers[i]; break; } // dive into nested layers if necessary if (doc.layers[i].document.layers.length > 0) { theObj = seekLayer(document.layers[i].document, name); } } return theObj; } // Convert object name string or object reference // into a valid element object reference function getRawObject(obj) { var theObj; if (typeof obj == "string") { if (isW3C) { theObj = document.getElementById(obj); } else if (isIE4) { theObj = document.all(obj); } else if (isNN4) { theObj = seekLayer(document, obj); } } else { // pass through object reference theObj = obj; } return theObj; } // Convert object name string or object reference // into a valid style (or NN4 layer) reference function getObject(obj) { var theObj = getRawObject(obj); if (theObj && isCSS) { theObj = theObj.style; } return theObj; } // Position an object at a specific pixel coordinate function shiftTo(obj, x, y) { var theObj = getObject(obj); if (theObj) { if (isCSS) { // equalize incorrect numeric value type var units = (typeof theObj.left == "string") ? "px" : 0; theObj.left = x + units; theObj.top = y + units; } else if (isNN4) { theObj.moveTo(x,y); } } } // Move an object by x and/or y pixels function shiftBy(obj, deltaX, deltaY) { var theObj = getObject(obj); if (theObj) { if (isCSS) { // equalize incorrect numeric value type var units = (typeof theObj.left == "string") ? "px" : 0; theObj.left = getObjectLeft(obj) + deltaX + units; theObj.top = getObjectTop(obj) + deltaY + units; } else if (isNN4) { theObj.moveBy(deltaX, deltaY); } } } // Set the z-order of an object function setZIndex(obj, zOrder) { var theObj = getObject(obj); if (theObj) { theObj.zIndex = zOrder; } } // Set the background color of an object function setBGColor(obj, color) { var theObj = getObject(obj); if (theObj) { if (isNN4) { theObj.bgColor = color; } else if (isCSS) { theObj.backgroundColor = color; } } } // Set the visibility of an object to visible function show(obj) { var theObj = getObject(obj); if (theObj) { theObj.visibility = "visible"; } } // Set the visibility of an object to hidden function hide(obj) { var theObj = getObject(obj); if (theObj) { theObj.visibility = "hidden"; } } // Retrieve the x coordinate of a positionable object function getObjectLeft(obj) { var elem = getRawObject(obj); var result = 0; if (document.defaultView) { var style = document.defaultView; var cssDecl = style.getComputedStyle(elem, ""); result = cssDecl.getPropertyValue("left"); } else if (elem.currentStyle) { result = elem.currentStyle.left; } else if (elem.style) { result = elem.style.left; } else if (isNN4) { result = elem.left; } return parseInt(result); } // Retrieve the y coordinate of a positionable object function getObjectTop(obj) { var elem = getRawObject(obj); var result = 0; if (document.defaultView) { var style = document.defaultView; var cssDecl = style.getComputedStyle(elem, ""); result = cssDecl.getPropertyValue("top"); } else if (elem.currentStyle) { result = elem.currentStyle.top; } else if (elem.style) { result = elem.style.top; } else if (isNN4) { result = elem.top; } return parseInt(result); } // Retrieve the rendered width of an element function getObjectWidth(obj) { var elem = getRawObject(obj); var result = 0; if (elem.offsetWidth) { result = elem.offsetWidth; } else if (elem.clip && elem.clip.width) { result = elem.clip.width; } else if (elem.style && elem.style.pixelWidth) { result = elem.style.pixelWidth; } return parseInt(result); } // Retrieve the rendered height of an element function getObjectHeight(obj) { var elem = getRawObject(obj); var result = 0; if (elem.offsetHeight) { result = elem.offsetHeight; } else if (elem.clip && elem.clip.height) { result = elem.clip.height; } else if (elem.style && elem.style.pixelHeight) { result = elem.style.pixelHeight; } return parseInt(result); } // Return the available content width space in browser window function getInsideWindowWidth() { if (window.innerWidth) { return window.innerWidth; } else if (isIE6CSS) { // measure the html element's clientWidth return document.body.parentElement.clientWidth; } else if (document.body && document.body.clientWidth) { return document.body.clientWidth; } return 0; } // Return the available content height space in browser window function getInsideWindowHeight() { if (window.innerHeight) { return window.innerHeight; } else if (isIE6CSS) { // measure the html element's clientHeight return document.body.parentElement.clientHeight; } else if (document.body && document.body.clientHeight) { return document.body.clientHeight; } return 0; } // XMLhttpRequest stuff var aXmlHttp = new Array(); var aXmlResponse = new Array(); function xmlResult() { for(var i=0;i url // o -> object (can be null) to invoke function on // f -> callback function // p -> optional argument to specify POST function call(u,o,f) { //alert("calling: " + u + " " + o + "." + f); var method = "GET"; var dat; if (arguments.length==4){ method = "POST"; tmp = u.split(/\?/); u = tmp[0]; dat = tmp[1]; } var idx = aXmlHttp.length; for(var i=0; i" + file + " callback: " + o + "." + f); var s = document.createElement('script'); s.src = baseUrl + 'bypass.php?file=' + file + '&o=' + o + '&f=' + f; var h = document.getElementsByTagName('head').item(0); h.appendChild(s); } var goExpanderManager = new cExpanderManager(); /* * class to manage top level expander state between page * loads */ function cExpanderManager() { this.expanders = new Array(); this.formElement = null; this.add = cExpanderManager_Add; this.initialize = cExpanderManager_Initialize; this.registerOpen = cExpanderManager_RegisterOpen; this.registerClose = cExpanderManager_RegisterClose; this.isVisible = function() { return true; }; this.isElementVisible = cExpanderManager_IsElementVisible; this.expandAll = cExpanderManager_ExpandAll; this.collapseAll = cExpanderManager_CollapseAll; } function cExpanderManager_Add( oExpander ) { this.expanders[this.expanders.length] = oExpander; oExpander.manager = this; } function cExpanderManager_Initialize() { if (this.formElement == null) return; for(var i=0; i < this.expanders.length; i++) { if (this.expanders[i].bIsOpen) this.registerOpen( this.expanders[i] ); this.expanders[i].initialize( this.isElementVisible( this.expanders[i].element.id )); } } function cExpanderManager_RegisterOpen( oExpander ) { if (this.formElement == null) return; if (this.formElement.value.indexOf( oExpander.element.id ) < 0 ) { if (this.formElement.value != '') this.formElement.value += ","; this.formElement.value += oExpander.element.id; } } function cExpanderManager_RegisterClose( oExpander ) { if (this.formElement == null) return; var rx = new RegExp( oExpander.element.id, '' ); var text = this.formElement.value; text = text.replace( rx, '' ); text = text.replace( /,,/g, ',' ); if (text.substr(0, 1) == ',') text = text.slice( 1 ); if (text.substr(-1) == ',') text = text.slice( 0, -1); this.formElement.value = text; } function cExpanderManager_IsElementVisible( id ) { rx = new RegExp( id, '' ); return rx.test( this.formElement.value ); } function cExpanderManager_ExpandAll() { for(var i=0; i < this.expanders.length; i++) { this.expanders[i].expandAll(); } } function cExpanderManager_CollapseAll() { for(var i=0; i < this.expanders.length; i++) { this.expanders[i].collapseAll(); } return true; } /* * basic expander class to handle an expandable element * that expands or contracts child elements. */ function cExpander( elm ) { this.element = elm; this.element.expander = this; this.children = new Array(); this.bIsOpen = false; this.manager = null; this.img = null; this.szExpandImgSrc = ''; this.szCollapseImgSrc = ''; this.addElement = cExpander_AddElement; this.open = cExpander_Open; this.close = cExpander_Close; this.expandAll = cExpander_ExpandAll; this.collapseAll = cExpander_CollapseAll; this.expand = cExpander_Expand; this.contract = cExpander_Contract; this.toggle = cExpander_Toggle; this.initialize = cExpander_Initialize; this.registerOpen = cExpander_RegisterOpen; this.registerClose = cExpander_RegisterClose; this.isVisible = cExpander_IsVisible; } function cExpander_AddElement( elm ) { this.children[this.children.length] = elm; elm.manager = this; return true; } function cExpander_Open() { for( var i=0; i' , '', ''); this.element_.insertAdjacentHTML("BeforeEnd", vmlStr.join("")); }; contextPrototype.stroke = function(aFill) { var lineStr = []; var lineOpen = false; var a = processStyle(aFill ? this.fillStyle : this.strokeStyle); var color = a[0]; var opacity = a[1] * this.globalAlpha; lineStr.push(' max.x) { max.x = c.x; } if (min.y == null || c.y < min.y) { min.y = c.y; } if (max.y == null || c.y > max.y) { max.y = c.y; } } } lineStr.push(' ">'); if (typeof this.fillStyle == "object") { var focus = {x: "50%", y: "50%"}; var width = (max.x - min.x); var height = (max.y - min.y); var dimension = (width > height) ? width : height; focus.x = Math.floor((this.fillStyle.focus_.x / width) * 100 + 50) + "%"; focus.y = Math.floor((this.fillStyle.focus_.y / height) * 100 + 50) + "%"; var colors = []; // inside radius (%) if (this.fillStyle.type_ == "gradientradial") { var inside = (this.fillStyle.radius1_ / dimension * 100); // percentage that outside radius exceeds inside radius var expansion = (this.fillStyle.radius2_ / dimension * 100) - inside; } else { var inside = 0; var expansion = 100; } var insidecolor = {offset: null, color: null}; var outsidecolor = {offset: null, color: null}; // We need to sort 'colors' by percentage, from 0 > 100 otherwise ie // won't interpret it correctly this.fillStyle.colors_.sort(function (cs1, cs2) { return cs1.offset - cs2.offset; }); for (var i = 0; i < this.fillStyle.colors_.length; i++) { var fs = this.fillStyle.colors_[i]; colors.push( (fs.offset * expansion) + inside, "% ", fs.color, ","); if (fs.offset > insidecolor.offset || insidecolor.offset == null) { insidecolor.offset = fs.offset; insidecolor.color = fs.color; } if (fs.offset < outsidecolor.offset || outsidecolor.offset == null) { outsidecolor.offset = fs.offset; outsidecolor.color = fs.color; } } colors.pop(); lineStr.push(''); } else if (aFill) { lineStr.push(''); } else { lineStr.push( '' ); } lineStr.push(""); this.element_.insertAdjacentHTML("beforeEnd", lineStr.join("")); //this.currentPath_ = []; }; contextPrototype.fill = function() { this.stroke(true); } contextPrototype.closePath = function() { this.currentPath_.push({type: "close"}); }; /** * @private */ contextPrototype.getCoords_ = function(aX, aY) { return { x: (aX * this.m_[0][0] + aY * this.m_[1][0] + this.m_[2][0]), y: (aX * this.m_[0][1] + aY * this.m_[1][1] + this.m_[2][1]) } }; contextPrototype.save = function() { var o = {}; copyState(this, o); this.aStack_.push(o); this.mStack_.push(this.m_); this.m_ = matrixMultiply(createMatrixIdentity(), this.m_); }; contextPrototype.restore = function() { copyState(this.aStack_.pop(), this); this.m_ = this.mStack_.pop(); }; contextPrototype.translate = function(aX, aY) { var m1 = [ [1, 0, 0], [0, 1, 0], [aX, aY, 1] ]; this.m_ = matrixMultiply(m1, this.m_); }; contextPrototype.rotate = function(aRot) { var c = Math.cos(aRot); var s = Math.sin(aRot); var m1 = [ [c, s, 0], [-s, c, 0], [0, 0, 1] ]; this.m_ = matrixMultiply(m1, this.m_); }; contextPrototype.scale = function(aX, aY) { var m1 = [ [aX, 0, 0], [0, aY, 0], [0, 0, 1] ]; this.m_ = matrixMultiply(m1, this.m_); }; /******** STUBS ********/ contextPrototype.clip = function() { // TODO: Implement }; contextPrototype.arcTo = function() { // TODO: Implement }; contextPrototype.createPattern = function() { return new CanvasPattern_; }; // Gradient / Pattern Stubs function CanvasGradient_(aType) { this.type_ = aType; this.radius1_ = 0; this.radius2_ = 0; this.colors_ = []; this.focus_ = {x: 0, y: 0}; } CanvasGradient_.prototype.addColorStop = function(aOffset, aColor) { aColor = processStyle(aColor); this.colors_.push({offset: 1-aOffset, color: aColor}); }; function CanvasPattern_() {} // set up externs G_vmlCanvasManager = G_vmlCanvasManager_; CanvasRenderingContext2D = CanvasRenderingContext2D_; CanvasGradient = CanvasGradient_; CanvasPattern = CanvasPattern_; })(); } // if /****************************************************************************** * * kaMap! javascript code * * $Id: kaMap.js,v 1.61 2006/01/19 14:38:09 pspencer Exp $ * ****************************************************************************** * * Copyright (c) 2005 DM Solutions Group Inc. * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * Modified by Andrea Cappugi and Lorenzo Becchi toload to track layer visibility at diferent * scale, to load only visible layer * 22/12/2005 *****************************************************************************/ var LAYER_ALGO = "RANDOM"; // can be CENTER or RANDOM. Any other value will use the old code. /** * kaMap! events */ var gnLastEventId = 0; var KAMAP_ERROR = gnLastEventId ++; var KAMAP_WARNING = gnLastEventId ++; var KAMAP_NOTICE = gnLastEventId++; var KAMAP_INITIALIZED = gnLastEventId ++; var KAMAP_MAP_INITIALIZED = gnLastEventId ++; var KAMAP_EXTENTS_CHANGED = gnLastEventId ++; var KAMAP_SCALE_CHANGED = gnLastEventId ++; var KAMAP_SCALE_CHANGE_START = gnLastEventId ++; var KAMAP_LAYERS_CHANGED = gnLastEventId ++; var KAMAP_DRAG = gnLastEventId ++; var KAMAP_DRAG_START = gnLastEventId ++; var KAMAP_DRAG_END = gnLastEventId ++; var KAMAP_MOVE = gnLastEventId ++; var KAMAP_MOVE_START = gnLastEventId ++; var KAMAP_CONTEXT_MENU = gnLastEventId ++; /****************************************************************************** * kaMap main class * * construct a new kaMap instance. Pass the id of the div to put the kaMap in * * this class is the main API for any application. Only use the functions * provided by this API to ensure everything functions correctly * * szID - string, the id of a div to put the kaMap! into * *****************************************************************************/ function kaMap( szID ) { this.isCSS = false; this.isW3C = false; this.isIE4 = false; this.isNN4 = false; this.isIE6CSS = false; if (document.images) { this.isCSS = (document.body && document.body.style) ? true : false; this.isW3C = (this.isCSS && document.getElementById) ? true : false; this.isIE4 = (this.isCSS && document.all) ? true : false; this.isNN4 = (document.layers) ? true : false; this.isIE6CSS = (document.compatMode && document.compatMode.indexOf("CSS1") >= 0) ? true : false; } this.domObj = this.getRawObject( szID ); this.domObj.style.overflow = 'hidden'; this.hideLayersOnMove = false; //if true layer not checked are loaded if false aren't loaded this.loadUnchecked=false; /** * initialization states * 0 - not initialized * 1 - initializing * 2 - initialized */ this.initializationState = 0; //track mouse down events this.bMouseDown = false; //track last recorded mouse position this.lastx = 0; this.lasty = 0; //keep a reference to the inside layer since we use it a lot this.theInsideLayer = null; //viewport width and height are used in many calculations this.viewportWidth = safeParseInt(this.domObj.style.width); this.viewportHeight = safeParseInt(this.domObj.style.height); //track amount the inside layer has moved to help in wrapping images this.xOffset = 0; this.yOffset = 0; //track current origin offset value this.xOrigin = 0; this.yOrigin = 0; //the name of the current map this.currentMap = ''; //the current width and height in tiles this.nWide = 0; this.nHigh = 0; //current top and left are tracked when the map moves //to start the map at some offset, these would be set to //the appropriate pixel value. this.nCurrentTop = 0; //null; this.nCurrentLeft = 0; //null; //keep a live reference to aPixel to help with caching problems - hish this.aPixel = new Image(1,1); // make sure aPixel is never used. p9 hack //this.aPixel.src = 'images/a_pixel.gif'; // p9 hack //error stack for tracking images that have failed to load this.imgErrors = new Array(); //an array of available maps this.aMaps = new Array(); //tile size and buffer size determine how many tiles to create this.tileWidth = null; this.tileHeight = null; this.nBuffer = 1; this.baseURL = ''; //size of a pixel, geographically - assumed to be square this.cellSize = null; //image id counter - helps with reloading failed images this.gImageID = 0; //event manager this.eventManager = new _eventManager(); //slider stuff this.as=slideid=null; this.accelerationFactor=1; this.pixelsPerStep = 30; this.timePerStep = 25; // animated zoom stuff this.slideSteps = 3; // steps in the slide this.animatedZoomingIntervalID = null; this.animatedZoom = false; // CUSTOM: Allow kamap to request tiles as urls to images not tile.php. (speed up). // Set this in config.php this.isDirectTileAccess = null; //this is a convenience to allow redirecting the client code to a server //other than the one that this file was loaded from. This may not //work depending on security settings, except for loading tiles since //those come directly from a php script instead of an XmlHttpRequest. // //by default, if this is empty, it loads from the same site as the //page loaded from. If set, it should be a full http:// reference to the //directory in which init.php, tile.php and the other scripts are located. this.server = ''; // attach to _layer instead // this.tileServers = new kaServers(); //similarly, this is the global initialization script called once per page //load ... the result of this script tell the client what other scripts //are used for the other functions this.init = "init.pl"; //these are the values that need to be initialized by the init script this.tileURL = null; this.aObjects = []; this.aCanvases = []; this.layersHidden = false; this.aTools = []; /* register the known events */ for (var i=0; i 0) { theObj = this.seekLayer(document.layers[i].document, name); } } return theObj; } // Convert object name string or object reference // into a valid element object reference kaMap.prototype.getRawObject = function(obj) { var theObj; if (typeof obj == "string") { if (this.isW3C) { theObj = document.getElementById(obj); } else if (this.isIE4) { theObj = document.all(obj); } else if (this.isNN4) { theObj = seekLayer(document, obj); } } else { // pass through object reference theObj = obj; } return theObj; } // Convert object name string or object reference // into a valid style (or NN4 layer) reference kaMap.prototype.getObject = function(obj) { var theObj = this.getRawObject(obj); if (theObj && this.isCSS) { theObj = theObj.style; } return theObj; } // Retrieve the rendered width of an element kaMap.prototype.getObjectWidth = function(obj) { var elem = this.getRawObject(obj); var result = 0; if (elem.offsetWidth) { result = elem.offsetWidth; } else if (elem.clip && elem.clip.width) { result = elem.clip.width; } else if (elem.style && elem.style.pixelWidth) { result = elem.style.pixelWidth; } return parseInt(result); } // Retrieve the rendered height of an element kaMap.prototype.getObjectHeight = function(obj) { var elem = this.getRawObject(obj); var result = 0; if (elem.offsetHeight) { result = elem.offsetHeight; } else if (elem.clip && elem.clip.height) { result = elem.clip.height; } else if (elem.style && elem.style.pixelHeight) { result = elem.style.pixelHeight; } return parseInt(result); } /** * kaMap.zoomTo( lon, lat [, scale] ) * * zoom to some geographic point (in current projection) and optionally scale * * lon - the x coordinate to zoom to * lat - the y coordinate to zoom to * scale - optional. The scale to use */ kaMap.prototype.zoomTo = function( cgX, cgY ) { var oMap = this.getCurrentMap(); var inchesPerUnit = new Array(1, 12, 63360.0, 39.3701, 39370.1, 4374754); var newScale; var bScaleChanged = false; if (arguments.length == 3) { newScale = arguments[2]; bScaleChanged = (newScale != this.getCurrentScale()); if(bScaleChanged) this.triggerEvent(KAMAP_SCALE_CHANGE_START, newScale ); // check for zoom animation (animation only occurs one zoom in or out) if (this.animatedZoom) { if ((this.aMaps[this.currentMap].aScales[this.aMaps[this.currentMap].currentScale+1] && newScale == this.aMaps[this.currentMap].aScales[this.aMaps[this.currentMap].currentScale+1]) || (this.aMaps[this.currentMap].aScales[this.aMaps[this.currentMap].currentScale-1] && newScale == this.aMaps[this.currentMap].aScales[this.aMaps[this.currentMap].currentScale-1])) { this.zoomTo(cgX, cgY); this.zoomToScale(newScale); return; } } } else { newScale = this.getCurrentScale(); } this.cellSize = newScale/(oMap.resolution * inchesPerUnit[oMap.units]); var nFactor = oMap.zoomToScale( newScale ); this.setMapLayers(); var cpX = cgX / this.cellSize; var cpY = cgY / this.cellSize; var vpLeft = Math.round(cpX - this.viewportWidth/2); var vpTop = Math.round(cpY + this.viewportHeight/2); //figure out which tile the center point lies on var cTileX = Math.floor(cpX/this.tileWidth)*this.tileWidth; var cTileY = Math.floor(cpY/this.tileHeight)*this.tileHeight; //figure out how many tiles left and up we need to move to lay out from //the top left and have the top/left image off screen (or partially) var nTilesLeft = Math.ceil(this.viewportWidth/(2*this.tileWidth))*this.tileWidth; var nTilesUp = Math.ceil(this.viewportHeight/(2*this.tileHeight))*this.tileHeight; this.nCurrentLeft = cTileX - nTilesLeft; this.nCurrentTop = -1*(cTileY + nTilesUp); this.xOrigin = this.nCurrentLeft; this.yOrigin = this.nCurrentTop; this.theInsideLayer.style.left = -1*(vpLeft - this.xOrigin) + "px"; this.theInsideLayer.style.top = (vpTop + this.yOrigin) + "px"; var layers = oMap.getLayers(); for( var k=0; k= oMap.aScales[i]) { break; } newScale = oMap.aScales[i]; } // return scale if argument specified if (arguments[4]) return newScale; this.triggerEvent( KAMAP_SCALE_CHANGE_START, newScale ); //now newScale has our new scale size this.cellSize = newScale/(oMap.resolution * inchesPerUnit[oMap.units]); var nFactor = oMap.zoomToScale( newScale ); this.setMapLayers(); var cpX = cgX / this.cellSize; var cpY = cgY / this.cellSize; var vpLeft = Math.round(cpX - this.viewportWidth/2); var vpTop = Math.round(cpY + this.viewportHeight/2); //figure out which tile the center point lies on var cTileX = Math.floor(cpX/this.tileWidth)*this.tileWidth; var cTileY = Math.floor(cpY/this.tileHeight)*this.tileHeight; //figure out how many tiles left and up we need to move to lay out from //the top left and have the top/left image off screen (or partially) var nTilesLeft = Math.ceil(this.viewportWidth/(2*this.tileWidth))*this.tileWidth; var nTilesUp = Math.ceil(this.viewportHeight/(2*this.tileHeight))*this.tileHeight; this.nCurrentLeft = cTileX - nTilesLeft; this.nCurrentTop = -1*(cTileY + nTilesUp); this.xOrigin = this.nCurrentLeft; this.yOrigin = this.nCurrentTop; this.theInsideLayer.style.left = -1*(vpLeft - this.xOrigin) + "px"; this.theInsideLayer.style.top = (vpTop + this.yOrigin) + "px"; var layers = oMap.getLayers(); for( var k=0; k 0 && arguments[0] != '') { szURL = szURL + sep + "map="+ arguments[0]; sep = "&"; } if (arguments.length > 1 && arguments[1] != '') { szURL = szURL + sep + "extents="+ arguments[1]; sep = "&"; } if (arguments.length > 2 && arguments[2] != '') { szURL = szURL + sep + "centerPoint="+ arguments[2]; sep = "&"; } // CUSTOM: use bypass to get around security issue in FF // DEPRECATED: no need for initialization call //if (this.shouldBypassSameSourcePolicy == true) //{ //bypassCall(this.server, this.init, this.id, 'initializeCallback'); //} //else //{ call(szURL, this, this.initializeCallback); //} return true; } /** * hidden function on callback from init.php */ kaMap.prototype.initializeCallback = function( szInit ) { // szInit contains /**/ if it worked, or some php error otherwise if (szInit.substr(0, 1) != "/") { this.triggerEvent( KAMAP_ERROR, 'ERROR: ka-Map! initialization '+ 'failed on the server. Message returned was:\n' + szInit); return false; } eval(szInit); //this.xOrigin = this.nCurrentLeft; //this.yOrigin = this.nCurrentTop; this.triggerEvent( KAMAP_INITIALIZED ); this.initializationState = 2; } /** * kaMap.setBackgroundColor( color ) * * call this to set a background color for the inside layer. This color * shows through any transparent areas of the map. This is primarily * intended to be used by the initializeMap callback function to set the * background to the background color in the map file. * * color: string, a valid HTML color string * * returns true; */ kaMap.prototype.setBackgroundColor = function( color ) { this.domObj.style.backgroundColor = color; return true; } /** * hidden method of kaMap to initialize all the various layers needed by * kaMap to draw and move the map image. */ kaMap.prototype.createLayers = function() { this.theInsideLayer = document.createElement('div'); this.theInsideLayer.id = 'theInsideLayer'; this.theInsideLayer.style.position = 'absolute'; this.theInsideLayer.style.left = '0px'; this.theInsideLayer.style.top = '0px'; this.theInsideLayer.style.zIndex = '1'; this.theInsideLayer.kaMap = this; if (this.currentTool) this.theInsideLayer.style.cursor = this.currentTool.cursor; this.domObj.appendChild(this.theInsideLayer); this.domObj.kaMap = this; this.theInsideLayer.onmousedown = kaMap_onmousedown; this.theInsideLayer.onmouseup = kaMap_onmouseup; this.theInsideLayer.onmousemove = kaMap_onmousemove; this.theInsideLayer.ontouchstart = kaMap_onmousedown; this.theInsideLayer.ontouchend = kaMap_onmouseup; this.theInsideLayer.ontouchmove = kaMap_onmousemove; this.theInsideLayer.onmouseover = kaMap_onmouseover; this.domObj.onmouseout = kaMap_onmouseout; this.theInsideLayer.onkeypress = kaMap_onkeypress; this.theInsideLayer.ondblclick = kaMap_ondblclick; this.theInsideLayer.onclick = kaMap_onclick; this.theInsideLayer.oncontextmenu = kaMap_oncontextmenu; this.theInsideLayer.onmousewheel = kaMap_onmousewheel; if (window.addEventListener && navigator.product && navigator.product == "Gecko") { this.domObj.addEventListener( "DOMMouseScroll", kaMap_onmousewheel, false ); } //this is to prevent problems in IE this.theInsideLayer.ondragstart = new Function([], 'var e=e?e:event;e.cancelBubble=true;e.returnValue=false;return false;'); } /** * internal function * update the layer URLs based on their current positions */ kaMap.prototype.initializeLayers = function(nFactor) { var deltaMouseX = this.nCurrentLeft + safeParseInt(this.theInsideLayer.style.left) - this.xOrigin; var deltaMouseY = this.nCurrentTop + safeParseInt(this.theInsideLayer.style.top) - this.yOrigin; var vpTop = this.nCurrentTop - deltaMouseY; var vpLeft = this.nCurrentLeft - deltaMouseX; var vpCenterX = vpLeft + this.viewportWidth/2; var vpCenterY = vpTop + this.viewportHeight/2; var currentTileX = Math.floor(vpCenterX/this.tileWidth)*this.tileWidth; var currentTileY = Math.floor(vpCenterY/this.tileHeight)*this.tileHeight; var tileDeltaX = currentTileX - this.nCurrentLeft; var tileDeltaY = currentTileY - this.nCurrentTop; var newVpCenterX = vpCenterX * nFactor; var newVpCenterY = vpCenterY * nFactor; var newTileX = Math.floor(newVpCenterX/this.tileWidth) * this.tileWidth; var newTileY = Math.floor(newVpCenterY/this.tileHeight) * this.tileHeight; var newCurrentLeft = newTileX - tileDeltaX; var newCurrentTop = newTileY - tileDeltaY; this.nCurrentLeft = newCurrentLeft; this.nCurrentTop = newCurrentTop; var newTilLeft = -newVpCenterX + this.viewportWidth/2; var newTilTop = -newVpCenterY + this.viewportHeight/2; var xOldOrigin = this.xOrigin; var yOldOrigin = this.yOrigin; this.xOrigin = this.nCurrentLeft; this.yOrigin = this.nCurrentTop; this.theInsideLayer.style.left = (newTilLeft + this.xOrigin) + "px"; this.theInsideLayer.style.top = (newTilTop + this.yOrigin) + "px"; var layers = this.aMaps[this.currentMap].getLayers(); for( var k=0; k map.nHigh) return 0; if (y < 0) return 0; if (y > map.nHigh) return 0; var d = layer.domObj; var nbProcessed = 0; for(var i=0; i<2; i++) { direction = (direction+1) % 4; for(var j=0; j newHigh && newHigh > 3) this.removeRow(); while (this.nWide < newWide) this.appendColumn(); while (this.nWide > newWide && newWide > 3) this.removeColumn(); //create image don't call layer.set tile so i need to do that! var map = this.getCurrentMap(); var layers =map.getLayers(); for(var i=0;i=0; j--) { var top = this.nCurrentTop + (j * this.tileHeight); var left = this.nCurrentLeft + (this.nWide * this.tileWidth); var img = this.createImage( top, left, layers[i] ); //hack around IE problem with clipping layers when a filter is //active if (this.isIE4) img.style.filter = "Alpha(opacity="+layers[i].opacity+")"; if (j < this.nHigh-1) obj.insertBefore(img, obj.childNodes[((j+1)*this.nWide)]); else obj.appendChild(img); } } this.nWide = this.nWide + 1; } /** * internal function to remove a column of images to each of the layers * * this function is used when the viewport is resized * modified by cappu can take a single layer as input */ kaMap.prototype.removeColumn = function(layer) { if (this.nWide < 3) return; if(arguments.length==1) var layers = Array(layer); else var layers = this.aMaps[this.currentMap].getLayers(); for( var i=0; i= 0; j--) { var img = d.childNodes[((j+1)*this.nWide)-1]; d.removeChild( img ); //attempt to prevent memory leaks img.onload = null; img.onerror = null; } } this.nWide = this.nWide - 1; } /** * internal function to remove a row of images to each of the layers * * this function is used when the viewport is resized * modified by cappu can take a single layer as input */ kaMap.prototype.removeRow = function(layer) { if (this.nHigh < 3) return; if(arguments.length==1) var layers = Array(layer); else var layers = this.aMaps[this.currentMap].getLayers(); for( var i=0; i= 0; j--) { var img = d.childNodes[((this.nHigh-1)*this.nWide)+j]; d.removeChild( img ); //attempt to prevent memory leaks img.onload = null; img.onerror = null; } } this.nHigh = this.nHigh - 1; } kaMap.prototype.hideLayers = function() { if (!this.hideLayersOnMove) return; if (this.layersHidden) return; var layers = this.aMaps[this.currentMap].getLayers(); for( var i=0; i=this.as.length){this.as=slideid=null;this.showLayers();this.triggerEvent( KAMAP_EXTENTS_CHANGED, this.getGeoExtents() );return;} this.moveBy( this.as[pos][0], this.as[pos][1] ); pos ++; this.slideid=goQueueManager.enqueue(this.timePerStep,this,this.slide,[ pos]); } /** * internal function to handle various events that are passed to the * current tool */ kaMap_onkeypress = function( e ) { if (this.kaMap.currentTool) this.kaMap.currentTool.onkeypress( e ); } kaMap_onmousemove = function( e ) { e = (e)?e:((event)?event:null); if (e.button==2) { this.kaMap.triggerEvent( KAMAP_CONTEXT_MENU ); } if (this.kaMap.currentTool) this.kaMap.currentTool.onmousemove( e ); } kaMap_onmousedown = function( e ) { if (this.kaMap.currentTool) this.kaMap.currentTool.onmousedown( e ); } kaMap_onmouseup = function( e ) { if (this.kaMap.currentTool) this.kaMap.currentTool.onmouseup( e ); } kaMap_onmouseover = function( e ) { if (this.kaMap.currentTool) this.kaMap.currentTool.onmouseover( e ); } kaMap_onmouseout = function( e ) { if (this.kaMap.currentTool) this.kaMap.currentTool.onmouseout( e ); } kaMap_oncontextmenu = function( e ) { e = (e)?e:((event)?event:null); if (e.preventDefault) e.preventDefault(); return false; } kaMap_onclick = function( e ) { if (this.kaMap.currentTool) this.kaMap.currentTool.onclick( e ); } kaMap_ondblclick = function( e ) { if (this.kaMap.currentTool) this.kaMap.currentTool.ondblclick( e ); } kaMap_onmousewheel = function( e ) { if (this.kaMap.currentTool) this.kaMap.currentTool.onmousewheel( e ); } kaMap.prototype.cancelEvent = function(e) { e = (e)?e:((event)?event:null); e.returnValue = false; if (e.preventDefault) e.preventDefault(); return false; } kaMap.prototype.registerTool = function( toolObj ) { this.aTools.push( toolObj ); } kaMap.prototype.activateTool = function( toolObj ) { if (this.currentTool) { this.currentTool.deactivate(); } this.currentTool = toolObj; if (this.theInsideLayer) this.theInsideLayer.style.cursor = this.currentTool.cursor; } kaMap.prototype.deactivateTool = function( toolObj ) { if (this.currentTool == toolObj) this.currentTool = null; if (this.theInsideLayer) this.theInsideLayer.style.cursor = 'auto'; } /** * internal function to check if images need to be wrapped */ kaMap.prototype.checkWrap = function() { this.xOffset = safeParseInt(this.theInsideLayer.style.left) + this.nCurrentLeft - this.xOrigin; this.yOffset = safeParseInt(this.theInsideLayer.style.top) + this.nCurrentTop - this.yOrigin; while (this.xOffset > 0) { this.wrapR2L(); } while (this.xOffset < -(this.nBuffer*this.tileWidth)) { this.wrapL2R(); } while (this.yOffset > -(this.nBuffer*this.tileHeight)) { this.wrapB2T(); } while (this.yOffset < -(2*this.nBuffer*this.tileHeight)) { this.wrapT2B(); } var layer = this.aMaps[this.currentMap].aLayers[0].domObj; var img = layer.childNodes[0].style; this.nCurrentTop = safeParseInt(img.top) + this.yOrigin; this.nCurrentLeft = safeParseInt(img.left) + this.xOrigin; } /** * internal function to reuse extra images * take last image from each row and put it at the beginning */ kaMap.prototype.wrapR2L = function() { this.xOffset = this.xOffset - (this.nBuffer * this.tileWidth); var layers = this.aMaps[this.currentMap].getLayers(); for( var k=0; k=0; i-- ) { if (this.theInsideLayer.childNodes[i].className == 'mapLayer') { this.theInsideLayer.childNodes[i].appended=false; this.theInsideLayer.removeChild(this.theInsideLayer.childNodes[i]); } } //now check layer and create or append layers=oMap.getLayers(); for( var i=0; i newHigh) this.removeRow(group); while (this.nWide < newWide) this.appendColumn(group); while (this.nWide > newWide) this.removeColumn(group); return true; } kaMap.prototype.createMapLayer = function( id ) { var d = document.createElement( 'div' ); d.id = id; d.className = 'mapLayer'; d.style.position = 'absolute'; d.style.visibility = 'visible'; d.style.left = '0px'; d.style.top = '0px'; d.style.width= '3000px'; d.style.height = '3000px'; d.appended= false;//added by cappu return d; } //modified by cappu kaMap.prototype.addMapLayer = function( l ) { var map = this.getCurrentMap(); map.addLayer ( l ); this.setMapLayers(); this.paintLayer(l); this.triggerEvent( KAMAP_LAYERS_CHANGED, this.currentMap ); } //added by cappu kaMap.prototype.removeMapLayer = function( id ) { var map = this.getCurrentMap(); var layer = map.getLayer(id); if (!layer) return false; if(map.removeLayer ( map.getLayer(id) )) { this.setMapLayers(); this.triggerEvent( KAMAP_LAYERS_CHANGED, this.currentMap ); } } kaMap.prototype.getCenter = function() { var deltaMouseX = this.nCurrentLeft - this.xOrigin + safeParseInt(this.theInsideLayer.style.left); var deltaMouseY = this.nCurrentTop - this.yOrigin + safeParseInt(this.theInsideLayer.style.top); var vpTop = this.nCurrentTop - deltaMouseY; var vpLeft = this.nCurrentLeft - deltaMouseX; var vpCenterX = vpLeft + this.viewportWidth/2; var vpCenterY = vpTop + this.viewportHeight/2; return new Array( vpCenterX, vpCenterY ); } /** * kaMap.getGeoExtents() * * returns an array of geographic extents for the current view in the form * (minx, miny, maxx, maxy) */ kaMap.prototype.getGeoExtents = function() { var minx = -1*(safeParseInt(this.theInsideLayer.style.left) - this.xOrigin) * this.cellSize; var maxx = minx + this.viewportWidth * this.cellSize; var maxy= (safeParseInt(this.theInsideLayer.style.top) - this.yOrigin) * this.cellSize; var miny= maxy - this.viewportHeight * this.cellSize; return [minx,miny,maxx,maxy]; } // continuous zoom set up kaMap.prototype.zoomSlide = function(zoomfactor) { var slideWait = 80; // milliseconds between each step var slidePower = 0.2 // power used to calculate width of slide steps if (this.animatedZoomingIntervalID) { window.clearInterval(this.animatedZoomingIntervalID); this.animatedZoomingIntervalID = null; this.initializeLayers(zoomfactor); } var newscale = this.getCurrentScale() * zoomfactor; var context = { 'map': this, 'slideZoom': newscale, 'totalSteps': this.slideSteps, 'step': 1, 'power': slidePower }; var move = function() { var delta = this.slideZoom - this.map.getCurrentScale(); var dZoom = Math.pow(((1/this.totalSteps)*this.step),this.power) * delta; var factor = zoomfactor*dZoom/delta; if (zoomfactor < 1 && this.step < this.map.slideSteps) factor = 1 - factor; this.map.zoomByFactor(factor, false, this.step); this.step++; if (this.step > this.totalSteps) { window.clearInterval(this.map.animatedZoomingIntervalID); this.map.animatedZoomingIntervalID = null; } }; this.animatedZoomingIntervalID = window.setInterval(move.KamapBindAsEventListener(context), slideWait); } kaMap.prototype.zoomIn = function() { this.zoomByFactor(this.aMaps[this.currentMap].zoomIn()); } kaMap.prototype.zoomOut = function() { this.zoomByFactor(this.aMaps[this.currentMap].zoomOut()); } kaMap.prototype.zoomToScale = function( scale ) { this.zoomByFactor(this.aMaps[this.currentMap].zoomToScale(scale)); } kaMap.prototype.zoomByFactorAnimate = function (nZoomFactor) { var zoomTileWidth = this.tileWidth*nZoomFactor; var zoomTileHeight = this.tileHeight*nZoomFactor; var deltaMouseX = this.nCurrentLeft + safeParseInt(this.theInsideLayer.style.left) - this.xOrigin; var deltaMouseY = this.nCurrentTop + safeParseInt(this.theInsideLayer.style.top) - this.yOrigin; var vpTop = this.nCurrentTop - deltaMouseY; var vpLeft = this.nCurrentLeft - deltaMouseX; var vpCenterX = vpLeft + this.viewportWidth/2; var vpCenterY = vpTop + this.viewportHeight/2; var currentTileX = Math.floor(vpCenterX/this.tileWidth)*this.tileWidth; var currentTileY = Math.floor(vpCenterY/this.tileHeight)*this.tileHeight; var tileDeltaCenterX = ((currentTileX - vpCenterX) * nZoomFactor) - (currentTileX - vpCenterX); var tileDeltaCenterY = ((currentTileY - vpCenterY) * nZoomFactor) - (currentTileY - vpCenterY); var tileDeltaTileX = ((currentTileX - this.nCurrentLeft) * nZoomFactor) - (currentTileX - this.nCurrentLeft); var tileDeltaTileY = ((currentTileY - this.nCurrentTop) * nZoomFactor) - (currentTileY - this.nCurrentTop); var tileDeltaX = parseInt(tileDeltaTileX - tileDeltaCenterX); var tileDeltaY = parseInt(tileDeltaTileY - tileDeltaCenterY); var layers = this.getCurrentMap().getLayers(); for( var k=0; k= 0.5) { this.zoomSlide(nZoomFactor); } else { if (step != null && step <= this.slideSteps) { // run animation this.zoomByFactorAnimate(nZoomFactor); } if ((step == this.slideSteps) || ((step == null)&&(!animated)) || nZoomFactor > 2 || nZoomFactor < 0.5) { this.cellSize = this.cellSize/nZoomFactor; this.setMapLayers(); this.initializeLayers(nZoomFactor); this.triggerEvent( KAMAP_SCALE_CHANGED, this.getCurrentScale() ); this.triggerEvent(KAMAP_MOVE); this.triggerEvent( KAMAP_EXTENTS_CHANGED, this.getGeoExtents() ); // HACK FOR REDRAWING WIDGET if (this.getCurrentMap().aLayers[0].legend != null && this.widgetIndicator) this.widgetIndicator.buildWidget(); } } } kaMap.prototype.getCurrentScale = function() { return this.aMaps[this.currentMap].aScales[this.aMaps[this.currentMap].currentScale]; } kaMap.prototype.setLayerQueryable = function( name, bQueryable ) { this.aMaps[this.currentMap].setLayerQueryable( name, bQueryable ); } kaMap.prototype.setLayerVisibility = function( name, bVisible ) { if(!this.loadUnchecked && bVisible){ layer=this.aMaps[this.currentMap].getLayer(name); layer.visible=true; this.setMapLayers(); this.aMaps[this.currentMap].setLayerVisibility( name, bVisible ); this.paintLayer(layer); }else this.aMaps[this.currentMap].setLayerVisibility( name, bVisible ); } kaMap.prototype.setLayerOpacity = function( name, opacity ) { this.aMaps[this.currentMap].setLayerOpacity( name, opacity ); } kaMap.prototype.registerEventID = function( eventID ) { return this.eventManager.registerEventID(eventID); } kaMap.prototype.registerForEvent = function( eventID, obj, func ) { return this.eventManager.registerForEvent(eventID, obj, func); } kaMap.prototype.deregisterForEvent = function( eventID, obj, func ) { return this.eventManager.deregisterForEvent(eventID, obj, func); } kaMap.prototype.triggerEvent = function( eventID /*pass additional arguments*/ ) { return this.eventManager.triggerEvent.apply( this.eventManager, arguments ); } /** * special helper function to parse an integer value safely in case * it is represented in IEEE format (scientific notation). */ function safeParseInt( val ) { return Math.round(parseFloat(val)); } /****************************************************************************** * _map * * internal class used to store map objects coming from the init script * * szName - string, the layer name (or group name, in this case ;)) * * szTitle - string, the human-readable title of the map * * nCurrentScale - integer, the current scale as an index into aszScales; * * aszScales - array, an array of scale values for zooming. The first scale is * assumed to be the default scale of the map * * aszLayers - array, an array of layer names and statuses. The array is indexed by * the layer name and the value is true or false for the status. * *****************************************************************************/ function _map(szName,groupName,szTitle,nCurrentScale, units, aszScales ) { this.name = szName; this.groupName = groupName; this.title = szTitle; this.aScales = aszScales; this.currentScale = parseFloat(nCurrentScale); this.units = units; this.resolution = 72; //used in scale calculations this.aLayers = []; this.defaultExtents = []; this.currentExtents = []; this.maxExtents = []; this.backgroundColor = '#ffffff'; this.version = "0"; //to be used for versioning the map file ... this.aZoomTo = []; this.kaMap = null; } _map.prototype.addLayer = function( layer ) { layer._map = this; layer.zIndex = this.aLayers.length; this.aLayers.push( layer ); } //added by cappu _map.prototype.removeLayer = function( l ) { var alayer=Array(); for(i=0,a=0;i 0) { nZoomFactor = this.aScales[this.currentScale]/this.aScales[this.currentScale-1]; this.currentScale = this.currentScale - 1; } return nZoomFactor; } _map.prototype.zoomToScale = function( scale ) { var nZoomFactor = 1; for (var i=0; i 1) fixPNG(img); } } _layer.prototype.setVisibility = function( bVisible ) { this.visible = bVisible; if (this.domObj) { this.domObj.style.visibility = bVisible?'visible':'hidden'; //horrid hack - this is needed in case any element contained //within the div has its visibility set ... it overrides the //style of the container!!! this.domObj.style.display = bVisible?'block':'none'; } for( var i=0; i 1) fixPNG(img); } } } _layer.prototype.buildLayerList = function(scale) { var layers = ""; if (this.mergedLayers.length > 0) { for (var i=0; i < this.mergedLayers.length; i++) { if (this.mergedLayers[i].minScale <= scale && this.mergedLayers[i].maxScale >= scale) { var name = this.mergedLayers[i].name; // swap for thin lines or labels if thematic is on if (this.legend) { if (name == "pointline") layers += "t_pointline"; else if (name == "pp2_line") layers += "pp2_tline"; else if (name == "pp2_labels") layers += "pp2_tlabels"; else if (name == "pp2tg_pointline") layers += "pp2tg_tpointline"; else if (name == "pp2tg_line") layers += "pp2tg_tline"; else if (name == "pp2tg_streetlabels") layers += "pp2tg_tstreetlabels"; else layers += name; } else layers += name; if (i == 0 && this.legend != null && this.legend.getBreaks() != "") { var legendString = "p_" + this.legend.indicator.periodids[this.legend.indicator.curPerIndex] + ".id_" + this.legend.indicator.id + ".colors_" + this.legend.getColors().join(":") + ".breaksdata_" + this.legend.getEncodedBreaks() + ".boundary_definition_" + this.legend.getBoundaryDefinitionID(this.legend.getBoundaryType().id); var nd = 0; if (this.legend.indicator.nodata) nd++; if (this.legend.indicator.breakid == P_BREAKTYPE_EXACT_VALUE_ID || this.legend.indicator.breakid == P_BREAKTYPE_EXACT_VALUE_CUSTOM_ID) nd += this.legend.getNumberOfBreaks(); if (nd > 0) legendString += ":nd_" + nd; layers += "," + legendString; } if (this.mergedLayers[i].opacity < 1 && !this.mergedLayers[i].client) layers += ":o_" + this.mergedLayers[i].opacity; layers += ","; } } layers = layers.substring(0,layers.length-1); } layers = layers.replace(/&/g, '%26'); layers = layers.replace(/#/g, '%23'); return layers; } _layer.prototype.buildTileURL = function(t, l, mapName, scale, force, group, layer, imageFormat) { //logger.debug("[buildTileURL] " + t + " " + l + " " + scale); var kamap = this._map.kaMap; var server = this.tileServers.isEmpty() == true ? kamap.server : this.tileServers.next( (t+l)/kamap.tileWidth ); if (kamap.isDirectTileAccess == true) { var layers = this.buildLayerList(scale); var src = ""; if (scale && layers != "") { var metaTop = Math.floor(t / 1000) * 1000; var metaLeft = Math.floor(l / 1000) * 1000; src = server + '/' + mapName + '/' + scale + '/' + layer + '/' + layers + '/meta_t' + metaTop + '/t' + metaTop + 'l' + metaLeft + '/t' + t + 'l' + l + '.' + 'png' + '?maprev='+this._map.revision + '&key='+kamap.apiKey; } // if directory name is too long, go straight to tile_r if (layers.length > 255 || layers.match(".*pins_.*:data_.*")) { var url = server.split('/'); src = url[0] + "//" + url[2] + "/" + kamap.directTilePath + '?s='+scale+'&t='+t+'&l='+l+'&layers='+layers+'&key='+kamap.apiKey;; } //document.title = src; return src; } } /****************************************************************************** * Event Manager class * * an internal class for managing generic events. kaMap! uses the event * manager internally and exposes certain events to the application. * * the kaMap class provides wrapper functions that hide this implementation * useage: * * myKaMap.registerForEvent( gnSomeEventID, myObject, myFunction ); * myKaMap.registerForEvent( 'SOME_EVENT', myObject, myFunction ); * * myKaMap.deregisterForEvent( gnSomeEventID, myObject, myFunction ); * myKaMap.deregisterForEvent( 'SOME_EVENT', myObject, myFunction ); * * myObject is normally null but can be a javascript object to have myFunction * executed within the context of an object (becomes 'this' in the function). * *****************************************************************************/ function _eventManager( ) { this.events = []; this.lastEventID = 0; } _eventManager.prototype.registerEventID = function( eventID ) { var ev = new String(eventID); if (!this.events[eventID]) { this.events[eventID] = []; } } _eventManager.prototype.registerForEvent = function(eventID, obj, func) { var ev = new String(eventID); this.events[eventID].push( [obj, func] ); } _eventManager.prototype.deregisterForEvent = function( eventID, obj, func ) { var ev = new String(eventID); var bResult = false; if (!this.events[eventID]) return false; for (var i=0;i 0) this.kaMap.zoomIn(); else this.kaMap.zoomOut(); return false; } /** * kaTool.adjustPixPosition( x, y ) * * adjust a page-relative pixel position into a kaMap relative * pixel position * * x - int, the x page coord * y - int, the y page coord * * returns an array with the adjusted pixel positions */ kaTool.prototype.adjustPixPosition = function( x, y ) { var obj = this.kaMap.domObj; var offsetLeft = 0; var offsetTop = 0; while (obj) { offsetLeft += parseInt(obj.offsetLeft); offsetTop += parseInt(obj.offsetTop); obj = obj.offsetParent; } var pX = parseInt(this.kaMap.theInsideLayer.style.left) + offsetLeft - this.kaMap.xOrigin - x; var pY = parseInt(this.kaMap.theInsideLayer.style.top) + offsetTop - this.kaMap.yOrigin - y; return [pX,pY]; } // get window position coords kaTool.prototype.getMousePosition = function (e) { e = (e)?e:((event)?event:null); var posX = 0, posY = 0; if (e.pageX && e.pageY) { posX = e.pageX; posY = e.pageY; } else { var iebody=(document.compatMode && document.compatMode != "BackCompat")? document.documentElement : document.body var scrollX = iebody.scrollLeft?iebody.scrollLeft:(window.pageXOffset?window.pageXOffset:0); var scrollY = iebody.scrollTop?iebody.scrollTop:(window.pageYOffset?window.pageYOffset:0); posX = e.clientX + scrollX; posY = e.clientY + scrollY; } return [posX,posY]; } /* * key press events are directed to the HTMLDocument rather than the * div on which we really wanted them to happen. So we set the document * keypress handler to this function and redirect it to the kaMap core * keypress handler, which will eventually reach the onkeypress handler * of our current tool ... which by default is the keyboard navigation. * * To get the keyboard events in the first place, add the following when you * want the keypress events to be captured * * if (isIE4) document.onkeydown = kaTool_redirect_onkeypress; * document.onkeypress = kaTool_redirect_onkeypress; */ function kaTool_redirect_onkeypress(e) { if (document.kaCurrentTool) document.kaCurrentTool.onkeypress(e); } kaTool.prototype.onkeypress = function(e) { e = (e)?e:((event)?event:null); if(e) { var charCode=(e.charCode)?e.charCode:e.keyCode; var b=true; var nStep = 16; switch(charCode) { case 38://up this.kaMap.moveBy(0,nStep); this.kaMap.triggerEvent( KAMAP_EXTENTS_CHANGED, this.kaMap.getGeoExtents() ); break; case 40: this.kaMap.moveBy(0,-nStep); this.kaMap.triggerEvent( KAMAP_EXTENTS_CHANGED, this.kaMap.getGeoExtents() ); break; case 37: this.kaMap.moveBy(nStep,0); this.kaMap.triggerEvent( KAMAP_EXTENTS_CHANGED, this.kaMap.getGeoExtents() ); break; case 39: this.kaMap.moveBy(-nStep,0); this.kaMap.triggerEvent( KAMAP_EXTENTS_CHANGED, this.kaMap.getGeoExtents() ); break; case 33: this.kaMap.slideBy(0, this.kaMap.viewportHeight/2); break; case 34: this.kaMap.slideBy(0,-this.kaMap.viewportHeight/2); break; case 36: this.kaMap.slideBy(this.kaMap.viewportWidth/2,0); break; case 35: this.kaMap.slideBy(-this.kaMap.viewportWidth/2,0); break; case 43: this.kaMap.zoomIn(); break; case 45: this.kaMap.zoomOut(); break; default: b=false; } if (b) { return this.cancelEvent(e); } return true; } } kaTool.prototype.onmouseover = function(e) { return false; } kaTool.prototype.onmouseout = function(e) { if (this.kaMap.isIE4) document.onkeydown = null; document.onkeypress = null; return false; } kaTool.prototype.cancelEvent = function(e) { e = (e)?e:((event)?event:null); e.cancelBubble = true; e.returnValue = false; if (e.stopPropogation) e.stopPropogation(); if (e.preventDefault) e.preventDefault(); return false; } function kaNavigator( oKaMap ) { kaTool.apply( this, [oKaMap] ); this.name = 'kaNavigator'; this.cursor = 'move'; this.activeImage = this.kaMap.server + 'va-images/button_pan_3.png'; this.disabledImage = this.kaMap.server + 'va-images/button_pan_2.png'; this.lastx = null; this.lasty = null; this.bMouseDown = false; this.bMouseDrag = false; this.allowClick = true; for (var p in kaTool.prototype) { if (!kaNavigator.prototype[p]) kaNavigator.prototype[p]= kaTool.prototype[p]; } } kaNavigator.prototype.onmouseout = function(e) { e = (e)?e:((event)?event:null); if (!e.target) e.target = e.srcElement; if (e.target.id == this.kaMap.domObj.id) { this.bMouseDown = false; return kaTool.prototype.onmouseout.apply(this, [e]); } } kaNavigator.prototype.onmousemove = function(e) { e = (e)?e:((event)?event:null); if (!this.bMouseDown) { return false; } else { if (!this.bMouseDrag) { this.kaMap.triggerEvent(KAMAP_DRAG_START); this.kaMap.triggerEvent(KAMAP_MOVE_START); this.bMouseDrag = true; } this.kaMap.triggerEvent(KAMAP_MOVE); this.kaMap.triggerEvent(KAMAP_DRAG); } if (!this.kaMap.layersHidden) this.kaMap.hideLayers(); var newTop = safeParseInt(this.kaMap.theInsideLayer.style.top); var newLeft = safeParseInt(this.kaMap.theInsideLayer.style.left); newTop = newTop - this.lasty + (e.clientY || e.pageY); newLeft = newLeft - this.lastx + (e.clientX || e.pageX); this.kaMap.theInsideLayer.style.top=newTop + 'px'; this.kaMap.theInsideLayer.style.left=newLeft + 'px'; this.kaMap.checkWrap.apply(this.kaMap, []); this.lastx = (e.clientX || e.pageX); this.lasty = (e.clientY || e.pageY); return false; } kaNavigator.prototype.onmousedown = function(e) { e = (e)?e:((event)?event:null); if (e.button==2) { return this.cancelEvent(e); } else { if (this.kaMap.isIE4) document.onkeydown = kaTool_redirect_onkeypress; document.onkeypress = kaTool_redirect_onkeypress; this.bMouseDown=true; this.allowClick = true; this.lastx = (e.clientX || e.pageX); this.lasty = (e.clientY || e.pageY); e.cancelBubble = true; e.returnValue = false; if (e.stopPropogation) e.stopPropogation(); if (e.preventDefault) e.preventDefault(); return false; } } kaNavigator.prototype.onmouseup = function(e) { e = (e)?e:((event)?event:null); this.bMouseDown=false; if (this.bMouseDrag) { this.kaMap.triggerEvent(KAMAP_EXTENTS_CHANGED, this.kaMap.getGeoExtents()); this.kaMap.triggerEvent(KAMAP_DRAG_END); this.bMouseDrag=false; this.allowClick=false; } /* unnecessary according to Steve Lime */ //this.lastx=null; //this.lasty=null; this.kaMap.showLayers(); return false; } kaNavigator.prototype.onclick = function(e) { e = (e)?e:((event)?event:null); return false; } kaNavigator.prototype.ondblclick = function(e) { var pos = this.getMousePosition(e); var aPixPos = this.adjustPixPosition( pos[0], pos[1]); var vpX = this.kaMap.viewportWidth/2; var vpY = this.kaMap.viewportHeight/2; var dx = parseInt(this.kaMap.theInsideLayer.style.left) - this.kaMap.xOrigin - vpX - aPixPos[0]; var dy = parseInt(this.kaMap.theInsideLayer.style.top) - this.kaMap.yOrigin - vpY - aPixPos[1]; this.kaMap.slideBy(-dx, -dy); } /* This notice must be untouched at all times. wz_dragdrop.js v. 4.62 The latest version is available at http://www.walterzorn.com or http://www.devira.com or http://www.walterzorn.de Copyright (c) 2002-2003 Walter Zorn. All rights reserved. Created 26. 8. 2002 by Walter Zorn (Web: http://www.walterzorn.com ) Last modified: 30. 5. 2005 This DHTML & Drag&Drop Library adds Drag&Drop functionality to the following types of html-elements: - images, even if not positioned via layers, nor via stylesheets or any other kind of "hard-coding" - relatively and absolutely positioned layers (DIV elements). Moreover, it provides extended DHTML abilities. LICENSE: LGPL This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License (LGPL) as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For more details on the GNU Lesser General Public License, see http://www.gnu.org/copyleft/lesser.html */ // PATH TO THE TRANSPARENT 1*1 PX IMAGE (required by NS 4 as spacer) var spacer = 'transparentpixel.gif'; //window.onerror = new Function('return true;'); // Optional commands passed to SET_DHTML() on the html-page (g: may be applied globally, i: individually) var CLONE = 'C10nE'; // i img clone image var COPY = 'C0pY'; // i img create copies var DETACH_CHILDREN = 'd37aCH'; // i lyr detach images var HORIZONTAL = 'H0r1Z'; // i img,lyr horizontally draggable only var MAXHEIGHT = 'm7x8I'; // i img,lyr maximum height limit, " var MAXOFFBOTTOM = 'm7xd0wN'; // i img,lyr downward offset limit var MAXOFFLEFT = 'm7x23Ft'; // i img,lyr leftward offset limit var MAXOFFRIGHT = 'm7x0Ff8'; // i img,lyr rightward offset limit var MAXOFFTOP = 'm7xu9'; // i img,lyr upward offset limit var MAXWIDTH = 'm7xW1'; // i img,lyr maximum width limit, use with resizable or scalable var MINWIDTH = 'm1nw1'; // i img,lyr minimum width limit, " var MINHEIGHT = 'm1n8I'; // i img,lyr minimum height limit, " var NO_ALT = 'no81T'; // gi img disable alt and title attributes var NO_DRAG = 'N0d4Ag'; // i img,lyr disable draggability var RESET_Z = 'r35E7z'; // gi img,lyr reset z-index when dropped var RESIZABLE = 'r5IZbl'; // gi img,lyr resizable if or pressed var SCALABLE = 'SCLbl'; // gi img,lyr scalable " var SCROLL = 'sC8lL'; // gi img,lyr enable auto scroll functionality var TRANSPARENT = 'dIApHAn'; // gi img,lyr translucent while dragged var VERTICAL = 'V3Rt1C'; // i img,lyr vertically draggable only var dd_cursors = new Array( 'c:default', 'c:crosshair', 'c:e-resize', 'c:hand', 'c:help', 'c:move', 'c:n-resize', 'c:ne-resize', 'c:nw-resize', 'c:s-resize', 'c:se-resize', 'c:sw-resize', 'c:text', 'c:w-resize', 'c:wait' ); var dd_i = dd_cursors.length; while(dd_i--) eval('var CURSOR_' + (dd_cursors[dd_i].substring(2).toUpperCase().replace('-', '_')) + ' = "' + dd_cursors[dd_i] + '";'); function WZDD() { this.elements = new Array(0); this.obj = null; this.n = navigator.userAgent.toLowerCase(); this.db = (document.compatMode && document.compatMode.toLowerCase() != "backcompat")? document.documentElement : (document.body || null); this.op = !!(window.opera && document.getElementById); this.op6 = !!(this.op && !(this.db && this.db.innerHTML)); if (this.op && !this.op6) document.onmousedown = new Function('e', 'if (((e = e || window.event).target || e.srcElement).tagName == "IMAGE") return false;'); this.ie = !!(this.n.indexOf("msie") >= 0 && document.all && this.db && !this.op); this.iemac = !!(this.ie && this.n.indexOf("mac") >= 0); this.ie4 = !!(this.ie && !document.getElementById); this.n4 = !!(document.layers && typeof document.classes != "undefined"); this.n6 = !!(typeof window.getComputedStyle != "undefined" && typeof document.createRange != "undefined"); this.w3c = !!(!this.op && !this.ie && !this.n6 && document.getElementById); this.ce = !!(document.captureEvents && document.releaseEvents); this.px = (this.n4 || this.op6)? '' : 'px'; this.tiv = this.w3c? 40 : 10; } var dd = new WZDD(); dd.Int = function(d_x, d_y) { return isNaN(d_y = parseInt(d_x))? 0 : d_y; }; dd.getWndW = function() { return dd.Int( (dd.db && !dd.op && !dd.w3c && dd.db.clientWidth)? dd.db.clientWidth : (window.innerWidth || 0) ); }; dd.getWndH = function() { return dd.Int( (dd.db && !dd.op && !dd.w3c && dd.db.clientHeight)? dd.db.clientHeight : (window.innerHeight || 0) ); }; dd.getScrollX = function() { return dd.Int(window.pageXOffset || (dd.db? dd.db.scrollLeft : 0)); }; dd.getScrollY = function() { return dd.Int(window.pageYOffset || (dd.db? dd.db.scrollTop : 0)); }; dd.getPageXY = function(d_o) { if (dd.n4 && d_o) { dd.x = d_o.pageX || 0; dd.y = d_o.pageY || 0; } else { dd.x = dd.y = 0; //global helper vars while (d_o) { dd.x += dd.Int(d_o.offsetLeft); dd.y += dd.Int(d_o.offsetTop); d_o = d_o.offsetParent || null; } } }; dd.getCssXY = function(d_o) { if (d_o.div) { if (dd.n4) { d_o.cssx = d_o.div.x; d_o.cssy = d_o.div.y; } else if (dd.ie4) { d_o.cssx = d_o.css.pixelLeft; d_o.cssy = d_o.css.pixelTop; } else { d_o.css.left = d_o.css.top = 0 + dd.px; dd.getPageXY(d_o.div); d_o.cssx = d_o.x - dd.x; d_o.cssy = d_o.y - dd.y; d_o.css.left = d_o.cssx + dd.px; d_o.css.top = d_o.cssy + dd.px; } } else { d_o.cssx = 0; d_o.cssy = 0; } }; dd.getImgW = function(d_o) { return d_o? dd.Int(d_o.width) : 0; }; dd.getImgH = function(d_o) { return d_o? dd.Int(d_o.height) : 0; }; dd.getDivW = function(d_o) { return dd.Int( dd.n4? (d_o.div? d_o.div.clip.width : 0) : d_o.div? (d_o.div.offsetWidth || d_o.css.pixelWidth || d_o.css.width || 0) : 0 ); }; dd.getDivH = function(d_o) { return dd.Int( dd.n4? (d_o.div? d_o.div.clip.height : 0) : d_o.div? (d_o.div.offsetHeight || d_o.css.pixelHeight || d_o.css.height || 0) : 0 ); }; dd.getWH = function(d_o) { d_o.w = dd.getDivW(d_o); d_o.h = dd.getDivH(d_o); if (d_o.css) { d_o.css.width = d_o.w + dd.px; d_o.css.height = d_o.h + dd.px; d_o.dw = dd.getDivW(d_o)-d_o.w; d_o.dh = dd.getDivH(d_o)-d_o.h; d_o.css.width = (d_o.w-d_o.dw) + dd.px; d_o.css.height = (d_o.h-d_o.dh) + dd.px; } else d_o.dw = d_o.dh = 0; }; dd.getCssProp = function(d_o, d_pn6, d_pstyle, d_pn4) { if (d_o && dd.n6) return ''+window.getComputedStyle(d_o, null).getPropertyValue(d_pn6); if (d_o && d_o.currentStyle) return ''+eval('d_o.currentStyle.'+d_pstyle); if (d_o && d_o.style) return ''+eval('d_o.style.'+d_pstyle); if (d_o && dd.n4) return ''+eval('d_o.'+d_pn4); return ''; }; dd.getDiv = function(d_x, d_d) { d_d = d_d || document; if (dd.n4) { if (d_d.layers[d_x]) return d_d.layers[d_x]; for (var d_i = d_d.layers.length; d_i--;) { var d_y = dd.getDiv(d_x, d_d.layers[d_i].document); if (d_y) return d_y; } } if (dd.ie) return d_d.all[d_x] || null; if (d_d.getElementById) return d_d.getElementById(d_x) || null; return null; }; dd.getImg = function(d_o, d_nm, d_xy, d_w) { d_w = d_w || window; var d_img; if (document.images && (d_img = d_w.document.images[d_nm]) && d_img.name == d_nm) { if (d_xy) { if (dd.n4) { dd.getPageXY(d_w); d_o.defx = d_img.x + dd.x; d_o.defy = d_img.y + dd.y; } else { dd.getPageXY(d_img); d_o.defx = dd.x; d_o.defy = dd.y; } } return d_img; } if (dd.n4) for (var d_i = d_w.document.layers.length; d_i--;) { var d_y = dd.getImg(d_o, d_nm, d_xy, d_w.document.layers[d_i]); if (d_y) return d_y; } return null; }; dd.getParent = function(d_o, d_p) { if (dd.n4) { for (d_p, d_i = dd.elements.length; d_i--;) { if (!((d_p = dd.elements[d_i]).is_image) && d_p.div && (d_p.div.document.layers[d_o.name] || d_o.oimg && d_p.div.document.images[d_o.oimg.name])) d_p.addChild(d_o, d_p.detach, 1); } } else { d_p = d_o.is_image? dd.getImg(d_o, d_o.oimg.name) : (d_o.div || null); while (d_p && !!(d_p = d_p.offsetParent || d_p.parentNode || null)) { if (d_p.ddObj) { d_p.ddObj.addChild(d_o, d_p.ddObj.detach, 1); break; } } } }; dd.getCmd = function(d_o, d_cmd, d_cmdStr) { var d_i = d_o.id.indexOf(d_cmd), d_j, d_y = (d_i >= 0)*1; if (d_y) { d_j = d_i+d_cmd.length; if (d_cmdStr) d_o.cmd += d_o.id.substring(d_i, d_j); d_o.id = d_o.id.substring(0, d_i) + d_o.id.substring(d_j); } return d_y; }; dd.getCmdVal = function(d_o, d_cmd, d_cmdStr, int0) { var d_i = d_o.id.indexOf(d_cmd), d_j, d_y = (d_o.id.indexOf(d_cmd) >= 0)? dd.Int(d_o.id.substring(d_o.id.indexOf(d_cmd)+d_cmd.length)) : int0? -1 : 0; if (!int0 && d_y || int0 && d_y >= 0) { d_j = d_i+d_cmd.length+(""+d_y).length; if (d_cmdStr) d_o.cmd += d_o.id.substring(d_i, d_j); d_o.id = d_o.id.substring(0, d_i) + d_o.id.substring(d_j); } return d_y; }; dd.addElt = function(d_o, d_p) { dd.elements[d_o.name] = dd.elements[d_o.index = dd.elements.length] = d_o; if (d_p) d_p.copies[d_o.name] = d_p.copies[d_p.copies.length] = d_o; }; dd.mkWzDom = function() { var d_o, d_i = dd.elements.length; while(d_i--) dd.getParent(dd.elements[d_i]); d_i = dd.elements.length; while(d_i--) { d_o = dd.elements[d_i]; if (d_o.children && !d_o.parent) { var d_j = d_o.children.length; while(d_j--) d_o.children[d_j].setZ(d_o.z+d_o.children[d_j].z, 1); } } }; dd.addProps = function(d_o) { var d_i, d_c; if (d_o.is_image) { d_o.div = dd.getDiv(d_o.id); if (d_o.div && typeof d_o.div.style != "undefined") d_o.css = d_o.div.style; d_o.nimg = (dd.n4 && d_o.div)? d_o.div.document.images[0] : (document.images[d_o.id+'NImG'] || null); if (d_o.nimg && !d_o.noalt && !dd.noalt) { d_o.nimg.alt = d_o.oimg.alt || ''; if (d_o.oimg.title) d_o.nimg.title = d_o.oimg.title; } d_o.bgColor = ''; } else { d_o.bgColor = dd.getCssProp(d_o.div, 'background-color','backgroundColor','bgColor').toLowerCase(); if (dd.n6 && d_o.div) { if ((d_c = d_o.bgColor).indexOf('rgb') >= 0) { d_c = d_c.substring(4, d_c.length-1).split(','); d_o.bgColor = '#'; for (d_i = 0; d_i < d_c.length; d_i++) d_o.bgColor += parseInt(d_c[d_i]).toString(0x10); } else d_o.bgColor = d_c; } } if (dd.scalable) d_o.scalable = d_o.resizable^1; else if (dd.resizable) d_o.resizable = d_o.scalable^1; d_o.setZ(d_o.defz); d_o.cursor = d_o.cursor || dd.cursor || 'auto'; d_o._setCrs(d_o.nodrag? 'auto' : d_o.cursor); d_o.diaphan = d_o.diaphan || dd.diaphan || 0; d_o.opacity = 1.0; //if (dd.ie && !dd.iemac && d_o.div) // d_o.div.style.filter = "Alpha(opacity=100)"; d_o.visible = true; }; dd.initz = function() { if (!(dd && (dd.n4 || dd.n6 || dd.ie || dd.op || dd.w3c))) return; if (dd.op6) WINSZ(2); else if (dd.n6 || dd.ie || dd.op && !dd.op6 || dd.w3c) dd.recalc(1); var d_drag = (document.onmousemove == DRAG), d_resize = (document.onmousemove == RESIZE); if (dd.loadFunc) dd.loadFunc(); if (d_drag && document.onmousemove != DRAG) dd.setEvtHdl(1, DRAG); else if (d_resize && document.onmousemove != RESIZE) dd.setEvtHdl(1, RESIZE); if ((d_drag || d_resize) && document.onmouseup != DROP) dd.setEvtHdl(2, DROP); dd.setEvtHdl(0, PICK); }; dd.finlz = function() { if (dd.ie && dd.elements) { var d_i = dd.elements.length; while (d_i--) dd.elements[d_i].del(); } }; dd.setEvtHdl = function(d_typ, d_func) { if (!d_typ) { if (document.onmousedown != d_func) dd.downFunc = document.onmousedown || null; document.onmousedown = d_func; } else if (d_typ&1) { if (document.onmousemove != d_func) dd.moveFunc = document.onmousemove || null; document.onmousemove = d_func; } else { if (document.onmouseup != d_func) dd.upFunc = document.onmouseup || null; document.onmouseup = d_func; } if (dd.ce) { var d_e = (!d_typ)? Event.MOUSEDOWN : (d_typ&1)? Event.MOUSEMOVE : Event.MOUSEUP; d_func? document.captureEvents(d_e) : document.releaseEvents(d_e); } }; dd.evt = function(d_e) { this.but = (this.e = d_e || window.event).which || this.e.button || 0; this.button = (this.e.type == 'mousedown')? this.but : (dd.e && dd.e.button)? dd.e.button : 0; this.src = this.e.target || this.e.srcElement || null; this.src.tag = ("" + (this.src.tagName || this.src)).toLowerCase(); this.x = dd.Int(this.e.pageX || this.e.clientX || 0); this.y = dd.Int(this.e.pageY || this.e.clientY || 0); if (dd.ie) { this.x += dd.getScrollX() - (dd.ie && !dd.iemac)*1; this.y += dd.getScrollY() - (dd.ie && !dd.iemac)*1; } this.modifKey = this.e.modifiers? this.e.modifiers&Event.SHIFT_MASK : (this.e.shiftKey || false); }; dd.recalc = function(d_x) { var d_o, d_i = dd.elements.length; while(d_i--) { if (!(d_o = dd.elements[d_i]).is_image && d_o.div) { dd.getWH(d_o); if (d_o.div.pos_rel) { dd.getPageXY(d_o.div); var d_dx = dd.x - d_o.x, d_dy = dd.y - d_o.y; d_o.defx += d_dx; d_o.x += d_dx; d_o.defy += d_dy; d_o.y += d_dy; var d_p, d_j = d_o.children.length; while(d_j--) { if (!(d_p = d_o.children[d_j]).detached && (d_o != d_p.defparent || !(d_p.is_image && dd.getImg(d_p, d_p.oimg.name, 1)))) { d_p.defx += d_dx; d_p.defy += d_dy; d_p.moveBy(d_dx, d_dy); } } } } else if (d_o.is_image && !dd.op6 && !dd.n4) { if (dd.n6 && d_x && !d_o.defw) d_o.resizeTo(d_o.defw = dd.getImgW(d_o.oimg), d_o.defh = dd.getImgH(d_o.oimg)); var d_defx = d_o.defx, d_defy = d_o.defy; if (!(d_o.parent && d_o.parent != d_o.defparent) && (d_x || !d_o.detached || d_o.horizontal || d_o.vertical) && dd.getImg(d_o, d_o.oimg.name, 1)) d_o.moveBy(d_o.defx-d_defx, d_o.defy-d_defy); } } }; function WINSZ(d_x) { if (d_x) { if (dd.n4 || dd.op6 && d_x&2) { dd.iW = innerWidth; dd.iH = innerHeight; if (dd.op6) setTimeout("WINSZ()", 0x1ff); } window.onresize = new Function('WINSZ();'); } else if ((dd.n4 || dd.op6) && (innerWidth != dd.iW || innerHeight != dd.iH)) location.reload(); else if (dd.op6) setTimeout("WINSZ()", 0x1ff); else if (!dd.n4) setTimeout('dd.recalc()', 0xa); } WINSZ(1); function DDObj(d_o, d_i) { this.id = d_o; this.cmd = ''; this.cpy_n = dd.getCmdVal(this, COPY); this.maxoffb = dd.getCmdVal(this, MAXOFFBOTTOM, 0, 1); this.maxoffl = dd.getCmdVal(this, MAXOFFLEFT, 0, 1); this.maxoffr = dd.getCmdVal(this, MAXOFFRIGHT, 0, 1); this.maxofft = dd.getCmdVal(this, MAXOFFTOP, 0, 1); var d_j = dd_cursors.length; while(d_j--) if (dd.getCmd(this, dd_cursors[d_j], 1)) this.cursor = dd_cursors[d_j].substring(2); this.clone = dd.getCmd(this, CLONE, 1); this.detach = dd.getCmd(this, DETACH_CHILDREN); this.scalable = dd.getCmd(this, SCALABLE, 1); this.horizontal = dd.getCmd(this, HORIZONTAL); this.noalt = dd.getCmd(this, NO_ALT, 1); this.nodrag = dd.getCmd(this, NO_DRAG); this.scroll = dd.getCmd(this, SCROLL, 1); this.resizable = dd.getCmd(this, RESIZABLE, 1); this.re_z = dd.getCmd(this, RESET_Z, 1); this.diaphan = dd.getCmd(this, TRANSPARENT, 1); this.vertical = dd.getCmd(this, VERTICAL); this.maxw = dd.getCmdVal(this, MAXWIDTH, 1, 1); this.minw = Math.abs(dd.getCmdVal(this, MINWIDTH, 1, 1)); this.maxh = dd.getCmdVal(this, MAXHEIGHT, 1, 1); this.minh = Math.abs(dd.getCmdVal(this, MINHEIGHT, 1, 1)); this.name = this.id + (d_i || ''); this.oimg = dd.getImg(this, this.id, 1); this.is_image = !!this.oimg; this.copies = new Array(); this.children = new Array(); this.parent = this.original = null; if (this.oimg) { this.id = this.name + 'div'; this.w = dd.getImgW(this.oimg); this.h = dd.getImgH(this.oimg); this.dw = this.dh = 0; this.defz = dd.Int(dd.getCssProp(this.oimg, 'z-index','zIndex','zIndex')) || 1; this.defsrc = this.src = this.oimg.src; this.htm = ''; this.t_htm = '
'+ this.htm + '<\/div>'; } else { if (!!(this.div = dd.getDiv(this.id)) && typeof this.div.style != "undefined") this.css = this.div.style; dd.getWH(this); if (this.div) { this.div.ddObj = this; this.div.pos_rel = ("" + (this.div.parentNode? this.div.parentNode.tagName : this.div.parentElement? this.div.parentElement.tagName : '').toLowerCase().indexOf('body') < 0); } dd.getPageXY(this.div); this.defx = this.x = dd.x; this.defy = this.y = dd.y; dd.getCssXY(this); this.defz = dd.Int(dd.getCssProp(this.div, 'z-index','zIndex','zIndex')); } this.defw = this.w || 0; this.defh = this.h || 0; } DDObj.prototype.moveBy = function(d_x, d_y, d_kds, d_o) { if (!this.div) return; this.x += (d_x = dd.Int(d_x)); this.y += (d_y = dd.Int(d_y)); if (!d_kds || this.is_image || this.parent != this.defparent) { (d_o = this.css || this.div).left = (this.cssx += d_x) + dd.px; d_o.top = (this.cssy += d_y) + dd.px; } var d_i = this.children.length; while (d_i--) { if (!(d_o = this.children[d_i]).detached) d_o.moveBy(d_x, d_y, 1); d_o.defx += d_x; d_o.defy += d_y; } }; DDObj.prototype.moveTo = function(d_x, d_y) { this.moveBy(dd.Int(d_x)-this.x, dd.Int(d_y)-this.y); }; DDObj.prototype.hide = function(d_m, d_o, d_p) { if (this.div && this.visible) { d_p = this.css || this.div; if (d_m && !dd.n4) { this.display = dd.getCssProp(this.div, "display", "display", "display"); if (this.oimg) { this.oimg.display = dd.getCssProp(this.oimg, "display", "display", "display"); this.oimg.style.display = "none"; } d_p.display = "none"; dd.recalc(); } else d_p.visibility = "hidden"; } this.visible = false; var d_i = this.children.length; while (d_i--) if (!(d_o = this.children[d_i]).detached) d_o.hide(d_m); }; DDObj.prototype.show = function(d_o, d_p) { if (this.div) { d_p = this.css || this.div; if (d_p.display && d_p.display == "none") { d_p.display = this.display || "block"; if (this.oimg) this.oimg.style.display = this.oimg.display || "inline"; dd.recalc(); } else d_p.visibility = "visible"; } this.visible = true; var d_i = this.children.length; while (d_i--) if (!(d_o = this.children[d_i]).detached) d_o.show(); }; DDObj.prototype.resizeTo = function(d_w, d_h, d_o) { if (!this.div) return; d_w = (this.w = dd.Int(d_w))-this.dw; d_h = (this.h = dd.Int(d_h))-this.dh; if (dd.n4) { this.div.resizeTo(d_w, d_h); if (this.is_image) { this.write(''); (this.nimg = this.div.document.images[0]).src = this.src; } } else if (typeof this.css.pixelWidth != "undefined") { this.css.pixelWidth = d_w; this.css.pixelHeight = d_h; if (this.is_image) { (d_o = this.nimg.style).pixelWidth = d_w; d_o.pixelHeight = d_h; } } else { this.css.width = d_w + dd.px; this.css.height = d_h + dd.px; if (this.is_image) { (d_o = this.nimg).width = d_w; d_o.height = d_h; if (!d_o.complete) d_o.src = this.src; } } }; DDObj.prototype.resizeBy = function(d_dw, d_dh) { this.resizeTo(this.w+dd.Int(d_dw), this.h+dd.Int(d_dh)); }; DDObj.prototype.swapImage = function(d_x, d_cp) { if (!this.nimg) return; this.nimg.src = d_x; this.src = this.nimg.src; if (d_cp) { var d_i = this.copies.length; while (d_i--) this.copies[d_i].src = this.copies[d_i].nimg.src = this.nimg.src; } }; DDObj.prototype.setBgColor = function(d_x) { if (dd.n4 && this.div) this.div.bgColor = d_x; else if (this.css) this.css.background = d_x; this.bgColor = d_x; }; DDObj.prototype.write = function(d_x, d_o) { this.text = d_x; if (!this.div) return; if (dd.n4) { (d_o = this.div.document).open(); d_o.write(d_x); d_o.close(); dd.getWH(this); } else if (!dd.op6) { this.css.height = 'auto'; this.div.innerHTML = d_x; if (!dd.ie4) dd.recalc(); if (dd.ie4 || dd.n6) setTimeout('dd.recalc();', 0); // n6.0: recalc twice } }; DDObj.prototype.copy = function(d_n, d_p) { if (!this.oimg) return; d_n = d_n || 1; while (d_n--) { var d_l = this.copies.length, d_o = new DDObj(this.name+this.cmd, d_l+1); if (dd.n4) { d_o.id = (d_p = new Layer(d_o.w)).name; d_p.clip.height = d_o.h; d_p.visibility = 'show'; (d_p = d_p.document).open(); d_p.write(d_o.htm); d_p.close(); } else if (dd.db.insertAdjacentHTML) dd.db.insertAdjacentHTML("AfterBegin", d_o.t_htm); else if (document.createElement && dd.db && dd.db.appendChild) { dd.db.appendChild(d_p = document.createElement('div')); d_p.innerHTML = d_o.htm; d_p.id = d_o.id; d_p.style.position = 'absolute'; d_p.style.width = d_o.w + 'px'; d_p.style.height = d_o.h + 'px'; } else if (dd.db && dd.db.innerHTML) dd.db.innerHTML += d_o.t_htm; d_o.defz = this.defz+1+d_l; dd.addProps(d_o); d_o.original = this; dd.addElt(d_o, this); if (this.parent) { this.parent.addChild(d_o, this.detached); d_o.defparent = this.defparent; } d_o.moveTo(d_o.defx = this.defx, d_o.defy = this.defy); if (dd.n4) d_o.defsrc = d_o.src = this.defsrc; d_o.swapImage(this.src); } }; DDObj.prototype.addChild = function(d_kd, detach, defp) { if (typeof d_kd != "object") d_kd = dd.elements[d_kd]; if (d_kd.parent && d_kd.parent == this || d_kd == this || !d_kd.is_image && d_kd.defparent && !defp) return; this.children[this.children.length] = this.children[d_kd.name] = d_kd; d_kd.detached = detach || 0; if (defp) d_kd.defparent = this; else if (this == d_kd.defparent && d_kd.is_image) dd.getImg(this, d_kd.oimg.name, 1); if (!d_kd.defparent || this != d_kd.defparent) { d_kd.defx = d_kd.x; d_kd.defy = d_kd.y; } if (!detach) { d_kd.defz = d_kd.defz+this.defz-(d_kd.parent? d_kd.parent.defz : 0)+(!d_kd.is_image*1); d_kd.setZ(d_kd.z+this.z-(d_kd.parent? d_kd.parent.z : 0)+(!d_kd.is_image*1), 1); } if (d_kd.parent) d_kd.parent._removeChild(d_kd, 1); d_kd.parent = this; }; DDObj.prototype._removeChild = function(d_kd, d_newp) { if (typeof d_kd != "object") d_kd = this.children[d_kd]; var d_oc = this.children, d_nc = new Array(); for (var d_i = 0; d_i < d_oc.length; d_i++) if (d_oc[d_i] != d_kd) d_nc[d_nc.length] = d_oc[d_i]; this.children = d_nc; d_kd.parent = null; if (!d_newp) { d_kd.detached = d_kd.defp = 0; if (d_kd.is_image) dd.getImg(d_kd, d_kd.oimg.name, 1); } }; DDObj.prototype.attachChild = function(d_kd) { (d_kd = (typeof d_kd != "object")? this.children[d_kd]: d_kd).detached = 0; d_kd.setZ(d_kd.defz + this.z-this.defz, 1); }; DDObj.prototype.detachChild = function(d_kd) { (d_kd = (typeof d_kd != "object")? this.children[d_kd]: d_kd).detached = 1; }; DDObj.prototype.setZ = function(d_x, d_kds, d_o) { if (d_kds) { var d_dz = d_x-this.z, d_i = this.children.length; while (d_i--) if (!(d_o = this.children[d_i]).detached) d_o.setZ(d_o.z+d_dz, 1); } dd.z = Math.max(dd.z, this.z = this.div? ((this.css || this.div).zIndex = d_x) : 0); }; DDObj.prototype.maximizeZ = function() { this.setZ(dd.z+1, 1); }; DDObj.prototype._resetZ = function(d_o) { if (this.re_z || dd.re_z) { this.setZ(this.defz); var d_i = this.children.length; while (d_i--) if (!(d_o = this.children[d_i]).detached) d_o.setZ(d_o.defz); } }; DDObj.prototype.setOpacity = function(d_x) { this.opacity = d_x; this._setOpaRel(1.0, 1); }; DDObj.prototype._setOpaRel = function(d_x, d_kd, d_y, d_o) { if (this.diaphan || d_kd) { d_y = this.opacity*d_x; if (dd.n6) this.css.MozOpacity = d_y; else if (dd.ie && !dd.iemac && typeof this.div.filters != "undefined") this.div.filters[0].opacity = parseInt(100*d_y); else if (this.css) this.css.opacity = d_y; var d_i = this.children.length; while (d_i--) if (!(d_o = this.children[d_i]).detached) d_o._setOpaRel(d_x, 1); } }; DDObj.prototype.setCursor = function(d_x) { this._setCrs(this.cursor = (d_x.indexOf('c:')+1)? d_x.substring(2) : d_x); }; DDObj.prototype._setCrs = function(d_x) { if (this.css) this.css.cursor = ((!dd.ie || dd.iemac) && d_x == 'hand')? 'pointer' : d_x; }; DDObj.prototype.setDraggable = function(d_x) { this.nodrag = !d_x*1; this._setCrs(d_x? this.cursor : 'auto'); }; DDObj.prototype.setResizable = function(d_x) { this.resizable = d_x*1; if (d_x) this.scalable = 0; }; DDObj.prototype.setScalable = function(d_x) { this.scalable = d_x*1; if (d_x) this.resizable = 0; }; DDObj.prototype.del = function(d_os, d_o) { var d_i; if (this.parent && this.parent._removeChild) this.parent._removeChild(this); if (this.original) { this.hide(); if (this.original.copies) { d_os = new Array(); for (d_i = 0; d_i < this.original.copies.length; d_i++) if ((d_o = this.original.copies[d_i]) != this) d_os[d_o.name] = d_os[d_os.length] = d_o; this.original.copies = d_os; } } else if (this.is_image) { this.hide(); if (this.oimg) { if (dd.n4) this.oimg.src = this.defsrc; else this.oimg.style.visibility = 'visible'; } } else if (this.moveTo) { if (this.css) this.css.cursor = 'default'; this.moveTo(this.defx, this.defy); this.resizeTo(this.defw, this.defh); } d_os = new Array(); for (d_i = 0; d_i < dd.elements.length; d_i++) { if ((d_o = dd.elements[d_i]) != this) d_os[d_o.name] = d_os[d_o.index = d_os.length] = d_o; else d_o._free(); } dd.elements = d_os; if (!dd.op6 && !dd.n4) dd.recalc(); }; DDObj.prototype._free = function() { for (var d_i in this) this[d_i] = null; dd.elements[this.name] = null; }; dd.n4RectVis = function(vis) { for (var d_i = 4; d_i--;) { dd.rectI[d_i].visibility = dd.rectA[d_i].visibility = vis? 'show' : 'hide'; if (vis) dd.rectI[d_i].zIndex = dd.rectA[d_i].zIndex = dd.z+2; } }; dd.n4RectPos = function(d_o, d_x, d_y, d_w, d_h) { d_o.x = d_x; d_o.y = d_y; d_o.clip.width = d_w; d_o.clip.height = d_h; }; // NN4: draw img resize rectangle dd.n4Rect = function(d_w, d_h) { var d_i; if (!dd.rectI) { dd.rectI = new Array(); dd.rectA = new Array(); } if (!dd.rectI[0]) { for (d_i = 4; d_i--;) { (dd.rectI[d_i] = new Layer(1)).bgColor = '#000000'; (dd.rectA[d_i] = new Layer(1)).bgColor = '#ffffff'; } } if (!dd.rectI[0].visibility || dd.rectI[0].visibility == 'hide') dd.n4RectVis(1); dd.obj.w = d_w; dd.obj.h = d_h; for (d_i = 4; d_i--;) { dd.n4RectPos(dd.rectI[d_i], dd.obj.x + (!(d_i-1)? (dd.obj.w-1) : 0), dd.obj.y + (!(d_i-2)? (dd.obj.h-1) : 0), d_i&1 || dd.obj.w, !(d_i&1) || dd.obj.h); dd.n4RectPos(dd.rectA[d_i], !(d_i-1)? dd.rectI[1].x+1 : (dd.obj.x-1), !(d_i-2)? dd.rectI[2].y+1 : (dd.obj.y-1), d_i&1 || dd.obj.w+2, !(d_i&1) || dd.obj.h+2); } }; dd.reszTo = function(d_w, d_h) { if (dd.n4 && dd.obj.is_image) dd.n4Rect(d_w, d_h); else dd.obj.resizeTo(d_w, d_h); }; dd.embedVis = function(d_vis) { var d_o = new Array('iframe', 'applet', 'embed', 'object'); var d_i = d_o.length; while (d_i--) { var d_p = dd.ie? document.all.tags(d_o[d_i]) : document.getElementsByTagName? document.getElementsByTagName(d_o[d_i]) : null; if (d_p) { var d_j = d_p.length; while (d_j--) { var d_q = d_p[d_j]; while (d_q.offsetParent || d_q.parentNode) { if ((d_q = d_q.parentNode || d_q.offsetParent || null) == dd.obj.div) { d_p[d_j].style.visibility = d_vis; break; } } } } } }; dd.maxOffX = function(d_x, d_y) { return ( (dd.obj.maxoffl+1 && (d_y = dd.obj.defx-dd.obj.maxoffl)-d_x > 0 || dd.obj.maxoffr+1 && (d_y = dd.obj.defx+dd.obj.maxoffr)-d_x < 0)? d_y : d_x ); }; dd.maxOffY = function(d_x, d_y) { return ( (dd.obj.maxofft+1 && (d_y = dd.obj.defy-dd.obj.maxofft)-d_x > 0 || dd.obj.maxoffb+1 && (d_y = dd.obj.defy+dd.obj.maxoffb)-d_x < 0)? d_y : d_x ); }; dd.inWndW = function(d_x, d_y) { var d_wx = dd.getScrollX(), d_ww = dd.getWndW(); return ( ((d_y = d_wx+2)-d_x > 0) || ((d_y = d_wx+d_ww+dd.obj.w-2)-d_x < 0)? d_y : d_x ); }; dd.inWndH = function(d_x, d_y) { var d_wy = dd.getScrollY(), d_wh = dd.getWndH(); return ( ((d_y = d_wy+2)-d_x > 0) || ((d_y = d_wy+d_wh+dd.obj.h-2)-d_x < 0)? d_y : d_x ); }; // These two funcs limit the size of element when mouseresized. // Implemented 22.5.2003 by Gregor L?tolf , modified by Walter Zorn dd.limW = function(d_w) { return ( (dd.obj.minw-d_w > 0)? dd.obj.minw : (dd.obj.maxw > 0 && dd.obj.maxw-d_w < 0)? dd.obj.maxw : d_w ); }; dd.limH = function(d_h) { return ( (dd.obj.minh-d_h > 0)? dd.obj.minh : (dd.obj.maxh > 0 && dd.obj.maxh-d_h < 0)? dd.obj.maxh : d_h ); }; // Optional autoscroll-page functionality. Courtesy Cedric Savarese. // Implemented by Walter Zorn function DDScroll() { if (!dd.obj || !dd.obj.scroll && !dd.scroll || dd.op || dd.ie4 || dd.whratio) { dd.scrx = dd.scry = 0; return; } var d_bnd = 0x1c, d_wx = dd.getScrollX(), d_wy = dd.getScrollY(); if (dd.msmoved) { var d_ww = dd.getWndW(), d_wh = dd.getWndH(), d_y; dd.scrx = ((d_y = dd.e.x-d_ww-d_wx+d_bnd) > 0)? (d_y>>=2)*d_y : ((d_y = d_wx+d_bnd-dd.e.x) > 0)? -(d_y>>=2)*d_y : 0; dd.scry = ((d_y = dd.e.y-d_wh-d_wy+d_bnd) > 0)? (d_y>>=2)*d_y : ((d_y = d_wy+d_bnd-dd.e.y) > 0)? -(d_y>>=2)*d_y : 0; } if (dd.scrx || dd.scry) { window.scrollTo( d_wx + (dd.scrx = dd.obj.is_resized? dd.limW(dd.obj.w+dd.scrx)-dd.obj.w : dd.obj.vertical? 0 : (dd.maxOffX(dd.obj.x+dd.scrx)-dd.obj.x)), d_wy + (dd.scry = dd.obj.is_resized? dd.limH(dd.obj.h+dd.scry)-dd.obj.h : dd.obj.horizontal? 0 : (dd.maxOffY(dd.obj.y+dd.scry)-dd.obj.y)) ); dd.obj.is_dragged? dd.obj.moveTo(dd.obj.x+dd.getScrollX()-d_wx, dd.obj.y+dd.getScrollY()-d_wy) : dd.reszTo(dd.obj.w+dd.getScrollX()-d_wx, dd.obj.h+dd.getScrollY()-d_wy); } dd.msmoved = 0; window.setTimeout('DDScroll()', 0x33); } function PICK(d_ev) { dd.e = new dd.evt(d_ev); if (dd.e.x >= dd.getWndW()+dd.getScrollX() || dd.e.y >= dd.getWndH()+dd.getScrollY()) return true; // on scrollbar var d_o, d_cmp = -1, d_i = dd.elements.length; while (d_i--) { d_o = dd.elements[d_i]; if (dd.n4 && dd.e.but > 1 && dd.e.src == d_o.oimg && !d_o.clone) return false; if (d_o.visible && dd.e.but <= 1 && dd.e.x >= d_o.x && dd.e.x <= d_o.x+d_o.w && dd.e.y >= d_o.y && dd.e.y <= d_o.y+d_o.h) { if (d_o.z > d_cmp && dd.e.src.tag.indexOf('input') < 0 && dd.e.src.tag.indexOf('textarea') < 0 && dd.e.src.tag.indexOf('select') < 0 && dd.e.src.tag.indexOf('option') < 0) { d_cmp = d_o.z; dd.obj = d_o; } } } if (dd.obj) { if (dd.obj.nodrag) dd.obj = null; else { dd.e.e.cancelBubble = true; var d_rsz = dd.e.modifKey && (dd.obj.resizable || dd.obj.scalable); if (dd.op && !dd.op6) { (d_o = document.getElementById('OpBlUr')).style.pixelLeft = dd.e.x; d_o.style.pixelTop = dd.e.y; (d_o = d_o.children[0].children[0]).focus(); d_o.blur(); } else if (dd.ie && !dd.ie4) { if (document.selection && document.selection.empty) document.selection.empty(); dd.db.onselectstart = function() { event.returnValue = false; }; } if (d_rsz) { dd.obj._setCrs('se-resize'); dd.obj.is_resized = 1; dd.whratio = dd.obj.scalable? dd.obj.defw/dd.obj.defh : 0; if (dd.ie) { if (dd.ie4) { window.dd_x = dd.getScrollX(); window.dd_y = dd.getScrollY(); } setTimeout( 'if (dd.obj && document.selection && document.selection.empty)'+ '{'+ 'document.selection.empty();'+ 'if (dd.ie4) window.scrollTo(window.dd_x, window.dd_y);'+ '}' ,0); } dd.setEvtHdl(1, RESIZE); dd.reszTo(dd.obj.w, dd.obj.h); } else { dd.obj.is_dragged = 1; dd.setEvtHdl(1, DRAG); } dd.setEvtHdl(2, DROP); dd.embedVis('hidden'); dd.obj._setOpaRel(0.7); dd.obj.maximizeZ(); dd.ofx = dd.obj.x+dd.obj.w-dd.e.x; dd.ofy = dd.obj.y+dd.obj.h-dd.e.y; if (window.my_PickFunc) my_PickFunc(); DDScroll(); return !( dd.obj.is_resized || dd.n4 && dd.obj.is_image || dd.n6 || dd.w3c ); } } if (dd.downFunc) return dd.downFunc(d_ev); return true; } function DRAG(d_ev) { if (!dd.obj || !dd.obj.visible) return true; if (dd.ie4 || dd.w3c || dd.n6 || dd.obj.children.length > 0xf) { if (dd.wait) return false; dd.wait = 1; setTimeout('dd.wait = 0;', dd.tiv); } dd.e = new dd.evt(d_ev); if (dd.ie && !dd.e.but) { DROP(d_ev); return true; } dd.msmoved = 1; dd.obj.moveTo( dd.obj.vertical? dd.obj.x : dd.maxOffX(dd.inWndW(dd.ofx+dd.e.x)-dd.obj.w), dd.obj.horizontal? dd.obj.y : dd.maxOffY(dd.inWndH(dd.ofy+dd.e.y)-dd.obj.h) ); if (window.my_DragFunc) my_DragFunc(); return false; } function RESIZE(d_ev) { if (!dd.obj || !dd.obj.visible) return true; if (dd.wait) return false; dd.wait = 1; setTimeout('dd.wait = 0;', dd.tiv); dd.e = new dd.evt(d_ev); if (dd.ie && !dd.e.but) { DROP(d_ev); return true; } dd.msmoved = 1; var d_w = dd.limW(dd.inWndW(dd.ofx+dd.e.x)-dd.obj.x), d_h; if (!dd.whratio) d_h = dd.limH(dd.inWndH(dd.ofy+dd.e.y)-dd.obj.y); else { d_h = dd.limH(dd.inWndH(Math.round(d_w/dd.whratio)+dd.obj.y)-dd.obj.y); d_w = Math.round(d_h*dd.whratio); } dd.reszTo(d_w, d_h); if (window.my_ResizeFunc) my_ResizeFunc(); return false; } function DROP(d_ev) { if (dd.obj) { if (dd.obj.is_dragged) { if (!dd.obj.is_image) dd.getWH(dd.obj); } else if (dd.n4) { if (dd.obj.is_image) { dd.n4RectVis(0); dd.obj.resizeTo(dd.obj.w, dd.obj.h); } } if (!dd.n4 && !dd.op6 || !dd.obj.is_image) dd.recalc(); dd.setEvtHdl(1, dd.moveFunc); dd.setEvtHdl(2, dd.upFunc); if (dd.db) dd.db.onselectstart = null; dd.obj._setOpaRel(1.0); dd.obj._setCrs(dd.obj.cursor); dd.embedVis('visible'); dd.obj._resetZ(); if (window.my_DropFunc) { dd.e = new dd.evt(d_ev); my_DropFunc(); } dd.msmoved = dd.obj.is_dragged = dd.obj.is_resized = dd.whratio = 0; dd.obj = null; } dd.setEvtHdl(0, PICK); } function SET_DHTML() { var d_a = arguments, d_ai, d_htm = '', d_o, d_i = d_a.length; while (d_i--) { if (dd.op6) { var d_t0 = (new Date()).getTime(); while ((new Date()).getTime()-d_t0 < 0x99); } if (!(d_ai = d_a[d_i]).indexOf('c:')) dd.cursor = d_ai.substring(2); else if (d_ai == NO_ALT) dd.noalt = 1; else if (d_ai == SCROLL) dd.scroll = 1; else if (d_ai == RESET_Z) dd.re_z = 1; else if (d_ai == RESIZABLE) dd.resizable = 1; else if (d_ai == SCALABLE) dd.scalable = 1; else if (d_ai == TRANSPARENT) dd.diaphan = 1; else { d_o = new DDObj(d_ai); dd.addElt(d_o); d_htm += d_o.t_htm || ''; if (d_o.oimg && d_o.cpy_n) { var d_j = 0; while (d_j < d_o.cpy_n) { var d_p = new DDObj(d_o.name+d_o.cmd, ++d_j); dd.addElt(d_p, d_o); d_p.defz = d_o.defz+d_j; d_p.original = d_o; d_htm += d_p.t_htm; } } } } if (dd.n4 || dd.n6 || dd.ie || dd.op || dd.w3c) document.write( (dd.n4? '
<\/div>\n' : (dd.op && !dd.op6)? '