//START AjaxControlToolkit.Compat.Timer.Timer.js
/////////////////////////////////////////////////////////////////////////////
Sys.Timer = function() {
Sys.Timer.initializeBase(this);this._interval = 1000;this._enabled = false;this._timer = null;}
Sys.Timer.prototype = {
get_interval: function() {
return this._interval;},
set_interval: function(value) {
if (this._interval !== value) {
this._interval = value;this.raisePropertyChanged('interval');if (!this.get_isUpdating() && (this._timer !== null)) {
this._stopTimer();this._startTimer();}
}
},
get_enabled: function() {
return this._enabled;},
set_enabled: function(value) {
if (value !== this.get_enabled()) {
this._enabled = value;this.raisePropertyChanged('enabled');if (!this.get_isUpdating()) {
if (value) {
this._startTimer();}
else {
this._stopTimer();}
}
}
},
add_tick: function(handler) {
this.get_events().addHandler("tick", handler);},
remove_tick: function(handler) {
this.get_events().removeHandler("tick", handler);},
dispose: function() {
this.set_enabled(false);this._stopTimer();Sys.Timer.callBaseMethod(this, 'dispose');},
updated: function() {
Sys.Timer.callBaseMethod(this, 'updated');if (this._enabled) {
this._stopTimer();this._startTimer();}
},
_timerCallback: function() {
var handler = this.get_events().getHandler("tick");if (handler) {
handler(this, Sys.EventArgs.Empty);}
},
_startTimer: function() {
this._timer = window.setInterval(Function.createDelegate(this, this._timerCallback), this._interval);},
_stopTimer: function() {
window.clearInterval(this._timer);this._timer = null;}
}
Sys.Timer.descriptor = {
properties: [ {name: 'interval', type: Number},
{name: 'enabled', type: Boolean} ],
events: [ {name: 'tick'} ]
}
Sys.Timer.registerClass('Sys.Timer', Sys.Component);
//END AjaxControlToolkit.Compat.Timer.Timer.js
//START AjaxControlToolkit.Common.Common.js
Type.registerNamespace('AjaxControlToolkit');AjaxControlToolkit.BoxSide = function() {
}
AjaxControlToolkit.BoxSide.prototype = {
Top : 0,
Right : 1,
Bottom : 2,
Left : 3
}
AjaxControlToolkit.BoxSide.registerEnum("AjaxControlToolkit.BoxSide", false);AjaxControlToolkit._CommonToolkitScripts = function() {
}
AjaxControlToolkit._CommonToolkitScripts.prototype = {
_borderStyleNames : ["borderTopStyle","borderRightStyle","borderBottomStyle","borderLeftStyle"],
_borderWidthNames : ["borderTopWidth", "borderRightWidth", "borderBottomWidth", "borderLeftWidth"],
_paddingWidthNames : ["paddingTop", "paddingRight", "paddingBottom", "paddingLeft"],
_marginWidthNames : ["marginTop", "marginRight", "marginBottom", "marginLeft"],
getCurrentStyle : function(element, attribute, defaultValue) {
var currentValue = null;if (element) {
if (element.currentStyle) {
currentValue = element.currentStyle[attribute];} else if (document.defaultView && document.defaultView.getComputedStyle) {
var style = document.defaultView.getComputedStyle(element, null);if (style) {
currentValue = style[attribute];}
}
if (!currentValue && element.style.getPropertyValue) {
currentValue = element.style.getPropertyValue(attribute);}
else if (!currentValue && element.style.getAttribute) {
currentValue = element.style.getAttribute(attribute);} 
}
if ((!currentValue || currentValue == "" || typeof(currentValue) === 'undefined')) {
if (typeof(defaultValue) != 'undefined') {
currentValue = defaultValue;}
else {
currentValue = null;}
} 
return currentValue;},
getInheritedBackgroundColor : function(element) {
if (!element) return '#FFFFFF';var background = this.getCurrentStyle(element, 'backgroundColor');try {
while (!background || background == '' || background == 'transparent' || background == 'rgba(0, 0, 0, 0)') {
element = element.parentNode;if (!element) {
background = '#FFFFFF';} else {
background = this.getCurrentStyle(element, 'backgroundColor');}
}
} catch(ex) {
background = '#FFFFFF';}
return background;},
getLocation : function(element) {
if (element === document.documentElement) {
return new Sys.UI.Point(0,0);}
if (Sys.Browser.agent == Sys.Browser.InternetExplorer && Sys.Browser.version < 7) {
if (element.window === element || element.nodeType === 9 || !element.getClientRects || !element.getBoundingClientRect) return new Sys.UI.Point(0,0);var screenRects = element.getClientRects();if (!screenRects || !screenRects.length) {
return new Sys.UI.Point(0,0);}
var first = screenRects[0];var dLeft = 0;var dTop = 0;var inFrame = false;try {
inFrame = element.ownerDocument.parentWindow.frameElement;} catch(ex) {
inFrame = true;}
if (inFrame) {
var clientRect = element.getBoundingClientRect();if (!clientRect) {
return new Sys.UI.Point(0,0);}
var minLeft = first.left;var minTop = first.top;for (var i = 1;i < screenRects.length;i++) {
var r = screenRects[i];if (r.left < minLeft) {
minLeft = r.left;}
if (r.top < minTop) {
minTop = r.top;}
}
dLeft = minLeft - clientRect.left;dTop = minTop - clientRect.top;}
var ownerDocument = element.document.documentElement;return new Sys.UI.Point(first.left - 2 - dLeft + ownerDocument.scrollLeft, first.top - 2 - dTop + ownerDocument.scrollTop);}
return Sys.UI.DomElement.getLocation(element);},
setLocation : function(element, point) {
Sys.UI.DomElement.setLocation(element, point.x, point.y);},
getContentSize : function(element) {
if (!element) {
throw Error.argumentNull('element');}
var size = this.getSize(element);var borderBox = this.getBorderBox(element);var paddingBox = this.getPaddingBox(element);return {
width : size.width - borderBox.horizontal - paddingBox.horizontal,
height : size.height - borderBox.vertical - paddingBox.vertical
}
},
getSize : function(element) {
if (!element) {
throw Error.argumentNull('element');}
return {
width: element.offsetWidth,
height: element.offsetHeight
};},
setContentSize : function(element, size) {
if (!element) {
throw Error.argumentNull('element');}
if (!size) {
throw Error.argumentNull('size');}
if(this.getCurrentStyle(element, 'MozBoxSizing') == 'border-box' || this.getCurrentStyle(element, 'BoxSizing') == 'border-box') {
var borderBox = this.getBorderBox(element);var paddingBox = this.getPaddingBox(element);size = {
width: size.width + borderBox.horizontal + paddingBox.horizontal,
height: size.height + borderBox.vertical + paddingBox.vertical
};}
element.style.width = size.width.toString() + 'px';element.style.height = size.height.toString() + 'px';},
setSize : function(element, size) {
if (!element) {
throw Error.argumentNull('element');}
if (!size) {
throw Error.argumentNull('size');}
var borderBox = this.getBorderBox(element);var paddingBox = this.getPaddingBox(element);var contentSize = {
width: size.width - borderBox.horizontal - paddingBox.horizontal,
height: size.height - borderBox.vertical - paddingBox.vertical
};this.setContentSize(element, contentSize);},
getBounds : function(element) {
var offset = $common.getLocation(element);return new Sys.UI.Bounds(offset.x, offset.y, element.offsetWidth || 0, element.offsetHeight || 0);}, 
setBounds : function(element, bounds) {
if (!element) {
throw Error.argumentNull('element');}
if (!bounds) {
throw Error.argumentNull('bounds');}
this.setSize(element, bounds);$common.setLocation(element, bounds);},
getClientBounds : function() {
var clientWidth;var clientHeight;switch(Sys.Browser.agent) {
case Sys.Browser.InternetExplorer:
clientWidth = document.documentElement.clientWidth;clientHeight = document.documentElement.clientHeight;break;case Sys.Browser.Safari:
clientWidth = window.innerWidth;clientHeight = window.innerHeight;break;case Sys.Browser.Opera:
clientWidth = Math.min(window.innerWidth, document.body.clientWidth);clientHeight = Math.min(window.innerHeight, document.body.clientHeight);break;default: 
clientWidth = Math.min(window.innerWidth, document.documentElement.clientWidth);clientHeight = Math.min(window.innerHeight, document.documentElement.clientHeight);break;}
return new Sys.UI.Bounds(0, 0, clientWidth, clientHeight);},
getMarginBox : function(element) {
if (!element) {
throw Error.argumentNull('element');}
var box = {
top: this.getMargin(element, AjaxControlToolkit.BoxSide.Top),
right: this.getMargin(element, AjaxControlToolkit.BoxSide.Right),
bottom: this.getMargin(element, AjaxControlToolkit.BoxSide.Bottom),
left: this.getMargin(element, AjaxControlToolkit.BoxSide.Left)
};box.horizontal = box.left + box.right;box.vertical = box.top + box.bottom;return box;},
getBorderBox : function(element) {
if (!element) {
throw Error.argumentNull('element');}
var box = {
top: this.getBorderWidth(element, AjaxControlToolkit.BoxSide.Top),
right: this.getBorderWidth(element, AjaxControlToolkit.BoxSide.Right),
bottom: this.getBorderWidth(element, AjaxControlToolkit.BoxSide.Bottom),
left: this.getBorderWidth(element, AjaxControlToolkit.BoxSide.Left)
};box.horizontal = box.left + box.right;box.vertical = box.top + box.bottom;return box;},
getPaddingBox : function(element) {
if (!element) {
throw Error.argumentNull('element');}
var box = {
top: this.getPadding(element, AjaxControlToolkit.BoxSide.Top),
right: this.getPadding(element, AjaxControlToolkit.BoxSide.Right),
bottom: this.getPadding(element, AjaxControlToolkit.BoxSide.Bottom),
left: this.getPadding(element, AjaxControlToolkit.BoxSide.Left)
};box.horizontal = box.left + box.right;box.vertical = box.top + box.bottom;return box;},
isBorderVisible : function(element, boxSide) {
if (!element) {
throw Error.argumentNull('element');}
if(boxSide < AjaxControlToolkit.BoxSide.Top || boxSide > AjaxControlToolkit.BoxSide.Left) {
throw Error.argumentOutOfRange(String.format(Sys.Res.enumInvalidValue, boxSide, 'AjaxControlToolkit.BoxSide'));}
var styleName = this._borderStyleNames[boxSide];var styleValue = this.getCurrentStyle(element, styleName);return styleValue != "none";},
getMargin : function(element, boxSide) {
if (!element) {
throw Error.argumentNull('element');}
if(boxSide < AjaxControlToolkit.BoxSide.Top || boxSide > AjaxControlToolkit.BoxSide.Left) {
throw Error.argumentOutOfRange(String.format(Sys.Res.enumInvalidValue, boxSide, 'AjaxControlToolkit.BoxSide'));}
var styleName = this._marginWidthNames[boxSide];var styleValue = this.getCurrentStyle(element, styleName);try { return this.parsePadding(styleValue);} catch(ex) { return 0;}
},
getBorderWidth : function(element, boxSide) {
if (!element) {
throw Error.argumentNull('element');}
if(boxSide < AjaxControlToolkit.BoxSide.Top || boxSide > AjaxControlToolkit.BoxSide.Left) {
throw Error.argumentOutOfRange(String.format(Sys.Res.enumInvalidValue, boxSide, 'AjaxControlToolkit.BoxSide'));}
if(!this.isBorderVisible(element, boxSide)) {
return 0;} 
var styleName = this._borderWidthNames[boxSide];var styleValue = this.getCurrentStyle(element, styleName);return this.parseBorderWidth(styleValue);},
getPadding : function(element, boxSide) {
if (!element) {
throw Error.argumentNull('element');}
if(boxSide < AjaxControlToolkit.BoxSide.Top || boxSide > AjaxControlToolkit.BoxSide.Left) {
throw Error.argumentOutOfRange(String.format(Sys.Res.enumInvalidValue, boxSide, 'AjaxControlToolkit.BoxSide'));}
var styleName = this._paddingWidthNames[boxSide];var styleValue = this.getCurrentStyle(element, styleName);return this.parsePadding(styleValue);},
parseBorderWidth : function(borderWidth) {
if (!this._borderThicknesses) {
var borderThicknesses = { };var div0 = document.createElement('div');div0.style.visibility = 'hidden';div0.style.position = 'absolute';div0.style.fontSize = '1px';document.body.appendChild(div0)
var div1 = document.createElement('div');div1.style.height = '0px';div1.style.overflow = 'hidden';div0.appendChild(div1);var base = div0.offsetHeight;div1.style.borderTop = 'solid black';div1.style.borderTopWidth = 'thin';borderThicknesses['thin'] = div0.offsetHeight - base;div1.style.borderTopWidth = 'medium';borderThicknesses['medium'] = div0.offsetHeight - base;div1.style.borderTopWidth = 'thick';borderThicknesses['thick'] = div0.offsetHeight - base;div0.removeChild(div1);document.body.removeChild(div0);this._borderThicknesses = borderThicknesses;}
if (borderWidth) {
switch(borderWidth) {
case 'thin':
case 'medium':
case 'thick':
return this._borderThicknesses[borderWidth];case 'inherit':
return 0;}
var unit = this.parseUnit(borderWidth);Sys.Debug.assert(unit.type == 'px', String.format(AjaxControlToolkit.Resources.Common_InvalidBorderWidthUnit, unit.type));return unit.size;}
return 0;},
parsePadding : function(padding) {
if(padding) {
if(padding == 'inherit') {
return 0;}
var unit = this.parseUnit(padding);Sys.Debug.assert(unit.type == 'px', String.format(AjaxControlToolkit.Resources.Common_InvalidPaddingUnit, unit.type));return unit.size;}
return 0;},
parseUnit : function(value) {
if (!value) {
throw Error.argumentNull('value');}
value = value.trim().toLowerCase();var l = value.length;var s = -1;for(var i = 0;i < l;i++) {
var ch = value.substr(i, 1);if((ch < '0' || ch > '9') && ch != '-' && ch != '.' && ch != ',') {
break;}
s = i;}
if(s == -1) {
throw Error.create(AjaxControlToolkit.Resources.Common_UnitHasNoDigits);}
var type;var size;if(s < (l - 1)) {
type = value.substring(s + 1).trim();} else {
type = 'px';}
size = parseFloat(value.substr(0, s + 1));if(type == 'px') {
size = Math.floor(size);}
return { 
size: size,
type: type
};},
getElementOpacity : function(element) {
if (!element) {
throw Error.argumentNull('element');}
var hasOpacity = false;var opacity;if (element.filters) {
var filters = element.filters;if (filters.length !== 0) {
var alphaFilter = filters['DXImageTransform.Microsoft.Alpha'];if (alphaFilter) {
opacity = alphaFilter.opacity / 100.0;hasOpacity = true;}
}
}
else {
opacity = this.getCurrentStyle(element, 'opacity', 1);hasOpacity = true;}
if (hasOpacity === false) {
return 1.0;}
return parseFloat(opacity);},
setElementOpacity : function(element, value) {
if (!element) {
throw Error.argumentNull('element');}
if (element.filters) {
var filters = element.filters;var createFilter = true;if (filters.length !== 0) {
var alphaFilter = filters['DXImageTransform.Microsoft.Alpha'];if (alphaFilter) {
createFilter = false;alphaFilter.opacity = value * 100;}
}
if (createFilter) {
element.style.filter = 'progid:DXImageTransform.Microsoft.Alpha(opacity=' + (value * 100) + ')';}
}
else {
element.style.opacity = value;}
},
getVisible : function(element) {
return (element &&
("none" != $common.getCurrentStyle(element, "display")) &&
("hidden" != $common.getCurrentStyle(element, "visibility")));},
setVisible : function(element, value) {
if (element && value != $common.getVisible(element)) {
if (value) {
if (element.style.removeAttribute) {
element.style.removeAttribute("display");} else {
element.style.removeProperty("display");}
} else {
element.style.display = 'none';}
element.style.visibility = value ? 'visible' : 'hidden';}
},
resolveFunction : function(value) {
if (value) {
if (value instanceof Function) {
return value;} else if (String.isInstanceOfType(value) && value.length > 0) {
var func;if ((func = window[value]) instanceof Function) {
return func;} else if ((func = eval(value)) instanceof Function) {
return func;}
}
}
return null;},
addCssClasses : function(element, classNames) {
for(var i = 0;i < classNames.length;i++) {
Sys.UI.DomElement.addCssClass(element, classNames[i]);}
},
removeCssClasses : function(element, classNames) {
for(var i = 0;i < classNames.length;i++) {
Sys.UI.DomElement.removeCssClass(element, classNames[i]);}
},
setStyle : function(element, style) {
$common.applyProperties(element.style, style);},
removeHandlers : function(element, events) {
for (var name in events) {
$removeHandler(element, name, events[name]);}
},
overlaps : function(r1, r2) {
return r1.x < (r2.x + r2.width)
&& r2.x < (r1.x + r1.width)
&& r1.y < (r2.y + r2.height)
&& r2.y < (r1.y + r1.height);},
containsPoint : function(rect, x, y) {
return x >= rect.x && x < (rect.x + rect.width) && y >= rect.y && y < (rect.y + rect.height);},
isKeyDigit : function(keyCode) { 
return (0x30 <= keyCode && keyCode <= 0x39);},
isKeyNavigation : function(keyCode) { 
return (Sys.UI.Key.left <= keyCode && keyCode <= Sys.UI.Key.down);},
padLeft : function(text, size, ch, truncate) { 
return $common._pad(text, size || 2, ch || ' ', 'l', truncate || false);},
padRight : function(text, size, ch, truncate) { 
return $common._pad(text, size || 2, ch || ' ', 'r', truncate || false);},
_pad : function(text, size, ch, side, truncate) {
text = text.toString();var length = text.length;var builder = new Sys.StringBuilder();if (side == 'r') {
builder.append(text);} 
while (length < size) {
builder.append(ch);length++;}
if (side == 'l') {
builder.append(text);}
var result = builder.toString();if (truncate && result.length > size) {
if (side == 'l') {
result = result.substr(result.length - size, size);} else {
result = result.substr(0, size);}
}
return result;},
__DOMEvents : {
focusin : { eventGroup : "UIEvents", init : function(e, p) { e.initUIEvent("focusin", true, false, window, 1);} },
focusout : { eventGroup : "UIEvents", init : function(e, p) { e.initUIEvent("focusout", true, false, window, 1);} },
activate : { eventGroup : "UIEvents", init : function(e, p) { e.initUIEvent("activate", true, true, window, 1);} },
focus : { eventGroup : "UIEvents", init : function(e, p) { e.initUIEvent("focus", false, false, window, 1);} },
blur : { eventGroup : "UIEvents", init : function(e, p) { e.initUIEvent("blur", false, false, window, 1);} },
click : { eventGroup : "MouseEvents", init : function(e, p) { e.initMouseEvent("click", true, true, window, 1, p.screenX || 0, p.screenY || 0, p.clientX || 0, p.clientY || 0, p.ctrlKey || false, p.altKey || false, p.shiftKey || false, p.metaKey || false, p.button || 0, p.relatedTarget || null);} },
dblclick : { eventGroup : "MouseEvents", init : function(e, p) { e.initMouseEvent("click", true, true, window, 2, p.screenX || 0, p.screenY || 0, p.clientX || 0, p.clientY || 0, p.ctrlKey || false, p.altKey || false, p.shiftKey || false, p.metaKey || false, p.button || 0, p.relatedTarget || null);} },
mousedown : { eventGroup : "MouseEvents", init : function(e, p) { e.initMouseEvent("mousedown", true, true, window, 1, p.screenX || 0, p.screenY || 0, p.clientX || 0, p.clientY || 0, p.ctrlKey || false, p.altKey || false, p.shiftKey || false, p.metaKey || false, p.button || 0, p.relatedTarget || null);} },
mouseup : { eventGroup : "MouseEvents", init : function(e, p) { e.initMouseEvent("mouseup", true, true, window, 1, p.screenX || 0, p.screenY || 0, p.clientX || 0, p.clientY || 0, p.ctrlKey || false, p.altKey || false, p.shiftKey || false, p.metaKey || false, p.button || 0, p.relatedTarget || null);} },
mouseover : { eventGroup : "MouseEvents", init : function(e, p) { e.initMouseEvent("mouseover", true, true, window, 1, p.screenX || 0, p.screenY || 0, p.clientX || 0, p.clientY || 0, p.ctrlKey || false, p.altKey || false, p.shiftKey || false, p.metaKey || false, p.button || 0, p.relatedTarget || null);} },
mousemove : { eventGroup : "MouseEvents", init : function(e, p) { e.initMouseEvent("mousemove", true, true, window, 1, p.screenX || 0, p.screenY || 0, p.clientX || 0, p.clientY || 0, p.ctrlKey || false, p.altKey || false, p.shiftKey || false, p.metaKey || false, p.button || 0, p.relatedTarget || null);} },
mouseout : { eventGroup : "MouseEvents", init : function(e, p) { e.initMouseEvent("mousemove", true, true, window, 1, p.screenX || 0, p.screenY || 0, p.clientX || 0, p.clientY || 0, p.ctrlKey || false, p.altKey || false, p.shiftKey || false, p.metaKey || false, p.button || 0, p.relatedTarget || null);} },
load : { eventGroup : "HTMLEvents", init : function(e, p) { e.initEvent("load", false, false);} },
unload : { eventGroup : "HTMLEvents", init : function(e, p) { e.initEvent("unload", false, false);} },
select : { eventGroup : "HTMLEvents", init : function(e, p) { e.initEvent("select", true, false);} },
change : { eventGroup : "HTMLEvents", init : function(e, p) { e.initEvent("change", true, false);} },
submit : { eventGroup : "HTMLEvents", init : function(e, p) { e.initEvent("submit", true, true);} },
reset : { eventGroup : "HTMLEvents", init : function(e, p) { e.initEvent("reset", true, false);} },
resize : { eventGroup : "HTMLEvents", init : function(e, p) { e.initEvent("resize", true, false);} },
scroll : { eventGroup : "HTMLEvents", init : function(e, p) { e.initEvent("scroll", true, false);} }
},
tryFireRawEvent : function(element, rawEvent) {
try {
if (element.fireEvent) {
element.fireEvent("on" + rawEvent.type, rawEvent);return true;} else if (element.dispatchEvent) {
element.dispatchEvent(rawEvent);return true;}
} catch (e) {
}
return false;}, 
tryFireEvent : function(element, eventName, properties) {
try {
if (document.createEventObject) {
var e = document.createEventObject();$common.applyProperties(e, properties || {});element.fireEvent("on" + eventName, e);return true;} else if (document.createEvent) {
var def = $common.__DOMEvents[eventName];if (def) {
var e = document.createEvent(def.eventGroup);def.init(e, properties || {});element.dispatchEvent(e);return true;}
}
} catch (e) {
}
return false;},
wrapElement : function(innerElement, newOuterElement, newInnerParentElement) {
var parent = innerElement.parentNode;parent.replaceChild(newOuterElement, innerElement);(newInnerParentElement || newOuterElement).appendChild(innerElement);},
unwrapElement : function(innerElement, oldOuterElement) {
var parent = oldOuterElement.parentNode;if (parent != null) {
$common.removeElement(innerElement);parent.replaceChild(innerElement, oldOuterElement);}
},
removeElement : function(element) {
var parent = element.parentNode;if (parent != null) {
parent.removeChild(element);}
},
applyProperties : function(target, properties) {
for (var p in properties) {
var pv = properties[p];if (pv != null && Object.getType(pv)===Object) {
var tv = target[p];$common.applyProperties(tv, pv);} else {
target[p] = pv;}
}
},
createElementFromTemplate : function(template, appendToParent, nameTable) {
if (typeof(template.nameTable)!='undefined') {
var newNameTable = template.nameTable;if (String.isInstanceOfType(newNameTable)) {
newNameTable = nameTable[newNameTable];}
if (newNameTable != null) {
nameTable = newNameTable;}
}
var elementName = null;if (typeof(template.name)!=='undefined') {
elementName = template.name;}
var elt = document.createElement(template.nodeName);if (typeof(template.name)!=='undefined' && nameTable) {
nameTable[template.name] = elt;}
if (typeof(template.parent)!=='undefined' && appendToParent == null) {
var newParent = template.parent;if (String.isInstanceOfType(newParent)) {
newParent = nameTable[newParent];}
if (newParent != null) {
appendToParent = newParent;}
}
if (typeof(template.properties)!=='undefined' && template.properties != null) {
$common.applyProperties(elt, template.properties);}
if (typeof(template.cssClasses)!=='undefined' && template.cssClasses != null) {
$common.addCssClasses(elt, template.cssClasses);}
if (typeof(template.events)!=='undefined' && template.events != null) {
$addHandlers(elt, template.events);}
if (typeof(template.visible)!=='undefined' && template.visible != null) {
this.setVisible(elt, template.visible);}
if (appendToParent) {
appendToParent.appendChild(elt);}
if (typeof(template.opacity)!=='undefined' && template.opacity != null) {
$common.setElementOpacity(elt, template.opacity);}
if (typeof(template.children)!=='undefined' && template.children != null) {
for (var i = 0;i < template.children.length;i++) {
var subtemplate = template.children[i];$common.createElementFromTemplate(subtemplate, elt, nameTable);}
}
var contentPresenter = elt;if (typeof(template.contentPresenter)!=='undefined' && template.contentPresenter != null) {
contentPresenter = nameTable[contentPresenter];}
if (typeof(template.content)!=='undefined' && template.content != null) {
var content = template.content;if (String.isInstanceOfType(content)) {
content = nameTable[content];}
if (content.parentNode) {
$common.wrapElement(content, elt, contentPresenter);} else {
contentPresenter.appendChild(content);}
}
return elt;},
prepareHiddenElementForATDeviceUpdate : function () {
var objHidden = document.getElementById('hiddenInputToUpdateATBuffer_CommonToolkitScripts');if (!objHidden) {
var objHidden = document.createElement('input');objHidden.setAttribute('type', 'hidden');objHidden.setAttribute('value', '1');objHidden.setAttribute('id', 'hiddenInputToUpdateATBuffer_CommonToolkitScripts');objHidden.setAttribute('name', 'hiddenInputToUpdateATBuffer_CommonToolkitScripts');if ( document.forms[0] ) {
document.forms[0].appendChild(objHidden);}
}
},
updateFormToRefreshATDeviceBuffer : function () {
var objHidden = document.getElementById('hiddenInputToUpdateATBuffer_CommonToolkitScripts');if (objHidden) {
if (objHidden.getAttribute('value') == '1') {
objHidden.setAttribute('value', '0');} else {
objHidden.setAttribute('value', '1');}
}
}
}
var CommonToolkitScripts = AjaxControlToolkit.CommonToolkitScripts = new AjaxControlToolkit._CommonToolkitScripts();var $common = CommonToolkitScripts;Sys.UI.DomElement.getVisible = $common.getVisible;Sys.UI.DomElement.setVisible = $common.setVisible;Sys.UI.Control.overlaps = $common.overlaps;AjaxControlToolkit._DomUtility = function() {
}
AjaxControlToolkit._DomUtility.prototype = {
isDescendant : function(ancestor, descendant) {
for (var n = descendant.parentNode;n != null;n = n.parentNode) {
if (n == ancestor) return true;}
return false;},
isDescendantOrSelf : function(ancestor, descendant) {
if (ancestor === descendant) 
return true;return AjaxControlToolkit.DomUtility.isDescendant(ancestor, descendant);},
isAncestor : function(descendant, ancestor) {
return AjaxControlToolkit.DomUtility.isDescendant(ancestor, descendant);},
isAncestorOrSelf : function(descendant, ancestor) {
if (descendant === ancestor)
return true;return AjaxControlToolkit.DomUtility.isDescendant(ancestor, descendant);},
isSibling : function(self, sibling) {
var parent = self.parentNode;for (var i = 0;i < parent.childNodes.length;i++) {
if (parent.childNodes[i] == sibling) return true;}
return false;}
}
AjaxControlToolkit._DomUtility.registerClass("AjaxControlToolkit._DomUtility");AjaxControlToolkit.DomUtility = new AjaxControlToolkit._DomUtility();AjaxControlToolkit.TextBoxWrapper = function(element) {
AjaxControlToolkit.TextBoxWrapper.initializeBase(this, [element]);this._current = element.value;this._watermark = null;this._isWatermarked = false;}
AjaxControlToolkit.TextBoxWrapper.prototype = {
dispose : function() {
this.get_element().AjaxControlToolkitTextBoxWrapper = null;AjaxControlToolkit.TextBoxWrapper.callBaseMethod(this, 'dispose');},
get_Current : function() {
this._current = this.get_element().value;return this._current;},
set_Current : function(value) {
this._current = value;this._updateElement();},
get_Value : function() {
if (this.get_IsWatermarked()) {
return "";} else {
return this.get_Current();}
},
set_Value : function(text) {
this.set_Current(text);if (!text || (0 == text.length)) {
if (null != this._watermark) {
this.set_IsWatermarked(true);}
} else {
this.set_IsWatermarked(false);}
},
get_Watermark : function() {
return this._watermark;},
set_Watermark : function(value) {
this._watermark = value;this._updateElement();},
get_IsWatermarked : function() {
return this._isWatermarked;},
set_IsWatermarked : function(isWatermarked) {
if (this._isWatermarked != isWatermarked) {
this._isWatermarked = isWatermarked;this._updateElement();this._raiseWatermarkChanged();}
},
_updateElement : function() {
var element = this.get_element();if (this._isWatermarked) {
if (element.value != this._watermark) {
element.value = this._watermark;}
} else {
if (element.value != this._current) {
element.value = this._current;}
}
},
add_WatermarkChanged : function(handler) {
this.get_events().addHandler("WatermarkChanged", handler);},
remove_WatermarkChanged : function(handler) {
this.get_events().removeHandler("WatermarkChanged", handler);},
_raiseWatermarkChanged : function() {
var onWatermarkChangedHandler = this.get_events().getHandler("WatermarkChanged");if (onWatermarkChangedHandler) {
onWatermarkChangedHandler(this, Sys.EventArgs.Empty);}
}
}
AjaxControlToolkit.TextBoxWrapper.get_Wrapper = function(element) {
if (null == element.AjaxControlToolkitTextBoxWrapper) {
element.AjaxControlToolkitTextBoxWrapper = new AjaxControlToolkit.TextBoxWrapper(element);}
return element.AjaxControlToolkitTextBoxWrapper;}
AjaxControlToolkit.TextBoxWrapper.registerClass('AjaxControlToolkit.TextBoxWrapper', Sys.UI.Behavior);AjaxControlToolkit.TextBoxWrapper.validatorGetValue = function(id) {
var control = $get(id);if (control && control.AjaxControlToolkitTextBoxWrapper) {
return control.AjaxControlToolkitTextBoxWrapper.get_Value();}
return AjaxControlToolkit.TextBoxWrapper._originalValidatorGetValue(id);}
if (typeof(ValidatorGetValue) == 'function') {
AjaxControlToolkit.TextBoxWrapper._originalValidatorGetValue = ValidatorGetValue;ValidatorGetValue = AjaxControlToolkit.TextBoxWrapper.validatorGetValue;}
if (Sys.CultureInfo.prototype._getAbbrMonthIndex) {
try {
Sys.CultureInfo.prototype._getAbbrMonthIndex('');} catch(ex) {
Sys.CultureInfo.prototype._getAbbrMonthIndex = function(value) {
if (!this._upperAbbrMonths) {
this._upperAbbrMonths = this._toUpperArray(this.dateTimeFormat.AbbreviatedMonthNames);}
return Array.indexOf(this._upperAbbrMonths, this._toUpper(value));}
Sys.CultureInfo.CurrentCulture._getAbbrMonthIndex = Sys.CultureInfo.prototype._getAbbrMonthIndex;Sys.CultureInfo.InvariantCulture._getAbbrMonthIndex = Sys.CultureInfo.prototype._getAbbrMonthIndex;}
}

//END AjaxControlToolkit.Common.Common.js
//START AjaxControlToolkit.Animation.Animations.js
Type.registerNamespace('AjaxControlToolkit.Animation');var $AA = AjaxControlToolkit.Animation;$AA.registerAnimation = function(name, type) {
if (type && ((type === $AA.Animation) || (type.inheritsFrom && type.inheritsFrom($AA.Animation)))) {
if (!$AA.__animations) {
$AA.__animations = { };}
$AA.__animations[name.toLowerCase()] = type;type.play = function() {
var animation = new type();type.apply(animation, arguments);animation.initialize();var handler = Function.createDelegate(animation,
function() {
animation.remove_ended(handler);handler = null;animation.dispose();});animation.add_ended(handler);animation.play();}
} else {
throw Error.argumentType('type', type, $AA.Animation, AjaxControlToolkit.Resources.Animation_InvalidBaseType);}
}
$AA.buildAnimation = function(json, defaultTarget) {
if (!json || json === '') {
return null;}
var obj;json = '(' + json + ')';if (! Sys.Debug.isDebug) {
try { obj = Sys.Serialization.JavaScriptSerializer.deserialize(json);} catch (ex) { } 
} else {
obj = Sys.Serialization.JavaScriptSerializer.deserialize(json);}
return $AA.createAnimation(obj, defaultTarget);}
$AA.createAnimation = function(obj, defaultTarget) {
if (!obj || !obj.AnimationName) {
throw Error.argument('obj', AjaxControlToolkit.Resources.Animation_MissingAnimationName);}
var type = $AA.__animations[obj.AnimationName.toLowerCase()];if (!type) {
throw Error.argument('type', String.format(AjaxControlToolkit.Resources.Animation_UknownAnimationName, obj.AnimationName));}
var animation = new type();if (defaultTarget) {
animation.set_target(defaultTarget);}
if (obj.AnimationChildren && obj.AnimationChildren.length) {
if ($AA.ParentAnimation.isInstanceOfType(animation)) {
for (var i = 0;i < obj.AnimationChildren.length;i++) {
var child = $AA.createAnimation(obj.AnimationChildren[i]);if (child) {
animation.add(child);}
}
} else {
throw Error.argument('obj', String.format(AjaxControlToolkit.Resources.Animation_ChildrenNotAllowed, type.getName()));}
}
var properties = type.__animationProperties;if (!properties) {
type.__animationProperties = { };type.resolveInheritance();for (var name in type.prototype) {
if (name.startsWith('set_')) {
type.__animationProperties[name.substr(4).toLowerCase()] = name;}
}
delete type.__animationProperties['id'];properties = type.__animationProperties;}
for (var property in obj) {
var prop = property.toLowerCase();if (prop == 'animationname' || prop == 'animationchildren') {
continue;}
var value = obj[property];var setter = properties[prop];if (setter && String.isInstanceOfType(setter) && animation[setter]) {
if (! Sys.Debug.isDebug) {
try { animation[setter](value);} catch (ex) { }
} else {
animation[setter](value);}
} else {
if (prop.endsWith('script')) {
setter = properties[prop.substr(0, property.length - 6)];if (setter && String.isInstanceOfType(setter) && animation[setter]) {
animation.DynamicProperties[setter] = value;} else if ( Sys.Debug.isDebug) {
throw Error.argument('obj', String.format(AjaxControlToolkit.Resources.Animation_NoDynamicPropertyFound, property, property.substr(0, property.length - 5)));}
} else if ( Sys.Debug.isDebug) {
throw Error.argument('obj', String.format(AjaxControlToolkit.Resources.Animation_NoPropertyFound, property));}
}
}
return animation;}
$AA.Animation = function(target, duration, fps) {
$AA.Animation.initializeBase(this);this._duration = 1;this._fps = 25;this._target = null;this._tickHandler = null;this._timer = null;this._percentComplete = 0;this._percentDelta = null;this._owner = null;this._parentAnimation = null;this.DynamicProperties = { };if (target) {
this.set_target(target);}
if (duration) {
this.set_duration(duration);}
if (fps) { 
this.set_fps(fps);}
}
$AA.Animation.prototype = {
dispose : function() {
if (this._timer) {
this._timer.dispose();this._timer = null;}
this._tickHandler = null;this._target = null;$AA.Animation.callBaseMethod(this, 'dispose');},
play : function() {
if (!this._owner) {
var resume = true;if (!this._timer) {
resume = false;if (!this._tickHandler) {
this._tickHandler = Function.createDelegate(this, this._onTimerTick);}
this._timer = new Sys.Timer();this._timer.add_tick(this._tickHandler);this.onStart();this._timer.set_interval(1000 / this._fps);this._percentDelta = 100 / (this._duration * this._fps);this._updatePercentComplete(0, true);}
this._timer.set_enabled(true);this.raisePropertyChanged('isPlaying');if (!resume) {
this.raisePropertyChanged('isActive');}
}
},
pause : function() {
if (!this._owner) {
if (this._timer) {
this._timer.set_enabled(false);this.raisePropertyChanged('isPlaying');}
}
},
stop : function(finish) {
if (!this._owner) {
var t = this._timer;this._timer = null;if (t) {
t.dispose();if (this._percentComplete !== 100) {
this._percentComplete = 100;this.raisePropertyChanged('percentComplete');if (finish || finish === undefined) {
this.onStep(100);}
}
this.onEnd();this.raisePropertyChanged('isPlaying');this.raisePropertyChanged('isActive');}
}
},
onStart : function() {
this.raiseStarted();for (var property in this.DynamicProperties) {
try {
this[property](eval(this.DynamicProperties[property]));} catch(ex) {
if ( Sys.Debug.isDebug) {
throw ex;}
}
}
},
onStep : function(percentage) {
this.setValue(this.getAnimatedValue(percentage));},
onEnd : function() {
this.raiseEnded();},
getAnimatedValue : function(percentage) {
throw Error.notImplemented();},
setValue : function(value) {
throw Error.notImplemented();},
interpolate : function(start, end, percentage) {
return start + (end - start) * (percentage / 100);},
_onTimerTick : function() {
this._updatePercentComplete(this._percentComplete + this._percentDelta, true);},
_updatePercentComplete : function(percentComplete, animate) {
if (percentComplete > 100) {
percentComplete = 100;}
this._percentComplete = percentComplete;this.raisePropertyChanged('percentComplete');if (animate) {
this.onStep(percentComplete);}
if (percentComplete === 100) {
this.stop(false);}
},
setOwner : function(owner) {
this._owner = owner;},
raiseStarted : function() {
var handlers = this.get_events().getHandler('started');if (handlers) {
handlers(this, Sys.EventArgs.Empty);}
},
add_started : function(handler) {
this.get_events().addHandler("started", handler);},
remove_started : function(handler) {
this.get_events().removeHandler("started", handler);},
raiseEnded : function() {
var handlers = this.get_events().getHandler('ended');if (handlers) {
handlers(this, Sys.EventArgs.Empty);}
},
add_ended : function(handler) {
this.get_events().addHandler("ended", handler);},
remove_ended : function(handler) {
this.get_events().removeHandler("ended", handler);},
get_target : function() {
if (!this._target && this._parentAnimation) {
return this._parentAnimation.get_target();}
return this._target;},
set_target : function(value) {
if (this._target != value) {
this._target = value;this.raisePropertyChanged('target');}
},
set_animationTarget : function(id) {
var target = null;var element = $get(id);if (element) {
target = element;} else {
var ctrl = $find(id);if (ctrl) {
element = ctrl.get_element();if (element) {
target = element;}
}
}
if (target) { 
this.set_target(target);} else {
throw Error.argument('id', String.format(AjaxControlToolkit.Resources.Animation_TargetNotFound, id));}
},
get_duration : function() {
return this._duration;},
set_duration : function(value) {
value = this._getFloat(value);if (this._duration != value) {
this._duration = value;this.raisePropertyChanged('duration');}
},
get_fps : function() {
return this._fps;},
set_fps : function(value) {
value = this._getInteger(value);if (this.fps != value) {
this._fps = value;this.raisePropertyChanged('fps');}
},
get_isActive : function() {
return (this._timer !== null);},
get_isPlaying : function() {
return (this._timer !== null) && this._timer.get_enabled();},
get_percentComplete : function() {
return this._percentComplete;},
_getBoolean : function(value) {
if (String.isInstanceOfType(value)) {
return Boolean.parse(value);}
return value;},
_getInteger : function(value) {
if (String.isInstanceOfType(value)) {
return parseInt(value);}
return value;},
_getFloat : function(value) {
if (String.isInstanceOfType(value)) {
return parseFloat(value);}
return value;},
_getEnum : function(value, type) {
if (String.isInstanceOfType(value) && type && type.parse) {
return type.parse(value);}
return value;}
}
$AA.Animation.registerClass('AjaxControlToolkit.Animation.Animation', Sys.Component);$AA.registerAnimation('animation', $AA.Animation);$AA.ParentAnimation = function(target, duration, fps, animations) {
$AA.ParentAnimation.initializeBase(this, [target, duration, fps]);this._animations = [];if (animations && animations.length) {
for (var i = 0;i < animations.length;i++) {
this.add(animations[i]);}
}
}
$AA.ParentAnimation.prototype = {
initialize : function() {
$AA.ParentAnimation.callBaseMethod(this, 'initialize');if (this._animations) {
for (var i = 0;i < this._animations.length;i++) {
var animation = this._animations[i];if (animation && !animation.get_isInitialized) {
animation.initialize();}
}
}
},
dispose : function() {
this.clear();this._animations = null;$AA.ParentAnimation.callBaseMethod(this, 'dispose');},
get_animations : function() {
return this._animations;},
add : function(animation) {
if (this._animations) {
if (animation) {
animation._parentAnimation = this;}
Array.add(this._animations, animation);this.raisePropertyChanged('animations');}
},
remove : function(animation) {
if (this._animations) {
if (animation) {
animation.dispose();}
Array.remove(this._animations, animation);this.raisePropertyChanged('animations');}
},
removeAt : function(index) {
if (this._animations) {
var animation = this._animations[index];if (animation) {
animation.dispose();}
Array.removeAt(this._animations, index);this.raisePropertyChanged('animations');}
},
clear : function() {
if (this._animations) {
for (var i = this._animations.length - 1;i >= 0;i--) {
this._animations[i].dispose();this._animations[i] = null;}
Array.clear(this._animations);this._animations = [];this.raisePropertyChanged('animations');}
}
}
$AA.ParentAnimation.registerClass('AjaxControlToolkit.Animation.ParentAnimation', $AA.Animation);$AA.registerAnimation('parent', $AA.ParentAnimation);$AA.ParallelAnimation = function(target, duration, fps, animations) {
$AA.ParallelAnimation.initializeBase(this, [target, duration, fps, animations]);}
$AA.ParallelAnimation.prototype = {
add : function(animation) {
$AA.ParallelAnimation.callBaseMethod(this, 'add', [animation]);animation.setOwner(this);},
onStart : function() {
$AA.ParallelAnimation.callBaseMethod(this, 'onStart');var animations = this.get_animations();for (var i = 0;i < animations.length;i++) {
animations[i].onStart();}
},
onStep : function(percentage) {
var animations = this.get_animations();for (var i = 0;i < animations.length;i++) {
animations[i].onStep(percentage);}
},
onEnd : function() {
var animations = this.get_animations();for (var i = 0;i < animations.length;i++) {
animations[i].onEnd();}
$AA.ParallelAnimation.callBaseMethod(this, 'onEnd');}
}
$AA.ParallelAnimation.registerClass('AjaxControlToolkit.Animation.ParallelAnimation', $AA.ParentAnimation);$AA.registerAnimation('parallel', $AA.ParallelAnimation);$AA.SequenceAnimation = function(target, duration, fps, animations, iterations) {
$AA.SequenceAnimation.initializeBase(this, [target, duration, fps, animations]);this._handler = null;this._paused = false;this._playing = false;this._index = 0;this._remainingIterations = 0;this._iterations = (iterations !== undefined) ? iterations : 1;}
$AA.SequenceAnimation.prototype = {
dispose : function() {
this._handler = null;$AA.SequenceAnimation.callBaseMethod(this, 'dispose');},
stop : function() {
if (this._playing) {
var animations = this.get_animations();if (this._index < animations.length) {
animations[this._index].remove_ended(this._handler);for (var i = this._index;i < animations.length;i++) {
animations[i].stop();}
}
this._playing = false;this._paused = false;this.raisePropertyChanged('isPlaying');this.onEnd();}
},
pause : function() {
if (this.get_isPlaying()) {
var current = this.get_animations()[this._index];if (current != null) {
current.pause();}
this._paused = true;this.raisePropertyChanged('isPlaying');}
},
play : function() {
var animations = this.get_animations();if (!this._playing) {
this._playing = true;if (this._paused) {
this._paused = false;var current = animations[this._index];if (current != null) {
current.play();this.raisePropertyChanged('isPlaying');}
} else {
this.onStart();this._index = 0;var first = animations[this._index];if (first) {
first.add_ended(this._handler);first.play();this.raisePropertyChanged('isPlaying');} else {
this.stop();}
}
}
},
onStart : function() {
$AA.SequenceAnimation.callBaseMethod(this, 'onStart');this._remainingIterations = this._iterations - 1;if (!this._handler) {
this._handler = Function.createDelegate(this, this._onEndAnimation);}
},
_onEndAnimation : function() {
var animations = this.get_animations();var current = animations[this._index++];if (current) {
current.remove_ended(this._handler);}
if (this._index < animations.length) {
var next = animations[this._index];next.add_ended(this._handler);next.play();} else if (this._remainingIterations >= 1 || this._iterations <= 0) {
this._remainingIterations--;this._index = 0;var first = animations[0];first.add_ended(this._handler);first.play();} else {
this.stop();}
},
onStep : function(percentage) {
throw Error.invalidOperation(AjaxControlToolkit.Resources.Animation_CannotNestSequence);},
onEnd : function() {
this._remainingIterations = 0;$AA.SequenceAnimation.callBaseMethod(this, 'onEnd');},
get_isActive : function() {
return true;},
get_isPlaying : function() {
return this._playing && !this._paused;},
get_iterations : function() {
return this._iterations;},
set_iterations : function(value) {
value = this._getInteger(value);if (this._iterations != value) {
this._iterations = value;this.raisePropertyChanged('iterations');}
},
get_isInfinite : function() {
return this._iterations <= 0;}
}
$AA.SequenceAnimation.registerClass('AjaxControlToolkit.Animation.SequenceAnimation', $AA.ParentAnimation);$AA.registerAnimation('sequence', $AA.SequenceAnimation);$AA.SelectionAnimation = function(target, duration, fps, animations) {
$AA.SelectionAnimation.initializeBase(this, [target, duration, fps, animations]);this._selectedIndex = -1;this._selected = null;}
$AA.SelectionAnimation.prototype = { 
getSelectedIndex : function() {
throw Error.notImplemented();},
onStart : function() {
$AA.SelectionAnimation.callBaseMethod(this, 'onStart');var animations = this.get_animations();this._selectedIndex = this.getSelectedIndex();if (this._selectedIndex >= 0 && this._selectedIndex < animations.length) {
this._selected = animations[this._selectedIndex];if (this._selected) {
this._selected.setOwner(this);this._selected.onStart();}
}
},
onStep : function(percentage) {
if (this._selected) {
this._selected.onStep(percentage);}
},
onEnd : function() {
if (this._selected) {
this._selected.onEnd();this._selected.setOwner(null);}
this._selected = null;this._selectedIndex = null;$AA.SelectionAnimation.callBaseMethod(this, 'onEnd');}
}
$AA.SelectionAnimation.registerClass('AjaxControlToolkit.Animation.SelectionAnimation', $AA.ParentAnimation);$AA.registerAnimation('selection', $AA.SelectionAnimation);$AA.ConditionAnimation = function(target, duration, fps, animations, conditionScript) {
$AA.ConditionAnimation.initializeBase(this, [target, duration, fps, animations]);this._conditionScript = conditionScript;}
$AA.ConditionAnimation.prototype = { 
getSelectedIndex : function() {
var selected = -1;if (this._conditionScript && this._conditionScript.length > 0) {
try {
selected = eval(this._conditionScript) ? 0 : 1;} catch(ex) {
}
}
return selected;},
get_conditionScript : function() {
return this._conditionScript;},
set_conditionScript : function(value) {
if (this._conditionScript != value) {
this._conditionScript = value;this.raisePropertyChanged('conditionScript');}
}
}
$AA.ConditionAnimation.registerClass('AjaxControlToolkit.Animation.ConditionAnimation', $AA.SelectionAnimation);$AA.registerAnimation('condition', $AA.ConditionAnimation);$AA.CaseAnimation = function(target, duration, fps, animations, selectScript) {
$AA.CaseAnimation.initializeBase(this, [target, duration, fps, animations]);this._selectScript = selectScript;}
$AA.CaseAnimation.prototype = {
getSelectedIndex : function() {
var selected = -1;if (this._selectScript && this._selectScript.length > 0) {
try {
var result = eval(this._selectScript)
if (result !== undefined)
selected = result;} catch (ex) {
}
}
return selected;},
get_selectScript : function() {
return this._selectScript;},
set_selectScript : function(value) {
if (this._selectScript != value) {
this._selectScript = value;this.raisePropertyChanged('selectScript');}
}
}
$AA.CaseAnimation.registerClass('AjaxControlToolkit.Animation.CaseAnimation', $AA.SelectionAnimation);$AA.registerAnimation('case', $AA.CaseAnimation);$AA.FadeEffect = function() {
throw Error.invalidOperation();}
$AA.FadeEffect.prototype = {
FadeIn : 0,
FadeOut : 1
}
$AA.FadeEffect.registerEnum("AjaxControlToolkit.Animation.FadeEffect", false);$AA.FadeAnimation = function(target, duration, fps, effect, minimumOpacity, maximumOpacity, forceLayoutInIE) {
$AA.FadeAnimation.initializeBase(this, [target, duration, fps]);this._effect = (effect !== undefined) ? effect : $AA.FadeEffect.FadeIn;this._max = (maximumOpacity !== undefined) ? maximumOpacity : 1;this._min = (minimumOpacity !== undefined) ? minimumOpacity : 0;this._start = this._min;this._end = this._max;this._layoutCreated = false;this._forceLayoutInIE = (forceLayoutInIE === undefined || forceLayoutInIE === null) ? true : forceLayoutInIE;this._currentTarget = null;this._resetOpacities();}
$AA.FadeAnimation.prototype = {
_resetOpacities : function() {
if (this._effect == $AA.FadeEffect.FadeIn) {
this._start = this._min;this._end = this._max;} else {
this._start = this._max;this._end = this._min;}
},
_createLayout : function() {
var element = this._currentTarget;if (element) {
var originalWidth = $common.getCurrentStyle(element, 'width');var originalHeight = $common.getCurrentStyle(element, 'height');var originalBackColor = $common.getCurrentStyle(element, 'backgroundColor');if ((!originalWidth || originalWidth == '' || originalWidth == 'auto') &&
(!originalHeight || originalHeight == '' || originalHeight == 'auto')) {
element.style.width = element.offsetWidth + 'px';}
if (!originalBackColor || originalBackColor == '' || originalBackColor == 'transparent' || originalBackColor == 'rgba(0, 0, 0, 0)') {
element.style.backgroundColor = $common.getInheritedBackgroundColor(element);}
this._layoutCreated = true;}
},
onStart : function() {
$AA.FadeAnimation.callBaseMethod(this, 'onStart');this._currentTarget = this.get_target();this.setValue(this._start);if (this._forceLayoutInIE && !this._layoutCreated && Sys.Browser.agent == Sys.Browser.InternetExplorer) {
this._createLayout();}
},
getAnimatedValue : function(percentage) {
return this.interpolate(this._start, this._end, percentage);},
setValue : function(value) {
if (this._currentTarget) {
$common.setElementOpacity(this._currentTarget, value);}
},
get_effect : function() {
return this._effect;},
set_effect : function(value) {
value = this._getEnum(value, $AA.FadeEffect);if (this._effect != value) {
this._effect = value;this._resetOpacities();this.raisePropertyChanged('effect');}
},
get_minimumOpacity : function() {
return this._min;},
set_minimumOpacity : function(value) {
value = this._getFloat(value);if (this._min != value) {
this._min = value;this._resetOpacities();this.raisePropertyChanged('minimumOpacity');}
},
get_maximumOpacity : function() {
return this._max;},
set_maximumOpacity : function(value) {
value = this._getFloat(value);if (this._max != value) {
this._max = value;this._resetOpacities();this.raisePropertyChanged('maximumOpacity');}
},
get_forceLayoutInIE : function() {
return this._forceLayoutInIE;},
set_forceLayoutInIE : function(value) {
value = this._getBoolean(value);if (this._forceLayoutInIE != value) {
this._forceLayoutInIE = value;this.raisePropertyChanged('forceLayoutInIE');}
},
set_startValue : function(value) {
value = this._getFloat(value);this._start = value;}
}
$AA.FadeAnimation.registerClass('AjaxControlToolkit.Animation.FadeAnimation', $AA.Animation);$AA.registerAnimation('fade', $AA.FadeAnimation);$AA.FadeInAnimation = function(target, duration, fps, minimumOpacity, maximumOpacity, forceLayoutInIE) {
$AA.FadeInAnimation.initializeBase(this, [target, duration, fps, $AA.FadeEffect.FadeIn, minimumOpacity, maximumOpacity, forceLayoutInIE]);}
$AA.FadeInAnimation.prototype = {
onStart : function() {
$AA.FadeInAnimation.callBaseMethod(this, 'onStart');if (this._currentTarget) {
this.set_startValue($common.getElementOpacity(this._currentTarget));}
}
}
$AA.FadeInAnimation.registerClass('AjaxControlToolkit.Animation.FadeInAnimation', $AA.FadeAnimation);$AA.registerAnimation('fadeIn', $AA.FadeInAnimation);$AA.FadeOutAnimation = function(target, duration, fps, minimumOpacity, maximumOpacity, forceLayoutInIE) {
$AA.FadeOutAnimation.initializeBase(this, [target, duration, fps, $AA.FadeEffect.FadeOut, minimumOpacity, maximumOpacity, forceLayoutInIE]);}
$AA.FadeOutAnimation.prototype = {
onStart : function() {
$AA.FadeOutAnimation.callBaseMethod(this, 'onStart');if (this._currentTarget) {
this.set_startValue($common.getElementOpacity(this._currentTarget));}
}
}
$AA.FadeOutAnimation.registerClass('AjaxControlToolkit.Animation.FadeOutAnimation', $AA.FadeAnimation);$AA.registerAnimation('fadeOut', $AA.FadeOutAnimation);$AA.PulseAnimation = function(target, duration, fps, iterations, minimumOpacity, maximumOpacity, forceLayoutInIE) {
$AA.PulseAnimation.initializeBase(this, [target, duration, fps, null, ((iterations !== undefined) ? iterations : 3)]);this._out = new $AA.FadeOutAnimation(target, duration, fps, minimumOpacity, maximumOpacity, forceLayoutInIE);this.add(this._out);this._in = new $AA.FadeInAnimation(target, duration, fps, minimumOpacity, maximumOpacity, forceLayoutInIE);this.add(this._in);}
$AA.PulseAnimation.prototype = {
get_minimumOpacity : function() {
return this._out.get_minimumOpacity();},
set_minimumOpacity : function(value) {
value = this._getFloat(value);this._out.set_minimumOpacity(value);this._in.set_minimumOpacity(value);this.raisePropertyChanged('minimumOpacity');},
get_maximumOpacity : function() {
return this._out.get_maximumOpacity();},
set_maximumOpacity : function(value) {
value = this._getFloat(value);this._out.set_maximumOpacity(value);this._in.set_maximumOpacity(value);this.raisePropertyChanged('maximumOpacity');},
get_forceLayoutInIE : function() {
return this._out.get_forceLayoutInIE();},
set_forceLayoutInIE : function(value) {
value = this._getBoolean(value);this._out.set_forceLayoutInIE(value);this._in.set_forceLayoutInIE(value);this.raisePropertyChanged('forceLayoutInIE');},
set_duration : function(value) {
value = this._getFloat(value);$AA.PulseAnimation.callBaseMethod(this, 'set_duration', [value]);this._in.set_duration(value);this._out.set_duration(value);},
set_fps : function(value) {
value = this._getInteger(value);$AA.PulseAnimation.callBaseMethod(this, 'set_fps', [value]);this._in.set_fps(value);this._out.set_fps(value);}
}
$AA.PulseAnimation.registerClass('AjaxControlToolkit.Animation.PulseAnimation', $AA.SequenceAnimation);$AA.registerAnimation('pulse', $AA.PulseAnimation);$AA.PropertyAnimation = function(target, duration, fps, property, propertyKey) {
$AA.PropertyAnimation.initializeBase(this, [target, duration, fps]);this._property = property;this._propertyKey = propertyKey;this._currentTarget = null;}
$AA.PropertyAnimation.prototype = {
onStart : function() {
$AA.PropertyAnimation.callBaseMethod(this, 'onStart');this._currentTarget = this.get_target();},
setValue : function(value) {
var element = this._currentTarget;if (element && this._property && this._property.length > 0) { 
if (this._propertyKey && this._propertyKey.length > 0 && element[this._property]) {
element[this._property][this._propertyKey] = value;} else {
element[this._property] = value;}
}
},
getValue : function() {
var element = this.get_target();if (element && this._property && this._property.length > 0) { 
var property = element[this._property];if (property) {
if (this._propertyKey && this._propertyKey.length > 0) {
return property[this._propertyKey];}
return property;}
}
return null;},
get_property : function() {
return this._property;},
set_property : function(value) {
if (this._property != value) {
this._property = value;this.raisePropertyChanged('property');}
},
get_propertyKey : function() {
return this._propertyKey;},
set_propertyKey : function(value) {
if (this._propertyKey != value) {
this._propertyKey = value;this.raisePropertyChanged('propertyKey');}
}
}
$AA.PropertyAnimation.registerClass('AjaxControlToolkit.Animation.PropertyAnimation', $AA.Animation);$AA.registerAnimation('property', $AA.PropertyAnimation);$AA.DiscreteAnimation = function(target, duration, fps, property, propertyKey, values) {
$AA.DiscreteAnimation.initializeBase(this, [target, duration, fps, property, propertyKey]);this._values = (values && values.length) ? values : [];}
$AA.DiscreteAnimation.prototype = {
getAnimatedValue : function(percentage) {
var index = Math.floor(this.interpolate(0, this._values.length - 1, percentage));return this._values[index];},
get_values : function() {
return this._values;},
set_values : function(value) {
if (this._values != value) {
this._values = value;this.raisePropertyChanged('values');}
}
}
$AA.DiscreteAnimation.registerClass('AjaxControlToolkit.Animation.DiscreteAnimation', $AA.PropertyAnimation);$AA.registerAnimation('discrete', $AA.DiscreteAnimation);$AA.InterpolatedAnimation = function(target, duration, fps, property, propertyKey, startValue, endValue) {
$AA.InterpolatedAnimation.initializeBase(this, [target, duration, fps, ((property !== undefined) ? property : 'style'), propertyKey]);this._startValue = startValue;this._endValue = endValue;}
$AA.InterpolatedAnimation.prototype = {
get_startValue : function() {
return this._startValue;},
set_startValue : function(value) {
value = this._getFloat(value);if (this._startValue != value) {
this._startValue = value;this.raisePropertyChanged('startValue');}
},
get_endValue : function() {
return this._endValue;},
set_endValue : function(value) {
value = this._getFloat(value);if (this._endValue != value) {
this._endValue = value;this.raisePropertyChanged('endValue');}
} 
}
$AA.InterpolatedAnimation.registerClass('AjaxControlToolkit.Animation.InterpolatedAnimation', $AA.PropertyAnimation);$AA.registerAnimation('interpolated', $AA.InterpolatedAnimation);$AA.ColorAnimation = function(target, duration, fps, property, propertyKey, startValue, endValue) {
$AA.ColorAnimation.initializeBase(this, [target, duration, fps, property, propertyKey, startValue, endValue]);this._start = null;this._end = null;this._interpolateRed = false;this._interpolateGreen = false;this._interpolateBlue = false;}
$AA.ColorAnimation.prototype = {
onStart : function() {
$AA.ColorAnimation.callBaseMethod(this, 'onStart');this._start = $AA.ColorAnimation.getRGB(this.get_startValue());this._end = $AA.ColorAnimation.getRGB(this.get_endValue());this._interpolateRed = (this._start.Red != this._end.Red);this._interpolateGreen = (this._start.Green != this._end.Green);this._interpolateBlue = (this._start.Blue != this._end.Blue);},
getAnimatedValue : function(percentage) {
var r = this._start.Red;var g = this._start.Green;var b = this._start.Blue;if (this._interpolateRed)
r = Math.round(this.interpolate(r, this._end.Red, percentage));if (this._interpolateGreen)
g = Math.round(this.interpolate(g, this._end.Green, percentage));if (this._interpolateBlue)
b = Math.round(this.interpolate(b, this._end.Blue, percentage));return $AA.ColorAnimation.toColor(r, g, b);},
set_startValue : function(value) {
if (this._startValue != value) {
this._startValue = value;this.raisePropertyChanged('startValue');}
},
set_endValue : function(value) {
if (this._endValue != value) {
this._endValue = value;this.raisePropertyChanged('endValue');}
} 
}
$AA.ColorAnimation.getRGB = function(color) {
if (!color || color.length != 7) {
throw String.format(AjaxControlToolkit.Resources.Animation_InvalidColor, color);}
return { 'Red': parseInt(color.substr(1,2), 16),
'Green': parseInt(color.substr(3,2), 16),
'Blue': parseInt(color.substr(5,2), 16) };}
$AA.ColorAnimation.toColor = function(red, green, blue) {
var r = red.toString(16);var g = green.toString(16);var b = blue.toString(16);if (r.length == 1) r = '0' + r;if (g.length == 1) g = '0' + g;if (b.length == 1) b = '0' + b;return '#' + r + g + b;}
$AA.ColorAnimation.registerClass('AjaxControlToolkit.Animation.ColorAnimation', $AA.InterpolatedAnimation);$AA.registerAnimation('color', $AA.ColorAnimation);$AA.LengthAnimation = function(target, duration, fps, property, propertyKey, startValue, endValue, unit) {
$AA.LengthAnimation.initializeBase(this, [target, duration, fps, property, propertyKey, startValue, endValue]);this._unit = (unit != null) ? unit : 'px';}
$AA.LengthAnimation.prototype = {
getAnimatedValue : function(percentage) {
var value = this.interpolate(this.get_startValue(), this.get_endValue(), percentage);return Math.round(value) + this._unit;},
get_unit : function() {
return this._unit;},
set_unit : function(value) {
if (this._unit != value) {
this._unit = value;this.raisePropertyChanged('unit');}
}
}
$AA.LengthAnimation.registerClass('AjaxControlToolkit.Animation.LengthAnimation', $AA.InterpolatedAnimation);$AA.registerAnimation('length', $AA.LengthAnimation);$AA.MoveAnimation = function(target, duration, fps, horizontal, vertical, relative, unit) {
$AA.MoveAnimation.initializeBase(this, [target, duration, fps, null]);this._horizontal = horizontal ? horizontal : 0;this._vertical = vertical ? vertical : 0;this._relative = (relative === undefined) ? true : relative;this._horizontalAnimation = new $AA.LengthAnimation(target, duration, fps, 'style', 'left', null, null, unit);this._verticalAnimation = new $AA.LengthAnimation(target, duration, fps, 'style', 'top', null, null, unit);this.add(this._verticalAnimation);this.add(this._horizontalAnimation);}
$AA.MoveAnimation.prototype = {
onStart : function() {
$AA.MoveAnimation.callBaseMethod(this, 'onStart');var element = this.get_target();this._horizontalAnimation.set_startValue(element.offsetLeft);this._horizontalAnimation.set_endValue(this._relative ? element.offsetLeft + this._horizontal : this._horizontal);this._verticalAnimation.set_startValue(element.offsetTop);this._verticalAnimation.set_endValue(this._relative ? element.offsetTop + this._vertical : this._vertical);},
get_horizontal : function() {
return this._horizontal;},
set_horizontal : function(value) {
value = this._getFloat(value);if (this._horizontal != value) {
this._horizontal = value;this.raisePropertyChanged('horizontal');}
},
get_vertical : function() {
return this._vertical;},
set_vertical : function(value) {
value = this._getFloat(value);if (this._vertical != value) {
this._vertical = value;this.raisePropertyChanged('vertical');}
},
get_relative : function() {
return this._relative;},
set_relative : function(value) {
value = this._getBoolean(value);if (this._relative != value) {
this._relative = value;this.raisePropertyChanged('relative');}
},
get_unit : function() {
this._horizontalAnimation.get_unit();},
set_unit : function(value) {
var unit = this._horizontalAnimation.get_unit();if (unit != value) {
this._horizontalAnimation.set_unit(value);this._verticalAnimation.set_unit(value);this.raisePropertyChanged('unit');}
}
}
$AA.MoveAnimation.registerClass('AjaxControlToolkit.Animation.MoveAnimation', $AA.ParallelAnimation);$AA.registerAnimation('move', $AA.MoveAnimation);$AA.ResizeAnimation = function(target, duration, fps, width, height, unit) {
$AA.ResizeAnimation.initializeBase(this, [target, duration, fps, null]);this._width = width;this._height = height;this._horizontalAnimation = new $AA.LengthAnimation(target, duration, fps, 'style', 'width', null, null, unit);this._verticalAnimation = new $AA.LengthAnimation(target, duration, fps, 'style', 'height', null, null, unit);this.add(this._horizontalAnimation);this.add(this._verticalAnimation);}
$AA.ResizeAnimation.prototype = {
onStart : function() {
$AA.ResizeAnimation.callBaseMethod(this, 'onStart');var element = this.get_target();this._horizontalAnimation.set_startValue(element.offsetWidth);this._verticalAnimation.set_startValue(element.offsetHeight);this._horizontalAnimation.set_endValue((this._width !== null && this._width !== undefined) ?
this._width : element.offsetWidth);this._verticalAnimation.set_endValue((this._height !== null && this._height !== undefined) ?
this._height : element.offsetHeight);},
get_width : function() {
return this._width;},
set_width : function(value) {
value = this._getFloat(value);if (this._width != value) {
this._width = value;this.raisePropertyChanged('width');}
},
get_height : function() {
return this._height;},
set_height : function(value) {
value = this._getFloat(value);if (this._height != value) {
this._height = value;this.raisePropertyChanged('height');}
},
get_unit : function() {
this._horizontalAnimation.get_unit();},
set_unit : function(value) {
var unit = this._horizontalAnimation.get_unit();if (unit != value) {
this._horizontalAnimation.set_unit(value);this._verticalAnimation.set_unit(value);this.raisePropertyChanged('unit');}
}
}
$AA.ResizeAnimation.registerClass('AjaxControlToolkit.Animation.ResizeAnimation', $AA.ParallelAnimation);$AA.registerAnimation('resize', $AA.ResizeAnimation);$AA.ScaleAnimation = function(target, duration, fps, scaleFactor, unit, center, scaleFont, fontUnit) {
$AA.ScaleAnimation.initializeBase(this, [target, duration, fps]);this._scaleFactor = (scaleFactor !== undefined) ? scaleFactor : 1;this._unit = (unit !== undefined) ? unit : 'px';this._center = center;this._scaleFont = scaleFont;this._fontUnit = (fontUnit !== undefined) ? fontUnit : 'pt';this._element = null;this._initialHeight = null;this._initialWidth = null;this._initialTop = null;this._initialLeft = null;this._initialFontSize = null;}
$AA.ScaleAnimation.prototype = { 
getAnimatedValue : function(percentage) {
return this.interpolate(1.0, this._scaleFactor, percentage);},
onStart : function() {
$AA.ScaleAnimation.callBaseMethod(this, 'onStart');this._element = this.get_target();if (this._element) {
this._initialHeight = this._element.offsetHeight;this._initialWidth = this._element.offsetWidth;if (this._center) {
this._initialTop = this._element.offsetTop;this._initialLeft = this._element.offsetLeft;}
if (this._scaleFont) {
this._initialFontSize = parseFloat(
$common.getCurrentStyle(this._element, 'fontSize'));}
}
},
setValue : function(scale) {
if (this._element) {
var width = Math.round(this._initialWidth * scale);var height = Math.round(this._initialHeight * scale);this._element.style.width = width + this._unit;this._element.style.height = height + this._unit;if (this._center) {
this._element.style.top = (this._initialTop +
Math.round((this._initialHeight - height) / 2)) + this._unit;this._element.style.left = (this._initialLeft +
Math.round((this._initialWidth - width) / 2)) + this._unit;}
if (this._scaleFont) {
var size = this._initialFontSize * scale;if (this._fontUnit == 'px' || this._fontUnit == 'pt') {
size = Math.round(size);}
this._element.style.fontSize = size + this._fontUnit;}
}
},
onEnd : function() {
this._element = null;this._initialHeight = null;this._initialWidth = null;this._initialTop = null;this._initialLeft = null;this._initialFontSize = null;$AA.ScaleAnimation.callBaseMethod(this, 'onEnd');},
get_scaleFactor : function() {
return this._scaleFactor;},
set_scaleFactor : function(value) {
value = this._getFloat(value);if (this._scaleFactor != value) {
this._scaleFactor = value;this.raisePropertyChanged('scaleFactor');}
},
get_unit : function() {
return this._unit;},
set_unit : function(value) {
if (this._unit != value) {
this._unit = value;this.raisePropertyChanged('unit');}
},
get_center : function() {
return this._center;},
set_center : function(value) {
value = this._getBoolean(value);if (this._center != value) {
this._center = value;this.raisePropertyChanged('center');}
},
get_scaleFont : function() {
return this._scaleFont;},
set_scaleFont : function(value) {
value = this._getBoolean(value);if (this._scaleFont != value) {
this._scaleFont = value;this.raisePropertyChanged('scaleFont');}
},
get_fontUnit : function() {
return this._fontUnit;},
set_fontUnit : function(value) {
if (this._fontUnit != value) { 
this._fontUnit = value;this.raisePropertyChanged('fontUnit');}
}
}
$AA.ScaleAnimation.registerClass('AjaxControlToolkit.Animation.ScaleAnimation', $AA.Animation);$AA.registerAnimation('scale', $AA.ScaleAnimation);$AA.Action = function(target, duration, fps) {
$AA.Action.initializeBase(this, [target, duration, fps]);if (duration === undefined) {
this.set_duration(0);}
}
$AA.Action.prototype = {
onEnd : function() {
this.doAction();$AA.Action.callBaseMethod(this, 'onEnd');},
doAction : function() {
throw Error.notImplemented();},
getAnimatedValue : function() {
},
setValue : function() {
}
}
$AA.Action.registerClass('AjaxControlToolkit.Animation.Action', $AA.Animation);$AA.registerAnimation('action', $AA.Action);$AA.EnableAction = function(target, duration, fps, enabled) {
$AA.EnableAction.initializeBase(this, [target, duration, fps]);this._enabled = (enabled !== undefined) ? enabled : true;}
$AA.EnableAction.prototype = {
doAction : function() {
var element = this.get_target();if (element) {
element.disabled = !this._enabled;}
},
get_enabled : function() {
return this._enabled;},
set_enabled : function(value) {
value = this._getBoolean(value);if (this._enabled != value) {
this._enabled = value;this.raisePropertyChanged('enabled');}
}
}
$AA.EnableAction.registerClass('AjaxControlToolkit.Animation.EnableAction', $AA.Action);$AA.registerAnimation('enableAction', $AA.EnableAction);$AA.HideAction = function(target, duration, fps, visible) {
$AA.HideAction.initializeBase(this, [target, duration, fps]);this._visible = visible;}
$AA.HideAction.prototype = {
doAction : function() {
var element = this.get_target();if (element) {
$common.setVisible(element, this._visible);}
},
get_visible : function() {
return this._visible;},
set_visible : function(value) {
if (this._visible != value) {
this._visible = value;this.raisePropertyChanged('visible');}
}
}
$AA.HideAction.registerClass('AjaxControlToolkit.Animation.HideAction', $AA.Action);$AA.registerAnimation('hideAction', $AA.HideAction);$AA.StyleAction = function(target, duration, fps, attribute, value) {
$AA.StyleAction.initializeBase(this, [target, duration, fps]);this._attribute = attribute;this._value = value;}
$AA.StyleAction.prototype = {
doAction : function() {
var element = this.get_target();if (element) {
element.style[this._attribute] = this._value;}
},
get_attribute : function() {
return this._attribute;},
set_attribute : function(value) {
if (this._attribute != value) {
this._attribute = value;this.raisePropertyChanged('attribute');}
},
get_value : function() {
return this._value;},
set_value : function(value) {
if (this._value != value) {
this._value = value;this.raisePropertyChanged('value');}
}
}
$AA.StyleAction.registerClass('AjaxControlToolkit.Animation.StyleAction', $AA.Action);$AA.registerAnimation('styleAction', $AA.StyleAction);$AA.OpacityAction = function(target, duration, fps, opacity) {
$AA.OpacityAction.initializeBase(this, [target, duration, fps]);this._opacity = opacity;}
$AA.OpacityAction.prototype = {
doAction : function() {
var element = this.get_target();if (element) {
$common.setElementOpacity(element, this._opacity);}
},
get_opacity : function() {
return this._opacity;},
set_opacity : function(value) {
value = this._getFloat(value);if (this._opacity != value) {
this._opacity = value;this.raisePropertyChanged('opacity');}
}
}
$AA.OpacityAction.registerClass('AjaxControlToolkit.Animation.OpacityAction', $AA.Action);$AA.registerAnimation('opacityAction', $AA.OpacityAction);$AA.ScriptAction = function(target, duration, fps, script) {
$AA.ScriptAction.initializeBase(this, [target, duration, fps]);this._script = script;}
$AA.ScriptAction.prototype = {
doAction : function() {
try {
eval(this._script);} catch (ex) {
}
},
get_script : function() {
return this._script;},
set_script : function(value) {
if (this._script != value) {
this._script = value;this.raisePropertyChanged('script');}
}
}
$AA.ScriptAction.registerClass('AjaxControlToolkit.Animation.ScriptAction', $AA.Action);$AA.registerAnimation('scriptAction', $AA.ScriptAction);
//END AjaxControlToolkit.Animation.Animations.js
//START ESRI.ArcGIS.ADF.Web.UI.WebControls.Runtime.JavaScript.display_dotnetadf.js
/*
COPYRIGHT 1995-2003 ESRI

TRADE SECRETS: ESRI PROPRIETARY AND CONFIDENTIAL
Unpublished material - all rights reserved under the 
Copyright Laws of the United States.

For additional information, contact:
Environmental Systems Research Institute, Inc.
Attn: Contracts Dept
380 New York Street
Redlands, California, USA 92373


email: contracts@esri.com
*/


// set path for loading banner image
loadBannerPath = "images";
var displayLoading = false;
var sendDelay = 100;
var currentEventArg = "";

activeControl = "Map1";
var esriCurrentResponseCount = 0;
var esriLastResponseCount = -1;
var postBackInterval = null;

var clientPostbackEventArgs = new Array();
// add additional control non-tool event args, if necessary
clientPostbackEventArgs[0] = "resize";
clientPostbackEventArgs[1] = "scrollwheelzoom";
clientPostbackEventArgs[2] = "dragimage";
clientPostbackEventArgs[3] = "drawtile";
clientPostbackEventArgs[4] = "getextent";
clientPostbackEventArgs[5] = "newextent";
clientPostbackEventArgs[6] = "dragrectangle";
clientPostbackEventArgs[7] = "changelevel";
clientPostbackEventArgs[8] = "point";
clientPostbackEventArgs[9] = "line";
clientPostbackEventArgs[10] = "polyline";
clientPostbackEventArgs[11] = "polygon";
clientPostbackEventArgs[12] = "circle";
clientPostbackEventArgs[13] = "oval";


function postBack(control, eventArg, responseFunction) {
	//eventArg = eventArg.toLowerCase();
	currentEventArg = eventArg;	
	//var map2 = Maps[control];
	//var ov2 = Overviews[control];
	//var page2 = Pages[control];
	var toolbar2 = Toolbars[control];
//	var toc2 = Tocs[control];
	var forcePostBack  = false;
	activeControl = control;
	var mode = "";
	var f;
//	if (map2!=null) {
//		// map request
//		f = map2.document.forms[docFormID];
//		f.minx.value = map2.xMin;
//		f.miny.value = map2.yMin;
//		f.maxx.value = map2.xMax;
//		f.maxy.value = map2.yMax;
//		f.coords.value = map2.coords;
//		var postbackEvents = map2.forcePostBackEvent.split(",");
//		for (var h=0;h<clientPostbackEventArgs.length;h++)
//		{	// Check if eventArg is a PostBack event arg.
//			if (eventArg.toLowerCase()==clientPostbackEventArgs[h])
//			{	//check postback event
//				for (var i=0;i<postbackEvents.length;i++)
//				{	// Check if Postback is for Map Mode.
//					if (map2.mode==postbackEvents[i])
//						forcePostBack = true;
//				}
//			}
//		}
//		f.elements[control + "_mode"].value = map2.mode;
//		mode = map2.mode;
//		map2.mode = map2.tempMode;
//		map2.actionType = map2.tempAction;
//		map2.cursor = map2.tempCursor;
//		if (map2.callBackFunctionString!=null) callBackFunctionString = map2.callBackFunctionString;
//	}
//	 else if (page2!=null) {
//		// page request
//		f = page2.document.forms[docFormID];
//		f.minx.value = page2.xMin;
//		f.miny.value = page2.yMin;
//		f.maxx.value = page2.xMax;
//		f.maxy.value = page2.yMax;
//		f.coords.value = page2.coords;
//		var supportpostbackEvents = page2.toolsSupportingClientPostBack.split(",");
//		for (var j=0;j<clientPostbackEventArgs.length;j++)
//		{	// Check if eventArg is a PostBack event arg.
//			if (eventArg.toLowerCase()==clientPostbackEventArgs[j])
//			{	//check postback event
//				for (var k=0;k<supportpostbackEvents.length;k++)
//				{	// Check if Postback is for Page Mode.
//					if (page2.mode==supportpostbackEvents[k])
//						forcePostBack = true;
//				}
//			}
//		}
//		f.elements[control + "_mode"].value = page2.mode;
//		mode = page2.mode;
//		page2.mode = page2.tempMode;
//		page2.actionType = page2.tempAction;
//		page2.cursor = page2.tempCursor;
//		if (page2.callBackFunctionString!=null) callBackFunctionString = page2.callBackFunctionString;
//	} else if (ov2!=null) {
//		// overview request
//		f = ov2.document.forms[docFormID];
//		f.centerx.value = ov2.centerX;
//		f.centery.value = ov2.centerY;
//        if (eventArg==ov2.forcePostBackEvent)
//            forcePostBack = true;
//		if (ov2.callBackFunctionString!=null) callBackFunctionString = ov2.callBackFunctionString;
//	}  else
	 if (toolbar2!=null) {
		f = toolbar2.document.forms[docFormID];
		//find out if item supports client postback
		// ToDo: set up for forced postback
//		if (toolbar2.enableClientPostBack &&
//			(isForcePostBackTool(eventArg, toolbar2.buttonsSupportingClientPostBack)
//		  || eventArg == "resize" || eventArg == "drawtile") )
//			forcePostBack = true;
		if ((toolbar2.items[currentEventArg]!=null) && (toolbar2.items[currentEventArg].selectAutoPostBack))
			forcePostBack = true;
		if (toolbar2.callBackFunctionString!=null) callBackFunctionString = toolbar2.callBackFunctionString;
	} 	else if (toc2 !=null) {
		f = toc2.document.forms[docFormID];
		//enableClientPostBack = toc2.enableClientPostBack;
		if (toc2.callBackFunctionString!=null) callBackFunctionString = toc2.callBackFunctionString;
	} else {
		alert(control + " is not available or does not exist.");
		return false;
	}
	if (f.elements["PostBackMode"]!=null) f.PostBackMode.value = f.elements[control+"_mode"].value;
	//alert("forcePostBack=" + forcePostBack);
	if (forcePostBack) {
		__doPostBack(control, eventArg);
	} else {
		// send to ClientPostBack
		var querystring = createClientPostBackQueryString(control, eventArg);
		clientPostBack(querystring);
	}
	
	map2=null;
	page2=null;
	ov2=null;
	toolbar2=null;
	toc2=null;
}

function clientPostBack(querystring) {
	
	var argument = querystring;
	var context = activeControl + "," + currentEventArg;
	if (querystring!=null && querystring.length>0) {
		eval(callBackFunctionString);
		// Debug stuff to be removed, or at least commented out
		if (checkForFormElement(document, 0, "MapDebugBox")) document.forms[0].MapDebugBox.value += "PostBack Request: " + querystring + "\n";
	}
}

function delayedClientPostBack(argument, context, callbackString) {
    if (commonCallbackFree) {
        eval(callBackString);
// Debug stuff to be removed, or at least commented out
if (checkForFormElement(document, 0, "MapDebugBox")) document.forms[0].MapDebugBox.value += "PostBack Request: " + querystring + "\n";
        window.clearInterval(postBackInterval);
        commonCallbackFree = false;
    }

}

function postBackError(argument, context) {
	alert("An unhandled exception has occurred:\n" + argument);
}

function createClientPostBackQueryString(control, eventArg) {
	var s = "ControlID=" + control;
	s += "&EventArg=" + eventArg;
	var map2 = map;
	var ov2 = ov;
	var page2 = page;
	var map2 = Maps[control];
	var ov2 = Overviews[control];
	var page2 = Pages[control];
	var toolbar2 = Toolbars[control];
	var toc2 = Tocs[control];
	var f;
	if (map2!=null) {
	  f = map2.document.forms[docFormID];
		s += "&ControlType=Map&PageID=" + map2.pageID;
	} else if (ov2!=null) {
	  f = ov2.document.forms[docFormID];
		s += "&ControlType=OverviewMap&PageID=" + ov2.pageID;
	} else if (page2!=null) {
	  f = page2.document.forms[docFormID];
		s += "&ControlType=PageLayout&PageID=" + page2.pageID;
		s += "&dataframeIndex=" + page2.dataframeIndex;
	} else if (toolbar2!=null) {
	  f = toolbar2.document.forms[docFormID];
		s += "&ControlType=Toolbar&PageID=" + toolbar2.pageID;
	} else if (toc2!=null) {
	  f = toc2.document.forms[docFormID];
		s += "&ControlType=Toc&PageID=" + toc2.pageID;
	}
	
	if (f != null)
	{
	  var fieldList = f.elements["ESRIWebADFHiddenFields"].value;
	  var fields = fieldList.split(',');
	  var value;
	  for (var i= 0; i < fields.length; ++i)
	  {
	    if (f.elements[fields[i]] !=null)
	    {
	      value = f.elements[fields[i]].value;
	      if (value != null)
	        s += "&" + fields[i] + "=" + value;
	    }
	  }
	}
	
	map2=null;
	page2=null;
	ov2=null;
	toolbar2=null;
	toc2=null;
	//alert(s);
	return s;
}

// checks if tool is available for client postback
function isForcePostBackTool(tool,toolstring) {
	//alert("tool: " + tool + "\ntoolstring: " + toolstring);
	var hasIt = false;
	if (toolstring!=null && toolstring!="") {
		var toollist = toolstring.split(",");
		for (var i=0;i<toollist.length;i++) {
			if (toollist[i]==tool) {
				hasIt = true;
				break;
			}
		}
	}
	return hasIt;
}

function tocAutoLayerVisibility(e, tocID) {
	var o;
	if (isNav && e != null)
		o = e.target;
	else
    o = window.event.srcElement;
  if (o.tagName == 'INPUT' && o.type == 'checkbox' && o.name != null && o.name.indexOf('CheckBox') > -1)
	{
	    //alert(o.state);
        o.state = o.checked;
        var req = "EventArg=Toc&" + o.value + "&state=" + o.checked; 
        eval('CallServer_' + tocID + '(req,"");');
	}
}

function resizeContentsFunction(win){
    
	if (win.contentsObject!=null) {
		if (win.contentsObject.resize!=null) //map, overviewmap, pagelayout
			win.contentsObject.resize(win.width, win.height); 
	}
}

function checkForClientPostbackEventArgs(eventArg) {
	//retValue = false;
	for (var i=0;i<clientPostbackEventArgs.length;i++) {
		if (eventArg.toLowerCase().indexOf(clientPostbackEventArgs[i].toLowerCase())!=-1) return true;
	}
	return false;
}

//END ESRI.ArcGIS.ADF.Web.UI.WebControls.Runtime.JavaScript.display_dotnetadf.js
//START ESRI.ArcGIS.ADF.Web.UI.WebControls.Runtime.JavaScript.display_common.js
/*
COPYRIGHT 1995-2005 ESRI

TRADE SECRETS: ESRI PROPRIETARY AND CONFIDENTIAL
Unpublished material - all rights reserved under the 
Copyright Laws of the United States.

For additional information, contact:
Environmental Systems Research Institute, Inc.
Attn: Contracts Dept
380 New York Street
Redlands, California, USA 92373


email: contracts@esri.com
*/


//////////////////////// Common global variables ////////////////////////

// setup test for browser
var isNav = (window.navigator.appName.toLowerCase().indexOf("netscape")>=0);
var isIE = (Sys.Browser.agent == Sys.Browser.InternetExplorer)
var userAgent = navigator.userAgent;
var navType = "IE";
var nav70 = false;
var nav8 = false;
// get flavor of browser
switch(Sys.Browser.agent) {
	case Sys.Browser.InternetExplorer: 'IE'; break;
	case Sys.Browser.Firefox: navType = 'FireFox'; break;
	case Sys.Browser.Safari: navType = 'Safari'; break;
	case Sys.Browser.Opera: navType = 'Opera'; break;
	default: navType = 'Mozilla'; break;
}

// if IE, check for major versions
if (Sys.Browser.agent == Sys.Browser.InternetExplorer) {
    var ieVersion = Sys.Browser.version;
}

var doc = document;
var defaultImagePath = "/aspnet_client/ESRI/WebADF/images/";
var defaultStylePath = "/aspnet_client/ESRI/WebADF/styles/";
var esriBlankImagePath = "/aspnet_client/ESRI/WebADF/images/blank.gif";

// current coords
var mouseX = 0;
var mouseY = 0;

// saved zoom box coords
var x1 = 0;
var y1 = 0;
var x2 = 0;
var y2 = 0;
var x3 = 0;
var y3 = 0;
var lastX = 0;
var lastY = 0;

// zoom box variables
var zleft = 0;
var ztop = 0;
var zright = 0;
var zbottom = 0;

// obj's for Form Identifier
var docFormID = 0;

var leftButton =1;
var rightButton = 2;
if (isNav) {
	leftButton = 1;
	rightButton = 3;
}

var Maps = [];
var MapNames = [];
var map = null;
var lastmap = null;
var page = null;
var lastpage = null;
var pagemap = null;
var lastpagemap = null;
var mapCount = 0;
var pageCount = 0;
var dragbox = null;

var promptString = "";
var savedCursor = "pointer";

var eLeft = 0;
var eTop = 0;
var eWidth = 0;
var eHeight = 0;

var xMove = 0;
var yMove = 0;

var mapCount = 0;

var jumpToFinish = false;

var coordString = "";
//var statusString = "";
var controlType = "Map";

var Overviews = new Array();
var OverviewNames = new Array();
var ovCount = 0;
var ov = null;

//var Toolbars = new Array();
//var ToolbarGroups = new Array();
//var ToolbarName = new Array();

var Tocs = [];
var TocNames = [];

// popup window objects
var mapWindow = null;
var ovWindow = null;
var tocWindow = null;
var toolWindow = null;
var pageWindow = null;

// maptips objects
var MapTipCollections = [];
var MapTipCollectionNames = [];
var maptipHoverPanel = null;
var maptipExtendedPanels = [];
var maptips = null;
var maptip = null;
var mt_manager = null;
var maptipsActive = false;

var tempMouseMove = null;
var tempMouseUp = null;
var tempContent = "";
var tempStyle = "";

// dynamic stylesheet
var m_StyleSheet = null;
var m_ajaxMethodPrefix = "";
var m_ajaxMethods = null;

var callBackFunctionString = "";
var tileCallbackFunctionString = "";
if (identifyCallbackFunctionString==null)
    var identifyCallbackFunctionString = "";
if (overviewCallbackFunctionString==null)
    var overviewCallbackFunctionString = "";
if (vectorCallbackFunctionString==null)
    var vectorCallbackFunctionString = "";
var hasZoomLevel = false;
var webPageIsLoaded = false;

var commonCallbackFree = true;
var shiftPressed = false;
var ctrlPressed = false;
var altPressed = false;

var esriJavaScriptDecimalDelimiter = ((("theChar is" + (10/100)).indexOf("."))==-1) ? "," : "."; // get decimal delimiter used by JavaScript on user machine
if (typeof(esriSystemDecimalDelimiter)=="undefined") 
    esriSystemDecimalDelimiter = esriJavaScriptDecimalDelimiter;

function createLayer(name, inLeft, inTop, width, height, visible, content, classname, style, container) {
	var oStyle = 'position:absolute; overflow:hidden; left:' + inLeft + 'px; top:' + inTop + 'px; width:' + width + 'px; height:' + height + 'px;' + '  visibility:' + (visible ? 'visible;' : 'hidden;');
	var s = '<div id="' + name + '" style=" position:absolute; overflow:hidden; left:' + inLeft + 'px; top:' + inTop + 'px; width:' + width + 'px; height:' + height + 'px;' + '  visibility:' + (visible ? 'visible;' : 'hidden;');
	if (style!=null)  s += style;
	s += '"';
	if ((classname!=null) && (classname!=""))  s += ' class="' + classname + '"';
	s += '>';
	//s += content;
	//s += '</div>';
	if (container!=null) {
		var contObj = document.getElementById(container);
		contObj.innerHTML = s + content + '</div>';
	} else {
		//alert(s);
		var oDiv = document.createElement("div");
		oDiv.id = name;
		if (style!=null) oStyle += ";" + style;
		oDiv.style.cssText += oStyle;
		if (classname!=null) oDiv.className = classname;
		
		dragObj.innerHTML = content;
		document.body.appendChild(dragObj);		
	}
}

function addDiv(id, content, left, top, width, height, visible, style, className, parent) {
	// add a delay (window.setTimeout('addDiv()', 1000)) for IE if called during page creation 
	var oDiv = document.createElement("div");

	oDiv.id = id;

	if (left!=null) oDiv.style.left = left + "px";
	if (top!=null) oDiv.style.top = top + "px";
	if (width!=null) oDiv.style.width = width + "px";
	if (height!=null) oDiv.style.height = height + "px";
	if (className!=null) oDiv.className = className;
	if (style!=null) oDiv.style.cssText += "; " + style;
	if (oDiv.style.position==null) oDiv.style.position = "absolute";	
	oDiv.innerHTML = content;
	if(parent) { parent.appendChild(oDiv); }
	else { document.body.appendChild(oDiv);	 }
	if (visible!=null) oDiv.style.visibility = visible;	
}


function createLayer2(name, inLeft, inTop, width, height, visible, content, classname, style, container) {
	document.write('<div id="' + name + '" style=" position:absolute; overflow:hidden; left:' + inLeft + 'px; top:' + inTop + 'px; width:' + width + 'px; height:' + height + 'px;' + ';  visibility:' + (visible ? 'visible;' : 'hidden;'));
	if (style!=null) document.write(style);
	document.write('"');
	if ((classname!=null) && (classname!="")) document.write(' class="' + classname + '"');
	document.writeln('>');
	document.writeln(content);
	document.writeln('</div>');
}

// get the layer object called "name"
function getLayer(name) {
	var theObj = document.getElementById(name);
	if (theObj!=null) return theObj.style;
	  else return(null);
}

// set layer background color
function setLayerBackgroundColor(name, color) {
  	var layer = getLayer(name);
    layer.backgroundColor = color;
}

// set Div Z-ORDER
function setDivZOrder(name, zvalue)
{
	var layer = getLayer(name);
	layer.zIndex = zvalue;
}

// toggle layer to invisible
function hideLayer(name) {
  	var layer = getLayer(name);
   	if (layer!=null) layer.visibility = "hidden";
	return false;
}

// toggle layer to visible
function showLayer(name) {
  	var layer = getLayer(name);
   	if (layer!=null) layer.visibility = "visible";
	return false;
}

// move layer to x,y
function moveLayer(name, x, y) {		
  	var layer = getLayer(name);	
	if (layer!=null) {	
   		layer.left = x + "px";
		layer.top  = y + "px";
	}
	return false;
}

// replace layer's content with new content
function replaceLayerContent(name, content) {
	var theObj = document.getElementById(name);
	if (theObj!=null) {	  
		theObj.innerHTML = content;	
	}
}

// check to see if the specified div is visible
function isLayerVisible(name) {
	var layer = getLayer(name);
	if (layer!=null) {
		if (layer.visibility == "visible")  return(true);
	}
	return(false);
}



// get cursor location 
function getXY(e) {
	if (isNav) {
		mouseX=e.pageX;
		mouseY=e.pageY;
	} else {
		mouseX=event.clientX + (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft);
		mouseY=event.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
// Added to adjust to cursor hot spot in IE 
		mouseX-=3;
		mouseY-=3;
// Added to adjust to cursor hot spot in IE

	}
	return false;
}

// clip function for zoom box edges... 
function clipLayer(name, clipleft, cliptop, clipright, clipbottom) {
	var layer = getLayer(name);
	if (layer!=null) {
		var newWidth = clipright - clipleft;
		var newHeight = clipbottom - cliptop;
		layer.height = newHeight;
		layer.width	= newWidth;
		layer.top	= cliptop  + "px";
		layer.left	= clipleft + "px";
	}
	return false;

}

// add to dynamic style sheet
function addToDynamicStyleSheet(ruleKey, ruleValue) {
	if (isIE) {
		if (m_StyleSheet==null) 
			m_StyleSheet = document.createStyleSheet();
		m_StyleSheet.addRule(ruleKey, ruleValue);
	} else {
		if (m_StyleSheet==null) {
			m_StyleSheet = document.createElement("style");
			document.body.appendChild(m_StyleSheet);
		}
		m_StyleSheet.innerHTML += ruleKey + " {" + ruleValue + "}";
	}
}

function getWinWidth () {
	var mapFrameWidth = window.innerWidth;
	if (mapFrameWidth == null) {
		if (document.documentElement && document.documentElement.clientWidth)
			mapFrameWidth = document.documentElement.clientWidth
		else	
			mapFrameWidth = document.body.clientWidth;
	}
	return mapFrameWidth;
}

 //get the Map Image height
function getWinHeight () {
	var mapFrameHeight = window.innerHeight;
	if (mapFrameHeight == null) {
		if (document.documentElement && document.documentElement.clientHeight)
			mapFrameHeight = document.documentElement.clientHeight;
		else
			mapFrameHeight = document.body.clientHeight;
	}
	return mapFrameHeight;
}

function getElementWidth (element) {
    var width = element.clientWidth;
    while (width<10 && element != null) {
        element = element.offsetParent;
        if (element != null) width = element.clientWidth;
    }
    if (width==null || width<10) width = document.documentElement.clientWidth;
    
    return width;
}

function getElementHeight (element) {
    var height = element.clientHeight;
    while (height<10 && element != null) {
        element = element.offsetParent;
        if (element != null) height = element.clientHeight;
    }
    if (height==null || height<10) height = document.documentElement.clientHeight;
    return height;
}

function getParentWidth (element) {
    if (element.offsetParent != null && element.offsetParent.id.indexOf("FWin_") == 0)
    {
        var mapId = element.offsetParent.id.substring(5);
        var windowElement = document.getElementById("FWinContents_" + mapId);
        return windowElement.clientWidth;
    }
    var parElem = element.parentElement;
    var width = 0;
    while (width==0 && parElem != null) {
        width = parElem.clientWidth;
        parElem = parElem.parentElement;
    }
    if (width==null || width==0) width = document.documentElement.clientWidth;
    
    return width;
}
function getParentHeight (element) {
    if (element.offsetParent != null && element.offsetParent.id.indexOf("FWin_") == 0)
    {
        var mapId = element.offsetParent.id.substring(5);
        var windowElement = document.getElementById("FWinContents_" + mapId);
        return windowElement.clientHeight;
    }
    var parElem = element.parentElement;
    var height = 0;
    while (height==0 && parElem != null) {
        height = parElem.clientHeight;
        parElem = parElem.parentElement;
    }
    if (height==null || height==0) width = document.documentElement.clientHeight;
    
    return height;   
}

function getMapWidth (element)
{
    var width = 0;
    var outermostElement = null;

    if (element.offsetParent != null && element.offsetParent.id.indexOf("FWin_") == 0)
    {
        var mapId = element.offsetParent.id.substring(5);
        var windowElement = document.getElementById("FWinContents_" + mapId);
        return windowElement.clientWidth;
    }
    else if (element.id.indexOf("MapControlDiv_")==0) outermostElement = element.offsetParent.offsetParent;
    
    element = outermostElement;
    while (width == 0 && element != null)
    {
        if (element.width)
            width = element.width;
        else 
            width = element.clientWidth;
        //if (isIE) width += (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft);
        element = element.offsetParent;
    }
    if (width==null || width==0) width = document.documentElement.clientWidth; // + document.documentElement.scrollLeft;
    return width;
}		

function getMapHeight (element)
{
    var height = 0;
    var outermostElement = null;

    if (element.offsetParent != null && element.offsetParent.id.indexOf("FWin_") == 0)
    {
        var mapId = element.offsetParent.id.substring(5);
        var windowElement = document.getElementById("FWinContents_" + mapId);
        return windowElement.clientHeight;
    }
    else if (element.id.indexOf("MapControlDiv_")==0) outermostElement = element.offsetParent.offsetParent;
    
    element = outermostElement;
    while (height == 0 && element != null)
    {
        if (element.height)
            height = element.height;
        else
            height = element.clientHeight;
        //if (isIE) hight += (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
        element = element.offsetParent;
    }
    if (height==null || height==0) height = document.documentElement.clientHeight; // + document.documentElement.scrollTop;
    return height;
}		

// get which mouse button was pressed
function isLeftButton(e) {
	var theButton= 0;
	var isLeft = false;
	// get the button pushed... if right, ignore... let browser do the popup... it will anyway
	if (isNav) {
		theButton = e.which;
	} else {
		theButton = window.event.button;
	}	
	if (theButton==leftButton) isLeft = true;
	
	return isLeft;
}

// find out if shift, ctrl, or alt keys are pressed
function checkShiftCtrlAltKeys(e) {
    if (isIE) 
        e = event;
    shiftPressed = e.shiftKey;
    ctrlPressed = e.ctrlKey;
    altPressed = e.altKey;
}


// converts color string from Netscape/Mozilla div backgrounds... 
// returned as 'rgb(r g b)'... converted to hex string
function convertNSrgb(color) {
	var h = color;
	if (h.indexOf("rgb")!=-1) {
		// netscape gets "rgb(r, g, b)", so convert to hex
		var re = /%20/gi;
		var h2 = h.replace(re, "");
		endpos = h2.indexOf(")");
		var h3 = h2.substring(4,endpos);
		var ha = h3.split(",");
		var r = parseInt(ha[0]).toString(16);
		if (r.length==1) r = "0" + r;
		var g = parseInt(ha[1]).toString(16);
		if (g.length==1) g = "0" + g;
		var b = parseInt(ha[2]).toString(16);
		if (b.length==1) b = "0" + b;
		color = r + g + b;
		//alert(color);
	}
	return color;
}

function calcElementPosition(elementId) {
	//window.status = elementId;
	var element = document.getElementById(elementId);
	eLeft = 0;
    eTop = 0;
    var eLeftBorder, eTopBorder;
	//eWidth = parseInt(element.style.width);
	//eHeight = parseInt(element.style.height);
	eWidth = element.clientWidth;
	eHeight = element.clientHeight;
    while(element != null) {
		eLeftBorder = 0;
		eTopBorder = 0;
        eLeft += element.offsetLeft;
        eTop += element.offsetTop;
        if (element!=document.documentElement) {
            eLeft -= element.scrollLeft;
            eTop -= element.scrollTop;
        }  
        if (element.style.borderWidth!="") {
			eLeftBorder = parseInt(element.style.borderWidth);
			eTopBorder = parseInt(element.style.borderWidth);
		} else if (element.style.borderLeftWidth!="") {
			eLeftBorder = parseInt(element.style.borderLeftWidth);
			eTopBorder = parseInt(element.style.borderTopWidth);
		}							
		if (isNaN(eLeftBorder)) eLeftBorder = 0;
		if (isNaN(eTopBorder)) eTopBorder = 0;
		eLeft += eLeftBorder;
		eTop += eTopBorder;
        element = element.offsetParent;
     }
	 return new RectangleObject("dummy", eLeft, eTop, eWidth, eHeight);
}

function checkForFormElement(mapdoc, formId, elemName) {
	var hasIt = false;
	if (mapdoc.forms[formId].elements[elemName] != null) hasIt = true;
	return hasIt;
}

function resizeElement(ElementId, width, height) {
	var div = document.getElementById(ElementId);
	if (div!=null) {
		if (width!=null) div.style.width = width + "px";
		if (height!=null) div.style.height = height + "px";
	}
}

function remainder(num1, num2) {
	var nfloor = Math.floor(num1 / num2);
	var ftotal = nfloor * num2;
	return(num1 - ftotal);
}


///////////////////////////////////// Common functions /////////////////////////////////////

///////////////////////////////////// Common objects ///////////////////////////////////////

	SimpleObject = function(id) {		
		this._id = this.id = id;		
	}
	SimpleObject.prototype = {
		get_id : function() {
			return this._id;
		}
	}
	SimpleObject.registerClass('SimpleObject');
	
	RectangleObject = function(id, left, top, width, height) {
		RectangleObject.initializeBase(this,[id]);
		//inheritsFrom(new SimpleObject(id), this);
		this.left = left;
		this.top = top;
		this.width = width;
		this.height = height;
	}
	RectangleObject.registerClass('RectangleObject',SimpleObject);
	
	PageElementObject = function(id, left, top, width, height) {
		//inheritsFrom(new RectangleObject(id, left, top, width, height), this);
		PageElementObject.initializeBase(this,[id, left, top, width, height]);
		this.left = left;
		this.top = top;
		this.width = width;
		this.height = height;
		
		this.divId = "";
		this.divObject = null;
		this.document = document;
		this.cursor = "default";
		
		//this.createDivs = null;
	}
	PageElementObject.prototype = {
		show : function() { this.divObject.display=''; },
		hide : function() { this.divObject.display='none'; },
		createDivs : null
	}
	PageElementObject.registerClass('PageElementObject',RectangleObject);
	
	function ControlObject(id, controlType, left, top, width, height) {
		ControlObject.initializeBase(this,[id, left, top, width, height]);
		//inheritsFrom(new PageElementObject(id, left, top, width, height), this);
		this.controlType = controlType;
		this.controlName = id;
		this.mode = "";
		
		this.pageLeft = 0;
		this.pageTop = 0;
		this.xMin = 0;
		this.yMin = 0;
		this.xMax = 0;
		this.yMax = 0;
		this.coords = "";
		
		this.clientAction = "";
		this.actionType = "";
		
		this.pageID = "";
		this.enableClientPostBack = false;
		this.buddyControls = "";
		this.toolsForcingPostback = "";
		
		this.resetDisplay = null;		
	}
	ControlObject.prototype = {
		resize : function(width, height) {
			this.width = width;
			this.height = height;
		},
		setObjects : null,
		setTool : null
	}
	ControlObject.registerClass('ControlObject',PageElementObject);
	// 



var winWidth = getWinWidth();
var winHeight = getWinHeight();

//////////////////////// IE functionality for Mozilla/Netscape ///////////////////////////////
	// make Mozilla browsers emulate IE's node/element functionality
if (isNav) {
	Element.prototype.contains = function(element){
		var range=document.createRange();
		range.selectNode(this);
		return range.compareNode(element)==3;
	}
	
	Element.prototype.applyElement = function(element, where){
		if(!element.splitText){
			element.removeNode();
			if(where && where.toLowerCase()=="inside"){
				for(var i=0;i<this.childNodes.length;i++){
					element.appendChild(this.childNodes[i])
				}
				this.appendChild(element)
			}else{
				var parent_Node=this.parentNode;
				parent_Node.insertBefore(element,this);
				element.appendChild(this);
			}
			return element;
		}
	}

	Element.prototype.insertAdjacent=function(where, element){
		var parent_Node=this.parentNode;
		switch(where.toLowerCase()) {
			case "beforebegin":
				parent_Node.insertBefore(element,this);
				break;
			case "afterend":
				parent_Node.insertBefore(element,this.nextSibling);
				break;
			case "afterbegin":
				this.insertBefore(element,this.childNodes[0]);
				break;
			case "beforeend":
				this.appendChild(element);
				break;
		}
	}
		
	Element.prototype.insertAdjacentText = function(where, text){
		var text_Node=document.createTextNode(text||"")
		this.insertAdjacent(where, text_Node);
	}
	
	Element.prototype.insertAdjacentHTML = function(where, html){
		var range=document.createRange();
		range.selectNode(this);
		var fragment=range.createContextualFragment(html);
		this.insertAdjacent(where, fragment);
	}

	Element.prototype.insertAdjacentElement = function(where,element){
		this.insertAdjacent(where,element);
		return a2;
	}

//	Node.prototype.removeNode = function (node){
//		var parent_Node=this.parentNode;
//		if(parent_Node && !node){
//			var fragment=document.createDocumentFragment();
//			for(var i=0;i<this.childNodes.length;i++){
//				fragment.appendChild(this.childNodes[i])
//			}
//			parent_Node.insertBefore(fragment,this)
//		}
//		return parent_Node ? parent_Node.removeChild(this):this;
//	}

    Node.prototype.removeNode = function( removeChildren ) {
	    var self = this;
	    if ( Boolean( removeChildren ) )
	    {
		    return this.parentNode.removeChild( self );
	    }
	    else
	    {
		    var range = document.createRange();
		    range.selectNodeContents( self );
		    return this.parentNode.replaceChild( range.extractContents(), self );
	    }
    }

	Node.prototype.replaceNode = function (node){
		return this.parentNode.replaceChild(node,this)
	}

	Node.prototype.swapNode=function(node){
		var parent_Node=node.parentNode;
		var next_Sibling=node.nextSibling;
		this.parentNode.replaceChild(node,this);
		parent_Node.insertBefore(this, next_Sibling)
		return this;
	}

    // outerHTML implementation
    var _emptyTags = {
       "IMG":   true,
       "BR":    true,
       "INPUT": true,
       "META":  true,
       "LINK":  true,
       "PARAM": true,
       "HR":    true
    };

    HTMLElement.prototype.__defineGetter__("outerHTML", function () {
       var attrs = this.attributes;
       var str = "<" + this.tagName;
       for (var i = 0; i < attrs.length; i++)
          str += " " + attrs[i].name + "=\"" + attrs[i].value + "\"";

       if (_emptyTags[this.tagName])
          return str + ">";

       return str + ">" + this.innerHTML + "</" + this.tagName + ">";
    });

    HTMLElement.prototype.__defineSetter__("outerHTML", function (sHTML) {
       var r = this.ownerDocument.createRange();
       r.setStartBefore(this);
       var df = r.createContextualFragment(sHTML);
       this.parentNode.replaceChild(df, this);
    });

}


function addEvent(obj, eventName, funct) {
    if (obj.addEventListener) {
        obj.addEventListener(eventName, funct, false); 
        return true;
    } else if (obj.attachEvent) {
        var att = obj.attachEvent("on" + eventName, funct);
        if (!att) alert("Unable to add " + eventName + " event to " + obj.id);
        return att;
    } else {
        alert("Unable to add " + eventName + " event to " + obj.id);
        return false;
    }        
}

function removeEvent(obj, eventName, funct) {
    if (obj.removeEventListener) {
        obj.removeEventListener(eventName, funct, false);
        return true;
    } else if (obj.attachEvent) {
        return obj.detachEvent("on" + eventName, funct);
    } else {
        return false;
    }
}


/*
////////////////////////////// Pre 9.2 function support ////////////////////////////////
// Functions with 9.1 names, calling 9.2 functionality... 
// For support of projects created prior to 9.2
// These functions are called by 9.1 MapViewer Template Identify
/////////////////////////////////////////////////////////////////////////////////////////

function getMapDiv(e) {
	map = getSelectedMapObject(e);
}

function ShowLoading() {
	if (map!=null) {
		if (map.loadingObject!=null) map.loadingObject.show();
	}
	if (page!=null) {
		if (page.loadingObject!=null) page.loadingObject.show();	
	} 
}

function HideLoading() {
	if (map!=null) {
		if (map.loadingObject!=null) map.loadingObject.hide();
	}
	if (page!=null) {
		if (page.loadingObject!=null) page.loadingObject.hide();	
	}
}

function adjustMapCoords() {
	zleft = mouseX - map.pageLeft;
	ztop = mouseY - map.pageTop;
	map.xMin=zleft;
	map.yMin=ztop;
	return null;
}
*/

////////////////////////////// Common Timing functions ////////////////////////////////
// 
/////////////////////////////////////////////////////////////////////////////////////////

var lastResponseReceivedTime = new Date();
var maximumLapseTime = 10; // Change this value to session timeout in minutes


// function executed when page is loaded... other functions can check webPageIsLoaded if necessary before executing
function webPageLoaded() {
    webPageIsLoaded = true;
}

// function that does nothing... used in required hyperlinks such as in treeview so page won't refresh
    // called in link as "javascript: doNothing();"
function doNothing() {
    // nothing happening here
}

// function that gets the elapsed time between requests... so client knows when the server code will not respone anymore
function getSessionLapse() {
    var now = new Date();
    var last = lastResponseReceivedTime;
    var diff = Math.floor((now.getTime() - last.getTime()) / (1000 * 60));
    return diff;
}

// function that resets the global laspe start time
function setSessionLapse() {
    lastResponseReceivedTime = new Date();
}

// function that displays an alert indicating session has lapsed
function showLapseAlert() {
    alert("Session has timed out from extended inactivity. A new session must be started to use this application by closing this browser and reopening.");
}

function switchImageSourceAndAlphaBlend(imgElement, newSource, forcePng)
{
    if (forcePng==null) forcePng = false;
    if (imgElement!=null)
    {
        if (ESRI.ADF.System.__isIE6)
        {
            var imageUrl=newSource;
            var imageType=imageUrl.substr(imageUrl.length-3,3);
            if (imageType=="png" || forcePng){
			    if (imgElement.runtimeStyle.filter.indexOf("DXImageTransform.Microsoft.AlphaImageLoader")> -1) {
				    imgElement.filters['DXImageTransform.Microsoft.AlphaImageLoader'].src = newSource;
                }
			    else {
			        imgElement.runtimeStyle.filter += "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + newSource + "',sizingMethod='image');";
					imgElement.src = esriBlankImagePath;
				}
			}
			else {
			    imgElement.src=newSource;
			}
        }
        else
        {
            imgElement.src=newSource;
        }
    }
}
/*
function iframeHideWorkaroundForVML()
{
        if (isIE && ieVersion < 7)
        {
            var iframes=document.getElementsByTagName("iframe");
            if (iframes==null)return;
            for (var i=0;i<iframes.length;i++)
            {
                var iframe=iframes[i];
                if (iframe==null)continue;
                if (iframe.style.hiddenForIE6==null)
                {
                    if (iframe.style.visibility!=null) iframe.style.hiddenForIE6=new String(iframe.style.visibility.toString());
                    iframe.style.visibility='hidden';
                }
           } 
        }
}

function iframeShowWorkaroundForVML()
{
        if (isIE && ieVersion < 7)
        {
            var iframes=document.getElementsByTagName("iframe");
            if (iframes==null)return;
            for (var i=0;i<iframes.length;i++)
            {
                var iframe=iframes[i];
                if (iframe==null)continue;
                if (iframe.style.hiddenForIE6!=null)
                {
                    iframe.style.visibility=iframe.style.hiddenForIE6;
                    iframe.style.hiddenForIE6=null; 
                }
           } 
        }
}

var commonLoaded = true;
*/
function setElementDisplayStyle(id, style)
{
    var elem = document.getElementById(id);
    if (elem != null)
        elem.style.display = style;
}

function expandCollapseElement(expandCollapseImageId, elementId, collapsedImage, expandedImage)
{
    var elem = document.getElementById(elementId);
    var src;
    if (elem != null)
    {
        if (elem.style.display == "none") //collapsed; so expand
        {
            elem.style.display = "block";
            src = expandedImage; 
        }
        else//expanded; so collapse
        {
            elem.style.display = "none";
            src = collapsedImage; 
        }
       if (expandCollapseImageId != null)
        { 
            var image = document.getElementById(expandCollapseImageId);
            if (image != null)
                image.src = src;
        } 
    }
}

function enableDisableElements(enableIds, disableIds)
{
    var element = null;
    if (enableIds != null)
    { 
        var enableArray = enableIds.split(',');
        if (enableArray != null && enableArray.length >0)
        {
            for(var i=0;i<enableArray.length;++i)
            {
                element = document.getElementById(enableArray[i]);
                if (element != null)
               { 
                    element.disabled = false;
                    element.style.color = "";
               } 
            } 
        } 
    } 
    if (disableIds != null)
    { 
        var disableArray = disableIds.split(',');
        if (disableArray != null && disableArray.length >0)
        {
            for(var i=0;i<disableArray.length;++i)
            {
                element = document.getElementById(disableArray[i]);
                if (element != null)
               { 
                    element.disabled = true;  
                    element.style.color = "Gray"; //spans(labels) cannot be disabled in Mozilla.  They have to be grayed out.
               } 
            } 
        } 
    }        
}

function addScriptTag(id, type, language, src, defer, charset, content)
{
    var scriptObj = document.createElement("script");
    // Add script object attributes
    if (id != null) scriptObj.setAttribute("id", id);
    if (type != null) scriptObj.setAttribute("type", type);
    if (charset != null) scriptObj.setAttribute("charset", charset);
    if (src != null) scriptObj.setAttribute("src", src);
    if (language != null) scriptObj.setAttribute("language", language);
    if (defer != null) scriptObj.setAttribute("defer", defer);
   if (content != null) scriptObj.text = content; 
    var headLoc = document.getElementsByTagName("head").item(0);
    headLoc.appendChild(scriptObj);
}
//END ESRI.ArcGIS.ADF.Web.UI.WebControls.Runtime.JavaScript.display_common.js
//START ESRI.ArcGIS.ADF.Web.UI.WebControls.Runtime.JavaScript.ESRI.ADF.System.release.js
//----------------------------------------------------------
// Copyright (C) ESRI. All rights reserved.
//----------------------------------------------------------
Type.registerNamespace('ESRI.ADF.System');ESRI.ADF.System.addMouseWheelHandler = function(element, handler, handlerOwner) {
if (typeof(handler) !== 'function') { throw Error.invalidOperation(Sys.Res.cantAddNonFunctionhandler);}
if(handlerOwner) {
handler = Function.createDelegate(handlerOwner, handler);}
if(Sys.Browser.agent===Sys.Browser.InternetExplorer || Sys.Browser.agent===Sys.Browser.Safari || Sys.Browser.agent===Sys.Browser.Opera) {
var fnc = Function.createDelegate(handlerOwner, function (sender) { return handler.call(element, ESRI.ADF.System.addMouseWheelHandler._convertWheelEventIE(sender));});$addHandler(element, "mousewheel",fnc);}
else if(element.addEventListener) {
var fnc = Function.createDelegate(handlerOwner, function (sender) { return handler.call(element, ESRI.ADF.System.addMouseWheelHandler._convertWheelEventMozilla(sender));});$addHandler(element, "DOMMouseScroll", fnc);} 
}
ESRI.ADF.System.addMouseWheelHandler._convertWheelEventIE = function(sender) {
sender.type = 'mousewheel';sender.wheelDelta = sender.rawEvent.wheelDelta;sender.preventDefault();sender.stopPropagation();return sender;};ESRI.ADF.System.addMouseWheelHandler._convertWheelEventMozilla = function(sender) {
sender.type = 'mousewheel';sender.wheelDelta = -sender.rawEvent.detail*40;sender.screenX = sender.rawEvent.screenX;sender.screenY = sender.rawEvent.screenY;sender.clientX = sender.rawEvent.pageX;sender.clientY = sender.rawEvent.pageY;sender.offsetX = sender.rawEvent.layerX;sender.offsetY = sender.rawEvent.layerY;sender.preventDefault();sender.stopPropagation();return sender;};ESRI.ADF.System._makeMouseEventRelativeToElement = function(evt,element,location) {
var e = evt;if(e.target && element && element!==e.target)
{ 
e = {};for(var idx in evt) e[idx] = evt[idx];if(!location) { location = Sys.UI.DomElement.getLocation(element);}
if(Sys.Browser.agent===Sys.Browser.InternetExplorer) {
if(e.target.parentNode===document.body) { e.target = document.body;}
e.offsetX = evt.screenX-window.screenLeft-location.x+document.documentElement.scrollLeft - 2;e.offsetY = evt.screenY-window.screenTop-location.y+document.documentElement.scrollTop - 2;}
else {
var eventLocation = Sys.UI.DomElement.getLocation(e.target);var diffX = eventLocation.x-location.x;var diffY = eventLocation.y-location.y;e.offsetX += diffX;e.offsetY += diffY;}
e.target = element;}
return e;};ESRI.ADF.System._templateBinderAttrRegEx = new RegExp("{@.*?}","g")
ESRI.ADF.System._templateBinderEvalRegEx = new RegExp("{eval(.*?)}","g");ESRI.ADF.System.templateBinder = function(dataItem,template) {
if(!template) { return '';}
var str = template;for(var idx in dataItem){
var re = new RegExp("{@" + idx + "}","g");str = str.replace(re,dataItem[idx]);}
var evalRe = new RegExp("\\{eval\\((.*?)\\)\\}", "g");var myArray = str.match(evalRe);if(myArray != null){
for(var idx=0;idx<myArray.length;idx++){
var result = eval(myArray[idx].replace(evalRe,"$1"));str = str.replace(myArray[idx],result);}
}
return str;};ESRI.ADF.System.arrayTemplateBinder = function(dataItems,itemTemplate,headerTemplate,footerTemplate,separatorTemplate,alternatingItemTemplate) {
var str = '';if(headerTemplate) str += headerTemplate;for(var idx=0;idx<dataItems.length;idx++) {
var dataItem = dataItems[idx];if(alternatingItemTemplate && idx%2==1)
str += ESRI.ADF.System.templateBinder(dataItem,alternatingItemTemplate);else
str += ESRI.ADF.System.templateBinder(dataItem,itemTemplate);if(separatorTemplate && idx<dataItems.length-1) str += separatorTemplate;}
if(footerTemplate) str += footerTemplate;return str;};ESRI.ADF.System.setOpacity = function(element,value) {
if (!element) { return;}
var filters = null;if(element.runtimeStyle) { filters = element.runtimeStyle.filter;}
if (filters!=null) {
var createFilter = true;if (filters.length !== 0) {
if(filters.indexOf('progid:DXImageTransform.Microsoft.Alpha')>-1) {
var filter = element.filters['DXImageTransform.Microsoft.Alpha'];if(value===1) {
var pngFilter = (ESRI.ADF.System.__isIE6?element.filters['progid:DXImageTransform.Microsoft.AlphaImageLoader']:null);element.runtimeStyle.filter = '';if(pngFilter) {ESRI.ADF.System.setIEPngTransparency(element,pngFilter.src,pngFilter.sizingMethod==='image',element.format);}
}
else {
filter.opacity = value * 100;filter.enabled = true;}
createFilter = false;}
}
if (createFilter && value!==1) {
element.runtimeStyle.filter += 'progid:DXImageTransform.Microsoft.Alpha(opacity=' + (value * 100) + ')';}
}
else {
element.style.opacity = value;}
};ESRI.ADF.System.setIEPngTransparency = function(img,src,noscale,format) {
if(ESRI.ADF.System.__isIE6 && img && img.tagName==='IMG') {
var srcLC = (format?'.'+format:src).toLowerCase();if(srcLC.endsWith('.gif') || srcLC.endsWith('.jpg') || format && !format.toLowerCase().startsWith('png')) { 
if (img.runtimeStyle.filter.indexOf("DXImageTransform.Microsoft.AlphaImageLoader")> -1) {
var opacityFilter = img.filters['DXImageTransform.Microsoft.Alpha'];img.runtimeStyle.filter = '';if(opacityFilter) ESRI.ADF.System.setOpacity(img,opacityFilter.opacity/100);}
img.src = src;}
else {
if (img.runtimeStyle.filter.indexOf("DXImageTransform.Microsoft.AlphaImageLoader")> -1) {
img.filters['DXImageTransform.Microsoft.AlphaImageLoader'].src = src;img.filters['DXImageTransform.Microsoft.AlphaImageLoader'].enabled = true;img.filters['DXImageTransform.Microsoft.AlphaImageLoader'].sizingMethod = (noscale?'image':'scale');img.format = format;}
else {
img.runtimeStyle.filter += "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "',sizingMethod='"+(noscale?'image':'scale')+"');";img.src = esriBlankImagePath;}
}
}
};ESRI.ADF.System.__isIE6 = (Sys.Browser.agent === Sys.Browser.InternetExplorer && Sys.Browser.version<7)
ESRI.ADF.System.ContentAlignment = function() {
throw Error.invalidOperation();};ESRI.ADF.System.ContentAlignment.prototype = {
TopLeft : 1,
TopCenter : 2,
TopRight : 4,
MiddleLeft : 16,
MiddleCenter : 32,
MiddleRight : 64,
BottomLeft : 256,
BottomCenter : 512,
BottomRight : 1024
};ESRI.ADF.System.ContentAlignment.registerEnum("ESRI.ADF.System.ContentAlignment", false);__esriDoPostBack = ESRI.ADF.System.__DoPostBack = function(uniqueId, clientId, argument, clientCallback, context) {
var status = Sys.WebForms.PageRequestManager.getInstance().get_isInAsyncPostBack();if(status) {
if(!ESRI.ADF.System._postBackQueue) { ESRI.ADF.System._postBackQueue = [];}
var fnc = Function.createDelegate(this, function() { ESRI.ADF.System.__DoPostBack(uniqueId, clientId, argument, clientCallback, context) });Array.add(ESRI.ADF.System._postBackQueue,fnc);}
else {
if(clientCallback) {
var _fncLoading = function(sender, args) {
Sys.WebForms.PageRequestManager.getInstance().remove_pageLoading(_fncLoading);clientCallback(sender, args, clientId, context);}
Sys.WebForms.PageRequestManager.getInstance().add_pageLoading(_fncLoading);}
__doPostBack(uniqueId, argument);}
};ESRI.ADF.System._checkQueue = function() {
if(ESRI.ADF.System._postBackQueue && ESRI.ADF.System._postBackQueue.length>0) {
var fnc = ESRI.ADF.System._postBackQueue[0];Array.removeAt(ESRI.ADF.System._postBackQueue,0);fnc();}
};if(Sys.WebForms) {
Sys.Application.add_init(function() {
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(ESRI.ADF.System._checkQueue);});};ESRI.ADF.System.ProcessMSAjaxCallbackResult = function(sender, args, controlId, context) {
var dataItems = args.get_dataItems();if(dataItems[controlId])
ESRI.ADF.System.processCallbackResult(dataItems[controlId],context);};ESRI.ADF.System._doCallback = function(callbackFunctionString, uniqueID, id, argument, context) {
if(ESRI.ADF.System.checkSessionExpired()) return;if(callbackFunctionString && !callbackFunctionString.startsWith('__esriDoPostBack'))
{
if(callbackFunctionString) {
window.setTimeout(Function.createDelegate(context,function() { eval(callbackFunctionString) }),0);}
}
else {
ESRI.ADF.System.__DoPostBack(uniqueID, id, argument, ESRI.ADF.System.ProcessMSAjaxCallbackResult, context);}
};ESRI.ADF.System.__epsilon = 1E-12;processCallbackResult = ESRI.ADF.System.processCallbackResult = function(response, context) {
if(!response) { return;}
var results=[];if(response.startsWith('///:::')) { 
var pairs = response.split("^^^");for (var k=0;k<pairs.length;k++) {
var item = pairs[k];if (item===null || item.length===0) { continue;} 
var actions = item.split(":::");if(actions.length<3) { continue;}
var type = actions[0].toLowerCase();var cntlID = actions[1];var actn = actions[2].toLowerCase();var pars = [];for(var j=3;j<actions.length;j++) {
Array.add(pars,actions[j]);}
Array.add(results,{"id":cntlID,"type":type,"action":actn,"params":pars});}
}
else { 
try { results = eval(response);}
catch(ex) {
Sys.Debug.trace('Failed to process page response: "' + response + '"');return;} 
}
ESRI.ADF.System.resetSessionLapse();var validResponse = false;for (var idx=0;idx<results.length;idx++)
{ 
var result = results[idx];var controlID = result.id;var controlType = result.type;var obj = null;if(controlID) { obj = $find(controlID);}
var action = result.action.toLowerCase();var params = result.params;if(action==='javascript') {
var method = function() {
try { eval(params[0]);}
catch(ex) { Sys.Debug.trace('CallbackResult[javascript]: Could not evaluate JavaScript: ' + params[0] +'\\n' + ex.name+' (' + ex.number + '):\\n' + ex.message);}
};if(obj || context) {
Function.createDelegate(obj?obj:context,method)();}
else { method();}
validResponse = true;continue;}
else if (action==="content") {
var o = $get(controlID);if (o) { o.outerHTML=params[0];}
else { Sys.Debug.trace('CallbackResult[content]: Element "' + controlID + '" not found');} 
validResponse = true;continue;}
else if (action==="innercontent") {
var o2 = $get(controlID);if (o2) { o2.innerHTML=params[0];validResponse = true;}
else { Sys.Debug.trace('CallbackResult[innercontent]: Element "' + controlID + '" not found');}
continue;}
else if (action==="image")
{
var o3 = $get(controlID);if (o3) { o3.src = params[0];}
else { Sys.Debug.trace('CallbackResult[image]: Image element "' + controlID + '" not found');}
validResponse = true;continue;}
else if (action==="set")
{
if(obj) {
var properties = params[0];if(String.isInstanceOfType(params[0])) {
properties = eval('('+params[0]+')');}
for(var name in properties) {
var val = properties[name];var setter = obj["set_" + name];if (setter && typeof(setter) === 'function') { setter.apply(obj, [val]);}
else { obj.name = val;}
}
}
else { Sys.Debug.trace('CallbackResult[set]: Component "' + controlID + '" not found');}
validResponse = true;continue;}
else if (action==='invoke') {
var method = null;var methodname = params[0];if(obj) { 
method = obj[methodname];}
else if(!controlID) { 
try { method = eval('('+methodname+')');}
catch(ex) { }
}
else {
Sys.Debug.trace('CallbackResult[invoke]: Component "' + controlID + '" not found');continue;}
if(method && typeof(method) == 'function') {
var args = params[1];if(args) {
if(Array.isInstanceOfType(args)) { method.apply(obj,args);}
else { method.apply(obj,[args]);}
}
else { method.apply(obj);}
}
else { Sys.Debug.trace('CallbackResult[invoke]: Invalid method "' + (controlID?controlID+'.':'')+methodname + '"');}
validResponse = true;continue;}
else if (action=='include') {
var id = params[0];var elm = (id?$get(id):null);if(elm) { elm.parentNode.removeChild(elm);}
elm=null;var src = params[1];var tagname = params[2];var type = params[3];var language = params[4];elm = document.createElement(tagname);if(id) { elm.id = id;}
if(tagname==='link') { elm.href = src;}
else { elm.src = src;}
if(type) { 
elm.type = type;if(type==='text/css') { elm.rel = 'stylesheet';}
}
if(language) { elm.language = language;}
document.getElementsByTagName('head').item(0).appendChild(elm);validResponse = true;continue;}
else if(obj && obj.processCallbackResult) {
validResponse = obj.processCallbackResult(result.action,params);if (obj._cancelled) {
obj._cancelled = false;return;}
continue;}
if(!validResponse) {
Sys.Debug.trace('CallbackResult action "' + action+ '" couldn\'t be processed.');}
}
if (validResponse)
{
lastResponseReceivedTime=new Date();}
};Type.registerNamespace('ESRI.ADF.UI.__DomEvent');ESRI.ADF.UI.__DomEvent = function(e) {
var target = e.target ? e.target : e.srcElement;if ((target !== window) && (target !== document) &&
!(window.HTMLElement && (target instanceof HTMLElement)) &&
(typeof(target.nodeName) !== 'string')) {
e.target = document.body;}
if(target.parentNode==null) return;ESRI.ADF.UI.__DomEvent.initializeBase(this, [e]);};ESRI.ADF.UI.__DomEvent.registerClass('ESRI.ADF.UI.__DomEvent',Sys.UI.DomEvent);ESRI.ADF.UI.__DomEvent.__addHandler = function (element, eventName, handler) {
if (!element._events) {
element._events = {};}
var eventCache = element._events[eventName];if (!eventCache) {
element._events[eventName] = eventCache = [];}
var browserHandler;if (element.addEventListener) {
browserHandler = function(e) {
return handler.call(element, new ESRI.ADF.UI.__DomEvent(e));}
element.addEventListener(eventName, browserHandler, false);}
else if (element.attachEvent) {
browserHandler = function() {
return handler.call(element, new ESRI.ADF.UI.__DomEvent(window.event));}
element.attachEvent('on' + eventName, browserHandler);}
eventCache[eventCache.length] = {handler: handler, browserHandler: browserHandler};};ESRI.ADF.System.__getAbsoluteMousePosition = function(e) {
var mouseX = 0;var mouseY = 0;if(e && typeof(e.pageX)!=='undefined' && typeof(e.pageY)!=='undefined') {
mouseX=e.pageX;mouseY=e.pageY;}
else {
e = window.event;mouseX=event.clientX + (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft);mouseY=event.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);}
return {"mouseX":mouseX,"mouseY":mouseY};};ESRI.ADF.System.__lastResponseRecievedTime = new Date();ESRI.ADF.System.__sessionExpired = false;ESRI.ADF.System.checkSessionExpired = function() {
var now = new Date();var last = ESRI.ADF.System.__lastResponseRecievedTime;var diff = Math.floor((now.getTime() - last.getTime()) / (1000 * 60));if(!ESRI.ADF.System.maximumLapseTime) { return false;} 
var hasExpired = (diff>=ESRI.ADF.System.maximumLapseTime);if(hasExpired && !ESRI.ADF.System.__sessionExpired) { 
ESRI.ADF.System.__sessionExpired = true;ESRI.ADF.System.showLapseAlert();}
return hasExpired;};ESRI.ADF.System.resetSessionLapse = function () {
ESRI.ADF.System.__lastResponseRecievedTime = new Date();};ESRI.ADF.System.showLapseAlert = function() {
alert("Session has timed out from extended inactivity. A new session must be started to use this application by closing this browser and reopening.");};ESRI.ADF.System.escapeForCallback = function(toEscape) {
if (toEscape) 
{
toEscape = toEscape.replace(/&/g, "__amp__");}
return toEscape;};if (typeof(Sys) !== 'undefined') { Sys.Application.notifyScriptLoaded();}

//END ESRI.ArcGIS.ADF.Web.UI.WebControls.Runtime.JavaScript.ESRI.ADF.System.release.js
//START ESRI.ArcGIS.ADF.Web.UI.WebControls.Runtime.JavaScript.ESRI.ADF.Animations.release.js
//----------------------------------------------------------
// Copyright (C) ESRI. All rights reserved.
//----------------------------------------------------------
Type.registerNamespace('ESRI.ADF.Animations');ESRI.ADF.Animations.ParallelAnimation = function(target, duration, fps, animations) {
ESRI.ADF.Animations.ParallelAnimation.initializeBase(this, [target, duration, fps, animations]);}
ESRI.ADF.Animations.ParallelAnimation.prototype = {
_onTimerTick : function() {
ESRI.ADF.Animations.ParallelAnimation.callBaseMethod(this, '_onTimerTick');var handler = this.get_events().getHandler('tick');if (handler) { handler(this);}
},
add_tick : function(handler) {
this.get_events().addHandler('tick', handler);},
remove_tick : function(handler) { this.get_events().removeHandler('tick', handler);}
}
ESRI.ADF.Animations.ParallelAnimation.registerClass('ESRI.ADF.Animations.ParallelAnimation', AjaxControlToolkit.Animation.ParallelAnimation);ESRI.ADF.Animations.ZoomAnimation = function(target, duration, fps, scaleFactor, centerX, centerY) {
ESRI.ADF.Animations.ZoomAnimation.initializeBase(this, [target, duration, fps]);this._scaleFactor = (scaleFactor !== undefined) ? scaleFactor : 1;if(centerX!=null && centerX!=undefined) this._centerX = centerX;else this._centerX = parseInt(target.offsetWidth)*0.5;if(centerY!=null && centerY!=undefined) this._centerY = centerY;else this._centerY = parseInt(target.offsetHeight)*0.5;this._unit = 'px';this._element = null;this._initialHeight = null;this._initialWidth = null;this._initialTop = null;this._initialLeft = null;this._initialFontSize = null;}
ESRI.ADF.Animations.ZoomAnimation.prototype = {
getAnimatedValue : function(percentage) {
return this.interpolate(1.0, this._scaleFactor, percentage);},
onStart : function() {
ESRI.ADF.Animations.ZoomAnimation.callBaseMethod(this, 'onStart');this._element = this.get_target();if (this._element) {
this._initialHeight = parseInt(this._element.offsetHeight);this._initialWidth = parseInt(this._element.offsetWidth);this._initialTop = parseInt(this._element.offsetTop);this._initialLeft = parseInt(this._element.offsetLeft);}
},
play : function() {
ESRI.ADF.Animations.ZoomAnimation.callBaseMethod(this, 'play');this._timer.add_tick(this.raiseTick);},
setValue : function(scale) {
if (this._element) {
var width = Math.round(this._initialWidth * scale);var height = Math.round(this._initialHeight * scale);var style = this._element.style;style.width = width+1 + this._unit;style.height = height+1 + this._unit;style.left = this._centerX - Math.round((this._centerX-this._initialLeft)*scale) + this._unit;style.top = this._centerY - Math.round((this._centerY-this._initialTop)*scale) + this._unit;}
}, 
onEnd : function() {
this._element = null;this._initialHeight = null;this._initialWidth = null;this._initialTop = null;this._initialLeft = null;ESRI.ADF.Animations.ZoomAnimation.callBaseMethod(this, 'onEnd');},
get_scaleFactor : function() {
return this._scaleFactor;},
set_scaleFactor : function(value) {
this._scaleFactor = value;},
get_centerX : function() {
return this._centerX;},
set_centerX : function(value) {
this._centerX = value;},
get_centerY : function() {
return this._centerY;},
set_centerY : function(value) {
this._centerY = value;}
}
ESRI.ADF.Animations.ZoomAnimation.registerClass('ESRI.ADF.Animations.ZoomAnimation', AjaxControlToolkit.Animation.Animation);AjaxControlToolkit.Animation.registerAnimation('scale', ESRI.ADF.Animations.ZoomAnimation);
//END ESRI.ArcGIS.ADF.Web.UI.WebControls.Runtime.JavaScript.ESRI.ADF.Animations.release.js
//START ESRI.ArcGIS.ADF.Web.UI.WebControls.Runtime.JavaScript.ESRI.ADF.Geometries.release.js
//----------------------------------------------------------
// Copyright (C) ESRI. All rights reserved.
//----------------------------------------------------------
Type.registerNamespace('ESRI.ADF.Geometries');ESRI.ADF.Geometries.Geometry = function(spatialReference) {
this._spatialReference = spatialReference;};ESRI.ADF.Geometries.Geometry.prototype = { 
get_spatialReference : function() {
return this._spatialReference;},
set_spatialReference : function(value) {
if(value!=this._spatialReference) {
this._spatialReference = value;this.raisePropertyChanged('spatialReference');}
},
getEnvelope : function() {
throw(new Error.notImplemented('getEnvelope'));}
};ESRI.ADF.Geometries.Geometry.registerClass('ESRI.ADF.Geometries.Geometry');ESRI.ADF.Geometries.Point = function(x,y,spatialReference) { 
ESRI.ADF.Geometries.Point.initializeBase(this, [spatialReference]);this.coordinates = [0.0,0.0];if(x) this.coordinates[0] = x;if(y) this.coordinates[1] = y;}
ESRI.ADF.Geometries.Point.prototype = {
toString : function(separator) {
if(!separator) separator = ',';return this.coordinates[0].toString() + separator + this.coordinates[1].toString();},
equals : function(other) {
return (this.coordinates[0]==other.coordinates[0] && this.coordinates[1]==other.coordinates[1]);},
getEnvelope : function() {
return new ESRI.ADF.Geometries.Envelope(this,this);},
get_x : function() {
return this.coordinates[0];},
set_x : function(value) {
this.coordinates[0] = value;},
get_y : function() {
return this.coordinates[1];},
set_y : function(value) {
this.coordinates[1] = value;}
}
ESRI.ADF.Geometries.Point.fromString = function(value) {
var arr = value.split(',');var x = parseFloat(arr[0]);var y = parseFloat(arr[1]);return new ESRI.ADF.Geometries.Point(x,y);}
ESRI.ADF.Geometries.Point.registerClass('ESRI.ADF.Geometries.Point', ESRI.ADF.Geometries.Geometry);ESRI.ADF.Geometries.GeometryCollection = function(geomtype,spatialReference) { 
ESRI.ADF.Geometries.GeometryCollection.initializeBase(this, [spatialReference]);this._geoms = [];if(!geomtype)
this._type = ESRI.ADF.Geometries.Geometry
else
this._type = geomtype;}
ESRI.ADF.Geometries.GeometryCollection.prototype = {
isEmpty : function() {
return (this._geoms.length>0);},
get_count : function() {
return this._geoms.length;},
add : function(geom) {
if(Sys.Debug.isDebug) { var e = Function._validateParams(arguments, [ {name: geom, type: this._type} ]);if(e) { throw e;} };this._geoms[this._geoms.length] = geom;},
get : function(index) {
return this._geoms[index];},
getFirst : function() {
if(this._geoms.length==0) return null;else return this._geoms[0];},
getLast : function() {
if(this._geoms.length==0) return null;else return this._geoms[this._geoms.length-1];},
remove : function(geom) {
Array.remove(this._geoms, point);},
removeAt : function(index) {
Array.removeAt(this._geoms, index);},
insert : function(index, geom) {
if(Sys.Debug.isDebug) { var e = Function._validateParams(arguments, [ {name: point, type: this._type} ]);if(e) { throw e;} };Array.insert(this._geoms, index, point);},
clear : function() {
Array.clear(this._geoms);},
getEnvelope : function() {
var env=null;for(var idx=0;idx<this.get_count();idx++) {
if(env) env = env.join(this._geoms[idx].getEnvelope());else env = this._geoms[idx].getEnvelope();}
return env;}
}
ESRI.ADF.Geometries.GeometryCollection.registerClass('ESRI.ADF.Geometries.GeometryCollection', ESRI.ADF.Geometries.Geometry);ESRI.ADF.Geometries.CoordinateCollection = function(points,spatialReference) { 
ESRI.ADF.Geometries.CoordinateCollection.initializeBase(this, [spatialReference]);this._coords = points?points:[];}
ESRI.ADF.Geometries.CoordinateCollection.prototype = {
toString : function(pntSeperator,coordSeparator) {
var pntCount = this.get_count();if(pntCount==0) return '';if(!pntSeperator) pntSeperator = ' ';var sb = new Sys.StringBuilder();sb.append(this.get(0)[0] + coordSeparator + this.get(0)[1]);for(var idx=1;idx<pntCount;idx++) {
sb.append(pntSeperator);sb.append(this.get(idx)[0] + coordSeparator + this.get(idx)[1]);}
return sb.toString();},
getEnvelope : function() {
if(this._coords.length===0) return null;var minx=this._coords[0][0];var miny=this._coords[0][1];var maxx=minx;var maxy=miny;for(var idx=1;idx<this.get_count();idx++) {
var g = this._coords[idx]
minx=Math.min(minx,g[0]);miny=Math.min(miny,g[1]);maxx=Math.max(maxx,g[0]);maxy=Math.max(maxy,g[1]);}
return new ESRI.ADF.Geometries.Envelope(minx,miny,maxx,maxy);},
get : function(index) {
return this._coords[index];},
getAsPoint : function(index) {
return new ESRI.ADF.Geometries.Point(this._coords[index][0],this._coords[index][1]);},
add : function(coord) {
this._coords[this._coords.length] = coord;},
get_coordinates: function() {
return this._coords;},
set_coordinates : function(value){
this._coords = value;},
getFirst : function() {
if(this._coords.length==0) return null;else return this._coords[0];},
getLast : function() {
if(this._coords.length==0) return null;else return this._coords[this._coords.length-1];}, 
removeAt : function(index) {
Array.removeAt(this._coords, index);},
get_count : function() {
return this._coords.length;},
clear : function() {
this._coords = [];} 
}
ESRI.ADF.Geometries.CoordinateCollection.fromString = function(value) {
var pnts = new ESRI.ADF.Geometries.CoordinateCollection();if(!value) { return pnts;}
var arr = value.split(' ');var geoms = [];for(var k=0;k<arr.length;k++) {
if(arr[k]) {
Array.add(geoms, ESRI.ADF.Geometries.Point.fromString(arr[k]).coordinates);}
}
pnts._coords = geoms;return pnts;}
ESRI.ADF.Geometries.CoordinateCollection.registerClass('ESRI.ADF.Geometries.CoordinateCollection',ESRI.ADF.Geometries.Geometry);ESRI.ADF.Geometries.Polyline = function(path, spatialReference) { 
ESRI.ADF.Geometries.Polyline.initializeBase(this, [spatialReference]);this._paths = new ESRI.ADF.Geometries.GeometryCollection(ESRI.ADF.Geometries.CoordinateCollection, spatialReference);if(path) this._paths.add(path);}
ESRI.ADF.Geometries.Polyline.prototype = { 
addPath : function(path) {
this._paths.add(path);},
getPath : function(n) {
return this._paths.get(n);},
getPathCount : function() {
return this._paths.get_count();},
getEnvelope : function() {
return this._paths.getEnvelope();}
}
ESRI.ADF.Geometries.Polyline.registerClass('ESRI.ADF.Geometries.Polyline', ESRI.ADF.Geometries.Geometry);ESRI.ADF.Geometries.Surface = function(spatialReference) { 
ESRI.ADF.Geometries.Surface.initializeBase(this, [spatialReference]);}
ESRI.ADF.Geometries.Surface.prototype = {
get_area : function() {
throw(new Error.notImplemented('get_area'));}
}
ESRI.ADF.Geometries.Surface.registerClass('ESRI.ADF.Geometries.Surface', ESRI.ADF.Geometries.Geometry);ESRI.ADF.Geometries.Polygon = function(ring, spatialReference) { 
ESRI.ADF.Geometries.Polygon.initializeBase(this, [spatialReference]);this._rings = new ESRI.ADF.Geometries.GeometryCollection(ESRI.ADF.Geometries.CoordinateCollection, spatialReference);if(ring) this._rings.add(ring);}
ESRI.ADF.Geometries.Polygon.prototype = {
addRing : function(ring) {
this._rings.add(ring);},
getRing : function(n) {
return this._rings.get(n);},
getRingCount : function() {
return this._rings.get_count();},
getEnvelope : function() {
return this._rings.getEnvelope();}
}
ESRI.ADF.Geometries.Polygon.registerClass('ESRI.ADF.Geometries.Polygon', ESRI.ADF.Geometries.Surface);ESRI.ADF.Geometries.Oval = function(center, width, height, spatialReference) { 
ESRI.ADF.Geometries.Oval.initializeBase(this, [spatialReference]);this._center = center;this._width = width;this._height = (height==null || height==undefined)?width:height;}
ESRI.ADF.Geometries.Oval.prototype = {
getEnvelope : function() {
return new ESRI.ADF.Geometries.Envelope(
this._center.get_x()-Math.abs(this._width)*0.5, this._center.get_y()-Math.abs(this._height)*0.5,
this._center.get_x()+Math.abs(this._width)*0.5, this._center.get_y()+Math.abs(this._height)*0.5,
this._spatialReference);},
get_area : function() {
return Math.PI * Math.abs(this._width) * Math.abs(this._height);},
toString : function() {
return this.getEnvelope().toString();},
get_center : function() {
return this._center;},
set_center : function(value) { this._center = value;},
get_width : function() {
return this._width;},
set_width : function(value) { this._width = value;},
get_height : function() {
return this._height;},
set_height : function(value) { this._height = value;}
}
ESRI.ADF.Geometries.Oval.registerClass('ESRI.ADF.Geometries.Oval', ESRI.ADF.Geometries.Surface);ESRI.ADF.Geometries.Envelope = function() { 
var n = arguments.length;var spatialReference = null;if(n>2 && String.isInstanceOfType(arguments[n-1])) {
spatialReference = arguments[n-1];}
else if(n<2) throw new Error.argument('ESRI.ADF.Geometries.Envelope','Invalid number of arguments');if(ESRI.ADF.Geometries.Point.isInstanceOfType(arguments[0]) && ESRI.ADF.Geometries.Point.isInstanceOfType(arguments[1])) {
this._xmin = Math.min(arguments[0].get_x(),arguments[1].get_x());this._ymin = Math.min(arguments[0].get_y(),arguments[1].get_y());this._xmax = Math.max(arguments[0].get_x(),arguments[1].get_x());this._ymax = Math.max(arguments[0].get_y(),arguments[1].get_y());}
else if(n>=4 && Number.isInstanceOfType(arguments[0]) && Number.isInstanceOfType(arguments[1]) && 
Number.isInstanceOfType(arguments[2]) && Number.isInstanceOfType(arguments[3])) {
this._xmin = Math.min(arguments[0],arguments[2]);this._ymin = Math.min(arguments[1],arguments[3]);this._xmax = Math.max(arguments[0],arguments[2]);this._ymax = Math.max(arguments[1],arguments[3]);}
else throw new Error.argument('ESRI.ADF.Geometries.Envelope','Invalid arguments');ESRI.ADF.Geometries.Envelope.initializeBase(this, [spatialReference]);}
ESRI.ADF.Geometries.Envelope.prototype = {
get_area : function() {
return (this.get_width()*this.get_height());},
toString : function() {
return '[' + this._xmin+','+this._ymin + ' ' +this._xmax+','+this._ymax + ']';},
get_xmin : function() {
return this._xmin;},
set_xmin : function(value) {
this._xmin = value;},
get_ymin : function() {
return this._ymin;},
set_ymin : function(value) {
this._ymin = value;},
get_xmax : function() {
return this._xmax;},
set_xmax : function(value) {
this._xmax = value;},
get_ymax : function() {
return this._ymax;},
set_ymax : function(value) {
this._ymax = value;}, 
intersects : function(env2) {
if(!env2) return false;return !(env2._xmin > this._xmax ||
env2._xmax < this._xmin ||
env2._ymin > this._ymax ||
env2._ymax < this._ymin);},
join : function(env2) {
if(!env2) return this;return new ESRI.ADF.Geometries.Envelope(
new ESRI.ADF.Geometries.Point(
(this._xmin<env2._xmin?this._xmin:env2._xmin),
(this._ymin<env2._ymin?this._ymin:env2._ymin)),
new ESRI.ADF.Geometries.Point(
(this._xmax>env2._xmax?this._xmax:env2._xmax),
(this._ymax>env2._ymax?this._ymax:env2._ymax)),
this._spatialReference);},
get_width : function() {
return (this._xmax-this._xmin);},
get_height : function() {
return (this._ymax-this._ymin);},
get_center : function() {
return new ESRI.ADF.Geometries.Point(
(this._xmin+this._xmax)*0.5,
(this._ymin+this._ymax)*0.5, this._spatialReference);},
intersection : function(env2) {
if(!this.intersects(env2)) return null;return new ESRI.ADF.Geometries.Envelope(
new ESRI.ADF.Geometries.Point(
(this._xmin>env2._xmin?this._xmin:env2._xmin),
(this._ymin>env2._ymin?this._ymin:env2._ymin)),
new ESRI.ADF.Geometries.Point(
(this._xmax<env2._xmax?this._xmax:env2._xmax),
(this._ymax<env2._ymax?this._ymax:env2._ymax)),
this._spatialReference);},
getEnvelope : function() {
return this.clone();},
clone: function() {
return new ESRI.ADF.Geometries.Envelope(this._xmin,this._ymin,this._xmax,this._ymax);}
}
ESRI.ADF.Geometries.Envelope.registerClass('ESRI.ADF.Geometries.Envelope', ESRI.ADF.Geometries.Surface);if (typeof(Sys) !== "undefined") Sys.Application.notifyScriptLoaded();
//END ESRI.ArcGIS.ADF.Web.UI.WebControls.Runtime.JavaScript.ESRI.ADF.Geometries.release.js
//START ESRI.ArcGIS.ADF.Web.UI.WebControls.Runtime.JavaScript.ESRI.ADF.Graphics.release.js
//----------------------------------------------------------
// Copyright (C) ESRI. All rights reserved.
//----------------------------------------------------------
Type.registerNamespace('ESRI.ADF.Graphics');ESRI.ADF.Graphics.Symbol = function(cursor) {
this._cursor = (cursor?cursor:null);this._opacity = 1.0;};ESRI.ADF.Graphics.Symbol.prototype = {
clone: function() {
throw(new Error.notImplemented('clone'));},
get_cursor : function() {
return this._cursor;},
set_cursor : function(value) { this._cursor = value;},
get_opacity : function() {
return this._opacity;},
set_opacity : function(value) { this._opacity = value;}
};ESRI.ADF.Graphics.Symbol.registerClass('ESRI.ADF.Graphics.Symbol');ESRI.ADF.Graphics.MarkerSymbol = function(imageUrl,centerX,centerY,cursor) {
ESRI.ADF.Graphics.MarkerSymbol.initializeBase(this,[cursor]);this._imageUrl = imageUrl;this._centerX = (centerX?centerX:0);this._centerY = (centerY?centerY:0);this._clipX = this._clipY = this._width = this._height = null;this._imageFormat = null;};ESRI.ADF.Graphics.MarkerSymbol.prototype = { 
clone : function() {
var symb = new ESRI.ADF.Graphics.MarkerSymbol(this._imageUrl,this._centerX,this._centerY,this._cursor);symb.set_clipX(this._clipX);symb.set_clipY(this._clipY);symb.set_width(this._width);symb.set_height(this._height);symb.set_opacity(this._opacity);symb.set_imageFormat(this._imageFormat);return symb;},
get_imageUrl : function() {
return this._imageUrl;},
set_imageUrl : function(value) { this._imageUrl = value;},
get_imageFormat : function() {
return this._imageFormat;},
set_imageFormat : function(value) { this._imageFormat = value;},
get_centerX : function() {
return this._centerX;},
set_centerX : function(value) { this._centerX = value;},
get_centerY : function() {
return this._centerY;},
set_centerY : function(value) { this._centerY = value;},
get_width : function() {
return this._width;},
set_width : function(value) { this._width = value;},
get_height : function() {
return this._height;},
set_height : function(value) { this._height = value;},
get_clipX : function() {
return this._clipX;},
set_clipX : function(value) { this._clipX = value;},
get_clipY : function() {
return this._clipY;},
set_clipY : function(value) { this._clipY = value;}
};ESRI.ADF.Graphics.MarkerSymbol.registerClass('ESRI.ADF.Graphics.MarkerSymbol', ESRI.ADF.Graphics.Symbol);ESRI.ADF.Graphics.CapType = function() {
throw Error.invalidOperation();};ESRI.ADF.Graphics.CapType.prototype = {
Round : 0,
Flat: 1,
Square : 2
};ESRI.ADF.Graphics.CapType.registerEnum("ESRI.ADF.Graphics.CapType", false);ESRI.ADF.Graphics.JoinType = function() {
throw Error.invalidOperation();};ESRI.ADF.Graphics.JoinType.prototype = {
Round : 0,
Bevel: 1,
Miter : 2
};ESRI.ADF.Graphics.JoinType.registerEnum("ESRI.ADF.Graphics.JoinType", false);ESRI.ADF.Graphics.LineSymbol = function(lineColor,width,cursor) {
ESRI.ADF.Graphics.LineSymbol.initializeBase(this, [cursor]);this._dashPattern = null;this._capType = ESRI.ADF.Graphics.CapType.Round;this._joinType = ESRI.ADF.Graphics.JoinType.Round;this.set_lineColor(lineColor?lineColor:'#000000');this._width = (width?width:1.0);};ESRI.ADF.Graphics.LineSymbol.prototype = { 
clone : function() {
var cloneObj = new ESRI.ADF.Graphics.LineSymbol(this._lineColor,this.get_width(),this.get_cursor());cloneObj.set_dashPattern(this.get_dashPattern());cloneObj.set_capType(this.get_capType());cloneObj.set_joinType(this.get_joinType());cloneObj.set_opacity(this.get_opacity());return cloneObj;},
get_dashPattern : function() {
return this._dashPattern;},
set_dashPattern : function(value) { this._dashPattern = value;},
get_capType : function() {
return this._capType;},
set_capType : function(value) { this._capType = value;},
get_joinType : function() {
return this._joinType;},
set_joinType : function(value) { this._joinType = value;},
get_lineColor : function() {
return this._lineColor;},
set_lineColor : function(value) { this._lineColor = value;},
get_width : function() {
return this._width;},
set_width : function(value) { this._width = value;}
};ESRI.ADF.Graphics.LineSymbol.registerClass('ESRI.ADF.Graphics.LineSymbol', ESRI.ADF.Graphics.Symbol);ESRI.ADF.Graphics.FillSymbol = function(color,outlineColor,outlineWidth,cursor) {
ESRI.ADF.Graphics.FillSymbol.initializeBase(this, [cursor]);this._fillColor = color;if(outlineColor) { this._outline = new ESRI.ADF.Graphics.LineSymbol(outlineColor,outlineWidth);}
else {this._outline = null;}
};ESRI.ADF.Graphics.FillSymbol.prototype = {
clone : function() {
var cloneObj = new ESRI.ADF.Graphics.FillSymbol(this._fillColor);cloneObj.set_opacity(this.get_opacity());cloneObj.set_cursor(this.get_cursor());var outline = this.get_outline();if(outline) { cloneObj.set_outline(outline.clone());}
else { cloneObj.set_outline(null);}
return cloneObj;},
get_fillColor : function() {
return this._fillColor;},
set_fillColor : function(value) { this._fillColor = value;},
get_outline : function() {
return this._outline;},
set_outline : function(value) { this._outline = value;} 
};ESRI.ADF.Graphics.FillSymbol.registerClass('ESRI.ADF.Graphics.FillSymbol', ESRI.ADF.Graphics.Symbol);ESRI.ADF.Graphics.GraphicFeatureBase = function(symbol) {
ESRI.ADF.Graphics.GraphicFeatureBase.initializeBase(this);this._opacity = 1.0;this._symbol = (symbol?symbol:null);this._selectedSymbol = null;this._highlightSymbol = null;};ESRI.ADF.Graphics.GraphicFeatureBase.prototype = {
get_mapTips : function() {
return this._mapTips;},
set_mapTips : function(value) {
if(this._mapTips!==value) {
if(this._mapTips) { this._mapTips.removeGraphics(this);}
this._mapTips = value;if(this._mapTips) {
this._mapTips.addGraphics(this);if(!this._mapTips.get_isInitialized() && this._map) { this._mapTips.initialize();}
}
this.raisePropertyChanged('mapTips');}
},
__set_map : function(value) {
if(this._map!==null && value!==null && this._map !== value) {
throw new Error.invalidOperation('Cannot add graphic to multiple map instances');}
this._map = value;if(this._map===null) { this._mapTips = null;}
else {
if(this._mapTips && !this._mapTips._map) {
this._mapTips.__set_map(this._map);}
}
},
__get_canvas : function(canvas) {
throw Error.notImplemented('__get_canvas');},
get_symbol : function() {
return this._symbol;},
set_symbol : function(value) {
if(this._symbol !== value) {
this._symbol = value;this.raisePropertyChanged('symbol');}
},
get_selectedSymbol : function() {
return this._selectedSymbol;},
set_selectedSymbol : function(value) { 
if(this._selectedSymbol !== value) {
this._selectedSymbol = value;this.raisePropertyChanged('selectedSymbol');}
},
get_highlightSymbol : function() {
return this._highlightSymbol;},
set_highlightSymbol : function(value) { 
if(this._highlightSymbol !== value) {
this._highlightSymbol = value;}
},
add_click : function(handler) {
this.get_events().addHandler('click', handler);},
remove_click : function(handler) { this.get_events().removeHandler('click', handler);},
add_mouseMove : function(handler) {
this.get_events().addHandler('mouseMove', handler);},
remove_mouseMove : function(handler) { this.get_events().removeHandler('mouseMove', handler);},
add_mouseOver : function(handler) {
this.get_events().addHandler('mouseOver', handler);},
remove_mouseOver : function(handler) { this.get_events().removeHandler('mouseOver', handler);},
add_mouseOut : function(handler) {
this.get_events().addHandler('mouseOut', handler);},
remove_mouseOut : function(handler) { this.get_events().removeHandler('mouseOut', handler);},
_raiseEvent : function(name,e) {
var handler = this.get_events().getHandler(name);if (handler) { if(!e) { e = Sys.EventArgs.Empty;} handler(this, e);}
}
};ESRI.ADF.Graphics.GraphicFeatureBase.registerClass('ESRI.ADF.Graphics.GraphicFeatureBase', Sys.Component);ESRI.ADF.Graphics.GraphicFeature = function(geometry,symbol,attributes) {
ESRI.ADF.Graphics.GraphicFeature.initializeBase(this,[symbol]);this._geometry = geometry;this._displayOnToc = false;this._envelope = null;this._graphicReference = null;this._canvas = null;this._attributes = null;this._isSelected = false;this._attributes = attributes;this._mapTips = null;this._map = null;this._onClickHandler = Function.createDelegate(this,function(e){ e.element = this;this._raiseEvent('click',e);});this._onMoveHandler = Function.createDelegate(this,function(e){e.element = this;this._raiseEvent('mouseMove',e);});this._onOverHandler = Function.createDelegate(this,function(e){e.element = this;this._raiseEvent('mouseOver',e);});this._onOutHandler = Function.createDelegate(this,function(e){e.element = this;this._raiseEvent('mouseOut',e);});this._propChangedHandler = Function.createDelegate(this,this._propertyChanged);this._highlight = false;};ESRI.ADF.Graphics.GraphicFeature.prototype = {
initialize : function() {
ESRI.ADF.Graphics.GraphicFeature.callBaseMethod(this, 'initialize');this.add_propertyChanged(this._propChangedHandler);},
dispose : function() {
this._envelope = null;this.clearGraphicReference();if(this._propChangedHandler) { this.remove_propertyChanged(this._propChangedHandler);}
ESRI.ADF.Graphics.GraphicFeature.callBaseMethod(this, 'dispose');this._onClickHandler = null;this._onMoveHandler = null;this._onOverHandler = null;this._onOutHandler = null;this._propChangedHandler = null;},
_propertyChanged : function(sender, eventArgs) {
if(eventArgs.get_propertyName() === 'geometry') { this._envelope=null;}
},
getEnvelope : function() {
if(!this._envelope && this._geometry) { this._setEnvelope();}
return this._envelope;},
_setEnvelope : function() {
if(this._geometry && this._geometry.getEnvelope) {
this._envelope = this._geometry.getEnvelope();}
else { this._envelope = null;}
},
get_graphicReference : function(element) {
return this._graphicReference;},
set_graphicReference : function(element) {
if(element===this._graphicReference) { return;}
this.clearGraphicReference();this._graphicReference = element;if(this._graphicReference) {
this._hookEvents();this._applyZIndex();}
this.raisePropertyChanged('graphicReference');},
clearGraphicReference : function() {
if(this._graphicReference) {
if(Array.isInstanceOfType(this._graphicReference)) {
for(var idx=0;idx<this._graphicReference.length;idx++) {
this._clearGraphicReferenceElement(this._graphicReference[idx]);this._graphicReference[idx]=null;}
}
else { this._clearGraphicReferenceElement(this._graphicReference);}
this._graphicReference = null;}
},
_clearGraphicReferenceElement : function(element) {
if(element) {
$clearHandlers(element);if(element.parentNode) { element.parentNode.removeChild(element);}
}
},
_hookEvents : function() {
if(Array.isInstanceOfType(this._graphicReference)) {
for(var idx=0;idx<this._graphicReference.length;idx++) {
this._hookElementEvent(this._graphicReference[idx]);}
}
else { this._hookElementEvent(this._graphicReference);}
},
_hookElementEvent : function(element) {
$addHandler(element,'mousemove',this._onMoveHandler);$addHandler(element,'mouseover',this._onOverHandler);$addHandler(element,'mouseout',this._onOutHandler);$addHandler(element,'click',this._onClickHandler);},
__set_groupParent : function(parent) {
this._parent = parent;},
__get_canvas : function(canvas) {
if(this._map) { return this._map._assotateCanvas;}
if(this._parent) { return this._parent.__get_canvas();}
return null;},
__draw : function(updateSymbolOnly) {
var symb = this._getActiveSymbol();if(!symb) {
if(this._graphicReference) { 
if(Array.isInstanceOfType(this._graphicReference)) {
for(var idx=0;idx<this._graphicReference.length;idx++) {
this._graphicReference[idx].parentNode.removeChild(this._graphicReference[idx]);this._graphicReference[idx] == null;}
}
else if(this._graphicReference.parentNode) {
this._graphicReference.parentNode.removeChild(this._graphicReference);}
this._graphicReference = null;}
return;}
if(ESRI.ADF.Geometries.Point.isInstanceOfType(this._geometry) && !ESRI.ADF.Graphics.MarkerSymbol.isInstanceOfType(symb)) {
throw(new Error.argumentType('symbol', Object.getType(symb), ESRI.ADF.Graphics.MarkerSymbol, 'Invalid symbol type "' + Object.getType(symb).getName()+ '" for rendering geometry of type "'+ Object.getType(this._geometry).getName() + '"'));}
var canvas = this.__get_canvas();if(!canvas) { return null;}
if(this._graphicReference) {
canvas.updateGeometry(this._geometry,symb,this._graphicReference,updateSymbolOnly);this._applyZIndex();return false;}
else {
this._graphicReference = canvas.drawGeometry(this._geometry,symb);this._applyZIndex();return true;}
},
_getActiveSymbol : function() {
var symb = null;if(this._highlight) { symb = (this._highlightSymbol?this._highlightSymbol : (this._parent ? this._parent.get_highlightSymbol() : symb));}
if(!symb && this._isSelected) { symb = (this._selectedSymbol?this._selectedSymbol : (this._parent ? this._parent.get_selectedSymbol() : symb));}
if(!symb) { symb = (this._symbol?this._symbol : (this._parent ? this._parent.get_symbol() : null));}
if(!symb) { return null;}
if(this._parent) {
var opacity = this._parent.get_opacity();if(opacity<1) {
symb = symb.clone();symb.set_opacity(symb.get_opacity()*opacity);}
}
return symb;},
_setSelected : function() {
if(this._graphicReference) { this.__draw(true);}
},
get_highlight: function() {
return this._highlight;},
set_highlight : function(value) {
if(this._highlight !== value) {
this._highlight = value;if(this._graphicReference) { this.__draw(true);}
}
},
_applyZIndex : function() {
var z = (ESRI.ADF.Geometries.Surface.isInstanceOfType(this._geometry) ? 0:
(ESRI.ADF.Geometries.Polyline.isInstanceOfType(this._geometry)?2:4)) + (this._highlight?1:0);if(Array.isInstanceOfType(this._graphicReference)) {
for(var idx=0;idx<this._graphicReference.length;idx++) {
this._applyZIndexElement(z,this._graphicReference[idx]);}
}
else { this._applyZIndexElement(z,this._graphicReference);} 
},
_applyZIndexElement : function(z,e) {
if(e && e.style) {
if(z) { e.style.zIndex = z;}
else { e.style.zIndex = '';}
}
},
get_isSelected : function() {
return this._isSelected;},
set_isSelected : function(value) {
if(this._isSelected!==value) {
this._isSelected = value;this.raisePropertyChanged('isSelected');this._setSelected();}
},
get_geometry : function() {
return this._geometry;},
set_geometry : function(value) {
if(this._geometry!==value) {
this._geometry = value;this.raisePropertyChanged('geometry');}
},
get_attributes : function() {
return this._attributes;},
set_attributes : function(value) {
if(this._attributes!==value) {
this._attributes = value;this.raisePropertyChanged('attributes');}
}
};ESRI.ADF.Graphics.GraphicFeature.registerClass('ESRI.ADF.Graphics.GraphicFeature', ESRI.ADF.Graphics.GraphicFeatureBase);ESRI.ADF.Graphics.GraphicFeatureGroup = function(id,defaultSymbol) {
this._id = id;ESRI.ADF.Graphics.GraphicFeatureGroup.initializeBase(this);this._elements = [];this._symbol = (defaultSymbol?defaultSymbol:null);this._transformFunc = null;this._elementChangedHandler = Function.createDelegate(this,this._onElementChanged);this._map = null;this._mapTips = null;this._visible = true;this._onClickHandler = Function.createDelegate(this,function(s,e){ this._raiseEvent('click',e);});this._onMoveHandler = Function.createDelegate(this,function(s,e){ this._raiseEvent('mouseMove',e);});this._onOverHandler = Function.createDelegate(this,function(s,e){ this._raiseEvent('mouseOver',e);});this._onOutHandler = Function.createDelegate(this,function(s,e){ this._raiseEvent('mouseOut',e);});};ESRI.ADF.Graphics.GraphicFeatureGroup.prototype = {
dispose : function() {
this.clear();ESRI.ADF.Graphics.GraphicFeatureGroup.callBaseMethod(this, 'dispose');this._onClickHandler = null;this._onMoveHandler = null;this._onOverHandler = null;this._onOutHandler = null;},
get : function(index) {
return this._elements[index];},
indexOf : function(element) {
return Array.indexOf(this._elements,element);},
add : function(element) {
this.insert(element,this._elements.length);element.__set_groupParent(this);},
insert : function(element,index) {
Array.insert(this._elements,index,element);element.__set_groupParent(this);element.add_propertyChanged(this._elementChangedHandler);this._hookEvents(element);var handler = this.get_events().getHandler('elementAdded');if (handler) { handler(this, element);}
},
getFeatureCount : function() {
return this._elements.length;},
remove : function(element) {
Array.remove(this._elements,element);element.__set_groupParent(null);element.remove_propertyChanged(this._elementChangedHandler);this._unhookEvents(element);element.clearGraphicReference();var handler = this.get_events().getHandler('elementRemoved');if (handler) { handler(this, element);}
},
clearGraphicReference : function() {
for(var idx=0;idx<this._elements.length;idx++) {
this._elements[idx].clearGraphicReference();}
},
clear : function() {
for(var idx=0;idx<this._elements.length;idx++) {
this._elements[idx].dispose();this._elements[idx] = null;}
Array.clear(this._elements);},
__get_canvas : function(canvas) {
if(this._map) { return this._map._assotateCanvas;}
else { return null;}
},
_onElementChanged : function(sender,eventArgs) {
var prop = eventArgs.get_propertyName();if(prop==='geometry' || prop==='symbol') {
var handler = this.get_events().getHandler('elementChanged');if (handler) { handler(this, sender);}
}
},
_hookEvents : function(gfxElm) {
gfxElm.add_click(this._onClickHandler);gfxElm.add_mouseMove(this._onMoveHandler);gfxElm.add_mouseOver(this._onOverHandler);gfxElm.add_mouseOut(this._onOutHandler);},
_unhookEvents : function(element) {
element.remove_click(this._onClickHandler);element.remove_mouseMove(this._onMoveHandler);element.remove_mouseOver(this._onOverHandler);element.remove_mouseOut(this._onOutHandler);},
get_opacity : function() {
return this._opacity;},
set_opacity : function(value) { this._opacity = value;},
get_visible : function() {
return this._visible;},
set_visible : function(value) { 
if(this._visible !== value) { 
this._visible = value;this._setVisible(this._elements,value);this.raisePropertyChanged('visible');}
},
_setVisible : function(features,visible) {
for(var idx=0;idx<features.length;idx++) {
if(ESRI.ADF.Graphics.GraphicFeatureGroup.isInstanceOfType(features[idx])) {
for(var j=0;j<features[idx]._elements.length();j++) {
this._setVisible(features.features[idx]._elements[j],visible);}
}
var ref = features[idx].get_graphicReference();if(ref) {
if(Array.isInstanceOfType(ref)) {
for(var k=0;k<ref.length;k++) {
ref[k].style.display = (visible?'':'none');}
}
else { ref.style.display = (visible?'':'none');}
}
}
},
add_elementChanged : function(handler) {
this.get_events().addHandler('elementChanged', handler);},
remove_elementChanged : function(handler) { this.get_events().removeHandler('elementChanged', handler);},
add_elementAdded : function(handler) {
this.get_events().addHandler('elementAdded', handler);},
remove_elementAdded : function(handler) { this.get_events().removeHandler('elementAdded', handler);},
add_elementRemoved : function(handler) {
this.get_events().addHandler('elementRemoved', handler);},
remove_elementRemoved : function(handler) { this.get_events().removeHandler('elementRemoved', handler);}
};ESRI.ADF.Graphics.GraphicFeatureGroup.registerClass('ESRI.ADF.Graphics.GraphicFeatureGroup',ESRI.ADF.Graphics.GraphicFeatureBase);ESRI.ADF.Graphics.__Canvas = function(element,transFunc) {
ESRI.ADF.Graphics.__Canvas.initializeBase(this, [element]);this._element = element;this._disposed = false;this._transFunc = transFunc;};ESRI.ADF.Graphics.createCanvas = function(element,transFunc) {
if(Sys.Browser.agent === Sys.Browser.InternetExplorer) {
return new ESRI.ADF.Graphics.__VmlCanvas(element,transFunc);}
else {
return new ESRI.ADF.Graphics.__SvgCanvas(element,transFunc);}
};ESRI.ADF.Graphics.__Canvas.prototype = {
dispose : function() {
if(this._disposed) { return;}
this.clear();ESRI.ADF.Graphics.__Canvas.callBaseMethod(this, 'dispose');this._disposed = true;},
clear : function() {
throw(new Error.notImplemented('clear'));},
updateGeometry : function(geom,symbol,element,symbolOnly) {
if(!element) { return;}
if(geom && ESRI.ADF.Geometries.GeometryCollection.isInstanceOfType(geom)) { 
for(var idx=0;idx<geom.get_count();idx++) {
this.updateGeometry(geom.get(idx),symbol,element[idx],symbolOnly);}
}
else {
if(symbol) { this.setSymbol(element,symbol);}
if((symbolOnly!==true || ESRI.ADF.Geometries.Point.isInstanceOfType(geom)) && this._transFunc) {
this.setVertices(element,this._createPntArray(geom,this._transFunc,symbol),symbol);}
}
},
drawGeometry : function(geom,symbol) {
if(ESRI.ADF.Geometries.GeometryCollection.isInstanceOfType(geom)) { 
var refs = [];for(var idx=0;idx<geom.get_count();idx++) {
Array.add(refs,this.drawGeometry(geom.get(idx),symbol));}
return refs;}
var array = this._createPntArray(geom,this._transFunc,symbol);if(ESRI.ADF.Geometries.Polygon.isInstanceOfType(geom)) {
if(array.length<6) { return null;}
return this._drawPolygon(array,symbol);}
else if(ESRI.ADF.Geometries.Envelope.isInstanceOfType(geom)) {
return this._drawEnvelope(array,symbol);}
else if(ESRI.ADF.Geometries.Polyline.isInstanceOfType(geom)) {
if(array.length<4) { return null;}
return this._drawPolyline(array,symbol);}
else if(ESRI.ADF.Geometries.Point.isInstanceOfType(geom)) { 
return this._drawPoint(array,symbol);}
else if(ESRI.ADF.Geometries.Oval.isInstanceOfType(geom)) { 
return this._drawOval(array,symbol);}
else { throw(new Error.notSupported('type not supported for clientside vector graphics rendering'));}
},
_drawPoint : function(pnt, marker) { 
var shape = this.createPoint(pnt,marker);this.setSymbol(shape,marker);this.addToCanvas(shape);return shape;},
_drawEnvelope : function(pntArray, fill) {
var shape = this.createEnvelope(pntArray);this.setSymbol(shape,fill);this.addToCanvas(shape);return shape;},
_drawPolygon : function(pntArray, fill) {
var shape = this.createPolygon(pntArray);this.setSymbol(shape,fill);this.addToCanvas(shape);return shape;},
_drawPolyline : function(pntArray, stroke) {
if(pntArray.length<2) { return null;}
var line = this.createPolyline(pntArray);this.setSymbol(line,stroke);this.addToCanvas(line);return line;},
_drawOval : function(pntArray, fill) {
var shape = this.createOval(pntArray);this.setSymbol(shape,fill);this.addToCanvas(shape);return shape;},
createPoint : function(pnt, symbol) {
var div = document.createElement('div');var img = document.createElement('img');div.appendChild(img);div.style.position = 'absolute';this.setVertices(div,pnt,symbol);return div;},
_createPntArray : function(geom,transformFunc,symbol){
var tol = 2;if(ESRI.ADF.Geometries.Polygon.isInstanceOfType(geom)) {
var parray = [];var length = geom.getRingCount();for(var j=0;j<length;j++) {
var ring = geom.getRing(j);var pntCount = ring.get_count();for(var idx=0;idx<pntCount;idx++) {
var obj = transformFunc(ring.get(idx));if(parray.length<2 || Math.abs(parray[parray.length-2]-obj.offsetX)>tol ||
Math.abs(parray[parray.length-1]-obj.offsetY)>tol || idx===pntCount-1) { 
Array.add(parray, obj.offsetX);Array.add(parray, obj.offsetY);}
}
if(j<length-1) { Array.add(parray,null);}
}
return parray;}
else if(ESRI.ADF.Geometries.Polyline.isInstanceOfType(geom)) { 
var larray = [];var pathCount = geom.getPathCount();for(var k=0;k<pathCount;k++) {
var path = geom.getPath(k);var pCount = path.get_count();for(var l=0;l<pCount;l++) {
var lobj = transformFunc(path.get(l));if(larray.length<2 || Math.abs(larray[larray.length-2]-lobj.offsetX)>tol ||
Math.abs(larray[larray.length-1]-lobj.offsetY)>tol || l===pCount-1) { 
Array.add(larray, lobj.offsetX);Array.add(larray, lobj.offsetY);}
}
if(k<pathCount-1) { Array.add(larray,null);}
}
return larray;} 
else if(ESRI.ADF.Geometries.Point.isInstanceOfType(geom)) { 
var pobj = transformFunc(geom);return [pobj.offsetX, pobj.offsetY];}
else if(ESRI.ADF.Geometries.Oval.isInstanceOfType(geom)) {
var center = transformFunc(geom.get_center());var size = transformFunc(new ESRI.ADF.Geometries.Point(geom.get_center().get_x()+geom.get_width()*0.5,geom.get_center().get_y()-geom.get_height()*0.5));return [center.offsetX,center.offsetY,Math.abs(size.offsetX-center.offsetX),Math.abs(size.offsetY-center.offsetY)];}
else if(ESRI.ADF.Geometries.Envelope.isInstanceOfType(geom)) {
var ll = transformFunc(new ESRI.ADF.Geometries.Point(geom.get_xmin(),geom.get_ymin()));var ur = transformFunc(new ESRI.ADF.Geometries.Point(geom.get_xmax(),geom.get_ymax()));return [ll.offsetX,ll.offsetY,ur.offsetX,ur.offsetY];}
else if(ESRI.ADF.Geometries.GeometryCollection.isInstanceOfType(geom)) {
Error.argumentType(Object.getTypeName(geom) + ' not yet supported');}
else { throw Error.argumentType('geom', Object.getType(geom), ESRI.ADF.Geometries.Geometry);}
}
};ESRI.ADF.Graphics.__Canvas.registerClass('ESRI.ADF.Graphics.__Canvas', Sys.UI.Control);ESRI.ADF.Graphics.__SvgCanvas = function(element,transfunc) {
ESRI.ADF.Graphics.__SvgCanvas.initializeBase(this, [element,transfunc]);};ESRI.ADF.Graphics.__SvgCanvas.prototype = {
initialize : function() {
ESRI.ADF.Graphics.__SvgCanvas.callBaseMethod(this, 'initialize');this.namespace = 'http://www.w3.org/2000/svg';this._element.style.MozUserSelect = 'none';this._element.style.zIndex = '100';this._element.parentNode.style.zIndex = '0';this._svgRoot = this._element.ownerDocument.createElementNS(this.namespace, 'svg');this._svgRoot.style.position = 'relative';this._svgRoot.style.width = '100%';this._svgRoot.style.height = '100%';this._element.appendChild(this._svgRoot);this._groupRoot = this._svgRoot.ownerDocument.createElementNS(this.namespace, 'g');this._svgRoot.appendChild(this._groupRoot);},
adjustCanvasExtent : function(left,top,height,width) {
this._svgRoot.style.left = -left + 'px';this._svgRoot.style.top = -top + 'px';this._element.style.height = height + 'px';this._groupRoot.setAttributeNS(null,'transform','translate('+left+' '+top+')');},
clear : function() {
if(this._disposed) { return;}
this._svgRoot.innerHTML = '';},
setSymbol : function(shape,symbol) {
if(ESRI.ADF.Graphics.FillSymbol.isInstanceOfType(symbol)) { 
this._setFill(shape,symbol);}
else if(ESRI.ADF.Graphics.LineSymbol.isInstanceOfType(symbol)) { 
this._setStroke(shape,symbol);}
else if(ESRI.ADF.Graphics.MarkerSymbol.isInstanceOfType(symbol)) { 
this._setMarker(shape,symbol);}
},
_setStroke : function(shape, stroke)
{
if(stroke) {
shape.setAttributeNS(null, 'stroke', stroke.get_lineColor());shape.setAttributeNS(null, 'stroke-width', stroke.get_width());shape.setAttributeNS(null, 'stroke-opacity', stroke.get_opacity());shape.setAttributeNS(null, 'stroke-linecap', this._joinTypeToSvg(stroke.get_capType()));shape.setAttributeNS(null, 'stroke-linejoin', this._joinTypeToSvg(stroke.get_joinType()));if(stroke.get_dashPattern()) {
shape.setAttributeNS(null, 'stroke-dasharray', this._dashPatternToSvg(stroke.get_dashPattern(),stroke.get_width()));}
else {
shape.removeAttributeNS(null, 'stroke-dasharray');}
}
else { shape.setAttributeNS(null, 'stroke', 'none');}
},
_dashPatternToSvg : function(pattern,width) {
if(!pattern || pattern.length===0) { return 'none';}
if(String.isInstanceOfType(pattern)) {
switch (pattern.toLowerCase()) {
case "dash":
pattern = [2,2];break;case "dot":
pattern = [1,2];break;case "dash_dot":
pattern = [2,2,1,2];break;case "dash_dot_dot":
pattern = [2,2,1,2,1,2];break;default:
return "none";} 
}
for(var j=0;j<pattern.length;j++) {
pattern[j] = (pattern[j] === 1 ? 1 : Math.round(pattern[j]*width));}
return pattern.toString();}, 
_capTypeToSvg : function(captype) {
switch(captype) {
case ESRI.ADF.Graphics.CapType.Flat: return 'butt';case ESRI.ADF.Graphics.CapType.Square: return 'square';default: return 'round';}
},
_joinTypeToSvg : function(jointype) {
switch(jointype) {
case ESRI.ADF.Graphics.JoinType.Miter: return 'miter';case ESRI.ADF.Graphics.JoinType.Bevel: return 'bevel';default: return 'round';}
},
_setFill : function(shape, fill)
{
if(fill && fill.get_fillColor()!==null) {
shape.setAttributeNS(null, 'fill', fill.get_fillColor());shape.setAttributeNS(null, 'fill-opacity', fill.get_opacity());shape.setAttributeNS(null, 'fill-rule', 'evenodd');}
else {
shape.setAttributeNS(null, 'fill', 'none');}
this._setStroke(shape,fill.get_outline());},
setVertices : function(shape,pntArray,symbol) {
switch(shape.tagName.toLowerCase()) {
case 'path': shape.setAttributeNS(null, 'd', this._pntArrayToSvgPath(pntArray,shape.closed));break;case 'ellipse':
shape.setAttributeNS(null, 'cx', pntArray[0] + 'px');shape.setAttributeNS(null, 'cy', pntArray[1] + 'px');shape.setAttributeNS(null, 'rx', pntArray[2] + 'px');shape.setAttributeNS(null, 'ry', pntArray[3] + 'px');break;case 'div':
if(pntArray.length===2 && symbol) { 
shape.style.left = (pntArray[0] - symbol.get_centerX())+'px';shape.style.top = (pntArray[1] - symbol.get_centerY())+'px';}
break;case 'rect':
shape.setAttributeNS(null, 'x', Math.min(pntArray[0],pntArray[2]) + 'px');shape.setAttributeNS(null, 'y', Math.min(pntArray[1],pntArray[3]) + 'px');shape.setAttributeNS(null, 'width', Math.abs(pntArray[2]-pntArray[0])+ 'px');shape.setAttributeNS(null, 'height', Math.abs(pntArray[3]-pntArray[1]) + 'px');break;default: break;}
},
_setMarker : function(div,symbol) {
var img = div.childNodes[0];if(symbol.get_cursor()) { img.style.cursor = symbol.get_cursor();}
if(!img.src || !img.src.endsWith(symbol.get_imageUrl())) {
img.src = symbol.get_imageUrl();}
else { img.src = symbol.get_imageUrl();}
if(symbol.get_width() && symbol.get_height() && symbol.get_clipX()!==null && symbol.get_clipY()!==null) {
div.style.width = symbol.get_width() + 'px';div.style.height = symbol.get_height() + 'px';img.style.left = -symbol.get_clipX()+'px';img.style.top = -symbol.get_clipY()+'px';img.style.position = 'relative';div.style.overflow = 'hidden';}
else {
if(symbol.get_width()>0) { img.style.width = symbol.get_width() + 'px';}
else { img.style.width = 'auto';}
if(symbol.get_height()>0) { img.style.height = symbol.get_height() + 'px';}
else { img.style.height = 'auto';}
}
if(!symbol.get_imageFormat() || !symbol.get_imageFormat().startsWith('png32')) {
ESRI.ADF.System.setOpacity(div,symbol.get_opacity());}
},
createPolyline : function(pntArray) {
var line = this._svgRoot.ownerDocument.createElementNS(this.namespace, 'path');line.closed = false;this.setVertices(line,pntArray);line.setAttributeNS(null, 'fill', 'none');return line;},
createPolygon : function(pntArray) {
var shape = this._svgRoot.ownerDocument.createElementNS(this.namespace, 'path');shape.closed = true;this.setVertices(shape,pntArray);return shape;},
createEnvelope : function(pntArray) {
var shape = this._svgRoot.ownerDocument.createElementNS(this.namespace, 'rect');this.setVertices(shape,pntArray);return shape;},
createOval : function(pntArray) {
var shape = this._svgRoot.ownerDocument.createElementNS(this.namespace, 'ellipse');this.setVertices(shape,pntArray);return shape;},
addToCanvas : function(shape) {
if(shape.tagName.toLowerCase()==='div') {
this._element.appendChild(shape);}
else { this._groupRoot.appendChild(shape);}
shape.setAttributeNS(null, 'overflow', 'visible');},
_pntArrayToSvgPath : function(pntArray, close) {
var pathString = '';var j=0;var newline = true;pathString += 'M';while(j<pntArray.length) {
if(pntArray[j]!==null && j<pntArray.length-1) {
pathString = pathString.concat(pntArray[j]," ");pathString = pathString.concat(pntArray[j+1]," ");j++;if(newline) { pathString += "L";newline = false;}
}
else if(j<pntArray.length-2) {
if(close) { pathString += "Z";}
pathString += ' M';newline = true;}
j++;}
if(close) { pathString += "Z";}
return pathString;}
};ESRI.ADF.Graphics.__SvgCanvas.registerClass('ESRI.ADF.Graphics.__SvgCanvas', ESRI.ADF.Graphics.__Canvas);ESRI.ADF.Graphics.__VmlCanvas = function(element,transfunc) {
ESRI.ADF.Graphics.__VmlCanvas.initializeBase(this, [element,transfunc]);};ESRI.ADF.Graphics.__VmlCanvas.prototype = {
initialize : function() {
ESRI.ADF.Graphics.__VmlCanvas.callBaseMethod(this, 'initialize');this._element.unselectable = 'on';},
adjustCanvasExtent : function(left,top,height,width) {
},
clear : function() {
if(this._disposed) { return;}
this.get_element().innerHTML = '';},
setSymbol : function(shape,symbol) {
if(ESRI.ADF.Graphics.FillSymbol.isInstanceOfType(symbol)) { 
this._setFill(shape,symbol);}
else if(ESRI.ADF.Graphics.LineSymbol.isInstanceOfType(symbol)) { 
this._setStroke(shape,symbol);}
else if(ESRI.ADF.Graphics.MarkerSymbol.isInstanceOfType(symbol)) { 
this._setMarker(shape,symbol);}
},
addToCanvas : function(shape) {
this._element.appendChild(shape);},
_setStroke : function(shape,stroke) {
if(shape.tagName.toLowerCase()==='div') {
shape.style.border = 'solid '+stroke.get_width()+'px ' + stroke.get_lineColor();}
else {
var strokes = shape.getElementsByTagName("stroke");var strokeElem = this._createVmlStrokeElement(stroke);if(strokes.length>0) { shape.replaceChild(strokeElem,strokes[0]);}
else { shape.appendChild(strokeElem);}
}
if(stroke && stroke.get_cursor()) { shape.style.cursor = stroke.get_cursor();}
},
_setFill : function(shape, fill) {
if(shape.tagName.toLowerCase()==='div') {
shape.style.backgroundColor = fill.get_fillColor();shape.style.filter = 'alpha(opacity='+(fill.get_opacity()*100)+')';shape.style.opacity = fill.get_opacity();this._setStroke(shape,fill.get_outline());}
else {
this._setStroke(shape,fill.get_outline());var fills = shape.getElementsByTagName("fill");var fillElem = this._createVmlFillElement(fill);if(fills.length>0) { shape.replaceChild(fillElem,fills[0]);}
else { shape.appendChild(fillElem);}
if(fill.get_cursor()) { shape.style.cursor = fill.get_cursor();}
}
if(fill.get_cursor()) { shape.style.cursor = fill.get_cursor();}
},
_setMarker : function(div,symbol) {
var img = div.childNodes[0];if(symbol.get_cursor()) { img.style.cursor = symbol.get_cursor();}
if(!img.src || !img.src.endsWith(symbol.get_imageUrl())) {
if(ESRI.ADF.System.__isIE6) {
ESRI.ADF.System.setIEPngTransparency(img,symbol.get_imageUrl(),(!symbol.get_width() || !symbol.get_height()),symbol.get_imageFormat());}
else { img.src = symbol.get_imageUrl();}
}
else { img.src = symbol.get_imageUrl();}
if(symbol.get_width()>0 && symbol.get_height()>0 && symbol.get_clipX()!==null && symbol.get_clipY()!==null) {
div.style.width = symbol.get_width() + 'px';div.style.height = symbol.get_height() + 'px';img.style.left = -symbol.get_clipX()+'px';img.style.top = -symbol.get_clipY()+'px';img.style.position = 'relative';div.style.overflow = 'hidden';}
else {
if(symbol.get_width()>0) { img.style.width = symbol.get_width() + 'px';}
else { img.style.width = 'auto';}
if(symbol.get_height()>0) { img.style.height = symbol.get_height() + 'px';}
else { img.style.height = 'auto';}
}
if(!symbol.get_imageFormat() || !symbol.get_imageFormat().startsWith('png32')) {
ESRI.ADF.System.setOpacity(div,symbol.get_opacity());}
},
setVertices : function(shape,pntArray,symbol) {
switch(shape.tagName.toLowerCase()) {
case 'shape':
var path = this._pntArrayToVmlPath(pntArray,shape.filled===true || shape.filled==='t');if(shape.path !== path) { shape.path = path;}
break;case 'oval':
shape.style.left = pntArray[0]-pntArray[2];shape.style.top = pntArray[1]-pntArray[3];shape.style.width = pntArray[2]*2;shape.style.height = pntArray[3]*2;break;case 'div':
if(pntArray.length===2 && symbol) { 
shape.style.left = (pntArray[0] - symbol.get_centerX())+'px';shape.style.top = (pntArray[1] - symbol.get_centerY())+'px';}
break;case 'rect':
shape.style.left = Math.min(pntArray[0],pntArray[2])+'px';shape.style.top = Math.min(pntArray[1],pntArray[3])+'px';shape.style.width = Math.abs(pntArray[2]-pntArray[0])+'px';shape.style.height = Math.abs(pntArray[3]-pntArray[1])+'px';break;default: break;}
},
createPolyline : function(pntArray) {
var shape=document.createElement('v:shape');shape.style.width = this._element.offsetWidth;shape.style.height = this._element.offsetHeight;shape.coordsize = this._element.offsetWidth + ' ' + this._element.offsetHeight;shape.style.position = 'absolute';shape.unselectable = false;shape.filled = 'f';this.setVertices(shape,pntArray);return shape;},
createPolygon : function(pntArray) {
var shape=document.createElement("v:shape");shape.style.width = this._element.offsetWidth;shape.style.height = this._element.offsetHeight;shape.coordsize = this._element.offsetWidth + " " + this._element.offsetHeight;shape.style.position = 'absolute';shape.filled = 't';this.setVertices(shape,pntArray);return shape;},
createEnvelope : function(pntArray) {
var shape=document.createElement("v:rect");shape.style.position = 'absolute';shape.filled = 't';this.setVertices(shape,pntArray);return shape;},
createOval : function(pntArray) {
var shape=document.createElement("v:oval");shape.style.position = 'absolute';shape.filled = 't';this.setVertices(shape,pntArray);return shape;},
_createVmlFillElement : function(fill) {
var fillElem = document.createElement('v:fill');fillElem.type = 'solid';fillElem.color = fill.get_fillColor();if(!fill.get_fillColor()) { fillElem.opacity = '0.0';}
else { fillElem.opacity = fill.get_opacity();}
return fillElem;}, 
_createVmlStrokeElement : function(stroke) {
var strokeElem = document.createElement('v:stroke');if(stroke) {
strokeElem.color = stroke.get_lineColor();strokeElem.weight = stroke.get_width() + 'px';strokeElem.opacity = stroke.get_opacity();if (strokeElem.opacity == 0)
strokeElem.opacity = 0.01;strokeElem.endcap = this._capTypeToVml(stroke.get_capType());strokeElem.joinstyle = this._joinTypeToVml(stroke.get_joinType());strokeElem.dashstyle = this._dashPatternToVml(stroke.get_dashPattern());}
else { strokeElem.opacity = '0';}
return strokeElem;},
_dashPatternToVml : function(pattern) {
if(!pattern || pattern.length===0) { return 'solid';}
if(String.isInstanceOfType(pattern)) {
switch (pattern.toLowerCase()) {
case "dash":
return "2 2";case "dot":
return "1 1";case "dash_dot":
return "2 1 1";case "dash_dot_dot":
return "longdashdotdot";default:
return "solid";} 
}
else{
var dash = pattern[0];for(var j=1;j<pattern.length;j++) {
dash += ' ' + pattern[j];}
}
return dash;},
_capTypeToVml : function(captype) {
switch(captype) {
case ESRI.ADF.Graphics.CapType.Flat: return 'flat';case ESRI.ADF.Graphics.CapType.Square: return 'square';default: return 'round';}
},
_joinTypeToVml : function(jointype) {
switch(jointype) {
case ESRI.ADF.Graphics.JoinType.Miter: return 'miter';case ESRI.ADF.Graphics.JoinType.Bevel: return 'bevel';default: return 'round';}
},
_pntArrayToVmlPath : function(pntArray, close) {
var strBuilder = new Sys.StringBuilder();var j=0;var newline = true;strBuilder.append('m');while(j<pntArray.length) {
if(pntArray[j]!==null && j<pntArray.length-1) {
strBuilder.append(pntArray[j]);strBuilder.append(',');strBuilder.append(pntArray[j+1]);strBuilder.append(' ');j++;if(newline) { strBuilder.append('l');newline = false;}
}
else if(j<pntArray.length-2) {
if(close) { strBuilder.append('x');}
else { strBuilder.append('e');}
strBuilder.append('m');newline = true;}
j++;}
if(close) { strBuilder.append('x');}
else { strBuilder.append('e');}
return strBuilder.toString();}
};ESRI.ADF.Graphics.__VmlCanvas.registerClass('ESRI.ADF.Graphics.__VmlCanvas', ESRI.ADF.Graphics.__Canvas);if(Sys.Browser.agent === Sys.Browser.InternetExplorer) {
document.writeln('<xml:namespace ns="urn:schemas-microsoft-com:vml" prefix="v"/>\n');var ss = document.createStyleSheet();ss.addRule('v\\:shape', "behavior: url(#default#VML);");ss.addRule('v\\:fill', "behavior: url(#default#VML);");ss.addRule('v\\:rect', "behavior: url(#default#VML);");ss.addRule('v\\:oval', "behavior: url(#default#VML);");ss.addRule('v\\:stroke', "behavior: url(#default#VML);");}
ESRI.ADF.Graphics.ShapeType = function() {
};ESRI.ADF.Graphics.ShapeType.prototype = {
Point : 0,
Line: 1,
Path : 2,
Envelope : 10,
Circle : 11,
Oval : 12,
Ring : 13
};ESRI.ADF.Graphics.ShapeType.registerEnum("ESRI.ADF.Graphics.ShapeType", false);ESRI.ADF.Graphics.__GraphicsEditor = function(map,canvas,feature,featuretype,style,oncomplete,oncancel,continuous,cursor) {
this._map = map;this._cursor = cursor;this._canvas = canvas;this._feature = feature;this._featuretype = featuretype;this._oncomplete = oncomplete;this._oncancel = oncancel;this._canvas = canvas;this._draggingHandler = null;this._dragCompletehandler = null;this._clickHandler = null;this._dblclickHandler = null;this._zoomStartHandler = null;this._zoomCompletedHandler = null;this._moveHandler = null;this._style = style;this._disposed = false;this._continuous = continuous;this._initialize();};ESRI.ADF.Graphics.__GraphicsEditor.prototype = {
_initialize : function() { 
if(!this._style) {
if(this._featuretype >=10) {
this._style = new ESRI.ADF.Graphics.FillSymbol('blue','yellow',1.0);}
else {
this._style = new ESRI.ADF.Graphics.LineSymbol('red',2);}
}
if(this._feature) { this._startEditFeature();}
else { this._startGetFeature();}
},
dispose : function() {
if(this._disposed || this._disposing) { return;}
this._disposing = true;this._unhookEvents();this._geometry = null;this._pntColl = null;if(this._elmRef) { this._elmRef.parentNode.removeChild(this._elmRef);}
this._elmRef = null;this._oncancel = null;this._oncomplete = null;this._disposing = false;this._disposed = true;},
_hookEvents : function() {
this._orgMouseMode = this._map.get_mouseMode();this._oldcursor = this._map.get_cursor();this._map.set_mouseMode(ESRI.ADF.UI.MouseMode.Custom);if(this._cursor) { this._map.set_cursor(this._cursor);}
this._dblclickHandler = Function.createDelegate(this,this._onDblClick);this._moveHandler = Function.createDelegate(this,this._onMouseMove);this._mouseDownHandler = Function.createDelegate(this,this._onMouseDown);this._mouseUpHandler = Function.createDelegate(this,this._onMouseUp);this._zoomStartHandler = Function.createDelegate(this,this._onZoomStart);this._zoomCompletedHandler = Function.createDelegate(this,this._onZoomCompleted);this._map.add_dblclick(this._dblclickHandler);this._map.add_mouseMove(this._moveHandler);this._map.add_mouseDown(this._mouseDownHandler);this._map.add_mouseUp(this._mouseUpHandler);this._map.add_zoomStart(this._zoomStartHandler);this._map.add_zoomCompleted(this._zoomCompletedHandler);},
_unhookEvents: function() {
if(this._map.get_mouseMode()!==this._orgMouseMode) {
this._map.set_mouseMode(this._orgMouseMode);}
this._map.set_cursor(this._oldcursor);this._map.remove_dblclick(this._dblclickHandler);this._map.remove_mouseMove(this._moveHandler);this._map.remove_mouseDown(this._mouseDownHandler);this._map.remove_mouseUp(this._mouseUpHandler);this._map.remove_zoomStart(this._zoomStartHandler);this._map.remove_zoomCompleted(this._zoomCompletedHandler);this._draggingHandler = null;this._dragCompletehandler = null;this._clickHandler = null;this._dblclickHandler = null;this._moveHandler = null;this._zoomStartHandler = null;this._zoomCompletedHandler = null;},
_drawVertices : function() {
if(this._feature) {
if(ESRI.ADF.Geometries.Polygon.isInstanceOf(this._feature)) {
var rings = this._feature.get_geometry().get_rings();for(var r=0;r<rings.length;r++) {
var ring = rings[r];for(var v=0;v<ring.length;v++) {
var env = new ESRI.ADF.Geometries.Envelope(r[0]-1,r[1]-1,r[0]+1,r[1]+1);this._canvas.drawGeometry(env,null);}
}
}
}
},
_onMouseDown : function(sender,args) {
if(args.button === Sys.UI.MouseButton.leftButton && !this._pntColl && this._featuretype!==ESRI.ADF.Graphics.ShapeType.Point) {
this._pntColl = new ESRI.ADF.Geometries.CoordinateCollection([[args.coordinate.get_x(), args.coordinate.get_y()]]);}
}, 
_onMouseMove : function(sender,args) {
if(this._pntColl) {
var count = this._pntColl.get_count();if(count>0) {
if(args.ctrlKey) { 
var lastpnt = this._pntColl.getLast();if(Math.abs(lastpnt[0]-args.coordinate.get_x()) < Math.abs(lastpnt[1]-args.coordinate.get_y())) {
args.coordinate.set_x(lastpnt[0]);}
else { args.coordinate.set_y(lastpnt[1]);}
} 
this._pntColl.add([args.coordinate.get_x(), args.coordinate.get_y()]);if(this._featuretype===ESRI.ADF.Graphics.ShapeType.Ring) { this._pntColl.add(this._pntColl.get(0));}
this._drawGeometry();this._pntColl.removeAt(count);if(this._featuretype===ESRI.ADF.Graphics.ShapeType.Ring) { this._pntColl.removeAt(count);}
}
}
},
_onZoomStart : function(sender,args) {
this._canvas.get_element().style.display = 'none';},
_onZoomCompleted : function(sender,args) {
this._drawGeometry();this._canvas.get_element().style.display = '';},
_isTwoPointFeatureType : function() {
return (this._featuretype===ESRI.ADF.Graphics.ShapeType.Line ||
this._featuretype===ESRI.ADF.Graphics.ShapeType.Oval ||
this._featuretype===ESRI.ADF.Graphics.ShapeType.Circle || 
this._featuretype===ESRI.ADF.Graphics.ShapeType.Envelope);},
_onMouseUp : function(sender,e) {
if(e.button === Sys.UI.MouseButton.leftButton) {
this.__addPoint(e.coordinate,e.ctrlKey);}
else if(e.button === Sys.UI.MouseButton.rightButton) {
if(this._pntColl) {
var count = this._pntColl.get_count();if(count>1) {
this._pntColl.removeAt(count-1);this._onMouseMove(sender,e);}
else {
this._pntColl.clear();this._cancel(false);}
}
}
},
__addPoint : function(pnt,ortho) {
if(this._featuretype===ESRI.ADF.Graphics.ShapeType.Point) { 
this._geometry = pnt;this.__completeEditing();return;}
if(!this._pntColl) { this._pntColl = new ESRI.ADF.Geometries.CoordinateCollection();}
var px = pnt.get_x();var py = pnt.get_y();var lastpoint = this._pntColl.getLast();if(lastpoint) { 
if(ortho) {
if(Math.abs(lastpoint[0]-px) < Math.abs(lastpoint[1]-py)) {
px = lastpoint[0];}
else { py = lastpoint[1];}
}
}
var isTwoPoint = this._isTwoPointFeatureType();if(!lastpoint || isTwoPoint || Math.abs(lastpoint[0]- px)/this._map._pixelsizeX>2 || Math.abs(lastpoint[1]-py)/this._map._pixelsizeY>2) {
this._pntColl.add([px,py]);if(isTwoPoint && this._pntColl.get_count()===2) { 
this.__completeEditing();}
else { this._drawGeometry();}
}
},
_createGeometry : function() {
if(!this._pntColl) { this._geometry = null;return;}
switch(this._featuretype) {
case ESRI.ADF.Graphics.ShapeType.Ring:
this._geometry = new ESRI.ADF.Geometries.Polygon(this._pntColl);break;case ESRI.ADF.Graphics.ShapeType.Envelope:
if(this._pntColl.get_count()>1) {
var x1 = this._pntColl.get(0)[0];var y1 = this._pntColl.get(0)[1];var x2 = this._pntColl.get(1)[0];var y2 = this._pntColl.get(1)[1];this._geometry = new ESRI.ADF.Geometries.Envelope(Math.min(x1,x2),Math.min(y1,y2),Math.max(x1,x2),Math.max(y1,y2));}
else {
this._geometry = new ESRI.ADF.Geometries.Envelope(this._pntColl.get(0)[0],this._pntColl.get(0)[1],this._pntColl.get(0)[0],this._pntColl.get(0)[1]);}
break;case ESRI.ADF.Graphics.ShapeType.Path:
case ESRI.ADF.Graphics.ShapeType.Line:
this._geometry = new ESRI.ADF.Geometries.Polyline(this._pntColl);break;case ESRI.ADF.Graphics.ShapeType.Circle:
case ESRI.ADF.Graphics.ShapeType.Oval:
if(this._pntColl.get_count()>1) {
var a = (this._pntColl.get(1)[0]-this._pntColl.get(0)[0]);var b = (this._pntColl.get(1)[1]-this._pntColl.get(0)[1]);var scale = Math.sqrt(2);if(this._featuretype===ESRI.ADF.Graphics.ShapeType.Circle) {
a = b = Math.sqrt(a*a+b*b);}
else if(a!==0 && b!==0) {
a*=scale;b*=scale;}
this._geometry = new ESRI.ADF.Geometries.Oval(this._pntColl.getAsPoint(0),a*2,this._featuretype===ESRI.ADF.Graphics.ShapeType.Oval?b*2:null);}
else {
this._geometry = new ESRI.ADF.Geometries.Oval(this._pntColl.getAsPoint(0),0,0);}
break;default: this._geometry=null;}
},
_drawGeometry : function() {
this._createGeometry();if(!this._geometry) { return;}
if(this._elmRef) {
this._canvas.updateGeometry(this._geometry,this._style,this._elmRef);}
else {
this._elmRef = this._canvas.drawGeometry(this._geometry,this._style);}
},
_onDblClick : function(sender, args) {
if(this._pntColl && (this._pntColl.get_count()>1 && this._featuretype !== ESRI.ADF.Graphics.ShapeType.Ring ||
this._pntColl.get_count()>2)) {
this.__completeEditing();}
else if(this._featuretype === ESRI.ADF.Graphics.ShapeType.Envelope) {
if(this._pntColl==null) {
this.__addPoint(args.coordinate,false);}
this.__completeEditing();}
},
__completeEditing : function() {
if(this._featuretype === ESRI.ADF.Graphics.ShapeType.Ring) {
var firstPnt = this._pntColl.getFirst();var lastPnt = this._pntColl.getLast();if(firstPnt[0]!==lastPnt[0] || firstPnt[1]!==lastPnt[1]) {
this._pntColl.add([firstPnt[0],firstPnt[1]]);}
}
else if(this._featuretype === ESRI.ADF.Graphics.ShapeType.Envelope && this._pntColl.get_count()===1) {
var firstPnt = this._pntColl.getFirst();this._geometry = new ESRI.ADF.Geometries.Envelope(firstPnt[0],firstPnt[1],firstPnt[0],firstPnt[1]);}
else if (this._isTwoPointFeatureType()) {
if(this._pntColl.get_count()!==2) {
throw new Error.invalidOperation('Operation requires two points');}
this._createGeometry();}
if(this._oncomplete && this._geometry) { this._oncomplete(this._geometry);}
if(!this._continuous) { this.dispose();}
else {
this._pntColl = null;this._geometry = null;if(this._elmRef) {
this._elmRef.parentNode.removeChild(this._elmRef);this._elmRef=null;}
}
},
_startEditFeature : function(feature) {
this._drawVertices();this._hookEvents();},
_startGetFeature : function() {
this._hookEvents();},
_cancel : function(force) {
if(this._elmRef) {
this._elmRef.parentNode.removeChild(this._elmRef);this._elmRef = null;}
this._pntColl = null;this._geometry = null;if(force || !this._continuous) { if(this._oncancel){this._oncancel(true);} this.dispose();}
},
cancel : function() {
this._cancel(true);}
};ESRI.ADF.Graphics.__GraphicsEditor.registerClass('ESRI.ADF.Graphics.__GraphicsEditor');Type.registerNamespace('ESRI.ADF.Graphics.__AdfGraphicsLayer');ESRI.ADF.Graphics.__AdfGraphicsLayer.parseJsonLayer = function(json,map) {
var obj = Sys.Serialization.JavaScriptSerializer.deserialize(json);var name = map.get_id() + '_' + obj.tableName;var type = obj.type;var rows = obj.rows;var titleTemplate = obj.title;var contentTemplate = obj.contents;var opacity = (obj.opacity || obj.opacity===0?obj.opacity:1);var visible = (obj.visible!==false);var enableCallout = (obj.enableCallout!==false);var layer = null;var ftype = ESRI.ADF.Geometries.Geometry;var symbol = null;var selectedSymbol = null;var highlightSymbol = null;if(type === 'featureGraphicsLayer')
{
switch(obj.featureType) {
case 'point':
type = ESRI.ADF.Geometries.Point;break;case 'line':
type = ESRI.ADF.Geometries.Line;break;case 'polygon':
type = ESRI.ADF.Geometries.Polygon;break;default:
}
symbol = ESRI.ADF.Graphics.__AdfGraphicsLayer._parseSymbol(obj.symbol);if(obj.selectedSymbol) { selectedSymbol = ESRI.ADF.Graphics.__AdfGraphicsLayer._parseSymbol(obj.selectedSymbol);}
if(obj.highlightSymbol) { highlightSymbol = ESRI.ADF.Graphics.__AdfGraphicsLayer._parseSymbol(obj.highlightSymbol);}
}
layer = $find(name);if(layer) { 
map.removeGraphic(layer);layer.clear();layer.set_visible(visible);layer.set_symbol(symbol);layer.set_selectedSymbol(selectedSymbol);layer.set_highlightSymbol(highlightSymbol);}
else {
layer = $create(ESRI.ADF.Graphics.GraphicFeatureGroup,{"id":name,"visible":visible,"symbol":symbol,"selectedSymbol":selectedSymbol,"highlightSymbol":highlightSymbol});}
if(opacity!==null) { layer.set_opacity(opacity);}
Array.forEach(rows, function(row) { layer.add(ESRI.ADF.Graphics.__AdfGraphicsLayer._parseRow(row,name));});if(enableCallout) {
var id = '__ESRI_WebADF_gfxLayerCallout_' + name;var callout = $find(id);if(!callout) {
callout = $create(ESRI.ADF.UI.MapTips,{"animate":false,"hoverTemplate":titleTemplate,"contentTemplate":contentTemplate,"id":id});}
else {
callout.set_hoverTemplate(titleTemplate);callout.set_contentTemplate(contentTemplate);}
layer.set_mapTips(callout);}
else {
var callout = layer.get_mapTips();if(callout) {
layer.set_mapTips(null);callout.dispose();}
}
if(!ESRI.ADF.Graphics.__mapZoomEvent) {
ESRI.ADF.Graphics.__mapZoomEvent = {};ESRI.ADF.Graphics._mapMouseOver = function(sender,args) {
if(ESRI.ADF.Graphics._currentMouseHighlightElement) {
ESRI.ADF.Graphics._currentMouseHighlightElement.set_highlight(false);ESRI.ADF.Graphics._currentMouseHighlightElement = null;}
if(!args.element.get_highlight()) { 
args.element.set_highlight(true);ESRI.ADF.Graphics._currentMouseHighlightElement = args.element;}
};ESRI.ADF.Graphics._mapMouseOut = function(sender,args) {
if(ESRI.ADF.Graphics._currentMouseHighlightElement === args.element) { 
args.element.set_highlight(false);ESRI.ADF.Graphics._currentMouseHighlightElement = null;}
};}
layer.add_mouseOver(ESRI.ADF.Graphics._mapMouseOver);layer.add_mouseOut(ESRI.ADF.Graphics._mapMouseOut);if(!ESRI.ADF.Graphics.__mapZoomEvent[map.get_id()]) {
ESRI.ADF.Graphics.__mapZoomEvent[map.get_id()] = true;map.add_zoomStart(function() {
if(ESRI.ADF.Graphics._currentMouseHighlightElement) {
ESRI.ADF.Graphics._currentMouseHighlightElement.set_highlight(false);ESRI.ADF.Graphics._currentMouseHighlightElement=null;}
});}
return layer;};ESRI.ADF.Graphics.__AdfGraphicsLayer._parseRow = function(row,layerid) {
var geometry = ESRI.ADF.Graphics.__AdfGraphicsLayer._parseGeometry(row.geometry);var symbol = null;var selectedSymbol = null;var highlightSymbol = null;if(row.symbol) { symbol = ESRI.ADF.Graphics.__AdfGraphicsLayer._parseSymbol(row.symbol);}
if(row.selectedSymbol) { selectedSymbol = ESRI.ADF.Graphics.__AdfGraphicsLayer._parseSymbol(row.selectedSymbol);}
if(row.highlightSymbol) { highlightSymbol = ESRI.ADF.Graphics.__AdfGraphicsLayer._parseSymbol(row.highlightSymbol);}
var id = layerid+'_'+row.id;var feat = $find(id);if(feat) { feat.dispose();}
var gfx = $create(ESRI.ADF.Graphics.GraphicFeature,{"id":id,"isSelected":row.isSelected,"geometry":geometry,"symbol":symbol,"selectedSymbol":selectedSymbol,"highlightSymbol":highlightSymbol,"attributes":row.attributes});if(row.geometry.envelope) {
gfx._envelope = new ESRI.ADF.Geometries.Envelope(row.geometry.envelope[0],row.geometry.envelope[1],row.geometry.envelope[2],row.geometry.envelope[3]);}
return gfx;};ESRI.ADF.System.attributeTableRenderer = function(obj) {
if(!obj) { return '';}
var strBuilder = new Sys.StringBuilder();var content = '';strBuilder.append('<div onclick="return false;" onwheel="return false;"><table>');for(var key in obj) { strBuilder.append(String.format('<tr><td><b>{0}:</b></td><td>{1}</td></tr>',
key,obj[key]));}
strBuilder.append('</table></div>');return strBuilder.toString();};ESRI.ADF.Graphics.__AdfGraphicsLayer._parseSymbol = function(symbol) {
if(!symbol) { return null;}
switch(symbol.type) {
case 'marker':
return ESRI.ADF.Graphics.__AdfGraphicsLayer._parseMarkerSymbol(symbol);case 'line':
return ESRI.ADF.Graphics.__AdfGraphicsLayer._parseLineSymbol(symbol);case 'fill':
return ESRI.ADF.Graphics.__AdfGraphicsLayer._parseFillSymbol(symbol);default: return null;}
};ESRI.ADF.Graphics.__AdfGraphicsLayer._parseMarkerSymbol = function(symbol) {
var centerx = symbol.center?symbol.center[0]: (symbol.size[0]*0.5);var centery = symbol.center?symbol.center[1]: (symbol.size[1]*0.5);var marker = new ESRI.ADF.Graphics.MarkerSymbol(symbol.url,centerx,centery);if(symbol.opacity<1) { marker.set_opacity(symbol.opacity);}
marker.set_width(symbol.size[0]);marker.set_height(symbol.size[1]);if(symbol.format) { marker.set_imageFormat(symbol.format);}
return marker;};ESRI.ADF.Graphics.__AdfGraphicsLayer._parseLineSymbol = function(symbol) {
var line = new ESRI.ADF.Graphics.LineSymbol(symbol.color,symbol.width);line.set_dashPattern(symbol.lineType);if(symbol.opacity<1) { line.set_opacity(symbol.opacity);}
return line;};ESRI.ADF.Graphics.__AdfGraphicsLayer._parseFillSymbol = function(symbol) {
var fill=null;if(symbol.hasBoundary===true) {
fill = new ESRI.ADF.Graphics.FillSymbol(symbol.color,symbol.boundaryColor,symbol.boundaryWidth);fill.get_outline().set_dashPattern(symbol.boundaryType);if(symbol.BoundaryOpacity===0 || symbol.BoundaryOpacity<1) {
fill.get_outline().set_opacity(symbol.BoundaryOpacity);}
}
else { fill = new ESRI.ADF.Graphics.FillSymbol(symbol.color);}
if(symbol.opacity===0 || symbol.opacity<1) {
fill.set_opacity(symbol.opacity);}
return fill;};ESRI.ADF.Graphics.__AdfGraphicsLayer._parseGeometry = function(geom) {
if(!geom) { return null;}
switch(geom.type) {
case 'point':
return ESRI.ADF.Graphics.__AdfGraphicsLayer._parsePoint(geom);case 'multipoint':
return ESRI.ADF.Graphics.__AdfGraphicsLayer._parseMultiPoint(geom);case 'polyline':
return ESRI.ADF.Graphics.__AdfGraphicsLayer._parsePolyline(geom);case 'polygon':
return ESRI.ADF.Graphics.__AdfGraphicsLayer._parsePolygon(geom);case 'envelope':
return ESRI.ADF.Graphics.__AdfGraphicsLayer._parseEnvelope(geom);default: return null;}
};ESRI.ADF.Graphics.__AdfGraphicsLayer._parsePoint = function(geom) {
return new ESRI.ADF.Geometries.Point(geom.x,geom.y);};ESRI.ADF.Graphics.__AdfGraphicsLayer._parseMultiPoint = function(geom) {
var pnts = new ESRI.ADF.Geometries.GeometryCollection(ESRI.ADF.Geometries.Point);for(var j=0;j<geom.points.length;j++) {
pnts.add(new ESRI.ADF.Geometries.Point(geom.points[j][0],geom.points[j][1]));}
return pnts;};ESRI.ADF.Graphics.__AdfGraphicsLayer._parsePolyline = function(geom) {
var line = new ESRI.ADF.Geometries.Polyline();var paths = geom.paths;for(var j=0;j<paths.length;j++) {
line.addPath(new ESRI.ADF.Geometries.CoordinateCollection(paths[j]));}
return line;};ESRI.ADF.Graphics.__AdfGraphicsLayer._parsePolygon = function(geom) {
var poly = new ESRI.ADF.Geometries.Polygon();var rings = geom.rings;for(var j=0;j<rings.length;j++) {
poly.addRing(new ESRI.ADF.Geometries.CoordinateCollection(rings[j]));}
return poly;};ESRI.ADF.Graphics.__AdfGraphicsLayer._parseEnvelope = function(geom) {
return new ESRI.ADF.Geometries.Envelope(geom.coords[0],geom.coords[1],geom.coords[2],geom.coords[3]);};if (typeof(Sys) !== "undefined") { Sys.Application.notifyScriptLoaded();}

//END ESRI.ArcGIS.ADF.Web.UI.WebControls.Runtime.JavaScript.ESRI.ADF.Graphics.release.js
//START ESRI.ArcGIS.ADF.Web.UI.WebControls.Runtime.JavaScript.ESRI.ADF.UI.Callout.release.js
//----------------------------------------------------------
// Copyright (C) ESRI. All rights reserved.
//----------------------------------------------------------
Type.registerNamespace('ESRI.ADF.UI');ESRI.ADF.UI.AnchorPoint = function() {
throw Error.invalidOperation();};ESRI.ADF.UI.AnchorPoint.prototype = {
TopLeft : 0,
TopRight : 1,
BottomLeft : 2,
BottomRight : 3
};ESRI.ADF.UI.AnchorPoint.registerEnum("ESRI.ADF.UI.AnchorPoint", false);ESRI.ADF.UI.CalloutLayout = function() {
ESRI.ADF.UI.CalloutLayout.initializeBase(this);this._layout = ESRI.ADF.UI.defaultCalloutTemplate;};ESRI.ADF.UI.CalloutLayout.prototype = {
set_layout: function(value) {
this._layout = value;if (!value.template && value.templateUrl) {
this._getTemplate();}
else {
this._onLayoutChanged();}
},
get_layout: function() { return this._layout;},
_getTemplate: function() {
this._layout.template = null;var wRequest1 = new Sys.Net.WebRequest();wRequest1.set_url(this._layout.templateUrl);wRequest1.add_completed(Function.createDelegate(this, this._onTemplateLoaded));wRequest1.invoke();},
_onTemplateLoaded: function(executor, eventArgs) {
if (executor.get_responseAvailable()) {
this._layout.template = executor.get_responseData();this._onLayoutChanged();}
},
_onLayoutChanged: function() {
var handler = this.get_events().getHandler('layoutChanged');if (handler) { handler(this, this._layout);}
},
add_layoutChanged: function(handler) {
this.get_events().addHandler('layoutChanged', handler);},
remove_layoutChanged: function(handler) { this.get_events().removeHandler('layoutChanged', handler);}
};ESRI.ADF.UI.CalloutLayout.registerClass('ESRI.ADF.UI.CalloutLayout',Sys.Component);ESRI.ADF.UI.Callout = function() {
ESRI.ADF.UI.Callout.initializeBase(this);this._parent = document.body;this._usesDefaultTemplate = true;this._isHidden = true;this._animate = true;this._autoHide = true;this._verticalOffset = 0;this._clickHandler = Function.createDelegate(this, this._onClick);this._mouseoverHandler = Function.createDelegate(this, function(e) { this.stopHideTimer();this._raiseEvent('mouseOver', e);});this._mouseoutHandler = Function.createDelegate(this, function(e) { this.startHideTimer();this._raiseEvent('mouseOut', e);});this._anchorPoint = ESRI.ADF.UI.AnchorPoint.TopLeft;this._hideDelayTime = 500;this._layout = ESRI.ADF.UI.defaultCalloutTemplate.get_layout();this._usesDefaultTemplate = true;this._defaultSpriteSize = [1000, 998];};ESRI.ADF.UI.Callout.prototype = {
initialize: function() {
if (this._usesDefaultTemplate) {
this._layout = ESRI.ADF.UI.defaultCalloutTemplate.get_layout();ESRI.ADF.UI.defaultCalloutTemplate.add_layoutChanged(Function.createDelegate(this, function(s, layout) {
if (this._usesDefaultTemplate) {
this._layout = layout;this._refreshContent();}
}));}
if (this._layout.template) {
this._createCallout();}
else if (this._layout.templateUrl) { 
var wRequest1 = new Sys.Net.WebRequest();wRequest1.set_url(this._layout.templateUrl);wRequest1.add_completed(Function.createDelegate(this, this._onTemplateLoaded));wRequest1.invoke();}
ESRI.ADF.UI.Callout.callBaseMethod(this, 'initialize');},
_onTemplateLoaded: function(executor, eventArgs) {
if (executor.get_responseAvailable()) {
this._layout.template = executor.get_responseData();}
this._createCallout();},
_createCallout: function() {
this._calloutMain = document.createElement('div');this._arrowDiv = document.createElement('div');this._contentDiv = document.createElement('div');this._calloutMain.style.position = 'absolute';this._arrowDiv.style.position = 'absolute';this._arrowDiv.style.overflow = 'hidden';var abounds = this._layout.arrowBounds[this._anchorPoint ? this._anchorPoint : 0];this._arrowDiv.style.width = abounds[2] + 'px';this._arrowDiv.style.height = abounds[3] + 'px';this._arrowImage = document.createElement('img');this._arrowImage.style.position = 'absolute';this._arrowImage.style.width = 'auto';this._arrowImage.style.height = 'auto';this._setArrowImage();this._arrowDiv.appendChild(this._arrowImage);this._contentDiv.style.position = 'absolute';this._contentDiv.style.cursor = 'default';this._calloutMain.appendChild(this._contentDiv);this._calloutMain.appendChild(this._arrowDiv);this._calloutMain.style.zIndex = ESRI.ADF.UI.Callout._zIndex;this._animation1 = new AjaxControlToolkit.Animation.FadeAnimation(this._contentDiv, 0.25, 25, AjaxControlToolkit.Animation.FadeEffect.FadeIn, 0, 1, false);this._animation2 = new AjaxControlToolkit.Animation.FadeAnimation(this._contentDiv, 0.25, 25, AjaxControlToolkit.Animation.FadeEffect.FadeOut, 0, 1, false);this._animation1.add_ended(Function.createDelegate(this, function() { this._arrowDiv.style.display = '';}));this._animation2.add_ended(Function.createDelegate(this, function() { this._calloutMain.style.display = 'none';}));if (this._isHidden) {
this._calloutMain.style.display = 'none';this._arrowDiv.style.display = 'none';}
this._parent.appendChild(this._calloutMain);this.setContent(this._content);this._reorient();this.setPosition(0, 0);$addHandler(this._contentDiv, "click", this._clickHandler);$addHandler(this._contentDiv, 'mouseover', this._mouseoverHandler);$addHandler(this._contentDiv, 'mouseout', this._mouseoutHandler);$addHandler(this._contentDiv, 'mousedown', function(e) { e.stopPropagation();});},
_setArrowImage: function() {
if (!this._arrowImage) { return;}
if (ESRI.ADF.System.__isIE6) {
this._tmpimage = document.createElement('img');this._tmpimage.style.position = 'absolute';this._tmpimage.style.visibility = 'hidden';this._tmpimage.style.left = 0;this._tmpimage.style.top = 0;this._tmpimage.onload = Function.createDelegate(this, function() {
if (!this._tmpimage) return;if (this._tmpimage.offsetWidth == 0) { 
this._arrowImage.style.width = this._defaultSpriteSize[0] + 'px';this._arrowImage.style.height = this._defaultSpriteSize[1] + 'px';}
else {
this._arrowImage.style.width = this._tmpimage.offsetWidth + 'px';this._arrowImage.style.height = this._tmpimage.offsetHeight + 'px';}
this._tmpimage.onload = null;this._tmpimage.parentNode.removeChild(this._tmpimage);this._tmpimage.removeAttribute('src');delete this._tmpimage;});document.body.appendChild(this._tmpimage);this._tmpimage.src = this._layout.arrowUrl;this._arrowImage.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled='true', , sizingMethod = 'crop', src='" + this._layout.arrowUrl + "');";this._arrowImage.src = esriBlankImagePath;}
else {
this._arrowImage.src = this._layout.arrowUrl;}
},
get_width: function() {
return this._value;},
set_width: function(value) {
if (this._width !== value) {
this._width = value;this.setContent(this._content);}
},
set_layout: function(value) {
this._layout = value;this._usesDefaultTemplate = false;if (!this._calloutMain) { this._createCallout();}
else {
this._setArrowImage();this._refreshContent();}
},
get_layout: function() {
return this._layout;},
dispose: function() {
if (!this._calloutMain) { return;}
this.hide();$clearHandlers(this._contentDiv);this._calloutMain.parentNode.removeChild(this._calloutMain);this._calloutMain = null;this._parent = null;ESRI.ADF.UI.Callout.callBaseMethod(this, 'dispose');},
setContent: function(value) {
if (this._content != value) {
this._content = value;this._refreshContent();this.raisePropertyChanged("content");}
},
_refreshContent: function() {
if (!this.get_isInitialized() || !this._contentDiv) { return;}
var template = ESRI.ADF.System.templateBinder({ "callout_width": this._width ? this._width + 'px' : 'auto' }, this._layout.template);this._contentDiv.innerHTML = ESRI.ADF.System.templateBinder(this._content, template);this._reorient();},
setPosition: function(x, y) {
if (!this.get_isInitialized()) { return;}
this._calloutMain.style.left = x + 'px';this._calloutMain.style.top = y + 'px';},
getPosition: function() {
if (!this._calloutMain) { return null;}
return [parseInt(this._calloutMain.offsetLeft, 10), parseInt(this._calloutMain.offsetTop, 10)];},
checkPosition: function() {
this._reorient();},
_reorient: function() {
if (!this._contentDiv || this._contentDiv.style.display === 'none' || !this._contentDiv.parentNode) { return;}
var bounds = Sys.UI.DomElement.getBounds(this._contentDiv);if (bounds.width == 0 || bounds.height == 0) { return;}
var x = 0;var y = 0;if (this._anchorPoint == ESRI.ADF.UI.AnchorPoint.BottomRight) { x = y = -1;}
else if (this._anchorPoint === ESRI.ADF.UI.AnchorPoint.TopRight) { x = -1;}
else if (this._anchorPoint === ESRI.ADF.UI.AnchorPoint.BottomLeft) { y = -1;}
var x2 = (x === 0 ? 1 : -1);var y2 = (y === 0 ? 1 : -1);var abounds = this._layout.arrowBounds[this._anchorPoint ? this._anchorPoint : 0];this._arrowDiv.style.width = abounds[2] + 'px';this._arrowDiv.style.height = abounds[3] + 'px';this._arrowDiv.style.left = (abounds[2] * x + abounds[6] * x2) + 'px';this._arrowDiv.style.top = (abounds[3] * y + abounds[7] * y2) + 'px';this._arrowImage.style.left = (-abounds[0]) + 'px';this._arrowImage.style.top = (-abounds[1]) + 'px';var left = (bounds.width * x + (abounds[2] + abounds[4] + abounds[6]) * x2);this._contentDiv.style.left = left + 'px';this._contentDiv.style.top = (bounds.height * y + (abounds[5] + abounds[7] - this._verticalOffset) * y2) + 'px';if (ESRI.ADF.System.__isIE6) {
var tmp = this._contentDiv.style.marginRight;this._contentDiv.style.marginRight = "1px";this._contentDiv.style.marginRight = tmp;if(document.documentElement.dir == "rtl")
this._contentDiv.style.left = (left - 1 * (x==0?1:0)) + 'px';else
this._contentDiv.style.left = (left - 1 * x) + 'px';}
},
startHideTimer: function() {
this.stopHideTimer();if (this.get_autoHide()) {
this._timer = window.setTimeout(Function.createDelegate(this, this.hide), this._hideDelayTime);}
},
stopHideTimer: function() {
if (this._timer) {
window.clearTimeout(this._timer);this._timer = null;}
},
show: function() {
ESRI.ADF.UI.Callout._zIndex++;this._isHidden = false;if (!this.get_isInitialized()) { return;}
this._calloutMain.style.zIndex = ESRI.ADF.UI.Callout._zIndex;this._calloutMain.style.visibility = 'hidden';this._calloutMain.style.display = '';this._raiseEvent('show');this._reorient();if (this._animate) { this._animation1.play();}
else { this._arrowDiv.style.display = '';}
this._calloutMain.style.visibility = '';},
hide: function() {
if (this._isHidden) { return;}
if (this._animate) { this._animation2.play();}
else { this._calloutMain.style.display = 'none';}
this._arrowDiv.style.display = 'none';this._isHidden = true;this._raiseEvent('hide');},
_onClick: function(e) {
e.stopPropagation();this._raiseEvent('click');},
get_isOpen: function() {
return !this._isHidden;},
get_content: function() {
return this._content;},
get_autoHide: function() {
return this._autoHide;},
set_autoHide: function(value) {
if (this._autoHide != value) {
this._autoHide = value;this.raisePropertyChanged("autoHide");}
},
get_anchorPoint: function() {
return this._anchorPoint;},
set_anchorPoint: function(value) {
if (this._anchorPoint != value) {
this._anchorPoint = value;this._reorient();}
},
get_animate: function() {
return this._animate;},
set_animate: function(value) {
if (this._animate != value) { this._animate = value;}
},
get_parent: function() {
return this._parent;},
set_parent: function(value) { if (this._parent != value) { this._parent = value;} },
get_hideDelayTime: function() {
return this._hideDelayTime;},
set_hideDelayTime: function(value) { if (this._hideDelayTime != value) { this._hideDelayTime = value;} },
get_template: function() {
return this._layout.template;},
///////////////////////////////	
set_template: function(value) { this._layout.template = value;this._usesDefaultTemplate = false;this._refreshContent();},
get_templateUrl: function() {
return this._templateUrl;},
set_templateUrl: function(value) { this._templateUrl = value;this._usesDefaultTemplate = false;},
get_arrowImageUrl: function() {
return this._layout.arrowUrl;},
set_arrowImageUrl: function(value) { this._layout.arrowUrl = value;},
get_arrowSize: function() {
return this._arrowSettings.size;},
set_arrowSize: function(value) { this._arrowSettings.size = value;},
get_arrowOffset: function() {
return this._arrowSettings.offset;},
set_arrowOffset: function(value) { this._arrowSettings.offset = value;},
get_calloutBuffer: function() {
return this._arrowSettings.buffer;},
set_calloutBuffer: function(value) { this._arrowSettings.buffer = value;},
//////////////////////////////	
get_verticalOffset: function() {
return this._verticalOffset;},
set_verticalOffset: function(value) { this._verticalOffset = value;},
_raiseEvent: function(name, e) {
var handler = this.get_events().getHandler(name);if (handler) { if (!e) { e = Sys.EventArgs.Empty;} handler(this, e);}
},
add_closed: function(handler) {
this.get_events().addHandler('closed', handler);},
remove_closed: function(handler) { this.get_events().removeHandler('closed', handler);},
add_click: function(handler) {
this.get_events().addHandler('click', handler);},
remove_click: function(handler) { this.get_events().removeHandler('click', handler);},
add_show: function(handler) {
this.get_events().addHandler('show', handler);},
remove_show: function(handler) { this.get_events().removeHandler('show', handler);},
add_hide: function(handler) {
this.get_events().addHandler('hide', handler);},
remove_hide: function(handler) { this.get_events().removeHandler('hide', handler);},
add_mouseOut: function(handler) {
this.get_events().addHandler('mouseOut', handler);},
remove_mouseOut: function(handler) { this.get_events().removeHandler('mouseOut', handler);},
add_mouseOver: function(handler) {
this.get_events().addHandler('mouseOver', handler);},
remove_mouseOver: function(handler) { this.get_events().removeHandler('mouseOver', handler);}
};ESRI.ADF.UI.Callout.registerClass('ESRI.ADF.UI.Callout', Sys.Component);ESRI.ADF.UI.Callout._zIndex = 1000;ESRI.ADF.UI.MapTips = function() {
ESRI.ADF.UI.MapTips.initializeBase(this);this._clickHandler = Function.createDelegate(this, this._onCalloutClick);this._mouseOverHandler = Function.createDelegate(this, this._onMouseOverCallout);this._mouseOutHandler = Function.createDelegate(this, this._onMouseOutCallout);this._onMouseGfxOverHandler = Function.createDelegate(this, this._onMouseOverGfx);this._onMouseGfxOutHandler = Function.createDelegate(this, this._onMouseOutGfx);this._onMouseGfxMoveHandler = Function.createDelegate(this, this._onMouseMoveGfx);this._onCalloutShowHandler = Function.createDelegate(this, this._onCalloutShow);this._onCalloutHideHandler = Function.createDelegate(this, this._onCalloutHide);this._onZoomStartHandler = Function.createDelegate(this, function() { if (this._callout) { this._callout.hide();} window.clearTimeout(this._showDelayedTimer);this._showDelayedTimer = null;});this._onGridOriginChanged = Function.createDelegate(this, function() { this._currentElement = null;});this._onMapTipEventHandler = Function.createDelegate(this, this._onMapTipEvent);this._onCalloutContentChanged = Function.createDelegate(this, this._contentChanged);this._currentElement = null;this._hoverTemplate = '';this._contentTemplate = '';this._layout = ESRI.ADF.UI.defaultMapTipsTemplate.get_layout();this._map = null;this._callout = null;this._hoverLayers = [];this._animate = true;this._maxheight = 150;this._width = 250;this._isExpanded = false;this._maptipID = ESRI.ADF.UI.MapTips._maptipCount;this._isDisposed = false;this._autoHide = true;this._expandOnClick = true;this._showOnHover = true;this._usesDefaultTemplate = true;ESRI.ADF.UI.MapTips._maptipCount++;};ESRI.ADF.UI.MapTips.prototype = {
initialize: function() {
if (this._usesDefaultTemplate) {
ESRI.ADF.UI.defaultMapTipsTemplate.add_layoutChanged(Function.createDelegate(this, function(s, args) {
if (this._usesDefaultTemplate) {
this._layout = args;if (this._callout) {
this._callout.set_layout(this._createCalloutLayout())
this._setExpandCollapseState();}
else { this._setupCallout();}
}
}));}
if (this._layout.templateUrl && !this._layout.template) { 
var wRequest1 = new Sys.Net.WebRequest();wRequest1.set_url(this._layout.templateUrl);wRequest1.add_completed(Function.createDelegate(this, this._onTemplateLoaded));wRequest1.invoke();}
else { this._setupCallout();}
ESRI.ADF.UI.MapTips.callBaseMethod(this, 'initialize');},
_onTemplateLoaded: function(executor, eventArgs) {
if (executor.get_responseAvailable()) {
this._layout.template = executor.get_responseData();if (this._callout) {
this._callout.set_layout(this._createCalloutLayout())
this._setExpandCollapseState();}
else { this._setupCallout();}
}
},
set_template: function(value) {
this._layout.template = value;this._callout.set_layout(this._createCalloutLayout());this._usesDefaultTemplate = false;this._setExpandCollapseState();},
get_template: function() {
return this._layout.template;},
_bindTemplate: function(template) {
var settings = {
"maptip_contentID": this.get_maptipContentID(),
"maptip_titleID": this.get_maptipTitleID(),
"maptipID": this.get_id()
};return ESRI.ADF.System.templateBinder(settings, template);},
createTemplate: function() {
return null;},
set_layout: function(value) {
this._layout = value;if (this._layout.templateUrl && !this._layout.template) { 
var wRequest1 = new Sys.Net.WebRequest();wRequest1.set_url(this._layout.templateUrl);wRequest1.add_completed(Function.createDelegate(this, this._onTemplateLoaded));wRequest1.invoke();}
else {
this._callout.set_layout(this._createCalloutLayout());}
this._usesDefaultTemplate = false;this._setExpandCollapseState();},
get_layout: function() {
return this._layout;},
_onMapTipEvent: function(s, e) {
if (e.maptip === this || this._isDisposed) { return;}
this._callout.set_verticalOffset(0);if (e.action === 'show' && this._autoHide) {
this.collapse();this._callout.hide();window.clearTimeout(this._showDelayedTimer);this._showDelayedTimer = null;}
},
collapse: function() {
this._isExpanded = false;this._setExpandCollapseState();var handler = this.get_events().getHandler('collapsed');if (handler) { handler(this, this._currentElement);}
this._raiseMapTipEvent("collapse");},
expand: function() {
this._isExpanded = true;this._setExpandCollapseState();var handler = this.get_events().getHandler('expanded');if (handler) { handler(this, this._currentElement);}
this._raiseMapTipEvent("expand");},
_setExpandCollapseState: function() {
var content = $get(this.get_maptipContentID());if (!content) { return;}
if (this._isExpanded) { content.style.display = '';}
else { content.style.display = 'none';}
this.adjustHeight();this._callout.checkPosition();if (ESRI.ADF.System.__isIE6) {
var tmp = content.style.width;content.style.width = '';content.style.width = tmp;}
},
_contentChanged: function(s, e) {
var prop = e.get_propertyName();if (prop !== 'content') { return;}
var tip = $get(this.get_maptipContentID());if (tip) {
if (tip.style.display === 'none' && this._isExpanded) { tip.style.display = '';}
else if (tip.style.display !== 'none' && !this._isExpanded) { tip.style.display = 'none';}
this.adjustHeight();}
},
_createCalloutLayout: function() {
var layoutClone = Sys.Serialization.JavaScriptSerializer.deserialize(Sys.Serialization.JavaScriptSerializer.serialize(this._layout));var settings = {
"callout_width": this._width + 'px',
"maptip_contentID": this.get_maptipContentID(),
"maptip_titleID": this.get_maptipTitleID(),
"maptipID": this.get_id()
};layoutClone.templateUrl = null;var template = this.createTemplate();if (template) { layoutClone.template = template;}
else { layoutClone.template = this._bindTemplate(this._layout.template);}
return layoutClone;},
_setupCallout: function() {
if (this._callout || !this._map) { return;}
this._callout = $create(ESRI.ADF.UI.Callout, {
"parent": this._map._containerDiv, "animate": this._animate,
"layout": this._createCalloutLayout(), "autoHide": this._autoHide,
"width": this._width, "id": this.get_id() + '_callout'
}, {
"click": this._clickHandler, "propertyChanged": this._onCalloutContentChanged,
"hide": this._onCalloutHideHandler, "show": this._onCalloutShowHandler,
"mouseOver": this._mouseOverHandler, "mouseOut": this._mouseOutHandler
}
);this._map.add_zoomStart(this._onZoomStartHandler);this._map.add_gridOriginChanged(this._onGridOriginChanged);this._map.__add_mapTipEvent(this._onMapTipEventHandler);this._setExpandCollapseState();},
addGraphics: function(gfxLayer) {
if (!this._callout && !this._map) {
if (gfxLayer._map) {
this._map = gfxLayer._map;this._setupCallout();}
}
gfxLayer.add_mouseOver(this._onMouseGfxOverHandler);gfxLayer.add_mouseOut(this._onMouseGfxOutHandler);gfxLayer.add_mouseMove(this._onMouseGfxMoveHandler);gfxLayer.add_click(this._clickHandler);Array.add(this._hoverLayers, gfxLayer);},
removeGraphics: function(gfxLayer) {
gfxLayer.remove_mouseOver(this._onMouseGfxOverHandler);gfxLayer.remove_mouseOut(this._onMouseGfxOutHandler);gfxLayer.remove_mouseMove(this._onMouseGfxMoveHandler);gfxLayer.remove_click(this._clickHandler);Array.remove(this._hoverLayers, gfxLayer);},
dispose: function() {
Array.forEach(this._hoverLayers, Function.createDelegate(this, function(layer) { this.removeGraphics(layer);}));if (this._map) {
this._map.remove_zoomStart(this._onMapTipEventHandler);this._map.remove_gridOriginChanged(this._onGridOriginChanged);this._map.__remove_mapTipEvent(this._onZoomStartHandler);}
if (this._callout) { this._callout.dispose();}
this._callout = null;this._currentElement = null;this._isDisposed = true;ESRI.ADF.UI.MapTips.callBaseMethod(this, 'dispose');},
_onMouseOverGfx: function(sender, e) {
if (!this._showOnHover) { return;};if (this._currentElement != e.element) {
this._callout.set_verticalOffset(0);this.collapse();this._callout.hide();this._setContentByElement(e.element);if (ESRI.ADF.Geometries.Point.isInstanceOfType(e.element.get_geometry())) {
this.setPosition(e.element.get_geometry());}
else {
var evt = ESRI.ADF.System._makeMouseEventRelativeToElement(e, this._callout.get_parent());this._callout.setPosition(evt.offsetX, evt.offsetY);}
}
this._callout.stopHideTimer();this._showDelayedTimer = window.setTimeout(Function.createDelegate(this, function() {
this._callout.show();if (ESRI.ADF.System.__isIE6) {
var content = $get(this.get_maptipContentID());var tmp = content.style.width;content.style.width = '';content.style.width = tmp;}
}), 500);},
_onMouseMoveGfx: function(sender, evt) {
if (this._showDelayedTimer && !this._callout.get_isOpen() && this._showOnHover &&
this._currentElement === evt.element && !ESRI.ADF.Geometries.Point.isInstanceOfType(evt.element.get_geometry())) {
var e = ESRI.ADF.System._makeMouseEventRelativeToElement(evt, this._callout.get_parent());this._callout.setPosition(e.offsetX, e.offsetY);}
},
setPosition: function(point) {
var pos = this._map._toMapScreen(point);this._callout.setPosition(pos.offsetX, pos.offsetY);},
adjustHeight: function() {
if (this._callout._calloutMain.style.display === 'none') { 
this._callout._calloutMain.style.visible = 'hidden';this._callout._calloutMain.style.display = '';}
var pos = this._callout.getPosition();var offset = [parseInt(this._callout._parent.style.left, 10), parseInt(this._callout._parent.style.top, 10)];var position = [offset[0] + pos[0], offset[1] + pos[1]];var centScreen = this._map.toScreenPoint(this._map.get_extent().get_center());var align = 0;if (position[1] > this._map._mapsize[1] / 2) { align += 2;}
if (position[0] > this._map._mapsize[0] / 2) { align++;}
var height = this._map._mapsize[1];var offsety = this._callout._layout.arrowBounds[this._callout._anchorPoint ? this._callout._anchorPoint : 0][5];var tip = $get(this.get_maptipContentID());if (tip) {
var bottomhalf = (position[1] > centScreen.offsetY);var dist = (bottomhalf ? position[1] : height - position[1]);tip.style.height = '';var tipHeight = parseInt(this._callout._contentDiv.offsetHeight, 10);var contentHeight = parseInt(tip.offsetHeight, 10);var titleHeight = tipHeight - contentHeight;var maxContentHeight = height - titleHeight;var adjustedHeight = null;if (maxContentHeight && maxContentHeight < contentHeight) { adjustedHeight = maxContentHeight;}
if (this._maxheight && (adjustedHeight && adjustedHeight > this._maxheight || contentHeight > this._maxheight)) { adjustedHeight = this._maxheight;}
if (adjustedHeight) { tip.style.height = adjustedHeight + 'px';contentHeight = adjustedHeight;}
var os = contentHeight + titleHeight - dist + offsety * 2;if (os < 0) os = 0;this._callout.set_verticalOffset(os);}
else { this._callout.set_verticalOffset(0);}
if (this._callout.get_anchorPoint() != align) { this._callout.set_anchorPoint(align);}
else { this._callout.checkPosition();}
if (this._callout._calloutMain.style.visible === 'hidden') { 
this._callout._calloutMain.style.display = 'none';this._callout._calloutMain.style.visible = '';}
},
_onMouseOutGfx: function(sender, e) {
if (!this._showOnHover) { return;}
if (this._showDelayedTimer) { window.clearTimeout(this._showDelayedTimer);this._showDelayedTimer = null;}
if (this._callout.get_isOpen() && this._autoHide) { this._callout.startHideTimer();}
},
_setContentByElement: function(element) {
var title = ESRI.ADF.System.templateBinder(element.get_attributes(), this._hoverTemplate);var content = '';var attr = element.get_attributes()
if (!this._contentTemplate) {
if (attr) { content = ESRI.ADF.System.attributeTableRenderer(attr);}
}
else { content = ESRI.ADF.System.templateBinder(attr, this._contentTemplate);}
if (!title) { title = '<div style="width:10px;">&nbsp;</div>';} 
this.setContent(content, title);this._currentElement = element;this._setExpandCollapseState();},
_onCalloutClick: function() {
if (this._expandOnClick) { this.expand();}
},
_onCalloutShow: function() {
this.adjustHeight();this._raiseMapTipEvent("show");},
_onCalloutHide: function() {
this._raiseMapTipEvent("hide");},
_raiseMapTipEvent: function(action) {
if (this._map) { this._map._raiseEvent('mapTipEvent', { "maptip": this, "element": this._currentElement, "action": action });}
},
_onMouseOverCallout: function() {
if (this._currentElement) {
this._currentHighlight = this._currentElement;}
},
_onMouseOutCallout: function(e) {
if (this._currentElement && this.autoHide) {
this._callout.startHideTimer();}
},
setContent: function(content, title) {
this._callout.setContent({ "content": content, "title": title });},
get_animate: function() {
if (this.get_isInitialized()) { return this._callout.get_animate();}
else { return this._animate;}
},
set_animate: function(value) {
this._animate = value;if (this.get_isInitialized()) { this._callout.set_animate(value);}
},
get_maxheight: function() {
return this._maxheight;},
set_maxheight: function(value) {
this._maxheight = value;},
get_width: function() {
return this._width;},
set_width: function(value) {
this._width = value;if (this._callout != null) {
this._callout.set_width(value);}
},
get_showOnHover: function() {
return this._showOnHover;},
set_showOnHover: function(value) {
this._showOnHover = value;if (value === false && this._callout) { this._callout.hide();}
},
__set_map: function(value) {
if (this._callout && this._map != value) {
throw new Error.invalidOperation('Cannot change the map on MapTips once initialized');}
this._map = value;this._setupCallout();},
get_callout: function() {
return this._callout;},
get_contentTemplate: function() {
return this._contentTemplate;},
set_contentTemplate: function(value) {
this._contentTemplate = value;},
get_hoverTemplate: function() {
return this._hoverTemplate;},
set_hoverTemplate: function(value) { this._hoverTemplate = value;},
set_autoHide: function(value) {
this._autoHide = value;},
get_autoHide: function() {
return this._autoHide;},
get_expandOnClick: function() {
return this._expandOnClick;},
set_expandOnClick: function(value) { this._expandOnClick = value;},
get_isExpanded: function() {
return this._isExpanded;},
get_maptipContentID: function() {
return "content_" + this._maptipID;},
get_maptipTitleID: function() {
return "title_" + this._maptipID;},
add_expanded: function(handler) {
this.get_events().addHandler('expanded', handler);},
remove_expanded: function(handler) { this.get_events().removeHandler('expanded', handler);},
add_collapsed: function(handler) {
this.get_events().addHandler('collapsed', handler);},
remove_collapsed: function(handler) { this.get_events().removeHandler('collapsed', handler);}
};ESRI.ADF.UI.MapTips.registerClass('ESRI.ADF.UI.MapTips', Sys.Component);ESRI.ADF.UI.MapTips._maptipCount = 0;ESRI.ADF.UI.createMapTips = function(gfxLayer,map) {
return new ESRI.ADF.UI.MapTips(gfxLayer,map);};Sys.Application.add_init(function() {
var calloutSettings = {
"template": '<div style="background-color:#ffa;border: solid 1px #eee;padding: 0px; margin:0;width:{@callout_width}" ><div style="padding:0;">{@content}</div></div>',
"templateUrl": null,
"arrowUrl": ESRI.ADF.UI.calloutArrowUrl,
"arrowBounds": [
[0, 0, 18, 30, 0, 6, 5, 5], 
[20, 0, 18, 30, 0, 6, 5, 5], 
[0, 30, 18, 30, 0, 6, 5, 5], 
[20, 30, 18, 30, 0, 6, 5, 5] 
]
};ESRI.ADF.UI.defaultCalloutTemplate = new ESRI.ADF.UI.CalloutLayout();ESRI.ADF.UI.defaultCalloutTemplate.set_layout(calloutSettings);var spriteStyle = String.format(".esriDefaultMaptip .esriDefaultMaptipWindowSprite {{ background-image:url({0}); width:1000px; height:998px; _background-image:none; _filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled='true', sizingMethod='crop', src='{0}'); }}", ESRI.ADF.UI._maptipsSprite);var pa = document.getElementsByTagName('head')[0];var el = document.createElement('style');el.type = 'text/css';el.media = 'screen';if (el.styleSheet) el.styleSheet.cssText = spriteStyle;else el.appendChild(document.createTextNode(spriteStyle));pa.appendChild(el);var isRTL = (document.documentElement.dir == "rtl");var maptipSettings = {
"template": '<div style="width:{@callout_width}; position:relative; color: #000;" class="esriDefaultMaptip"><div style="height:5px"><div style="position: absolute; height:5px; width:50%; left:0; overflow:hidden;"><div style="left:0px; position:absolute;" class="esriDefaultMaptipWindowSprite"></div></div><div style="position: absolute; height:5px; width:50%; right:0; overflow:hidden;"><div style="right:0px; position:absolute;" class="esriDefaultMaptipWindowSprite"></div></div></div><div style="position:relative; overflow:hidden;"><div style="overflow:hidden; width: 100%; position:relative; top:0;"><div style="position: absolute; left:0; top:-5px; width:100%; height:998px;"><div style="position: absolute; width:50%; height:100%; left:0; overflow:hidden;"><div class="esriDefaultMaptipWindowSprite" style="left:0;position:absolute;"></div></div><div style="position: absolute; width:50%; height:100%; right:0; overflow:hidden;"><div style="right: 0px;position:absolute;" class="esriDefaultMaptipWindowSprite"></div></div></div><div style="margin:0 10px 0px 10px;position:relative; top:0px;"><div id="{@maptip_titleID}" style="font-weight: bold; width:100%;" class="esriDefaultMaptipWindowTitle">{@title}&nbsp;</div><div id="{@maptip_contentID}" style="background-color:#fff; display:none; margin:0;position:relative; top:0px; overflow:auto;font-size:10pt;width:100%" class="esriDefaultMaptipWindowContent">{@content}</div></div><div id="close" onclick="$find(\'{@maptipID}\').get_callout().hide();" style="cursor:pointer; position: absolute;' + (isRTL ? 'left' : 'right') + ':10px;top:4px;width:7px; height:6px; overflow:hidden;"><div class="esriDefaultMaptipWindowSprite" style="position:absolute;left:-951px; top:-945px;"></div></div></div></div><div style="height:5px;position:relative;"><div style="left:0; top:0; width:50%;overflow:hidden;height:100%;position:absolute;"><div style="bottom:0;position:absolute;left:0" class="esriDefaultMaptipWindowSprite"></div></div><div style="right:0; top:0; width:50%;overflow:hidden;height:100%;position:absolute;"><div style="right:0;bottom:0px;position:absolute;" class="esriDefaultMaptipWindowSprite"></div></div></div></div>',
"templateUrl": null, 
"arrowUrl": ESRI.ADF.UI._maptipsSprite,
"arrowBounds": [
[954, 921, 16, 17, -1, -3, 5, -7], 
[939, 921, 16, 17, -1, -3, 5, -7], 
[954, 921, 16, 17, -1, -3, 5, -7], 
[939, 921, 16, 17, -1, -3, 5, -7] 
]
};ESRI.ADF.UI.defaultMapTipsTemplate = new ESRI.ADF.UI.CalloutLayout();ESRI.ADF.UI.defaultMapTipsTemplate.set_layout(maptipSettings);});if (typeof(Sys) !== "undefined") { Sys.Application.notifyScriptLoaded();}

//END ESRI.ArcGIS.ADF.Web.UI.WebControls.Runtime.JavaScript.ESRI.ADF.UI.Callout.release.js
//START ESRI.ArcGIS.ADF.Web.UI.WebControls.Runtime.JavaScript.ESRI.ADF.Layers.release.js
//----------------------------------------------------------
// Copyright (C) ESRI. All rights reserved.
//----------------------------------------------------------
Type.registerNamespace('ESRI.ADF.Layers');ESRI.ADF.Layers.LayerCollection = function() {
ESRI.ADF.Layers.LayerCollection.initializeBase(this);this._resources = [];this._levels = null;this._pendingResourceCount=0;this._resourceChangedHandler = Function.createDelegate(this, this._resourceChanged);};ESRI.ADF.Layers.LayerCollection.prototype = {
dispose : function() {
for(var idx=0;idx<this._resources.length;idx++) {
this._resources[idx].dispose();}
Array.clear(this._resources);ESRI.ADF.Layers.LayerCollection.callBaseMethod(this, 'dispose');},
add : function(layer) {
Array.add(this._resources, layer);if(!layer.get_isInitialized())
{
layer.add_initialized(Function.createDelegate(this,this._onResourceInitialized));this._pendingResourceCount++;}
else if(this._pendingResourceCount===0) {
this._calculateLevelScheme();}
var handler = this.get_events().getHandler('layerAdded');if (handler) { handler(this, layer);}
layer.add_propertyChanged(this._resourceChangedHandler);},
insert : function(layer,index) {
Array.insert(this._resources,index,layer);if(!layer.get_isInitialized())
{
layer.add_initialized(Function.createDelegate(this,this._onResourceInitialized));this._pendingResourceCount++;}
else if(this._pendingResourceCount===0) {
this._calculateLevelScheme();}
var handler = this.get_events().getHandler('layerAdded');if (handler) { handler(this, layer);}
layer.add_propertyChanged(this._resourceChangedHandler);},
remove : function(layer) {
Array.remove(this._resources, layer);if(!layer.get_isInitialized())
{
layer.remove_initialized(this._onResourceInitialized);this._pendingResourceCount--;}
else { this._calculateLevelScheme();}
var handler = this.get_events().getHandler('layerRemoved');if (handler) { handler(this, layer);}
layer.remove_propertyChanged(this._resourceChangedHandler);},
indexOf : function(layer) {
return Array.indexOf(this._resources,layer);},
get_layer : function(index) {
return this._resources[index];},
get_layerCount : function() {
return this._resources.length;},
_onResourceInitialized : function(s,e) {
this._pendingResourceCount--;if(this._pendingResourceCount===0) {
this._calculateLevelScheme();var handler = this.get_events().getHandler('layersInitialized');if (handler) { handler(this, Sys.EventArgs.Empty);}
}
},
get_hasPendingLayers : function() {
return (this._pendingResourceCount>0);},
get_extent : function() {
if(this._resources.length===0) { return null;}
var extent = this._resources[0].get_extent();for(var idx=1;idx<this._resources.length;idx++) {
if(this._resources[idx].get_isInitialized()) {
extent = extent.join(this._resources[idx].get_extent());}
}
return extent;},
__hasTiledResources : function() {
Sys.Debug.trace('__hasTiledResources is obsolete. Use __hasLevels');for(var idx=0;idx<this._resources.length;idx++) {
if(ESRI.ADF.Layers.TileLayer.isInstanceOfType(this._resources[idx])) {
return true;} 
}
return false;},
__hasLevels : function() {
for(var idx=0;idx<this._resources.length;idx++) {
if(ESRI.ADF.Layers.TileLayer.isInstanceOfType(this._resources[idx])) {
return true;}
else if(this._resources[idx]._levels) {
return true;}
}
return false;},
getLevelByNearestPixelsize : function(pixelsize) {
if(!this._levels) { return null;}
var level = 0;for(var idx=1;idx<this._levels.length;idx++)
{
if(Math.abs(this._levels[idx]-pixelsize)<Math.abs(this._levels[level]-pixelsize)) {
level = idx;}
}
return level;},
get_levelResolution : function(level) {
if(this._levels) { return this._levels[level];}
else { return null;}
},
_calculateLevelScheme : function() {
if(this.get_layerCount()===0) { this._levels = null;return;} 
if(!this.__hasLevels()) { 
this._levels = null;}
else {
this._levels = [];for(var idx=0;idx<this._resources.length;idx++) {
if(ESRI.ADF.Layers.TileLayer.isInstanceOfType(this._resources[idx])) {
var levels = this._resources[idx].get_levels();for(var j=0;j<levels.length;j++) {
if(!Array.contains(this._levels,levels[j].get_resX())) {
Array.add(this._levels,levels[j].get_resX());}
}
}
else if(this._resources[idx].get_levels()) {
var levels = this._resources[idx].get_levels();for(var j=0;j<levels.length;j++) {
if(!Array.contains(this._levels,levels[j])) {
Array.add(this._levels,levels[j]);}
}
}
}
this._levels.sort(function(a,b){return (a<b?-1:1);});for(var k=this._levels.length-1;k>0;k--) {
if(this._resolutionsAreSame(this._levels[k],this._levels[k-1])) {
Array.remove(this._levels,this._levels[k]);}
}
this._levels.reverse();}
},
_resourceChanged : function(sender, args) {
var handler = this.get_events().getHandler('layerChanged');if (handler) { handler(this, {"resource": sender, "eventArgs": args});}
},
_resolutionsAreSame : function(r1,r2) {
if(r1===r2) { return true;}
return (Math.abs(256.0/r1*r2-256.0)<0.5);},
get_levels : function() {
return this._levels;},
add_layersInitialized : function(handler) {
this.get_events().addHandler('layersInitialized', handler);},
remove_layersInitialized : function(handler) { this.get_events().removeHandler('layersInitialized', handler);},
add_layerAdded : function(handler) {
this.get_events().addHandler('layerAdded', handler);},
remove_layerAdded : function(handler) { this.get_events().removeHandler('layerAdded', handler);},
add_layerRemoved : function(handler) {
this.get_events().addHandler('layerRemoved', handler);},
remove_layerRemoved : function(handler) { this.get_events().removeHandler('layerRemoved', handler);},
add_layerChanged : function(handler) {
this.get_events().addHandler('layerChanged', handler);},
remove_layerChanged : function(handler) { this.get_events().removeHandler('layerChanged', handler);}
};ESRI.ADF.Layers.LayerCollection.registerClass('ESRI.ADF.Layers.LayerCollection', Sys.Component);ESRI.ADF.Layers.Layer = function(id, extent, sref) {
if(id) { this.set_id(id);}
ESRI.ADF.Layers.Layer.initializeBase(this);this._extent = extent;this._spatialReference = sref;this._opacity = 1;this._visible = true;this._functionalities = [];};ESRI.ADF.Layers.Layer.prototype = {
initialize : function() {
ESRI.ADF.Layers.Layer.callBaseMethod(this, 'initialize');if(!this._name) { this._name = this.get_id();}
var handler = this.get_events().getHandler('initialized');if (handler) { handler(this, Sys.EventArgs.Empty);}
},
get_extent : function() {
return this._extent;},
set_extent : function(extent) {
if(extent && !ESRI.ADF.Geometries.Envelope.isInstanceOfType(extent)) { throw Error.argumentType('extent',Object.getType(extent),ESRI.ADF.Geometries.Envelope);}
if(this._extent !== extent && (!extent || !this._extent ||
extent.get_xmin()!==this._extent.get_xmin() || extent.get_ymin()!==this._extent.get_ymin() ||
extent.get_xmax()!==this._extent.get_xmax() || extent.get_ymax()!==this._extent.get_ymax())) {
this._extent=extent;this.raisePropertyChanged('extent');}
},
get_imageFormat : function() {
return this._imageFormat;},
set_imageFormat : function(value) {
this._imageFormat = value;},
get_name : function() {
return this._name;},
set_name : function(value) {
this._name = value;},
get_spatialReference : function() {
return this._spatialReference;},
set_spatialReference : function(value) {
this._spatialReference = value;},
get_opacity : function() {
return this._opacity;},
set_opacity : function(value) {
if(this._opacity !== value) {
this._opacity = value;this.raisePropertyChanged('opacity');}
},
get_visible : function() {
return this._visible;},
set_visible : function(value) {
if(this._visible !== value) {
this._visible = value;this.raisePropertyChanged('visible');}
},
add_initialized : function(handler) {
this.get_events().addHandler('initialized', handler);},
remove_initialized : function(handler) { this.get_events().removeHandler('initialized', handler);}
};ESRI.ADF.Layers.Layer.registerClass('ESRI.ADF.Layers.Layer', Sys.Component);ESRI.ADF.Layers.LevelInfo = function(tileHeight,tileWidth,rows,columns,resX,resY,minrow,mincol) {
this._tileHeight = tileHeight;this._tileWidth = tileWidth;this._rows = rows;this._columns = columns;this._minRow = (minrow?minrow:0);this._minCol = (mincol?mincol:0);this._resX = resX;this._resY = (resY?resY:resX);};ESRI.ADF.Layers.LevelInfo.prototype = {
get_tileHeight : function() {
return this._tileHeight;},
set_tileHeight : function(value) { this._tileHeight = value;},
get_tileWidth : function() {
return this._tileWidth;},
set_tileWidth : function(value) { this._tileWidth = value;},
get_rows : function() {
return this._rows;},
set_rows : function(value) { this._rows = value;},
get_columns : function() {
return this._columns;},
set_columns : function(value) { this._columns = value;},
get_minRow : function() {
return this._minRow;},
set_minRow : function(value) { this._minRow = value;},
get_minCol : function() {
return this._minCol;},
set_minCol : function(value) { this._minCol = value;},
get_resX : function() {
return this._resX;},
set_resX : function(value) { this._resX = value;},
get_resY : function() {
return this._resY;},
set_resY : function(value) { this._resY = value;}
};ESRI.ADF.Layers.LevelInfo.registerClass('ESRI.ADF.Layers.LevelInfo');ESRI.ADF.Layers.TileLayer = function(id, extent, levels, sref) {
ESRI.ADF.Layers.TileLayer.initializeBase(this, [id, extent, sref]);this._levels = (levels?levels:[]);};ESRI.ADF.Layers.TileLayer.prototype = {
getTileUrl : function(column,row,level,handler) {
throw(new Error.notImplemented('getTileUrl'));},
getLevelExtent : function(level) {
var dx = 0;var dy = 0;if(this._tileOrigin) {
dx = this._tileOrigin.get_x();dy = this._tileOrigin.get_y();}
else 
{
dx = this._extent.get_xmin();dy = this._extent.get_ymax();}
var levelinfo = this._levels[level];var tilewidth = levelinfo.get_tileWidth()*levelinfo.get_resX();var tileheight = levelinfo.get_tileHeight()*levelinfo.get_resY();dx += levelinfo.get_minCol() * tilewidth;dy -= levelinfo.get_minRow() * tileheight;return new ESRI.ADF.Geometries.Envelope( 
dx , dy - (levelinfo.get_rows())*tileheight,
dx + (levelinfo.get_columns())*tilewidth, dy,
this._spatialReference);},
getTileExtent : function(column,row,level) {
var dx = 0;var dy = 0;if(this._tileOrigin) {
dx = this._tileOrigin.get_x();dy = this._tileOrigin.get_y();}
else 
{
dx = this._extent.get_xmin();dy = this._extent.get_ymax();}
var lvl = this._levels[level];return new ESRI.ADF.Geometries.Envelope(
new ESRI.ADF.Geometries.Point(
(column)*lvl._tileWidth*lvl.get_resX()+dx,
dy - (row+1)*lvl._tileHeight*lvl.get_resY()),
new ESRI.ADF.Geometries.Point(
(column+1)*lvl._tileWidth*lvl.get_resX()+dx,
dy - (row) * lvl._tileHeight*lvl.get_resY()),
this._spatialReference);},
getTileSpanWithin : function(envelope, level) {
envelope = envelope.intersection(this.getLevelExtent(level));if(envelope) {
var dx = 0;var dy = 0;if(this._tileOrigin) {
dx = this._tileOrigin.get_x();dy = this._tileOrigin.get_y();}
else 
{
dx = this._extent.get_xmin();dy = this._extent.get_ymax();}
var lvl = this._levels[level];var res = lvl.get_resX();var colStart = Math.floor((envelope.get_xmin()-dx+lvl._resX*0.5) / (res * lvl._tileWidth));var rowStart = Math.floor((dy-envelope.get_ymax()+lvl._resY*0.5) / (res * lvl._tileHeight)) ;var colEnd = Math.floor((envelope.get_xmax()-dx-lvl._resX*0.5) / (res * lvl._tileWidth));var rowEnd = Math.floor((dy-envelope.get_ymin()+lvl._resY*0.5) / (res * lvl._tileHeight));if(rowEnd>=lvl.get_rows()+lvl.get_minRow()) { rowEnd = lvl.get_rows()+lvl.get_minRow()-1;}
if(colEnd>=lvl.get_columns()+lvl.get_minCol()) { colEnd = lvl.get_columns()+lvl.get_minCol()-1;}
return [ colStart, rowStart, colEnd, rowEnd ];}
else { return [ 0, 0, -1, -1 ];}
},
getLevelByNearestPixelsize : function(pixelsizeX) {
var level = 0;for(var idx=1;idx<this._levels.length;idx++)
{
if(Math.abs(this._levels[idx].get_resX()-pixelsizeX)<Math.abs(this._levels[level].get_resX()-pixelsizeX)) {
level = idx;}
}
return level;},
getLevelInfo : function(level) {
return this._levels[level];},
get_minimumResolution : function() {
return this._levels[0].get_resX();},
set_minimumResolution : function() {
throw new Error.invalidOperation('Cannot set minimum resolution on a tiled resource');},
get_maximumResolution : function() {
return this._levels[this._levels.length-1].get_resX();},
set_maximumResolution : function() {
throw new Error.invalidOperation('Cannot set maximum resolution on a tiled resource');},
get_tileOrigin : function() {
return this._tileOrigin;},
set_tileOrigin : function(value) { this._tileOrigin = value;},
get_levels : function() {
return this._levels;},
set_levels : function(value) { this._levels = value;} 
};ESRI.ADF.Layers.TileLayer.registerClass('ESRI.ADF.Layers.TileLayer',ESRI.ADF.Layers.Layer);ESRI.ADF.Layers.DynamicLayer = function(id, extent, sref) {
ESRI.ADF.Layers.DynamicLayer.initializeBase(this, [id, extent, sref]);this._extent = extent;this._spatialReference = null;this._useTiling = false;this._tilesize = null;this._minimumResolution = 0;this._maximumResolution = Number.MAX_VALUE;this._levels = null;};ESRI.ADF.Layers.DynamicLayer.prototype = {
getUrl : function(minx,miny,maxx,maxy,width,height,handler) {
throw(new Error.notImplemented('getUrl'));},
get_minimumResolution : function() {
return this._minimumResolution;},
set_minimumResolution : function(value) {
this._minimumResolution = value;},
get_maximumResolution : function() {
return this._maximumResolution;},
set_maximumResolution : function(value) {
this._maximumResolution = value;},
get_useTiling : function() {
return this._useTiling;},
set_useTiling : function(value) {
this._useTiling = value;},
get_tilesize : function() {
return this._tilesize;},
set_tilesize : function(value) {
this._tilesize = value;},
get_levels : function() {
return this._levels;}, 
set_levels : function(value) {
this._levels = value;}
};ESRI.ADF.Layers.DynamicLayer.registerClass('ESRI.ADF.Layers.DynamicLayer',ESRI.ADF.Layers.Layer);ESRI.ADF.Layers.AdfTileHandler = function() {
ESRI.ADF.Layers.AdfTileHandler.initializeBase(this);this._onCompleteHandler = Function.createDelegate(this,this._onComplete);this._timeout = 90000;};ESRI.ADF.Layers.AdfTileHandler.prototype = {
getTileUrl: function(c, r, level, handler) {
if (c >= 0 && r >= 0) { 
if (ESRI.ADF.System.checkSessionExpired && ESRI.ADF.System.checkSessionExpired()) { return;}
var argument = '&Row=' + r + '&Column=' + c + '&Level=' + level + '&t=' + (new Date()).getTime();var wRequest = new Sys.Net.WebRequest();wRequest.add_completed(this._onCompleteHandler);wRequest.set_url(this._tileHandlerUrl + argument);wRequest.set_userContext(handler);wRequest.set_timeout(this._timeout);wRequest.invoke();}
},
_onComplete: function(executor, eventArgs) {
var handler = executor.get_webRequest().get_userContext();var url = executor.get_webRequest().get_url();if (executor.get_responseAvailable()) {
if (ESRI.ADF.System.resetSessionLapse) { ESRI.ADF.System.resetSessionLapse();}
var result = executor.get_responseData();var obj = null;try { obj = Sys.Serialization.JavaScriptSerializer.deserialize(result);}
catch (ex) {
this._raiseError('Invalid JSON response: ' + result, url, null);handler('');return;}
if (obj.code && obj.code !== 200) {
if (obj.type === 'error') {
this._raiseError('DrawTile returned error: ' + obj.errorMessage, url, obj.code);}
else {
Sys.Debug.trace('DrawTile returned message: ' + obj.errorMessage);}
handler('');}
else if (!obj.url && obj.url !== '') {
this._raiseError('Invalid response', url, executor.get_statusCode());handler('');}
else if (obj.url === '') {
this._raiseError('Returned empty URL', url, executor.get_statusCode());handler('');}
else { handler(obj.url);}
}
else if (executor.get_timedOut()) {
this._raiseError('Response timed out', url, null);handler('');}
else if (executor.get_aborted()) {
this._raiseError('Request was aborted', url, null);handler('');}
else {
this._raiseError('Empty response', url, executor.get_statusCode());handler('');}
},
_raiseError: function(message, url, statusCode) {
Sys.Debug.trace('MapHandler error\nmessage:' + message + '\n url:' + url + '\nresource:' + this.get_id() + '\nstatus code:' + statusCode);var handler = this.get_events().getHandler('requestError');if (handler) { handler(this, { "errorMessage": message, "url": url, "statusCode": statusCode });}
},
add_requestError: function(handler) {
this.get_events().addHandler('requestError', handler);},
remove_requestError: function(handler) { this.get_events().removeHandler('requestError', handler);},
get_tileHandlerUrl: function() {
return this._tileHandlerUrl;},
set_tileHandlerUrl: function(value) {
this._tileHandlerUrl = value;},
get_timeout: function() {
return this._timeout;},
set_timeout: function(value) { this._timeout = value;}
};ESRI.ADF.Layers.AdfTileHandler.registerClass('ESRI.ADF.Layers.AdfTileHandler',ESRI.ADF.Layers.TileLayer);ESRI.ADF.Layers.AdfMapHandler = function() {
ESRI.ADF.Layers.AdfMapHandler.initializeBase(this);this._onCompleteHandler = Function.createDelegate(this,this._onComplete);this._timeout = 90000;};ESRI.ADF.Layers.AdfMapHandler.prototype = {
getUrl: function(minx, miny, maxx, maxy, width, height, handler) {
if (ESRI.ADF.System.checkSessionExpired && ESRI.ADF.System.checkSessionExpired()) { return;}
var argument = '&Extent=' + minx + ',' + miny + ',' + maxx + ',' + maxy + '&Width=' + width + '&Height=' + height + '&t=' + (new Date()).getTime();var wRequest = new Sys.Net.WebRequest();wRequest.add_completed(this._onCompleteHandler);wRequest.set_url(this._mapHandlerUrl + argument);wRequest.set_userContext(handler);wRequest.set_timeout(this._timeout);wRequest.invoke();},
_onComplete: function(executor, eventArgs) {
var handler = executor.get_webRequest().get_userContext();var url = executor.get_webRequest().get_url();if (executor.get_responseAvailable()) {
if (ESRI.ADF.System.resetSessionLapse) { ESRI.ADF.System.resetSessionLapse();}
var result = executor.get_responseData();var obj = null;try { obj = Sys.Serialization.JavaScriptSerializer.deserialize(result);}
catch (ex) {
this._raiseError('Invalid JSON response: ' + result, url, null);handler('');return;}
if (obj.code && obj.code !== 200) {
if (obj.type === 'error') {
this._raiseError('DrawImage returned error: ' + obj.errorMessage, url, obj.code);}
else {
Sys.Debug.trace('DrawImage returned message: ' + obj.errorMessage);}
handler('');}
else if (!obj.url && obj.url !== '') {
this._raiseError('Invalid response', url, executor.get_statusCode());handler('');}
else if (obj.url === '') {
this._raiseError('Returned empty URL', url, executor.get_statusCode());handler('');}
else {
if (obj.imageExtent) {
handler(obj.url, new ESRI.ADF.Geometries.Envelope(obj.imageExtent[0], obj.imageExtent[1], obj.imageExtent[2], obj.imageExtent[3]));}
else { handler(obj.url);}
}
}
else if (executor.get_timedOut()) {
this._raiseError('Response timed out', url, null);handler('');}
else if (executor.get_aborted()) {
this._raiseError('Request was aborted', url, null);handler('');}
else {
this._raiseError('Empty response', url, executor.get_statusCode());handler('');}
},
_raiseError: function(message, url, statusCode) {
Sys.Debug.trace('MapHandler error\nmessage:' + message + '\n url:' + url + '\nresource:' + this.get_id() + '\nstatus code:' + statusCode);var handler = this.get_events().getHandler('requestError');if (handler) { handler(this, { "errorMessage": message, "url": url, "statusCode": statusCode });}
},
add_requestError: function(handler) {
this.get_events().addHandler('requestError', handler);},
remove_requestError: function(handler) { this.get_events().removeHandler('requestError', handler);},
get_mapHandlerUrl: function() {
return this._mapHandlerUrl;},
set_mapHandlerUrl: function(value) { this._mapHandlerUrl = value;},
get_timeout: function() {
return this._timeout;},
set_timeout: function(value) { this._timeout = value;}
};ESRI.ADF.Layers.AdfMapHandler.registerClass('ESRI.ADF.Layers.AdfMapHandler',ESRI.ADF.Layers.DynamicLayer);ESRI.ADF.Layers.AdfMapPageHandler = function() {
ESRI.ADF.Layers.AdfMapPageHandler.initializeBase(this);this._requestIdCounter=0;this._handlers = {};};ESRI.ADF.Layers.AdfMapPageHandler.prototype = {
getUrl : function(minx,miny,maxx,maxy,width,height,handler) {
if(ESRI.ADF.System.checkSessionExpired && ESRI.ADF.System.checkSessionExpired()) { return;}
var id = this._requestIdCounter++;var argument = 'EventArg=GetImage&resource='+this.get_id()+'&ID='+id+'&Extent=' + minx + ',' + miny + ',' + maxx + ',' + maxy + '&Width=' + width + '&Height=' + height + '&t='+(new Date()).getTime();this._handlers['Request_'+id] = handler;this._map.doCallback(argument,this);},
processCallbackResult : function(action,params) {
if(action === 'GetImage') {
var obj = params[0];var id = obj.id;var handler = this._handlers['Request_'+id];if(handler) {
if(obj.error) { this._raiseError('GetImage returned error: ' + obj.error);handler('');}
if(obj.imageExtent) { handler(obj.url, new ESRI.ADF.Geometries.Envelope(obj.imageExtent[0],obj.imageExtent[1],obj.imageExtent[2],obj.imageExtent[3]));}
else { handler(obj.url);}
}
return true;}
return false;},
_raiseError : function(message) {
Sys.Debug.trace('MapPageHandler error: ' + message);var handler = this.get_events().getHandler('requestError');if (handler) { handler(this, {"errorMessage": message });}
},
add_requestError : function(handler) {
this.get_events().addHandler('requestError', handler);},
remove_requestError : function(handler) { this.get_events().removeHandler('requestError', handler);},
get_map : function() {
return this._map;},
set_map : function(value) { this._map = value;}
};ESRI.ADF.Layers.AdfMapPageHandler.registerClass('ESRI.ADF.Layers.AdfMapPageHandler',ESRI.ADF.Layers.DynamicLayer);ESRI.ADF.Layers.AdfTileDirectAccess = function() {
this._tileUrlGeneratorFunction = null;this._serverUrl = null;ESRI.ADF.Layers.AdfTileDirectAccess.initializeBase(this);};ESRI.ADF.Layers.AdfTileDirectAccess.prototype = {
getTileUrl : function(c,r,level,handler) {
handler(this._tileUrlGeneratorFunction(level, c, r, this._serverUrl));},
get_tileUrlGeneratorFunction : function() {
return this._tileUrlGeneratorFunction;},
set_tileUrlGeneratorFunction : function(value) {
this._tileUrlGeneratorFunction = value;},
get_serverUrl : function() {
return this._serverUrl;},
set_serverUrl : function(value) {
this._serverUrl = value;}
};ESRI.ADF.Layers.AdfTileDirectAccess.registerClass('ESRI.ADF.Layers.AdfTileDirectAccess',ESRI.ADF.Layers.TileLayer);if (typeof(Sys) !== "undefined") { Sys.Application.notifyScriptLoaded();}

//END ESRI.ArcGIS.ADF.Web.UI.WebControls.Runtime.JavaScript.ESRI.ADF.Layers.release.js
//START ESRI.ArcGIS.ADF.Web.UI.WebControls.Runtime.JavaScript.ESRI.ADF.UI.Map.release.js
//----------------------------------------------------------
// Copyright (C) ESRI. All rights reserved.
//----------------------------------------------------------
Type.registerNamespace('ESRI.ADF.UI');ESRI.ADF.UI.MouseMode = function() {
throw Error.invalidOperation();};ESRI.ADF.UI.MouseMode.prototype = {
None: 0,
Pan: 1,
ZoomIn: 2,
ZoomOut: 3,
Custom: 99
};ESRI.ADF.UI.MouseMode.registerEnum("ESRI.ADF.UI.MouseMode", false);ESRI.ADF.UI.MapBase = function(element) {
ESRI.ADF.UI.MapBase.initializeBase(this, [element]);this._layers = null;this._mouseDragState = null;this._isZooming = false;this._extent = null;this._cursor = 'crosshair';this._pixelsizeX = 1.0;this._pixelsizeY = this._pixelsizeX;this._disableScrollWheelZoom = false;this._keyPanDirection = [0, 0];this._mapsize = null;this._graphicFeatures = [];this._gridOrigin = new ESRI.ADF.Geometries.Point(0, 0);this._mouseMode = null;this._altAction = null;this._ctrlAction = null;this._mapsize = this._getInternalElementSize(this.get_element());this._extentHistory = [];this._currentExtentHistory = null;this._mouseWheelDirection = 1;this._keyActions = [];this._rotation = { "angle": 0, "cos": 1, "sin": 0 };this._progressBarEnabled = true;this._clipExtentBuffer = 50;this._layerReferences = {};this._animationSettings = { "duration": 0.25, "fps": 25, "enableFadeTransition": !ESRI.ADF.System.__isIE6, "disableNavigationAnimation": false };this._fadingStarted = true;this._isPanning = false;this._minZoom = 0;this._maxZoom = Number.POSITIVE_INFINITY;this._progressBarAlignment = ESRI.ADF.System.ContentAlignment.BottomRight;this._tileBuffer = null;this._loadTilesContinously = true;};ESRI.ADF.UI.MapBase.prototype = {
initialize: function() {
ESRI.ADF.UI.MapBase.callBaseMethod(this, 'initialize');if (!this._mouseMode) { this._mouseMode = ESRI.ADF.UI.MouseMode.Pan;}
this._setupMap();if (this._extentHistory.length === 0) {
this._addExtentHistory();}
this.add_zoomStart(Function.createDelegate(this, function() {
this._clearRequestStack();this._isZooming = true;this._clearVectorGraphics();this._tmpExtent = this.get_extent();this._fadingStarted = false;}));this.add_zoomCompleted(Function.createDelegate(this, function() {
this._isZooming = false;this._oldLayersDiv = this._layersDiv;this._oldLayersDiv.id = '';for (var idx in this._oldLayersDiv.childNodes) {
if (this._oldLayersDiv.childNodes[idx]) {
this._oldLayersDiv.childNodes[idx].id = '';}
}
this._layersDiv = this._createLayersDiv();this._containerDiv.insertBefore(this._layersDiv, this._annotationDiv);this._oldLayersDiv.style.left = this._containerDivPos[0] + 'px';this._oldLayersDiv.style.top = this._containerDivPos[1] + 'px';this._resetGridOffset();if (Sys.Browser.agent === Sys.Browser.InternetExplorer && this._animationSettings.enableFadeTransition && !this._animationSettings.disableNavigationAnimation) {
this._layersDiv.style.filter = "progid:DXImageTransform.Microsoft.Fade(overlap=1, duration=0.5)";this._layersDiv.filters[0].Apply();}
if (this._suppressExtentChanged !== true) {
this._raiseEvent('extentChanged', { "previous": this._tmpExtent, "current": this.get_extent() });}
this._tmpExtent = null;}));this.add_click(Function.createDelegate(this, this._onClick));this.add_mouseDragging(Function.createDelegate(this, this._onMouseDragging));this.add_mouseDragCompleted(Function.createDelegate(this, this._onMouseDragCompleted));this.add_panning(Function.createDelegate(this, function() {
if (!this._panPanPositionTracker) {
this._panPanPositionTracker = [this._containerDivPos[0], this._containerDivPos[1]];if (this._loadTilesContinously) { this._loadTilesInView();}
}
else {
var dist = Math.max(
Math.abs(this._containerDivPos[0] - this._panPanPositionTracker[0]),
Math.abs(this._containerDivPos[1] - this._panPanPositionTracker[1]));if (dist > 64) {
this._panPanPositionTracker = [this._containerDivPos[0], this._containerDivPos[1]];if (this._loadTilesContinously) { this._loadTilesInView();}
}
}
this._raiseEvent('extentChanging');}));this.add_panCompleted(Function.createDelegate(this, function(s, e) {
this._extent = null;this._panPanPositionTracker = null;this._removeOutsideTiles();if (this._suppressExtentChanged !== true) {
this._raiseEvent('extentChanged', e);}
this._tmpExtent = null;}));var del = Function.createDelegate(this, function(s, e) {
this._extent = null;this._addExtentHistory(e.previous, e.current);this._loadLayersInView(false);});this.add_extentChanged(del);$addHandlers(this.get_element(), {
'dblclick': this._onDblClick,
'mousedown': this._onMouseDown,
'contextmenu': function() { return false;}
}, this);this._mouseMoveHandler = Function.createDelegate(this, this._onMouseMove);this._mouseUpHandler = Function.createDelegate(this, this._onMouseUp);if (Sys.Browser.agent === Sys.Browser.InternetExplorer) {
$addHandlers(this.get_element(), {
'mouseenter': Function.createDelegate(this, this._hookEventsOnMouseEnter),
'mouseleave': Function.createDelegate(this, this._unhookEventsOnMouseLeave)
}, this);}
else {
$addHandlers(this.get_element(), {
'mouseover': Function.createDelegate(this, this._hookEventsOnMouseEnter),
'mouseout': Function.createDelegate(this, this._unhookEventsOnMouseLeave)
}, this);}
this._onKeyDownHandler = Function.createDelegate(this, this._onKeyDown);this._onKeyUpHandler = Function.createDelegate(this, this._onKeyUp);this._onWindowResizeHandler = Function.createDelegate(this, this._onResize);this._onWindowBlurHandler = Function.createDelegate(this, function() { this._fireKeyUpAction('all');});$addHandler(window, 'resize', this._onWindowResizeHandler);$addHandler(window, 'blur', this._onWindowBlurHandler);if (Sys.Browser.agent === Sys.Browser.Firefox) {
$addHandler(window, 'mouseout', Function.createDelegate(this, function(e) { if (e.target === document.body.parentNode && this._mouseDragState) { this._onMouseUp(e);} }));}
if (!this._disableScrollWheelZoom) { ESRI.ADF.System.addMouseWheelHandler(this.get_element(), this._onMouseWheel, this);}
this._hookupLayerCollectionEvents();},
_createProgressBar: function() {
this._progressBar = $create(ESRI.ADF.UI.ProgressBarExtender, { "width": "200px", "progressBarAlignment": this._progressBarAlignment }, null, { "map": this.get_id() });},
_hookupLayerCollectionEvents: function() {
if (!this._layers) { this._layers = new ESRI.ADF.Layers.LayerCollection();}
if (!this._layers.get_hasPendingLayers() && this._layers._resources.length > 0) { this._loadLayersInView(true);}
this._layers.add_layerAdded(Function.createDelegate(this, function(sender, args) {
if (this._layers.get_layerCount() === 1) { 
var resource = this._layers.get_layer(0);if (resource.get_isInitialized()) { 
this._loadFirstResource();}
else {
resource.add_initialized(Function.createDelegate(this, this._loadFirstResourceAndLayersInView));}
}
if (!this._layers.get_hasPendingLayers()) {
if (ESRI.ADF.Layers.DynamicLayer.isInstanceOfType(args)) {
this.refreshLayer(args);}
else { this._loadLayersInView(true);}
}
else { args.add_initialized(Function.createDelegate(this, function() { this._loadLayersInView() }));}
}));this._layers.add_layersInitialized(Function.createDelegate(this, this._loadLayersInView));this._layers.add_layerRemoved(Function.createDelegate(this, function(s, e) {
this._clearResourceImageTiles(e);var layerid = this._getLayerId(e);this._removeElement(this._layerReferences[layerid]);this._layerReferences[layerid] = null;this._removePendingStackStartingWith(layerid, true, false);}));},
dispose: function() {
if (this._progressBar) { this._progressBar.dispose();}
$removeHandler(window, 'resize', this._onWindowResizeHandler);$removeHandler(window, 'blur', this._onWindowBlurHandler);if (this._layers) { this._layers.dispose();}
$clearHandlers(this.get_element());ESRI.ADF.UI.MapBase.callBaseMethod(this, 'dispose');},
_loadFirstResource: function() {
var resource = this.get_layers().get_layer(0);var level = this._layers.getLevelByNearestPixelsize(this._pixelsizeX);if (level === null) { this._pixelsizeY = this._pixelsizeX;}
else { this._pixelsizeX = this._pixelsizeY = this.get_layers().get_levelResolution(level);}
this.set_spatialReference(resource.get_spatialReference());this._applyExtent(this.get_extent());this.refreshGraphics();},
_loadFirstResourceAndLayersInView: function() {
this._loadFirstResource();this._loadLayersInView(true);},
_setupMap: function() {
if (!this.get_cursor()) { this.set_cursor('move');}
this._controlDiv = document.createElement('div');var MapControlDiv = this._controlDiv;MapControlDiv.style.overflow = 'hidden';MapControlDiv.style.width = '100%';MapControlDiv.style.height = '100%';MapControlDiv.style.position = 'relative';MapControlDiv.style.backgroundImage = 'url(' + ESRI.ADF.System.blankImagePath + ')';MapControlDiv.id = 'MapControlDiv_' + this.get_id();var mapdiv = null;this.get_element().appendChild(MapControlDiv);if (Sys.Browser.agent !== Sys.Browser.InternetExplorer) {
MapControlDiv.style.MozUserFocus = 'normal';this._keyActionDiv = document.createElement('a');this._keyActionDiv.id = 'MapMozillaLink_' + this.get_id();this._keyActionDiv.style.MozUserFocus = 'normal';MapControlDiv.appendChild(this._keyActionDiv);$addHandler(this._keyActionDiv, 'mouseover', this._keyActionDiv.focus);mapdiv = this._keyActionDiv;}
else { mapdiv = MapControlDiv;}
this._containerDiv = document.createElement('div');this._containerDiv.style.width = '100%';this._containerDiv.style.height = '100%';this._containerDiv.style.position = 'relative';this._containerDiv.id = 'MapContainerDiv_' + this.get_id();this._containerDiv.style.left = '0';this._containerDiv.style.top = '0';this._containerDivPos = [0, 0];mapdiv.appendChild(this._containerDiv);this._layersDiv = this._createLayersDiv();this._containerDiv.appendChild(this._layersDiv);this._annotationDiv = document.createElement('div');this._annotationDiv.id = 'MapAnnotationDiv_' + this.get_id();this._containerDiv.appendChild(this._annotationDiv);this._annotationDiv.style.position = 'absolute';this._annotationDiv.style.left = '0';this._annotationDiv.style.top = '0';this._annotationDiv.dir = 'ltr';this._containerDiv.appendChild(this._annotationDiv);this._assotateCanvas = this._createCanvas(this._annotationDiv);this.get_element().style.MozUserSelect = 'none';if (Sys.Browser.agent === Sys.Browser.InternetExplorer) {
this.get_element().unselectable = 'on';}
else if (Sys.Browser.agent === Sys.Browser.Safari) {
this.get_element().style.KhtmlUserSelect = 'none';}
else {
this.get_element().style.MozUserSelect = 'none';this.get_element().style["-moz-user-focus"] = 'normal';}
this._tilesInView = {};this._requestStack = [];this._pendingSrcImages = [];this._mapsize = this._getInternalElementSize(this.get_element());this._assotateCanvas.adjustCanvasExtent(this._containerDivPos[0], this._containerDivPos[1], this._mapsize[1], this._mapsize[0]);if (this._progressBarEnabled) { this._createProgressBar();}
},
_createLayersDiv: function() {
var layersDiv = document.createElement('div');layersDiv.style.width = '100%';layersDiv.style.height = '100%';layersDiv.style.position = 'absolute';layersDiv.id = this.get_id() + '_layers';layersDiv.dir = 'ltr';this._layerReferences = {};return layersDiv;},
_createCanvas: function(vectorcanvas) {
vectorcanvas.style.position = 'absolute';vectorcanvas.style.width = '100%';vectorcanvas.style.height = '100%';vectorcanvas.style.overflow = 'visible';var map = this;var vectorCanvasObj = ESRI.ADF.Graphics.createCanvas(vectorcanvas, function(pnt) { return map._toMapScreen(pnt);});if (vectorCanvasObj) { vectorCanvasObj.initialize();}
return vectorCanvasObj;},
refresh: function() {
this._loadLayersInView();},
_clearImageTiles: function() {
this._clearRequestStack();this._tilesInView = {};var imgs = null;if (this._layersDiv.querySelectorAll) {
imgs = this._layersDiv.querySelectorAll('.esriMapImage');}
else { imgs = this._layersDiv.getElementsByTagName('img');}
for (var idx = 0;idx < imgs.length;idx++) { this._removeElement(imgs[idx]);}
this._layersDiv.innerHTML = '';this._layerReferences = {};var ext = this.get_extent();this._gridOrigin = new ESRI.ADF.Geometries.Point(ext.get_xmin(), ext.get_ymax());this._extent = null;this._containerDiv.style.left = 0;this._containerDiv.style.top = 0;this._containerDivPos = [0, 0];this._raiseEvent('gridOriginChanged', this._gridOrigin);},
_clearOldImageTiles: function() {
if (!this._oldLayersDiv) { return;}
this._oldLayersDiv.style.display = 'none';var imgs = null;if (this._oldLayersDiv.querySelectorAll) {
imgs = this._oldLayersDiv.querySelectorAll('.esriMapImage');}
else { imgs = this._oldLayersDiv.getElementsByTagName('img');}
for (var idx = 0;idx < imgs.length;idx++) { this._removeElement(imgs[idx]);}
imgs = null;this._removeElement(this._oldLayersDiv);this._oldLayersDiv = null;},
_clearResourceImageTiles: function(resource) {
var layerid = this._getLayerId(resource);var idx = 0;for (idx = this._requestStack.length - 1;idx >= 0;idx--) {
if (this._requestStack[idx].startsWith(layerid)) {
this._tilesInView[this._requestStack[idx]] = null;}
}
for (idx in this._tilesInView) {
if (idx != null && idx.startsWith(layerid)) {
this._tilesInView[idx] = null;}
}
var layer = this._layerReferences[layerid]
if (layer) {
var imgs = null;if (layer.querySelectorAll) {
imgs = layer.querySelectorAll('.esriMapImage');}
else { imgs = layer.getElementsByTagName('img');}
for (idx = imgs.length - 1;idx >= 0;idx--) { this._removeElement(imgs[idx]);}
layer.innerHTML = '';}
},
refreshLayer: function(layer) {
this._clearResourceImageTiles(layer);this._updateLayer(layer);},
_updateLayer: function(resource) {
if (!resource || !resource.get_isInitialized()) { return;}
var layerid = this._getLayerId(resource);var layer = this._layerReferences[layerid]
if (!resource.get_visible()) {
if (layer) { this._removeElement(layer);}
layer = null;this._layerReferences[layerid] = null;return;}
if (!layer) { layer = this._createLayerDiv(resource);}
if (ESRI.ADF.Layers.DynamicLayer.isInstanceOfType(resource)) {
var ext = this.get_extent();if (!resource.get_useTiling()) {
if (!ext.intersects(resource.get_extent())) { if (layer) { this._layerReferences[layerid] = null;this._removeElement(layer);} return;}
this._loadImageInView(layerid, ext, resource);}
else {
if (!ext.intersects(resource.get_extent())) { return;}
this._loadDynamicTilesInView(resource, layerid);}
}
else if (ESRI.ADF.Layers.TileLayer.isInstanceOfType(resource)) {
this._loadResourceTilesInView(resource, layer);}
},
_loadLayersInView: function() {
if (!this.get_isInitialized()) { return;}
this.checkMapsize(true);if (this._mapsize[0] === 0 || this._mapsize[1] === 0) {
return;}
this._assotateCanvas.adjustCanvasExtent(this._containerDivPos[0], this._containerDivPos[1], this._mapsize[1], this._mapsize[0]);if (this.get_layers().get_layerCount() > 0) {
if (this.disabled) { return;}
var ext = this.get_extent();if (ext.get_area() === 0) { return;}
var level = this.get_layers().getLevelByNearestPixelsize(this._pixelsizeX);if (level !== null) {
var resX = this.get_layers().get_levelResolution(level);if (this._pixelsizeX !== resX) { 
this._suppressExtentChanged = true;this.zoom(this._pixelsizeX / resX, null, false);this._suppressExtentChanged = false;}
}
for (var idx = 0;idx < this._layers.get_layerCount();idx++) {
var resource = this._layers.get_layer(idx);this._updateLayer(resource);}
}
this.refreshGraphics();},
_createLayerDiv: function(resource) {
var index = this._layers.indexOf(resource);if (index < 0) return null;var layer = document.createElement('div');layer.id = this._getLayerId(resource);layer.style.position = 'absolute';layer.style.left = 0;layer.style.top = 0;layer.resourceName = resource.get_id();this._layerReferences[layer.id] = layer;var layerNodes = this._layersDiv.childNodes;var length = layerNodes.length;var nodeInserted = false;for (var i = 0;i < length;i++) {
var node = layerNodes[i];var name = node.resourceName;if (!name) { continue;}
var res = $find(name);if (!res) { continue;}
var idx = this._layers.indexOf(res);if (idx > index) {
this._layersDiv.insertBefore(layer, node);nodeInserted = true;break;}
}
if (!nodeInserted) { this._layersDiv.appendChild(layer);}
if (Sys.Browser.agent !== Sys.Browser.InternetExplorer && resource.get_opacity() < 1 && resource.get_imageFormat() !== 'png32') {
ESRI.ADF.System.setOpacity(layer, resource.get_opacity());}
return layer;},
_loadImageInView: function(layerid, ext, resource) {
var ext2 = resource.get_extent();if (this._rotation.angle === 0) {
var w = this._clipExtentBuffer * this._pixelsizeX;var h = this._clipExtentBuffer * this._pixelsizeY;ext2 = new ESRI.ADF.Geometries.Envelope(ext2.get_xmin() - w, ext2.get_ymin() - h, ext2.get_xmax() + w, ext2.get_ymax() + h);ext2 = ext.intersection(ext2);}
else { ext2 = ext;}
var width = this._mapsize[0];var height = this._mapsize[1];width = Math.round(width * (ext2.get_width() / ext.get_width()));height = Math.round(height * (ext2.get_height() / ext.get_height()));ext2.set_xmax(ext2.get_xmin() + width * this._pixelsizeX);ext2.set_ymax(ext2.get_ymin() + height * this._pixelsizeY);var id = layerid + '_img';this._removePendingStackStartingWith(id, true, true);if (!this._dynamicImageCounter) { this._dynamicImageCounter = 0;}
id += this._dynamicImageCounter;this._dynamicImageCounter++;this._addPendingStack(id);var format = resource.get_imageFormat();var onready = function(url, adjExtent) {
this._addImageOnReady(layerid, ext2, url, resource.get_opacity(), id, format, false);onready = null;};var del = Function.createDelegate(this, onready);resource.getUrl(ext2.get_xmin(), ext2.get_ymin(), ext2.get_xmax(), ext2.get_ymax(), width, height, del);},
_loadTilesInView: function() {
for (var idx = 0;idx < this._layers.get_layerCount();idx++) {
var resource = this._layers.get_layer(idx);if (resource && resource.get_isInitialized() && resource._visible) {
if (ESRI.ADF.Layers.TileLayer.isInstanceOfType(resource)) {
var layerid = this._getLayerId(resource);var layer = this._layerReferences[layerid]
if (!layer) { layer = this._createLayerDiv(resource);}
this._loadResourceTilesInView(resource, layer, idx === 0);layer = null;}
else if (ESRI.ADF.Layers.DynamicLayer.isInstanceOfType(resource) && resource.get_useTiling()) {
var dynlayerid = this._getLayerId(resource);var dynlayer = this._layerReferences[dynlayerid]
if (!dynlayer) { dynlayer = this._createLayerDiv(resource);}
this._loadDynamicTilesInView(resource, dynlayerid, idx === 0);dynlayer = null;}
}
}
},
_loadDynamicTilesInView: function(resource, layerid) {
var tiles = this._getDynamicTiles(resource, this.get_extent());for (var idx in tiles) {
this._addDynamicTile(tiles[idx], layerid, resource);}
},
_getDynamicTiles: function(resource, ext) {
var tilesize = resource.get_tilesize();if (!tilesize) {
if (!this._dynTileSize || this._dynTileSize[0] == 0 || this._dynTileSize[1] == 0) {
this._dynTileSize = this._mapsize;if (this._dynTileSize[0] > 1024) { this._dynTileSize[0] = 1024;}
if (this._dynTileSize[1] > 1024) { this._dynTileSize[1] = 1024;}
}
tilesize = this._dynTileSize;}
var tiles = {};if (tilesize[0] > 0 && tilesize[1] > 0) {
var tilesizeMap = [tilesize[0] * this._pixelsizeX, tilesize[1] * this._pixelsizeY];var startcol = Math.floor((ext.get_xmin() - this._gridOrigin.coordinates[0]) / tilesizeMap[0]);var startrow = Math.floor((this._gridOrigin.coordinates[1] - ext.get_ymax()) / tilesizeMap[1]);var endcol = Math.floor((ext.get_xmax() - this._gridOrigin.coordinates[0] - this._pixelsizeX * 0.5) / tilesizeMap[0]);var endrow = Math.floor((this._gridOrigin.coordinates[1] - ext.get_ymin() - this._pixelsizeY * 0.5) / tilesizeMap[1]);var idx = 0;for (var row = startrow;row <= endrow;row++) {
var top = this._gridOrigin.coordinates[1] - row * tilesizeMap[1];for (var col = startcol;col <= endcol;col++) {
var left = this._gridOrigin.coordinates[0] + col * tilesizeMap[0];tiles[idx] = { "env": [left, top - tilesizeMap[1], left + tilesizeMap[0], top], "row": row, "col": col, "width": tilesize[0], "height": tilesize[1] };idx++;}
}
}
return tiles;},
_loadResourceTilesInView: function(resource, layer) {
if (resource.get_minimumResolution() < this._pixelsizeX - this._pixelsizeX/256 ||
resource.get_maximumResolution() > this._pixelsizeX + this._pixelsizeX/256) { return;}
var currentLevel = resource.getLevelByNearestPixelsize(this._pixelsizeX);var res = resource.get_levels()[currentLevel].get_resX();var lod = this._pixelsizeX;if (!this._layers._resolutionsAreSame(lod, res)) { return;}
if (currentLevel !== null) { lod = resource.getLevelInfo(currentLevel).get_resX();}
if (lod) {
var tiles = resource.getTileSpanWithin(this.get_extent(), currentLevel);for (var column = tiles[0];column <= tiles[2];column++) {
for (var row = tiles[1];row <= tiles[3];row++) {
this._addTile(column, row, currentLevel, layer, resource);}
}
}
},
_isTileInPendingStack: function(id) {
return Array.contains(this._requestStack, id);},
_clearRequestStack: function() {
if (this._requestStack) {
var elm = null;var img = null;var parent = null;while (this._requestStack.length > 0) {
elm = Array.dequeue(this._requestStack);img = $get(elm);if (img) {
parent = img.parentNode;this._removeElement(img);if (ESRI.ADF.System.__isIE6 && parent) { this._removeElement(parent);}
}
}
}
else { this._requestStack = [];}
this._raiseEvent('onProgress', 0);},
_addPendingStack: function(id) {
Array.add(this._requestStack, id);this._raiseEvent('onProgress', this._requestStack.length);},
_removePendingStack: function(id, removeImg, suppressEvent) {
if (removeImg === true) {
var img = $get(id);if (img) {
var parent = img.parentNode;this._removeElement(img);if (ESRI.ADF.System.__isIE6 && parent) { this._removeElement(parent);}
}
}
if (Array.contains(this._requestStack, id)) {
Array.remove(this._requestStack, id);if (!suppressEvent) { this._raiseEvent('onProgress', this._requestStack.length);}
if (this._requestStack.length === 0 && this._oldLayersDiv) { this._clearOldImageTiles();}
}
},
_removePendingStackStartingWith: function(id, removeImg, suppressEvent) {
Array.forEach(this._requestStack, function(imgid, index, arr) { if (imgid.startsWith(id)) { this._removePendingStack(imgid, removeImg, suppressEvent);} }, this);},
_removeOutsideTiles: function() {
var tilesToKeep = [];for (var resourceIndex = 0;resourceIndex < this.get_layers().get_layerCount();resourceIndex++) {
var resource = this.get_layers().get_layer(resourceIndex);if (resource && resource.get_visible() === true) {
var extent = this.get_extent();if (this._tileBuffer === null || typeof (this._tileBuffer) == 'undefined' || this._tileBuffer < 0) {
bufferWidth = extent.get_width();bufferHeight = extent.get_height();}
else { bufferWidth = bufferHeight = this._tileBuffer * this._pixelsizeX;}
extent.set_xmin(extent.get_xmin() - bufferWidth);extent.set_xmax(extent.get_xmax() + bufferWidth);extent.set_ymin(extent.get_ymin() - bufferHeight);extent.set_ymax(extent.get_ymax() + bufferHeight);if (ESRI.ADF.Layers.TileLayer.isInstanceOfType(resource)) {
var currentLevel = resource.getLevelByNearestPixelsize(this._pixelsizeX);var res = resource.get_levels()[currentLevel].get_resX();var lod = this._pixelsizeX;if (!this._layers._resolutionsAreSame(lod, res)) { continue;}
var tiles = resource.getTileSpanWithin(extent, currentLevel);for (var column = tiles[0];column <= tiles[2];column++) {
for (var row = tiles[1];row <= tiles[3];row++) {
Array.add(tilesToKeep, this._getTileId(resource, row, column, currentLevel));}
}
}
else if (ESRI.ADF.Layers.DynamicLayer.isInstanceOfType(resource) && resource.get_useTiling()) {
var tiles2 = this._getDynamicTiles(resource, extent);for (var idx in tiles2) {
Array.add(tilesToKeep, this._getTileId(resource, tiles2[idx].row, tiles2[idx].col, this._pixelsizeX));}
}
}
}
for (var id in this._tilesInView) {
if (id && !Array.contains(tilesToKeep, id)) {
this._removePendingStack(id, true);this._tilesInView[id] = null;}
}
},
_getTileId: function(resource, row, column, level) {
return this._getLayerId(resource) + '_r' + row + 'c' + column + 'l' + level;},
_getLayerId: function(resource) {
return this._layersDiv.id + '_' + resource.get_id();},
_removeElement: function(element) {
if (!element) { return;}
$clearHandlers(element);var garbageBin = $get('IELeakGarbageBin');if (!garbageBin) {
garbageBin = document.createElement('DIV');garbageBin.id = 'IELeakGarbageBin';garbageBin.style.display = 'none';document.body.appendChild(garbageBin);}
garbageBin.appendChild(element);if (element.tagName === 'img' || element.tagName === 'IMG') { element.removeAttribute('src');}
garbageBin.innerHTML = '';},
_addTile: function(column, row, currentLevel, layer, resource) {
var tileid = this._getTileId(resource, row, column, currentLevel);if (!this._tilesInView[tileid]) {
this._tilesInView[tileid] = true;var tileEnv = resource.getTileExtent(column, row, currentLevel);this._addPendingStack(tileid);var format = resource.get_imageFormat();var handler = Function.createDelegate(this, function(url) { this._addTileOnReady(tileid, tileEnv, resource.get_opacity(), layer, url, format);handler = null;});resource.getTileUrl(column, row, currentLevel, handler);}
},
_addDynamicTile: function(tile, layerid, resource) {
var tileid = this._getTileId(resource, tile.row, tile.col, this._pixelsizeX);if (!this._tilesInView[tileid]) {
var tileEnv = new ESRI.ADF.Geometries.Envelope(tile.env[0], tile.env[1], tile.env[2], tile.env[3]);if (!resource.get_extent().intersects(tileEnv)) { return;}
this._tilesInView[tileid] = true;this._addPendingStack(tileid);var format = resource.get_imageFormat();var handler = Function.createDelegate(this, function(url) {
this._addImageOnReady(layerid, tileEnv, url, resource.get_opacity(), tileid, format, true);handler = null;});resource.getUrl(tile.env[0], tile.env[1], tile.env[2], tile.env[3], tile.width, tile.height, handler);}
},
_addTileOnReady: function(tileid, tileEnv, opacity, layer, url, format) {
var img = new Image();var container = null;var upperLeft = this._toMapScreen(new ESRI.ADF.Geometries.Point(tileEnv.get_xmin(), tileEnv.get_ymax()));var bottomRight = this._toMapScreen(new ESRI.ADF.Geometries.Point(tileEnv.get_xmax(), tileEnv.get_ymin()));var width = bottomRight.offsetX - upperLeft.offsetX;var height = bottomRight.offsetY - upperLeft.offsetY;if (ESRI.ADF.System.__isIE6) {
container = document.createElement('div');container.className = 'esriMapImage';container.appendChild(img);container.style.width = width + 'px';container.style.height = height + 'px';img.format = format;img.style.width = '100%';img.style.height = '100%';}
else {
img.className = 'esriMapImage';img.style.width = width + 'px';img.style.height = height + 'px';container = img;}
container.style.position = 'absolute';container.style.left = upperLeft.offsetX + 'px';container.style.top = upperLeft.offsetY + 'px';img.id = tileid;if (!this._fncTileOnLoad) {
this._fncTileOnLoad = function(e) {
var img = e.target;if (Sys.Browser.agent === Sys.Browser.Firefox) {
img = e.rawEvent.currentTarget;}
if (!this._isTileInPendingStack(img.id)) {
this._removeElement(img);return;}
this._removePendingStack(img.id, false);$clearHandlers(img);img.onerror = null;img.style.display = 'block';if (ESRI.ADF.System.__isIE6 && img.format.startsWith('png')) { ESRI.ADF.System.setIEPngTransparency(img, img.src);}
img = null;if (Sys.Browser.agent === Sys.Browser.InternetExplorer && !this._fadingStarted && this._animationSettings.enableFadeTransition && !this._animationSettings.disableNavigationAnimation) {
this._fadingStarted = true;if (this._layersDiv.filters[0]) {
this._layersDiv.filters[0].Play();window.setTimeout(Function.createDelegate(this, function() { this._layersDiv.style.filter = '';}), 500);}
}
};}
if (!this._fncTileOnError) {
this._fncTileOnError = Function.createDelegate(this, function(e) {
var img = null;if (!e) e = window.event;if (e.srcElement) {
img = window.event.srcElement;}
else if (e.currentTarget) {
img = e.currentTarget;}
if (!img) { return;}
img.onerror = null;$clearHandlers(img);Sys.Debug.trace('Failure loading tile "' + img.id + '" from ' + img.src);this._removeElement(img);if (!this._isTileInPendingStack(img.id)) { return;}
this._removePendingStack(img.id, true);img = null;});}
$addHandlers(img, { 'load': this._fncTileOnLoad }, this);img.onerror = this._fncTileOnError;if (Sys.Browser.agent !== Sys.Browser.InternetExplorer) { img.style.display = 'none';}
else if (opacity < 1 && format !== 'png32') { ESRI.ADF.System.setOpacity(container, opacity);}
layer.appendChild(container);img.src = url;img = null;container = null;},
_addImageOnReady: function(layerid, extent, url, opacity, id, format, keepOld) {
if (!this._isTileInPendingStack(id)) { return;}
if (!url || url === '') { 
this._removePendingStack(id, false);return;}
var layer = this._layerReferences[layerid]
if (!layer) { this._removePendingStack(id, false);return;}
if (Array.contains(this._pendingSrcImages, id)) {
var img2 = $get(id);if (img2) {
var parent = img2.parentNode;this._removeElement(img2);if (ESRI.ADF.System.__isIE6) {
this._removeElement(parent);}
}
img2 = null;}
else {
Array.add(this._pendingSrcImages, id);}
var currentImage = $get(id);if (currentImage && !keepOld) { currentImage.id += '_old';}
var img = new Image();img.id = id;img.alt = '';if (Sys.Browser.agent === Sys.Browser.Safari) {
img.style.KhtmlUserSelect = 'none';img.onmousedown = function() { return false;}
}
var container = null;if (ESRI.ADF.System.__isIE6) {
container = document.createElement('div');container.className = 'esriMapImage';container.appendChild(img);container.style.width = Math.round(extent.get_width() / this._pixelsizeX) + 'px';container.style.height = Math.round(extent.get_height() / this._pixelsizeY) + 'px';img.format = format;img.style.width = '100%';img.style.height = '100%';}
else {
img.className = 'esriMapImage';img.style.width = Math.round(extent.get_width() / this._pixelsizeX) + 'px';img.style.height = Math.round(extent.get_height() / this._pixelsizeY) + 'px';container = img;}
var upperLeft = new ESRI.ADF.Geometries.Point(extent.get_xmin(), extent.get_ymax());var imgpos = this._toMapScreen(upperLeft);container.style.position = 'absolute';if (this._rotation.angle === 0) {
container.style.left = imgpos.offsetX + 'px';container.style.top = imgpos.offsetY + 'px';}
else {
container.style.left = -this._containerDivPos[0] + 'px';container.style.top = -this._containerDivPos[1] + 'px';}
if (!this._fncImageOnLoad) {
this._fncImageOnLoad = Function.createDelegate(this, this._onImageTileLoaded);}
if (keepOld) { img.keepOld = 'true';}
else { img.keepOld = 'false';}
$addHandler(img, 'load', this._fncImageOnLoad);if (Sys.Browser.agent !== Sys.Browser.InternetExplorer) { img.style.display = 'none';}
else if (opacity < 1 && format !== 'png32') {
ESRI.ADF.System.setOpacity(img, opacity);}
layer.appendChild(container);img.src = url;img = null;container = null;},
_onImageTileLoaded: function(e) {
var img = e.target;Array.remove(this._pendingSrcImages, img.id);if (Sys.Browser.agent === Sys.Browser.Firefox) { img = e.rawEvent.currentTarget;}
$clearHandlers(img);if (!this._isTileInPendingStack(img.id)) {
this._tilesInView[img.id] = null;var parent = img.parentNode;this._removeElement(img);if (ESRI.ADF.System.__isIE6) { this._removeElement(parent);}
return;}
this._removePendingStack(img.id, false);var layer = img.parentNode;if (ESRI.ADF.System.__isIE6) { layer = layer.parentNode;}
if (img.keepOld !== 'true') {
var imgs = null;if (layer.querySelectorAll) {
imgs = layer.querySelectorAll('.esriMapImage');}
else { imgs = layer.getElementsByTagName('img');}
for (var idx = imgs.length - 1;idx >= 0;idx--) {
if (imgs[idx].id !== img.id) {
if (ESRI.ADF.System.__isIE6) {
var prnode = imgs[idx].parentNode;this._removeElement(imgs[idx]);this._removeElement(prnode);}
else { this._removeElement(imgs[idx]);}
}
}
}
if (Sys.Browser.agent === Sys.Browser.InternetExplorer && !this._fadingStarted && this._animationSettings.enableFadeTransition && !this._animationSettings.disableNavigationAnimation) {
this._fadingStarted = true;if (this._layersDiv.filters && this._layersDiv.filters[0]) {
this._layersDiv.filters[0].Play();window.setTimeout(Function.createDelegate(this, function() { this._layersDiv.style.filter = '';}), 500);}
}
if (ESRI.ADF.System.__isIE6 && img.format.startsWith('png')) { ESRI.ADF.System.setIEPngTransparency(img, img.src, false, img.format);}
img.style.display = 'block';img = null;},
_makeMouseEventRelativeToMap: function(e, resetLocation) {
if (!this._controlDivLocation || resetLocation) { this._controlDivLocation = Sys.UI.DomElement.getLocation(this._controlDiv);}
e = ESRI.ADF.System._makeMouseEventRelativeToElement(e, this._controlDiv, this._controlDivLocation);e.coordinate = this.toMapPoint(e.offsetX, e.offsetY);return e;},
_raiseEvent: function(name, e) {
if (!this.get_isInitialized()) { return;}
var handler = this.get_events().getHandler(name);if (handler) { if (e === null || typeof (e) === 'undefined') { e = Sys.EventArgs.Empty;} handler(this, e);}
},
_hookEventsOnMouseEnter: function(e) {
if (this._mouseInsideViewer === true) { return;}
if (Sys.Browser.agent !== Sys.Browser.InternetExplorer && e && (this._isZooming || !this._isMouseEnter(e.rawEvent, this.get_element()))) {
return;}
this._mouseInsideViewer = true;if (this._mouseDragState) { return;} 
if (!this._mapActiveEventsAttached) {
this._mapActiveEventsAttached = true;ESRI.ADF.UI.__DomEvent.__addHandler((Sys.Browser.agent === Sys.Browser.InternetExplorer) ? document.body : window, 'mousemove', this._mouseMoveHandler);$addHandler(document, 'keydown', this._onKeyDownHandler);$addHandler(document, 'keyup', this._onKeyUpHandler);}
this._raiseEvent('mouseOver', e);},
_unhookEventsOnMouseLeave: function(e) {
if (Sys.Browser.agent !== Sys.Browser.InternetExplorer && e && (this._isZooming || !this._isMouseLeave(e.rawEvent, this.get_element()))) {
return;}
this._mouseInsideViewer = false;if (this._mouseDragState) { return;} 
this._raiseEvent('mouseOut', e);if (this._mapActiveEventsAttached) {
$removeHandler((Sys.Browser.agent === Sys.Browser.InternetExplorer) ? document.body : window, 'mousemove', this._mouseMoveHandler);$removeHandler(document, 'keydown', this._onKeyDownHandler);$removeHandler(document, 'keyup', this._onKeyUpHandler);this._mapActiveEventsAttached = false;}
},
_isMouseEnter: function(e, handler) {
if (e.type !== 'mouseover') return false;var reltg = e.relatedTarget ? e.relatedTarget : e.fromElement;while (reltg && reltg !== handler) reltg = reltg.parentNode;return (reltg !== handler);},
_isMouseLeave: function(e, handler) {
if (e.type !== 'mouseout') return false;var reltg = e.relatedTarget ? e.relatedTarget : e.toElement;while (reltg && reltg !== handler) reltg = reltg.parentNode;return (reltg !== handler);},
_onMouseMove: function(evt) {
var e = this._makeMouseEventRelativeToMap(evt, false);this._raiseEvent('mouseMove', e);if (this._mouseDragState) {
if (this._mouseDragState.button === e.button && this._mouseDragState.mousedownX && this._mouseDragState.mousedownY &&
this._mouseDragState.button === Sys.UI.MouseButton.leftButton) {
e.originX = this._mouseDragState.mousedownX;e.originY = this._mouseDragState.mousedownY;e.deltaX = e.offsetX - this._mouseDragState.mousedownX;e.deltaY = e.offsetY - this._mouseDragState.mousedownY;e.mousedownCoordinate = this._mouseDragState.mousedownCoordinate;this._raiseEvent('mouseDragging', e);evt.preventDefault();evt.stopPropagation();}
this._mouseDragState.previousOffsetX = e.offsetX;this._mouseDragState.previousOffsetY = e.offsetY;}
},
_onMouseDown: function(e) {
e = this._makeMouseEventRelativeToMap(e, true);if (!this._mapActiveEventsAttached) { this._hookEventsOnMouseEnter();}
if (!this._mouseUpEventAttached) {
ESRI.ADF.UI.__DomEvent.__addHandler((Sys.Browser.agent === Sys.Browser.InternetExplorer) ? document.body : window, 'mouseup', this._mouseUpHandler);this._mouseUpEventAttached = true;}
if (!this._isZooming) {
this._mouseDragState = {
"mousedownX": e.offsetX, "mousedownY": e.offsetY,
"previousOffsetX": e.offsetX, "previousOffsetY": e.offsetY,
"button": e.button, "mousedownCoordinate": e.coordinate,
"startExtent": this.get_extent()
};}
this._raiseEvent('mouseDown', e);},
_onMouseUp: function(evt) {
var e = this._makeMouseEventRelativeToMap(evt, true);this._raiseEvent('mouseUp', e);if (this._mouseDragState && this._mouseDragState.button === e.button) {
if (this._mouseUpEventAttached) {
$removeHandler((Sys.Browser.agent === Sys.Browser.InternetExplorer) ? document.body : window, 'mouseup', this._mouseUpHandler);this._mouseUpEventAttached = false;}
this._controlDivLocation = null;if (this._mouseDragState.mousedownX && this._mouseDragState.mousedownY &&
(this._mouseDragState.mousedownX !== e.offsetX || this._mouseDragState.mousedownY !== e.offsetY)) {
e.originX = this._mouseDragState.mousedownX;e.originY = this._mouseDragState.mousedownY;e.deltaX = e.offsetX - this._mouseDragState.mousedownX;e.deltaY = e.offsetY - this._mouseDragState.mousedownY;e.mousedownCoordinate = this._mouseDragState.mousedownCoordinate;e.mouseStartExtent = this._mouseDragState.startExtent;this._mouseDragState = null;if (!this._mouseInsideViewer) {
this._unhookEventsOnMouseLeave();}
this._raiseEvent('mouseDragCompleted', e);}
else if (this._mouseDragState.mousedownX && this._mouseDragState.mousedownY &&
(this._mouseDragState.mousedownX === e.offsetX || this._mouseDragState.mousedownY === e.offsetY)) {
this._mouseDragState = null;this._raiseEvent('click', e);}
}
evt.preventDefault();evt.stopPropagation();},
_onMouseWheel: function(e) {
this._mouseDragState = null;if (e.target.namespaceURI && e.target.namespaceURI === 'http://www.w3.org/2000/svg') {
e.offsetX += parseInt(this._assotateCanvas._svgRoot.style.left, 10);e.offsetY += parseInt(this._assotateCanvas._svgRoot.style.top, 10);e.target = this._assotateCanvas._svgRoot.parentNode;}
e = this._makeMouseEventRelativeToMap(e, true);var now = new Date();if (!this._lastScrollZoomDate || (now - this._lastScrollZoomDate) > 150) {
if (Sys.Browser.agent === Sys.Browser.InternetExplorer && this._animationSettings.enableFadeTransition && !this._animationSettings.disableNavigationAnimation && this._layersDiv.filters[0] && this._layersDiv.filters[0].status === 1) {
return;}
this.zoom(this._getZoomFactor(e.wheelDelta * this._mouseWheelDirection > 0), e.coordinate);this._lastScrollZoomDate = now;}
},
_onDblClick: function(e) {
e.preventDefault();e.stopPropagation();e = this._makeMouseEventRelativeToMap(e, true);if (this._mouseMode !== ESRI.ADF.UI.MouseMode.Custom) { this.zoom(this._getZoomFactor(true), e.coordinate);}
this._raiseEvent('dblclick', e);},
_onClick: function(s, e) {
if (e.button === Sys.UI.MouseButton.leftButton) {
if (this._mouseMode === ESRI.ADF.UI.MouseMode.ZoomIn) { this.zoom(this._getZoomFactor(true), e.coordinate);}
else if (this._mouseMode === ESRI.ADF.UI.MouseMode.ZoomOut) { this.zoom(this._getZoomFactor(false), e.coordinate);}
}
},
_getZoomFactor: function(zoomin) {
if (!this._layers.__hasLevels()) { return (zoomin ? 2 : 0.5);}
else {
var level = this._layers.getLevelByNearestPixelsize(this._pixelsizeX);var level2Res = this._layers.get_levelResolution(level + (zoomin ? 1 : -1));if (!level2Res) { return 1;}
else { return this._pixelsizeX / level2Res;}
}
},
_onKeyDown: function(eventArgs) {
this._raiseEvent('keyDown', eventArgs);if (this._keyActions[eventArgs.keyCode]) {
this._fireKeyDownAction(this._keyActions[eventArgs.keyCode]);return;}
},
_onKeyUp: function(eventArgs) {
this._raiseEvent('keyUp', eventArgs);if (this._keyActions[eventArgs.keyCode]) {
this._fireKeyUpAction(this._keyActions[eventArgs.keyCode]);return;}
},
_fireKeyDownAction: function(keyaction) {
if (!this._currentKeyActions) { this._currentKeyActions = [];}
var isactive = Array.contains(this._currentKeyActions, keyaction);if (isactive && !keyaction.continuous) { return;}
if (!isactive) { Array.add(this._currentKeyActions, keyaction);}
if (keyaction.cursor) { this.get_element().style.cursor = keyaction.cursor;}
keyaction.keydown();},
_fireKeyUpAction: function(keyaction) {
if (keyaction === 'all' && this._currentKeyActions) {
for (var idx = 0;idx < this._currentKeyActions.length;idx++) {
if (keyaction.keyup) { this._currentKeyActions[idx].keyup();}
}
this._currentKeyActions = [];if (keyaction.cursor) { this.get_element().style.cursor = this.get_cursor();}
return;}
if (!this._currentKeyActions || !Array.contains(this._currentKeyActions, keyaction)) { return;}
if (keyaction.cursor) { this.get_element().style.cursor = this.get_cursor();}
Array.remove(this._currentKeyActions, keyaction);if (keyaction.keyup) { keyaction.keyup();}
},
_doContinuousPan: function(x, y) {
if (!this._tmpKeyPanExtent) { this._tmpKeyPanExtent = this.get_extent();}
if (!x && !y) { this._raiseEvent('panCompleted', { "previous": this._tmpKeyPanExtent, "current": this.get_extent() });this._tmpKeyPanExtent = null;return;}
this._moveContainerDiv(x, y);this._raiseEvent('panning');},
_onMouseDragging: function(sender, args) {
if (this._mouseMode === ESRI.ADF.UI.MouseMode.Pan) {
this._onMapPanDragging(sender, args);}
else if (this._mouseMode === ESRI.ADF.UI.MouseMode.ZoomIn || this._mouseMode === ESRI.ADF.UI.MouseMode.ZoomOut) {
if (!this._tempDragBox) {
this._tempDragBox = document.createElement('div');this._tempDragBox.style.border = 'solid 2px #333333';this._tempDragBox.style.backgroundColor = '#ffffff';this._tempDragBox.style.position = 'absolute';ESRI.ADF.System.setOpacity(this._tempDragBox, 0.5);}
this._getEnvelopeDraggingHandler(sender, args);}
},
_onMouseDragCompleted: function(sender, args) {
if (this._mouseMode === ESRI.ADF.UI.MouseMode.Pan) {
this._onMapPanDragCompleted(sender, args);}
else if (this._mouseMode === ESRI.ADF.UI.MouseMode.ZoomIn || this._mouseMode === ESRI.ADF.UI.MouseMode.ZoomOut) {
this._getEnvelopeComplete(sender, args);}
},
_moveContainerDiv: function(x, y) {
this._containerDivPos[0] -= x;this._containerDivPos[1] -= y;this._containerDiv.style.left = this._containerDivPos[0] + 'px';this._containerDiv.style.top = this._containerDivPos[1] + 'px';if (this._extent) {
this._extent._xmin += x * this._pixelsizeX;this._extent._xmax += x * this._pixelsizeX;this._extent._ymin -= y * this._pixelsizeY;this._extent._ymax -= y * this._pixelsizeY;}
},
_onMapPanDragging: function(sender, e) {
this._moveContainerDiv((this._mouseDragState.previousOffsetX - e.offsetX), (this._mouseDragState.previousOffsetY - e.offsetY));e.originX = this._mouseDragState.mousedownX;e.originY = this._mouseDragState.mousedownY;this._isPanning = true;this._raiseEvent('panning');},
_onMapPanDragCompleted: function(sender, args) {
this._isPanning = false;this._extent = null;this._raiseEvent('panCompleted', { "previous": args.mouseStartExtent, "current": this.get_extent() });},
_getEnvelopeDraggingHandler: function(sender, args) {
if (!this._tempDragBox.parentNode) { this._containerDiv.appendChild(this._tempDragBox);}
var from = this._toMapScreen(args.mousedownCoordinate);var to = this._toMapScreen(args.coordinate);var border = parseInt(this._tempDragBox.style.borderWidth, 10);var width = Math.abs(from.offsetX - to.offsetX) - border * 2 + (from.offsetX < to.offsetX ? 1 : 0);var height = Math.abs(from.offsetY - to.offsetY) - border * 2 + (from.offsetY < to.offsetY ? 1 : 0);if (width < 0) { width = 0;}
if (height < 0) { height = 0;}
this._tempDragBox.style.left = (from.offsetX < to.offsetX ? from.offsetX : to.offsetX) + 'px';this._tempDragBox.style.top = (from.offsetY < to.offsetY ? from.offsetY : to.offsetY) + 'px';this._tempDragBox.style.width = width + 'px';this._tempDragBox.style.height = height + 'px';},
_getEnvelopeComplete: function(sender, args) {
this._removeElement(this._tempDragBox);this._tempDragBox = null;var currentExtent = this.get_extent();var env = new ESRI.ADF.Geometries.Envelope(
Math.min(args.mousedownCoordinate.get_x(), args.coordinate.get_x()),
Math.min(args.mousedownCoordinate.get_y(), args.coordinate.get_y()),
Math.max(args.mousedownCoordinate.get_x(), args.coordinate.get_x()),
Math.max(args.mousedownCoordinate.get_y(), args.coordinate.get_y()), this._spatialReference);this._currentState = null;if (this._mouseMode === ESRI.ADF.UI.MouseMode.ZoomOut) {
var newWidth = currentExtent.get_width() * (currentExtent.get_width() / env.get_width());var newheight = currentExtent.get_height() * (currentExtent.get_height() / env.get_height());env.set_xmin(currentExtent.get_xmin() - ((env.get_xmin() - currentExtent.get_xmin()) * (currentExtent.get_width() / env.get_width())));env.set_ymin(currentExtent.get_ymin() - ((env.get_ymin() - currentExtent.get_ymin()) * (currentExtent.get_height() / env.get_height())));env.set_xmax(currentExtent.get_xmin() + newWidth);env.set_ymax(currentExtent.get_ymin() + newheight);}
var scaleFactor = currentExtent.get_width() / env.get_width();var toPx = this._pixelsizeX / scaleFactor;var toLevel = this.get_layers().getLevelByNearestPixelsize(toPx);if (toLevel !== null) { toPx = this.get_layers().get_levelResolution(toLevel);}
if (this._pixelsizeX === toPx) { return;} 
this.zoomToBox(env);},
_onZoomStep: function(anim, startScale, endScale, orgScale) {
this._extent = null;var ratio = this._pixelsizeY / this._pixelsizeX;this._recalculateContainerOffset();this._pixelsizeX = orgScale / anim.interpolate(startScale, endScale, anim.get_percentComplete());this._pixelsizeY = this._pixelsizeX * ratio;this._raiseEvent('extentChanging');},
_resetGridOffset: function() {
var ext = this.get_extent();this._clearImageTiles();this._gridOrigin = new ESRI.ADF.Geometries.Point(ext.get_xmin(), ext.get_ymax());this._extent = null;this._containerDivPos = [0, 0];this._containerDiv.style.left = 0;this._containerDiv.style.top = 0;this._raiseEvent('gridOriginChanged', this._gridOrigin);},
_onResize: function(e) {
if (Sys.Browser.agent === Sys.Browser.InternetExplorer) {
if (this._resizeTimer) { window.clearTimeout(this._resizeTimer);}
this._resizeTimer = window.setTimeout(Function.createDelegate(this, this._onResizeComplete), 1000);}
else { this._onResizeComplete();}
},
_onResizeComplete: function() {
this._resizeTimer = null;this.checkMapsize();},
checkMapsize: function(suppressEvent) {
var size = this._getInternalElementSize(this.get_element());if (this._mapsize[0] !== size[0] || this._mapsize[1] !== size[1]) {
this._tmpExtent = this.get_extent();this._mapsize = size;this._extent = null;this._controlDivLocation = null;this._raiseEvent('mapResized', size);if (this._rotation.angle !== 0) { this.refreshGraphics(true);}
if (!suppressEvent && this._suppressExtentChanged !== true) {
this._raiseEvent('extentChanged', { "previous": this._tmpExtent, "current": this.get_extent() });this._tmpExtent = null;}
}
},
_getInternalElementSize: function(elm) {
return [parseInt(elm.clientWidth, 10), parseInt(elm.clientHeight, 10)];},
_addExtentHistory: function(previousExt, currentExt) {
if (this._currentExtentHistory === -1) { return;}
if (this._currentExtentHistory !== null && this._currentExtentHistory + 1 < this._extentHistory.length) {
var len = this._extentHistory.length;for (var idx = this._currentExtentHistory + 1;idx < len;idx++) {
Array.removeAt(this._extentHistory, this._currentExtentHistory + 1);}
}
Array.add(this._extentHistory, this.get_extent());if (this._extentHistory.length > 50) { Array.dequeue(this._extentHistory);}
else { this._currentExtentHistory = this._extentHistory.length - 1;}
},
stepExtentHistory: function(steps) {
var pos = (this._currentExtentHistory !== null ? this._currentExtentHistory : this._extentHistory.length - 1) + steps;if (pos < 0) { pos = 0;}
else if (pos >= this._extentHistory.length - 1) { pos = this._extentHistory.length - 1;}
this._currentExtentHistory = -1;this.set_extent(this._extentHistory[pos]);this._currentExtentHistory = pos;return !(pos === 0 || pos === this._extentHistory.length - 1);},
_initializeZoomAnimation: function(scaleFactor, centerX, centerY) {
var duration = this._animationSettings.duration;var fps = this._animationSettings.fps;var animations = [];if (centerX === null || typeof (centerX) == "undefined") { centerX = parseInt(this.get_element().clientWidth, 10) * 0.5;}
if (centerY === null || typeof (centerY) == "undefined") { centerY = parseInt(this.get_element().clientHeight, 10) * 0.5;}
centerX -= this._containerDivPos[0];centerY -= this._containerDivPos[1];var moveanim = new AjaxControlToolkit.Animation.MoveAnimation(this._containerDiv, duration, fps, -centerX * (scaleFactor - 1), -centerY * (scaleFactor - 1), true);Array.add(animations, moveanim);var imgs = null;if (this._layersDiv.querySelectorAll) {
imgs = this._layersDiv.querySelectorAll('.esriMapImage');}
else { imgs = this._layersDiv.getElementsByTagName(ESRI.ADF.System.__isIE6 ? 'div' : 'img');}
for (var idx = 0;idx < imgs.length;idx++) {
var imgTile = imgs[idx];if (imgTile && imgTile.tagName && imgTile.tagName.toUpperCase() === (ESRI.ADF.System.__isIE6 ? 'DIV' : 'IMG')) {
var anim = new ESRI.ADF.Animations.ZoomAnimation(imgTile, duration, fps, scaleFactor, 0.0, 0.0);Array.add(animations, anim);}
}
return new ESRI.ADF.Animations.ParallelAnimation(null, duration, fps, animations);},
zoom: function(scaleFactor, center, animate) {
if (this._isZooming) {
if (!this._zoomQueue) { this._zoomQueue = [];}
Array.add(this._zoomQueue, { "scaleFactor": scaleFactor, "center": center });return;}
this._clearOldImageTiles();if (!center) { center = this.get_extent().get_center();}
if (animate !== false) { animate = true;}
var screenPoint = this.toScreenPoint(center);var centerOffsetX = screenPoint.offsetX;var centerOffsetY = screenPoint.offsetY;var fromPx = this._pixelsizeX;var toPx = this._pixelsizeX / scaleFactor;var toLevel = this.get_layers().getLevelByNearestPixelsize(toPx);if (toLevel !== null) { toPx = this.get_layers().get_levelResolution(toLevel);}
else {
if (this._minZoom && toPx < this._minZoom) { toPx = this._minZoom;}
else if (this._maxZoom && toPx > this._maxZoom) { toPx = this._maxZoom;}
}
scaleFactor = fromPx / toPx;if (animate && ESRI.ADF.System.__isIE6) {
var layers = this.get_layers();for (var i = 0;i < layers.get_layerCount();i++) {
var layer = layers.get_layer(i);if (layer.get_opacity() < 1 && (layer.get_imageFormat() === 'png8' || layer.get_imageFormat() === 'png24')) {
animate = false;break;}
}
}
if (scaleFactor === 1) { return false;}
else if (scaleFactor > 25) { animate = false;}
var anim = this._initializeZoomAnimation(scaleFactor, centerOffsetX, centerOffsetY);var startscale = this._pixelsizeX;var endextent = this.get_extent();var w0 = endextent.get_width();var h0 = endextent.get_height();var w1 = w0 / scaleFactor;var h1 = h0 / scaleFactor;var mx = center.get_x();var my = center.get_y();var mmx1 = -((w1 * 0.5) * (mx - endextent.get_xmin()) / (w0 * 0.5) - mx);var mmy1 = -((h1 * 0.5) * (my - endextent.get_ymin()) / (h0 * 0.5) - my);endextent.set_xmin(mmx1);endextent.set_xmax(mmx1 + w1);endextent.set_ymin(mmy1);endextent.set_ymax(mmy1 + h1);var onEnd = Function.createDelegate(this, function() {
this._pixelsizeX = toPx;this._pixelsizeY = this._pixelsizeX;this._recalculateContainerOffset();this._extent = endextent;anim.dispose();anim = null;onEnd = null;if (this._zoomQueue && this._zoomQueue.length > 0) {
var next = Array.dequeue(this._zoomQueue);this._isZooming = false;var result = this.zoom(next.scaleFactor, next.center, true);if (!result) { this._raiseEvent('zoomCompleted');}
}
else if (scaleFactor !== 1) { this._raiseEvent('zoomCompleted');}
});if (animate && !this.get_disableNavigationAnimation()) {
var ontick = Function.createDelegate(this, function() { this._onZoomStep(anim, 1.0, scaleFactor, startscale);ontick = null;});anim.add_tick(ontick);anim.add_ended(onEnd);this._raiseEvent('zoomStart');if (Sys.Browser.agent === Sys.Browser.InternetExplorer && this._layersDiv.filters[0]) {
this._layersDiv.filters[0].enabled = false;this._layersDiv.style.filter = ''
this._fadingStarted = false;}
anim.play();}
else {
this._raiseEvent('zoomStart');this._applyExtent(endextent);this._raiseEvent('zoomCompleted');}
return true;},
zoomTo: function(point, pixelsize, animate) {
var width = this._mapsize[0] * 0.5 * pixelsize;var height = this._mapsize[1] * 0.5 * pixelsize;var box = new ESRI.ADF.Geometries.Envelope(point.get_x() - width, point.get_y() - height,
point.get_x() + width, point.get_y() + height);return this.zoomToBox(box, animate);},
zoomToBox: function(box, animate) {
var extent = this.get_extent();if (animate === false || !extent.intersects(box)) {
this.set_extent(box);return true;}
var c = box.get_center();var wb = box.get_width();var hb = box.get_height();var ratio = this._mapsize[1] / this._mapsize[0];if (hb / wb > ratio) { wb = hb / ratio;}
else { hb = wb * ratio;}
box = new ESRI.ADF.Geometries.Envelope(c.get_x() - wb / 2, c.get_y() - hb / 2, c.get_x() + wb / 2, c.get_y() + hb / 2);var x0 = extent.get_xmin();var x1 = box.get_xmin();var ymin0 = extent.get_ymin();var ymax0 = extent.get_ymax();var ymin1 = box.get_ymin();var ymax1 = box.get_ymax();var a0 = (ymin1 - ymin0) / (x1 - x0);var a1 = (ymax1 - ymax0) / (x1 - x0);var b0 = ymin0 - a0 * x0;var b1 = ymax0 - a1 * x0;var x = (b1 - b0) / (a0 - a1);var y = a0 * x + b0;var result = this.zoom(extent.get_width() / wb, new ESRI.ADF.Geometries.Point(x, y), animate);if (result === false) { return this.panTo(box.get_center(), animate);}
else { return result;}
},
panTo: function(point, animate) {
if (this._isPanning) { return false;}
this._tmpExtent = this.get_extent();var centerScreen = this.toScreenPoint(point);var center = this.toScreenPoint(this.get_center());var ulX = center.offsetX - centerScreen.offsetX;var ulY = center.offsetY - centerScreen.offsetY;if (Math.abs(ulX) < 1 && Math.abs(ulY) < 1) { return false;} 
var width = parseInt(this.get_element().clientWidth, 10);var height = parseInt(this.get_element().clientHeight, 10);if (Math.abs(ulX) > width * 1 || Math.abs(ulY) > 2 * height) {
animate = false;}
if (animate === false || this.get_disableNavigationAnimation()) {
this._raiseEvent('panning');this._moveContainerDiv(-ulX, -ulY);this._resetGridOffset();this._raiseEvent('panCompleted', { "previous": this._tmpExtent, "current": this.get_extent() });}
else {
centerScreen = this.toScreenPoint(point);var anim = new AjaxControlToolkit.Animation.MoveAnimation(this._containerDiv, 0.5, 25, ulX, ulY, true);var onEnd = Function.createDelegate(this, function() {
anim.dispose();this._recalculateContainerOffset();anim = null;this._isPanning = false;this._raiseEvent('panCompleted', { "previous": this._tmpExtent, "current": this.get_extent() });onEnd = null;});anim.add_ended(onEnd);this._isPanning = true;anim.play();var ontick = Function.createDelegate(this, function() { this._recalculateContainerOffset();this._raiseEvent('panning');ontick = null;});anim._timer.add_tick(ontick);}
return true;},
_recalculateContainerOffset: function() {
this._containerDivPos = [parseInt(this._containerDiv.style.left, 10), parseInt(this._containerDiv.style.top, 10)];this._extent = null;},
set_extent: function(extent) {
if (!extent) { return;}
this.checkMapsize();if (this._mapsize[0] === 0 || this._mapsize[1] === 0) {
this._tmpextent = extent;if (this.get_isInitialized()) {
this._clearRequestStack();this._clearVectorGraphics();this._clearImageTiles();}
return;}
this._tmpExtent = this.get_extent();this._applyExtent(extent);if (this._suppressExtentChanged !== true) {
this._raiseEvent('extentChanged', { "previous": this._tmpExtent, "current": this.get_extent() });}
this._tmpExtent = null;},
_applyExtent: function(extent) {
var c = extent.get_center();var wb = extent.get_width();var hb = extent.get_height();var ratio = this._mapsize[1] / this._mapsize[0];if (hb / wb > ratio) { wb = hb / ratio;}
var gsd = wb / this._mapsize[0];var oldgsd = this._pixelsizeX;if (this.get_layers()) {
var level = this._layers.getLevelByNearestPixelsize(gsd);if (level !== null) {
var gsd2 = this._layers.get_levelResolution(level);if (gsd2 < gsd * 0.99 && level > 0) { 
gsd2 = this._layers.get_levelResolution(level - 1);}
gsd = gsd2;}
else {
if (this._minZoom && gsd < this._minZoom) { gsd = this._minZoom;}
else if (this._maxZoom && gsd > this._maxZoom) { gsd = this._maxZoom;}
}
}
this._pixelsizeX = this._pixelsizeY = gsd;if (oldgsd !== this._pixelsizeX) {
this._clearRequestStack();}
this._clearVectorGraphics();this._extent = null;this._gridOrigin = new ESRI.ADF.Geometries.Point(c.get_x() - this._pixelsizeX * this._mapsize[0] * 0.5,
c.get_y() + this._pixelsizeY * this._mapsize[1] * 0.5);if (!this.get_isInitialized()) { return;}
this._containerDivPos = [0, 0];this._assotateCanvas.adjustCanvasExtent(this._containerDivPos[0], this._containerDivPos[1], this._mapsize[1], this._mapsize[0]);this._containerDiv.style.left = '0';this._containerDiv.style.top = '0';this._clearImageTiles();this._raiseEvent('gridOriginChanged', this._gridOrigin);},
get_extent: function() {
if (this._extent) { return this._extent.clone();}
if (!this.get_isInitialized()) { return null;}
if (this._mapsize[0] > 0 && this._tmpextent) {
var ext = this._tmpextent;this._tmpextent = null;this._applyExtent(ext);this._addExtentHistory();}
else if (this._mapsize[0] === 0 && this._tmpextent) {
return this._tmpextent;}
else if (this._pixelsizeX === Number.POSITIVE_INFINITY) {
return this._gridOrigin.getEnvelope();}
var width = this._mapsize[0] * this._pixelsizeX;var height = this._mapsize[1] * this._pixelsizeY;var x = this._containerDivPos[0] * this._pixelsizeX;var y = this._containerDivPos[1] * this._pixelsizeY;if (this._rotation.angle !== 0) {
var x2 = (x * this._rotation.cos) - (y * this._rotation.sin);var y2 = (y * this._rotation.cos) + (x * this._rotation.sin);x = x2;y = y2;}
var left = this._gridOrigin.get_x() - x;var top = this._gridOrigin.get_y() + y;this._extent = new ESRI.ADF.Geometries.Envelope(
new ESRI.ADF.Geometries.Point(left, top - height, this._spatialReference),
new ESRI.ADF.Geometries.Point(left + width, top, this._spatialReference),
this._spatialReference);return this._extent.clone();},
get_center: function() {
return this.get_extent().get_center();},
toMapPoint: function(viewOffsetX, viewOffsetY) {
var x;var y;if (this._rotation.angle === 0) {
x = this._gridOrigin.get_x() + (viewOffsetX - this._containerDivPos[0]) * this._pixelsizeX;y = this._gridOrigin.get_y() + (this._containerDivPos[1] - viewOffsetY) * this._pixelsizeY;}
else {
var center = this.get_extent().get_center();viewOffsetX -= this._mapsize[0] / 2;viewOffsetY -= this._mapsize[1] / 2;x = viewOffsetX * this._pixelsizeX;y = -viewOffsetY * this._pixelsizeY;var x2 = ((x * this._rotation.cos) + (y * this._rotation.sin));var y2 = ((y * this._rotation.cos) - (x * this._rotation.sin));x = x2 + center.get_x();y = y2 + center.get_y();}
return new ESRI.ADF.Geometries.Point(x, y, this._spatialReference);},
_toMapScreen: function(point) {
var x = point.coordinates ? point.coordinates[0] : point[0];var y = point.coordinates ? point.coordinates[1] : point[1];if (this._rotation.angle !== 0) {
var center = this.get_extent().get_center();x -= center.coordinates[0];y -= center.coordinates[1];var x2 = Math.round(((x * this._rotation.cos) - (y * this._rotation.sin)) / this._pixelsizeX + this._mapsize[0] / 2);var y2 = Math.round(((y * this._rotation.cos) + (x * this._rotation.sin)) / this._pixelsizeY - this._mapsize[1] / 2);x = x2 - this._containerDivPos[0];y = y2 + this._containerDivPos[1];}
else {
x -= this._gridOrigin.coordinates[0];y -= this._gridOrigin.coordinates[1];x = Math.round(x / this._pixelsizeX);y = Math.round(y / this._pixelsizeY);}
return { "offsetX": x, "offsetY": -y };},
toScreenPoint: function(point) {
var obj = this._toMapScreen(point);obj.offsetX += this._containerDivPos[0];obj.offsetY += this._containerDivPos[1];return obj;},
getGeometry: function(type, onComplete, onCancel, linecolor, fillcolor, cursor, continuous) {
this.cancelGetGeometry();var style = null;if (type < ESRI.ADF.Graphics.ShapeType.Envelope) {
style = new ESRI.ADF.Graphics.LineSymbol(linecolor ? linecolor : '#000000', this.get_clientToolGraphicsWidth());}
else {
style = new ESRI.ADF.Graphics.FillSymbol(fillcolor, linecolor || fillcolor ? linecolor : '#000000', this.get_clientToolGraphicsWidth());style.set_opacity(0.2);}
var map = this;var del = null;var cancelDel = function(cancelled) {
if (cancelled) {
map._currentState = null;del = null;cancelDel = null;if (onCancel) { onCancel();}
}
};del = function(geom) {
if (!continuous && cancelDel) { cancelDel(false);}
onComplete(geom);};this.graphicsEditor = new ESRI.ADF.Graphics.__GraphicsEditor(this, this._assotateCanvas, null, type, style, del, cancelDel, continuous, cursor);this._currentState = 'getGeometry';},
cancelGetGeometry: function() {
if (this.graphicsEditor) {
this.graphicsEditor.cancel();if (this.graphicsEditor) { this.graphicsEditor.dispose();}
this.graphicsEditor = null;}
if (this._oldMouseMode) { this.set_mouseMode(this._oldMouseMode);}
this._oldMouseMode = null;this._currentState = null;},
addGraphic: function(element) {
Array.add(this._graphicFeatures, element);element.__set_map(this);if (!element.get_isInitialized()) { element.initialize();}
if (ESRI.ADF.Graphics.GraphicFeatureGroup.isInstanceOfType(element)) {
if (!this._featureGroupChangedHandler) { this._featureGroupChangedHandler = Function.createDelegate(this, function(s, e) { this._refreshGraphicsRecursive(s, true);});}
element.add_elementChanged(this._featureGroupChangedHandler);element.add_elementAdded(this._featureGroupChangedHandler);element.add_propertyChanged(this._featureGroupChangedHandler);this.refreshGraphics(false);}
else {
if (!this._featureGraphicChangedHandler) { this._featureGraphicChangedHandler = Function.createDelegate(this, this._onGraphicFeatureChanged);}
element.add_propertyChanged(this._featureGraphicChangedHandler);this._refreshGraphicsRecursive(element, false);}
},
removeGraphic: function(element) {
if (!element) { return;}
element.__set_map(null);if (ESRI.ADF.Graphics.GraphicFeatureGroup.isInstanceOfType(element)) {
element.remove_elementChanged(this._featureGroupChangedHandler);element.remove_elementAdded(this._featureGroupChangedHandler);element.remove_propertyChanged(this._featureGroupChangedHandler);element.clearGraphicReference();}
else {
element.remove_propertyChanged(this._featureGraphicChangedHandler);element.clearGraphicReference();}
Array.remove(this._graphicFeatures, element);},
_clearVectorGraphics: function() {
for (var idx = 0;idx < this._graphicFeatures.length;idx++) {
if (ESRI.ADF.Graphics.GraphicFeatureGroup.isInstanceOfType(this._graphicFeatures[idx])) {
for (var j = 0;j < this._graphicFeatures[idx].getFeatureCount();j++) {
this._graphicFeatures[idx].get(j).clearGraphicReference();}
}
else {
this._graphicFeatures[idx].clearGraphicReference();}
}
},
getShapeCount: function() {
return this._graphicFeatures.length;},
refreshGraphics: function(force) {
if (this._isZooming) { return;}
for (var idx = 0;idx < this._graphicFeatures.length;idx++) {
var feat = this._graphicFeatures[idx];this._refreshGraphicsRecursive(feat, force);}
},
_refreshGraphicsRecursive: function(element, force) {
if (ESRI.ADF.Graphics.GraphicFeatureGroup.isInstanceOfType(element)) {
if (!element.get_visible()) { return;}
for (var j = 0;j < element.getFeatureCount();j++) {
var subfeat = element.get(j);this._refreshGraphicsRecursive(subfeat, force);}
}
else {
if ((force === true || !element.get_graphicReference())) {
if (element._isDrawing) return;var fnc = Function.createDelegate(this, function() {
if (this._isZooming) { element._isDrawing = false;return;}
var elmExtent = element.getEnvelope();if (elmExtent && this.get_extent().intersects(elmExtent)) {
if (element.__draw()) {
var gfx = element.get_graphicReference();if (gfx) { element._hookEvents(element, gfx);}
}
}
element._isDrawing = false;fnc = null;});element._isDrawing = true;window.setTimeout(fnc, 0);}
}
},
_onGraphicFeatureChanged: function(sender, eventArgs) {
var prop = eventArgs.get_propertyName();if (prop === 'geometry' || prop === 'symbol' || prop === 'selectedSymbol' || prop === 'visible') {
this._refreshGraphicsRecursive(sender, true);}
},
setKeyAction: function(keycode, onkeydown, onkeyup, cursor, continuous) {
if (onkeydown !== null) {
this._keyActions[keycode] = { 'keydown': onkeydown, 'keyup': onkeyup, 'cursor': cursor, 'continuous': (continuous === true ? true : false) };}
else {
this._keyActions[keycode] = null;}
},
removeKeyAction: function(keycode) {
if (this._keyActions[keycode]) { Array.remove(this._keyActions, keycode);}
},
__get_contentDiv: function() {
return this._containerDiv;},
__get_controlDiv: function() {
return this._controlDiv;},
get_pixelSize: function() {
return this._pixelsizeX;},
get_mouseMode: function() {
return this._mouseMode;},
set_mouseMode: function(value) {
if (this._mouseMode === value) { return;}
if (this._tempDragBox) { this._removeElement(this._tempDragBox);this._tempDragBox = null;}
this.cancelGetGeometry();this._mouseMode = value;switch (this._mouseMode) {
case ESRI.ADF.UI.MouseMode.Pan: this.set_cursor('move');break;default:
this.set_cursor('crosshair');break;}
this.raisePropertyChanged('mouseMode');},
get_cursor: function() {
return this.get_element().style.cursor;},
set_cursor: function(value) { this.get_element().style.cursor = value;},
get_enableMouseWheel: function() {
return this._enableMouseWheel;},
set_enableMouseWheel: function(value) { if (value !== this._enableMouseWheel) { this._enableMouseWheel = value;this.raisePropertyChanged('enableMouseWheel');} },
get_layers: function() {
return this._layers;},
set_layers: function(value) {
if (value !== this._layers) {
this._layers = value;if (value.get_layerCount() > 0) {
var resource = value.get_layer(0);this.set_spatialReference(resource.get_spatialReference());}
if (this.get_isInitialized()) {
this._clearImageTiles();var raiseEvent = false;var level = value.getLevelByNearestPixelsize(this._pixelsizeX);if (level !== null) {
var resX = value.get_levelResolution(level);if (this._pixelsizeX !== resX) {
raiseEvent = true;}
}
this._hookupLayerCollectionEvents();if (raiseEvent) { this._raiseEvent('extentChanged');}
}
this.raisePropertyChanged('layers');}
},
get_spatialReference: function() {
return this._spatialReference;},
set_spatialReference: function(value) { if (value !== this._spatialReference) { this._spatialReference = value;this.raisePropertyChanged('spatialReference');} },
get_disableNavigationAnimation: function() {
return this._animationSettings.disableNavigationAnimation;},
set_disableNavigationAnimation: function(value) { if (value !== this._animationSettings.disableNavigationAnimation) { this._animationSettings.disableNavigationAnimation = value;this.raisePropertyChanged('disableNavigationAnimation');} },
get_disableScrollWheelZoom: function() {
return this._disableScrollWheelZoom;},
set_disableScrollWheelZoom: function(value) { if (value !== this._disableScrollWheelZoom) { this._disableScrollWheelZoom = value;this.raisePropertyChanged('disableScrollWheelZoom');} },
get_mouseWheelDirection: function() {
return this._mouseWheelDirection;},
set_mouseWheelDirection: function(value) { if (value !== this._mouseWheelDirection) { this._mouseWheelDirection = value;this.raisePropertyChanged('mouseWheelDirection');} },
get_rotation: function() {
return this._rotation.angle / Math.PI * 180.0;},
set_rotation: function(value) {
var rot = value / 180.0 * Math.PI;if (rot !== this._rotation.angle) {
this._rotation.angle = rot;this._rotation.cos = Math.cos(this._rotation.angle);this._rotation.sin = Math.sin(this._rotation.angle);this.raisePropertyChanged('rotation');}
},
set_dynTileSize: function(value) { this._dynTileSize = value;},
get_dynTileSize: function() {
return this._dynTileSize;},
get_progressBarEnabled: function() {
return this._progressBarEnabled;},
set_progressBarEnabled: function(value) {
if (this._progressBarEnabled !== value) {
this._progressBarEnabled = value;if (this._progressBarEnabled) { this._createProgressBar();}
else if (this._progressBar) {
this._progressBar.dispose();this._progressBar = null;}
}
},
get_progressBarAlignment: function() {
return this._progressBarAlignment;},
set_progressBarAlignment: function(value) {
this._progressBarAlignment = value;if (this._progressBar) { this._progressBar.set_progressBarAlignment(value);}
},
set_minZoom: function(value) { this._minZoom = value;},
get_minZoom: function() {
return this._minZoom;},
set_maxZoom: function(value) { this._maxZoom = value;},
get_maxZoom: function() {
return this._maxZoom;},
set_tileBuffer: function(value) { this._tileBuffer = value;},
get_tileBuffer: function() {
return this._tileBuffer;},
set_loadTilesContinously: function(value) { this._loadTilesContinously = value;},
get_loadTilesContinously: function() {
return this._loadTilesContinously;},
add_mouseDragging: function(handler) {
this.get_events().addHandler('mouseDragging', handler);},
remove_mouseDragging: function(handler) { this.get_events().removeHandler('mouseDragging', handler);},
add_mouseDragCompleted: function(handler) {
this.get_events().addHandler('mouseDragCompleted', handler);},
remove_mouseDragCompleted: function(handler) { this.get_events().removeHandler('mouseDragCompleted', handler);},
add_mouseMove: function(handler) {
this.get_events().addHandler('mouseMove', handler);},
remove_mouseMove: function(handler) { this.get_events().removeHandler('mouseMove', handler);},
add_mouseDown: function(handler) {
this.get_events().addHandler('mouseDown', handler);},
remove_mouseDown: function(handler) { this.get_events().removeHandler('mouseDown', handler);},
add_mouseUp: function(handler) {
this.get_events().addHandler('mouseUp', handler);},
remove_mouseUp: function(handler) { this.get_events().removeHandler('mouseUp', handler);},
add_mouseOver: function(handler) {
this.get_events().addHandler('mouseOver', handler);},
remove_mouseOver: function(handler) { this.get_events().removeHandler('mouseOver', handler);},
add_mouseOut: function(handler) {
this.get_events().addHandler('mouseOut', handler);},
remove_mouseOut: function(handler) { this.get_events().removeHandler('mouseOut', handler);},
add_click: function(handler) {
this.get_events().addHandler('click', handler);},
remove_click: function(handler) {
this.get_events().removeHandler('click', handler);},
add_dblclick: function(handler) {
this.get_events().addHandler('dblclick', handler);},
remove_dblclick: function(handler) { this.get_events().removeHandler('dblclick', handler);},
add_keyUp: function(handler) {
this.get_events().addHandler('keyUp', handler);},
remove_keyUp: function(handler) { this.get_events().removeHandler('keyUp', handler);},
add_keyDown: function(handler) {
this.get_events().addHandler('keyDown', handler);},
remove_keyDown: function(handler) { this.get_events().removeHandler('keyDown', handler);},
add_zoomStart: function(handler) {
this.get_events().addHandler('zoomStart', handler);},
remove_zoomStart: function(handler) { this.get_events().removeHandler('zoomStart', handler);},
add_zoomCompleted: function(handler) {
this.get_events().addHandler('zoomCompleted', handler);},
remove_zoomCompleted: function(handler) { this.get_events().removeHandler('zoomCompleted', handler);},
add_panning: function(handler) {
this.get_events().addHandler('panning', handler);},
remove_panning: function(handler) { this.get_events().removeHandler('panning', handler);},
add_panCompleted: function(handler) {
this.get_events().addHandler('panCompleted', handler);},
remove_panCompleted: function(handler) { this.get_events().removeHandler('panCompleted', handler);},
add_extentChanging: function(handler) {
this.get_events().addHandler('extentChanging', handler);},
remove_extentChanging: function(handler) { this.get_events().removeHandler('extentChanging', handler);},
add_extentChanged: function(handler) {
this.get_events().addHandler('extentChanged', handler);},
remove_extentChanged: function(handler) { this.get_events().removeHandler('extentChanged', handler);},
add_onProgress: function(handler) {
this.get_events().addHandler('onProgress', handler);},
remove_onProgress: function(handler) { this.get_events().removeHandler('onProgress', handler);},
add_mapResized: function(handler) {
this.get_events().addHandler('mapResized', handler);},
remove_mapResized: function(handler) { this.get_events().removeHandler('mapResized', handler);},
add_gridOriginChanged: function(handler) {
this.get_events().addHandler('gridOriginChanged', handler);},
remove_gridOriginChanged: function(handler) { this.get_events().removeHandler('gridOriginChanged', handler);},
__add_mapTipEvent: function(handler) {
this.get_events().addHandler('mapTipEvent', handler);},
__remove_mapTipEvent: function(handler) { this.get_events().removeHandler('mapTipEvent', handler);}
};ESRI.ADF.UI.MapBase.registerClass('ESRI.ADF.UI.MapBase', Sys.UI.Control);ESRI.ADF.UI.Map = function(element) {
ESRI.ADF.UI.Map.initializeBase(this, [element]);this._callbackFunctionString = null;this._onExtentsChangedHandler = null;this._onMapResizedHandler = null;this._restoreFromCookie = false;this._disableAutoCallbacks = false;this._disableDefaultKeyActions = false;};ESRI.ADF.UI.Map.prototype = {
initialize: function() {
ESRI.ADF.UI.Map.callBaseMethod(this, 'initialize');this.divObject = this._layersDiv;this._onExtentsChangedHandler = Function.createDelegate(this, this._onExtentChanged);this.add_extentChanged(this._onExtentsChangedHandler);this._onMapResizedHandler = Function.createDelegate(this, this._onMapResized);this.add_mapResized(this._onMapResizedHandler);if (!this._disableDefaultKeyActions) {
var keypanAmount = 50;var doKeyPanFunc = Function.createDelegate(this, function() { this._doContinuousPan(this._keyPanDirection[0], this._keyPanDirection[1]);});this.setKeyAction(Sys.UI.Key.right, Function.createDelegate(this, function() { this._keyPanDirection[0] = keypanAmount;doKeyPanFunc();}), Function.createDelegate(this, function() { this._keyPanDirection[0] = 0;doKeyPanFunc();}), null, true);this.setKeyAction(Sys.UI.Key.left, Function.createDelegate(this, function() { this._keyPanDirection[0] = -keypanAmount;doKeyPanFunc();}), Function.createDelegate(this, function() { this._keyPanDirection[0] = 0;doKeyPanFunc();}), null, true);this.setKeyAction(Sys.UI.Key.up, Function.createDelegate(this, function() { this._keyPanDirection[1] = -keypanAmount;doKeyPanFunc();}), Function.createDelegate(this, function() { this._keyPanDirection[1] = 0;doKeyPanFunc();}), null, true);this.setKeyAction(Sys.UI.Key.down, Function.createDelegate(this, function() { this._keyPanDirection[1] = keypanAmount;doKeyPanFunc();}), Function.createDelegate(this, function() { this._keyPanDirection[1] = 0;doKeyPanFunc();}), null, true);this.setKeyAction(33, Function.createDelegate(this, function() { this._keyPanDirection = [keypanAmount, -keypanAmount];doKeyPanFunc();}), Function.createDelegate(this, function() { this._keyPanDirection = [0, 0];doKeyPanFunc();}), null, true);this.setKeyAction(34, Function.createDelegate(this, function() { this._keyPanDirection = [keypanAmount, keypanAmount];doKeyPanFunc();}), Function.createDelegate(this, function() { this._keyPanDirection = [0, 0];doKeyPanFunc();}), null, true);this.setKeyAction(35, Function.createDelegate(this, function() { this._keyPanDirection = [-keypanAmount, keypanAmount];doKeyPanFunc();}), Function.createDelegate(this, function() { this._keyPanDirection = [0, 0];doKeyPanFunc();}), null, true);this.setKeyAction(36, Function.createDelegate(this, function() { this._keyPanDirection = [-keypanAmount, -keypanAmount];doKeyPanFunc();}), Function.createDelegate(this, function() { this._keyPanDirection = [0, 0];doKeyPanFunc();}), null, true);this.setKeyAction(107, Function.createDelegate(this, function() { this.zoom(2.0);}), null, null, false);this.setKeyAction(109, Function.createDelegate(this, function() { this.zoom(0.5);}), null, null, false);this.setKeyAction(16,
Function.createDelegate(this, function(e) {
if (this.get_mouseMode() === ESRI.ADF.UI.MouseMode.Custom) { return;}
if (!this._shiftkey_restoremode) { this._shiftkey_restoremode = { "mode": this.get_mouseMode(), "cursor": this.get_cursor() };}
this.set_mouseMode(ESRI.ADF.UI.MouseMode.ZoomIn);}),
Function.createDelegate(this, function() {
if (this._shiftkey_restoremode) { this.set_mouseMode(this._shiftkey_restoremode.mode);this.set_cursor(this._shiftkey_restoremode.cursor);this._shiftkey_restoremode = null;}
}), null, false);this.setKeyAction(17,
Function.createDelegate(this, function(e) {
if (this.get_mouseMode() === ESRI.ADF.UI.MouseMode.Custom) { return;}
if (!this._shiftkey_restoremode) { this._shiftkey_restoremode = { "mode": this.get_mouseMode(), "cursor": this.get_cursor() };}
this.set_mouseMode(ESRI.ADF.UI.MouseMode.ZoomOut);}),
Function.createDelegate(this, function() {
if (this._shiftkey_restoremode) { this.set_mouseMode(this._shiftkey_restoremode.mode);this.set_cursor(this._shiftkey_restoremode.cursor);this._shiftkey_restoremode = null;}
}), null, false);}
if (this.get_element().style.width.endsWith('%') || this.get_element().style.height.endsWith('%')) {
var ext = this.get_extent();if (this._mapsize[0] > 0 && this._mapsize[1] > 0 && ext) {
this.doCallback('EventArg=MapSizeChanged&xmin=' + ext.get_xmin() + '&ymin=' + ext.get_ymin() + '&xmax=' + ext.get_xmax() + '&ymax=' + ext.get_ymax() + '&WIDTH=' + this._mapsize[0] + '&HEIGHT=' + this._mapsize[1] + '&startup=true', this);}
}
else {
var ext = this._extent;this._extent = null;var ext2 = this.get_extent();if (ext && ext2) {
if (ext.get_xmax() !== ext2.get_xmax() || ext.get_ymax() !== ext2.get_ymax() ||
ext.get_xmin() !== ext2.get_xmin() || ext.get_ymin() !== ext2.get_ymin()) {
this._onExtentChanged();}
}
}
Maps[this.get_id()] = this;},
dispose: function() {
this.remove_extentChanged(this._onExtentsChangedHandler);this._onExtentsChangedHandler = null;this.remove_mapResized(this._onMapResizedHandler);this._onMapResizedHandler = null;ESRI.ADF.UI.Map.callBaseMethod(this, 'dispose');},
_onExtentChanged: function(sender, args) {
if (!this._disableAutoCallbacks && this._mapsize[0] > 0 && this._mapsize[1] > 0) {
var extent = args ? args.current : null;if (extent) {
this.doCallback('EventArg=ExtentChanged&xmin=' + extent.get_xmin() + '&ymin=' + extent.get_ymin() +
'&xmax=' + extent.get_xmax() + '&ymax=' + extent.get_ymax() +
'&WIDTH=' + this._mapsize[0] + '&HEIGHT=' + this._mapsize[1], this);}
}
},
_onMapResized: function(sender, args) {
if (!this._disableAutoCallbacks) {
var ext = this.get_extent();if (this._mapsize[0] > 0 && this._mapsize[1] > 0) {
this.doCallback('EventArg=MapSizeChanged&xmin=' + ext.get_xmin() + '&ymin=' + ext.get_ymin() + '&xmax=' + ext.get_xmax() + '&ymax=' + ext.get_ymax() + '&WIDTH=' + this._mapsize[0] + '&HEIGHT=' + this._mapsize[1], this);}
}
},
doCallback: function(argument, context) {
var args = { 'argument': argument };this._raiseEvent('onServerRequest', args);ESRI.ADF.System._doCallback(this._callbackFunctionString, this.get_uniqueID(), this.get_element().id, args.argument, context);},
processCallbackResult: function(action, params) {
if (action === 'insertLayer') {
var layer = $find(params[0]);if (layer) {
throw Error.invalidOperation('Cannot insert layer. ComponentID "' + params[0] + '" already in use.');}
layer = eval(params[1]);var idx = params[2];this.get_layers().insert(layer, idx);return true;}
else if (action === 'removeLayer') {
var remlayer = $find(params[0]);if (remlayer) {
this.get_layers().remove(remlayer);remlayer.dispose();return true;}
}
else if (action === 'moveLayer') {
var movelayer = $find(params[0]);if (!movelayer) {
return false;}
var from = params[1];var to = params[2];this.get_layers().remove(movelayer);this.get_layers().insert(movelayer, to);}
else if (action === "refreshLayer") {
var layerid = params[0];var reflayer = $find(layerid);var idx = params[2];if (reflayer) {
this.get_layers().remove(reflayer);reflayer.dispose();}
reflayer = eval(params[1]);this.get_layers().insert(reflayer, idx);return true;}
else if (action === "addGraphicsLayer") {
var addgfxlayer = ESRI.ADF.Graphics.__AdfGraphicsLayer.parseJsonLayer(params[1], this);if (addgfxlayer) { this.addGraphic(addgfxlayer);return true;}
}
else if (action === "removeGraphicsLayer") {
var remlayerid = this.get_id() + '_' + params[0];var remgfxlayer = $find(remlayerid);if (!remgfxlayer) { return false;}
this.removeGraphic(remgfxlayer);remgfxlayer.dispose();return true;}
else if (action === "clearGraphicsLayer") {
var remlayerid = this.get_id() + '_' + params[0];var remgfxlayer = $find(remlayerid);if (!remgfxlayer) { return false;}
remgfxlayer.clear();return true;}
else if (action === "updateGraphicsLayerRow") {
var upgfxlayerid = this.get_id() + '_' + params[0];var upGfxlayer = $find(upgfxlayerid);if (!upGfxlayer) { return false;}
var uprow = $find(upgfxlayerid + '_' + params[1]);if (!uprow) { return false;}
var rowidx = upGfxlayer.indexOf(uprow);upGfxlayer.remove(uprow);uprow.dispose();uprow = ESRI.ADF.Graphics.__AdfGraphicsLayer._parseRow(eval('(' + params[2] + ')'), upgfxlayerid);upGfxlayer.insert(uprow, rowidx);return true;}
else if (action === "addGraphicsLayerRow") {
var addgfxlayerid = this.get_id() + '_' + params[0];var addgfxlayer2 = $find(addgfxlayerid);if (!addgfxlayer2) { return false;}
var row = ESRI.ADF.Graphics.__AdfGraphicsLayer._parseRow(eval('(' + params[2] + ')'), addgfxlayerid);addgfxlayer2.add(row);return true;}
else if (action === "deleteGraphicsLayerRow") {
var dellayerid = this.get_id() + '_' + params[0];var delgfxlayer = $find(dellayerid);if (!delgfxlayer) { return false;}
var delrow = $find(dellayerid + '_' + params[1]);if (!delrow) { return false;}
delgfxlayer.remove(delrow);delrow.dispose();return true;}
else if (action === "setextent") {
this._disableAutoCallbacks = true;this.set_extent(new ESRI.ADF.Geometries.Envelope(params[0], params[1], params[2], params[3]));this._disableAutoCallbacks = false;return true;}
else if (action === "zoomToBox") {
this._disableAutoCallbacks = true;this.zoomToBox(new ESRI.ADF.Geometries.Envelope(parseFloat(params[0]), parseFloat(params[1]), parseFloat(params[2]), parseFloat(params[3])), true);this._disableAutoCallbacks = false;return true;}
return false;},
get_uniqueID: function() {
return this._uniqueID;},
set_uniqueID: function(value) {
this._uniqueID = value;},
get_callbackFunctionString: function() {
return this._callbackFunctionString;},
set_callbackFunctionString: function(value) {
this._callbackFunctionString = value;},
set_clientToolGraphicsColor: function(value) { this._clientToolGraphicsColor = value;},
get_clientToolGraphicsColor: function() {
return this._clientToolGraphicsColor;},
set_clientToolGraphicsWidth: function(value) { this._clientToolGraphicsWidth = value;},
get_clientToolGraphicsWidth: function() {
return this._clientToolGraphicsWidth;},
add_onServerRequest: function(handler) {
this.get_events().addHandler('onServerRequest', handler);},
remove_onServerRequest: function(handler) { this.get_events().removeHandler('onServerRequest', handler);}
};ESRI.ADF.UI.Map.registerClass('ESRI.ADF.UI.Map', ESRI.ADF.UI.MapBase);/////////////////////////////////// Set Tool Functions /////////////////////////////////////
Type.registerNamespace('ESRI.ADF.MapTools');ESRI.ADF.MapTools.fillColor = null;ESRI.ADF.MapTools.lineColor = 'black';MapDragImage = ESRI.ADF.MapTools.MapDragImage = function(mapid, mode, showLoading, cursor) {
var map = $find(mapid);if (!map) { map = Pages[mapid];}
if (ESRI.ADF.UI.Map.isInstanceOfType(map)) {
map.set_mouseMode(ESRI.ADF.UI.MouseMode.Pan);if (cursor) {
map.set_cursor(cursor);}
}
else if (ESRI.ADF.UI.Page.isInstanceOfType(map)) {
ESRI.ADF.PageTools.PageMapDragImage(mapid, mode, showLoading, cursor);}
};MapDragRectangle = ESRI.ADF.MapTools.DragRectangle = function(mapid, mode, showLoading, cursor) {
var map = $find(mapid);if (!map) { map = Pages[mapid];}
if (ESRI.ADF.UI.Map.isInstanceOfType(map)) {
if (mode === 'MapZoomIn') {
map.set_mouseMode(ESRI.ADF.UI.MouseMode.ZoomIn);}
else if (mode === 'MapZoomOut') {
map.set_mouseMode(ESRI.ADF.UI.MouseMode.ZoomOut);}
else {
var onComplete = Function.createDelegate(map, function(geom) {
var geomString = geom.get_xmin() + ':' + geom.get_ymin() + '|' + geom.get_xmax() + ':' + geom.get_ymax();this.doCallback('EventArg=DragRectangle&coords=' + geomString + '&' + mapid + '_mode=' + mode, this);});map.getGeometry(ESRI.ADF.Graphics.ShapeType.Envelope, onComplete, function() { map.__activeToolMode = null;}, map.get_clientToolGraphicsColor(), ESRI.ADF.MapTools.fillColor, cursor, true);map.__activeToolMode = mode;}
if (cursor) {
map.set_cursor(cursor);}
}
else if (ESRI.ADF.UI.Page.isInstanceOfType(map)) {
ESRI.ADF.PageTools.PageMapDragRectangle(mapid, mode, showLoading, cursor);}
};MapBox = MapDragBox = ESRI.ADF.MapTools.DragRectangle;MapPoint = ESRI.ADF.MapTools.Point = function(mapid, mode, showLoading, cursor) {
var map = $find(mapid);if (!map) { map = Pages[mapid];}
if (ESRI.ADF.UI.Map.isInstanceOfType(map)) {
var onComplete = Function.createDelegate(map, function(geom) {
this.doCallback('EventArg=Point&coords=' + geom.toString(':') + '&' + mapid + '_mode=' + mode, this);});map.getGeometry(ESRI.ADF.Graphics.ShapeType.Point, onComplete, function() { map.__activeToolMode = null;}, null, null, cursor, true);map.__activeToolMode = mode;}
else if (ESRI.ADF.UI.Page.isInstanceOfType(map)) {
ESRI.ADF.PageTools.PageMapPoint(mapid, mode, showLoading, cursor);}
};MapLine = ESRI.ADF.MapTools.Line = function(mapid, mode, showLoading, cursor, vectorToolbarState) {
var map = $find(mapid);var onComplete = Function.createDelegate(map, function(geom) {
var geomString = geom.getPath(0).toString('|', ':');this.doCallback('EventArg=Line&coords=' + geomString + '&' + mapid + '_mode=' + mode, this, null);});map.getGeometry(ESRI.ADF.Graphics.ShapeType.Line, onComplete, function() { map.__activeToolMode = null;}, map.get_clientToolGraphicsColor(), null, cursor, true);map.__activeToolMode = mode;};MapPolyline = ESRI.ADF.MapTools.Polyline = function(mapid, mode, showLoading, cursor, vectorToolbarState) {
var map = $find(mapid);var onComplete = Function.createDelegate(map, function(geom) {
var geomString = geom.getPath(0).toString('|', ':');this.doCallback('EventArg=Polyline&coords=' + geomString + '&' + mapid + '_mode=' + mode, this);});map.getGeometry(ESRI.ADF.Graphics.ShapeType.Path, onComplete, function() { map.__activeToolMode = null;}, map.get_clientToolGraphicsColor(), null, cursor, true);map.__activeToolMode = mode;};MapPolygon = ESRI.ADF.MapTools.Polygon = function(mapid, mode, showLoading, cursor, vectorToolbarState) {
var map = $find(mapid);var onComplete = Function.createDelegate(map, function(geom) {
var geomString = geom.getRing(0).toString('|', ':');this.doCallback('EventArg=Polygon&coords=' + geomString + '&' + mapid + '_mode=' + mode, this);});map.getGeometry(ESRI.ADF.Graphics.ShapeType.Ring, onComplete, function() { map.__activeToolMode = null;}, map.get_clientToolGraphicsColor(), ESRI.ADF.MapTools.fillColor, cursor, true);map.__activeToolMode = mode;};MapDragCircle = MapCircle = ESRI.ADF.MapTools.Circle = function(mapid, mode, showLoading, cursor, vectorToolbarState) {
var map = $find(mapid);var onComplete = Function.createDelegate(map, function(geom) {
var geomString = geom.get_center().toString(':') + ':' + geom.get_width() * 0.5;this.doCallback('EventArg=Circle&coords=' + geomString + '&' + mapid + '_mode=' + mode, this);});map.getGeometry(ESRI.ADF.Graphics.ShapeType.Circle, onComplete, function() { map.__activeToolMode = null;}, map.get_clientToolGraphicsColor(), ESRI.ADF.MapTools.fillColor, cursor, true);map.__activeToolMode = mode;};MapDragOval = MapOval = ESRI.ADF.MapTools.Oval = function(mapid, mode, showLoading, cursor, vectorToolbarState) {
var map = $find(mapid);var onComplete = Function.createDelegate(map, function(geom) {
var geomString = geom.get_center().toString(':') + ':' + Math.abs(geom.get_width()) + ':' + Math.abs(geom.get_height());this.doCallback('EventArg=Oval&coords=' + geomString + '&' + mapid + '_mode=' + mode, this);});map.getGeometry(ESRI.ADF.Graphics.ShapeType.Oval, onComplete, function() { map.__activeToolMode = null;}, map.get_clientToolGraphicsColor(), ESRI.ADF.MapTools.fillColor, cursor, true);map.__activeToolMode = mode;};MapTips = ESRI.ADF.MapTools.MapTips = function(mapid, mode, showLoading, cursor) {
throw (new Error.notImplemented('MapTips'));};ESRI.ADF.UI.MapBase.prototype.resize = function(width, height, resizeExtent) { };Maps = [];ESRI.ADF.UI.ProgressBarExtender = function() {
ESRI.ADF.UI.ProgressBarExtender.initializeBase(this);this._height = 10;this._map = null;this._width = null;this._barIsVisible = false;this._opacity = 0.35;this._maxNoOfTiles = 1;this._displayDelay = 1000;this._spinnerPosition = null;this._barColor = '#666';this._colors = ['#99f', '#99d', '#99b'];this._progressBarAlignment = ESRI.ADF.System.ContentAlignment.BottomRight;};ESRI.ADF.UI.ProgressBarExtender.prototype = {
initialize: function() {
var bounds = Sys.UI.DomElement.getBounds(this._map.get_element());this._pbar = document.createElement('div');this._pbar.style.position = 'absolute';this._pbar.style.zIndex = 10000;this._pbar.style.height = this._height + 'px';this._pbar.style.width = this._width;this._pbar.style.border = 'solid 1px #000';this._pbar.style.backgroundColor = '#fff';this._pbar.style.overflow = 'hidden';this._pbar.style.fontSize = '1px';ESRI.ADF.System.setOpacity(this._pbar, 0.0);this._bar = document.createElement('div');this._bar.style.height = this._height + 'px';this._bar.style.width = '0';this._bar.style.backgroundColor = this._barColor;this._bar.style.position = 'relative';this._spinner = document.createElement('div');for (var i = 0;i < this._colors.length;i++) {
var stripe = document.createElement('div');stripe.style.width = '8px';stripe.style.height = this._height + 'px';stripe.style.marginLeft = '1px';stripe.style.backgroundColor = this._colors[i];stripe.style.position = 'absolute';stripe.style.left = 9 * i + 'px';stripe.style.top = '0px';this._spinner.appendChild(stripe);}
this._spinnerWidth = 9 * this._colors.length;this._spinner.style.position = 'relative';this._spinner.style.left = 0;this._spinner.style.zIndex = 1;this._pbar.appendChild(this._spinner);document.body.appendChild(this._pbar);this._pbar.appendChild(this._bar);this._barWidth = parseInt(this._pbar.clientWidth, 10);this._animation1 = new AjaxControlToolkit.Animation.FadeAnimation(this._pbar, 0.25, 25, AjaxControlToolkit.Animation.FadeEffect.FadeIn, 0, this._opacity, true);this._animation2 = new AjaxControlToolkit.Animation.FadeAnimation(this._pbar, 0.25, 25, AjaxControlToolkit.Animation.FadeEffect.FadeOut, 0, this._opacity, true);this._animation1.add_started(Function.createDelegate(this, function() { this._pbar.style.display = '';}));this._animation2.add_ended(Function.createDelegate(this, function() { this._pbar.style.display = 'none';}));this._onProgressHandler = Function.createDelegate(this, this._onProgress);this._zoomStartHandler = Function.createDelegate(this, this._onZoom);this._spinnerAnimateHandler = Function.createDelegate(this, this._spinnerAnimate);this._mapChanged = Function.createDelegate(this, this._repositionProgressBar);this._map.add_onProgress(this._onProgressHandler);this._map.add_zoomStart(this._zoomStartHandler);this._map.add_mapResized(this._mapChanged);this._repositionProgressBar();},
_onLayersChanged: function(s, e) {
if (e.get_propertyName() == 'layers') {
s.get_layers().add_layerAdded(this._mapChanged);s.get_layers().add_layerRemoved(this._mapChanged);this._mapChanged();}
},
dispose: function() {
if (this._isDisposed || !this.get_isInitialized()) { return;}
this._map.get_layers().remove_layerAdded(this._mapChanged);this._map.get_layers().remove_layerRemoved(this._mapChanged);this._map.remove_mapResized(this._mapChanged);this._map.remove_onProgress(this._onProgressHandler);this._map.remove_zoomStart(this._zoomStartHandler);this._mapChanged = null;this._onProgressHandler = null;this._zoomStartHandler = null;this._animation1.dispose();this._animation2.dispose();if (this._pbar && this._pbar.parentNode) { this._pbar.parentNode.removeChild(this._pbar);}
this._bar = null;this._pbar = null;this._isDisposed = true;},
_spinnerAnimate: function() {
if (this._spinnerPosition === null || this._spinnerPosition > parseInt(this._barWidth, 10)) { this._spinnerPosition = -this._spinnerWidth;}
else { this._spinnerPosition += 5;}
this._spinner.style.left = this._spinnerPosition + 'px';if (this._barIsVisible) {
this._spinnerTimer = window.setTimeout(this._spinnerAnimateHandler, 50);}
else { this._spinnerPosition = null;}
},
_showProgressBar: function() {
this._showTimer = null;if (this._barIsVisible) {
this._animation2.stop();this._spinnerAnimate();this._animation1.play();}
},
_onZoom: function() {
this._animation1.stop();this._animation2.stop();ESRI.ADF.System.setOpacity(this._pbar, 0.0);this._barIsVisible = false;this._maxNoOfTiles = 1;},
_onProgress: function(s, e) {
if (!this._barIsVisible && e > 0) {
if (!this._showProgressBarHandler) { this._showProgressBarHandler = Function.createDelegate(this, this._showProgressBar);}
this._showTimer = window.setTimeout(this._showProgressBarHandler, this._displayDelay);this._barIsVisible = true;}
if (e > this._maxNoOfTiles) { this._maxNoOfTiles = e;} 
var width = Math.round(this._barWidth / this._maxNoOfTiles) * (this._maxNoOfTiles - e);if (width > this._barWidth) { width = this._barWidth;}
else if (width < 0) { width = 0;}
this._bar.style.width = width + 'px';if (e === 0 && this._barIsVisible) {
if (this._showTimer) {
window.clearTimeout(this._showTimer);this._showTimer = null;}
else {
this._animation1.stop();this._animation2.play();}
this._spinnerTimer = null;this._barIsVisible = false;}
},
_repositionProgressBar: function() {
if (!this._pbar || !this._map._controlDiv) { return;}
var bounds = Sys.UI.DomElement.getBounds(this._map._controlDiv);if (this._progressBarAlignment & 1092) { this._pbar.style.left = (bounds.x + bounds.width - this._barWidth - 5) + 'px';}
else if (this._progressBarAlignment & 546) { this._pbar.style.left = (bounds.x + (bounds.width - this._barWidth) / 2) + 'px';}
else { this._pbar.style.left = bounds.x + 5 + 'px';}
if (this._progressBarAlignment & 1792) { this._pbar.style.top = (bounds.y + bounds.height - this._height - 7) + 'px';}
else if (this._progressBarAlignment & 112) { this._pbar.style.top = (bounds.y + (this._height + bounds.height) / 2) + 'px';}
else { this._pbar.style.top = (bounds.y + this._height - 7) + 'px';}
},
get_map: function() { return this._map;},
set_map: function(value) { this._map = value;},
get_width: function() { return this._width;},
set_width: function(value) { this._width = value;},
get_progressBarAlignment: function() { return this._progressBarAlignment;},
set_progressBarAlignment: function(value) { this._progressBarAlignment = value;this._repositionProgressBar();}
};ESRI.ADF.UI.ProgressBarExtender.registerClass('ESRI.ADF.UI.ProgressBarExtender', Sys.Component);if (typeof (Sys) !== "undefined") { Sys.Application.notifyScriptLoaded();}

//END ESRI.ArcGIS.ADF.Web.UI.WebControls.Runtime.JavaScript.ESRI.ADF.UI.Map.release.js
//START AjaxControlToolkit.Compat.DragDrop.DragDropScripts.js
/////////////////////////////////////////////////////////////////////////////
Type.registerNamespace('AjaxControlToolkit');AjaxControlToolkit.IDragSource = function() {
}
AjaxControlToolkit.IDragSource.prototype = {
get_dragDataType: function() { throw Error.notImplemented();},
getDragData: function() { throw Error.notImplemented();},
get_dragMode: function() { throw Error.notImplemented();},
onDragStart: function() { throw Error.notImplemented();},
onDrag: function() { throw Error.notImplemented();},
onDragEnd: function() { throw Error.notImplemented();}
}
AjaxControlToolkit.IDragSource.registerInterface('AjaxControlToolkit.IDragSource');/////////////////////////////////////////////////////////////////////////////
AjaxControlToolkit.IDropTarget = function() {
}
AjaxControlToolkit.IDropTarget.prototype = {
get_dropTargetElement: function() { throw Error.notImplemented();},
canDrop: function() { throw Error.notImplemented();},
drop: function() { throw Error.notImplemented();},
onDragEnterTarget: function() { throw Error.notImplemented();},
onDragLeaveTarget: function() { throw Error.notImplemented();},
onDragInTarget: function() { throw Error.notImplemented();}
}
AjaxControlToolkit.IDropTarget.registerInterface('AjaxControlToolkit.IDropTarget');/////////////////////////////////////////////
AjaxControlToolkit.DragMode = function() {
throw Error.invalidOperation();}
AjaxControlToolkit.DragMode.prototype = {
Copy: 0,
Move: 1
}
AjaxControlToolkit.DragMode.registerEnum('AjaxControlToolkit.DragMode');//////////////////////////////////////////////////////////////////
AjaxControlToolkit.DragDropEventArgs = function(dragMode, dragDataType, dragData) {
this._dragMode = dragMode;this._dataType = dragDataType;this._data = dragData;}
AjaxControlToolkit.DragDropEventArgs.prototype = {
get_dragMode: function() {
return this._dragMode || null;},
get_dragDataType: function() {
return this._dataType || null;},
get_dragData: function() {
return this._data || null;}
}
AjaxControlToolkit.DragDropEventArgs.registerClass('AjaxControlToolkit.DragDropEventArgs');AjaxControlToolkit._DragDropManager = function() {
this._instance = null;this._events = null;}
AjaxControlToolkit._DragDropManager.prototype = {
add_dragStart: function(handler) {
this.get_events().addHandler('dragStart', handler);},
remove_dragStart: function(handler) {
this.get_events().removeHandler('dragStart', handler);},
get_events: function() {
if (!this._events) {
this._events = new Sys.EventHandlerList();}
return this._events;},
add_dragStop: function(handler) {
this.get_events().addHandler('dragStop', handler);},
remove_dragStop: function(handler) {
this.get_events().removeHandler('dragStop', handler);},
_getInstance: function() {
if (!this._instance) {
if (Sys.Browser.agent === Sys.Browser.InternetExplorer) {
this._instance = new AjaxControlToolkit.IEDragDropManager();}
else {
this._instance = new AjaxControlToolkit.GenericDragDropManager();}
this._instance.initialize();this._instance.add_dragStart(Function.createDelegate(this, this._raiseDragStart));this._instance.add_dragStop(Function.createDelegate(this, this._raiseDragStop));}
return this._instance;},
startDragDrop: function(dragSource, dragVisual, context) {
this._getInstance().startDragDrop(dragSource, dragVisual, context);},
registerDropTarget: function(target) {
this._getInstance().registerDropTarget(target);},
unregisterDropTarget: function(target) {
this._getInstance().unregisterDropTarget(target);},
dispose: function() {
delete this._events;Sys.Application.unregisterDisposableObject(this);Sys.Application.removeComponent(this);},
_raiseDragStart: function(sender, eventArgs) {
var handler = this.get_events().getHandler('dragStart');if(handler) {
handler(this, eventArgs);}
},
_raiseDragStop: function(sender, eventArgs) {
var handler = this.get_events().getHandler('dragStop');if(handler) {
handler(this, eventArgs);}
}
}
AjaxControlToolkit._DragDropManager.registerClass('AjaxControlToolkit._DragDropManager');AjaxControlToolkit.DragDropManager = new AjaxControlToolkit._DragDropManager();AjaxControlToolkit.IEDragDropManager = function() {
AjaxControlToolkit.IEDragDropManager.initializeBase(this);this._dropTargets = null;this._radius = 10;this._activeDragVisual = null;this._activeContext = null;this._activeDragSource = null;this._underlyingTarget = null;this._oldOffset = null;this._potentialTarget = null;this._isDragging = false;this._mouseUpHandler = null;this._documentMouseMoveHandler = null;this._documentDragOverHandler = null;this._dragStartHandler = null;this._mouseMoveHandler = null;this._dragEnterHandler = null;this._dragLeaveHandler = null;this._dragOverHandler = null;this._dropHandler = null;}
AjaxControlToolkit.IEDragDropManager.prototype = {
add_dragStart : function(handler) {
this.get_events().addHandler("dragStart", handler);},
remove_dragStart : function(handler) {
this.get_events().removeHandler("dragStart", handler);},
add_dragStop : function(handler) {
this.get_events().addHandler("dragStop", handler);},
remove_dragStop : function(handler) {
this.get_events().removeHandler("dragStop", handler);},
initialize : function() {
AjaxControlToolkit.IEDragDropManager.callBaseMethod(this, 'initialize');this._mouseUpHandler = Function.createDelegate(this, this._onMouseUp);this._documentMouseMoveHandler = Function.createDelegate(this, this._onDocumentMouseMove);this._documentDragOverHandler = Function.createDelegate(this, this._onDocumentDragOver);this._dragStartHandler = Function.createDelegate(this, this._onDragStart);this._mouseMoveHandler = Function.createDelegate(this, this._onMouseMove);this._dragEnterHandler = Function.createDelegate(this, this._onDragEnter);this._dragLeaveHandler = Function.createDelegate(this, this._onDragLeave);this._dragOverHandler = Function.createDelegate(this, this._onDragOver);this._dropHandler = Function.createDelegate(this, this._onDrop);},
dispose : function() {
if(this._dropTargets) {
for (var i = 0;i < this._dropTargets;i++) {
this.unregisterDropTarget(this._dropTargets[i]);}
this._dropTargets = null;}
AjaxControlToolkit.IEDragDropManager.callBaseMethod(this, 'dispose');},
startDragDrop : function(dragSource, dragVisual, context) {
var ev = window._event;if (this._isDragging) {
return;}
this._underlyingTarget = null;this._activeDragSource = dragSource;this._activeDragVisual = dragVisual;this._activeContext = context;var mousePosition = { x: ev.clientX, y: ev.clientY };dragVisual.originalPosition = dragVisual.style.position;dragVisual.style.position = "absolute";document._lastPosition = mousePosition;dragVisual.startingPoint = mousePosition;var scrollOffset = this.getScrollOffset(dragVisual,  true);dragVisual.startingPoint = this.addPoints(dragVisual.startingPoint, scrollOffset);if (dragVisual.style.position == "absolute") {
dragVisual.startingPoint = this.subtractPoints(dragVisual.startingPoint, $common.getLocation(dragVisual));}
else {
var left = parseInt(dragVisual.style.left);var top = parseInt(dragVisual.style.top);if (isNaN(left)) left = "0";if (isNaN(top)) top = "0";dragVisual.startingPoint = this.subtractPoints(dragVisual.startingPoint, { x: left, y: top });}
this._prepareForDomChanges();dragSource.onDragStart();var eventArgs = new AjaxControlToolkit.DragDropEventArgs(
dragSource.get_dragMode(),
dragSource.get_dragDataType(),
dragSource.getDragData(context));var handler = this.get_events().getHandler('dragStart');if(handler) handler(this,eventArgs);this._recoverFromDomChanges();this._wireEvents();this._drag( true);},
_stopDragDrop : function(cancelled) {
var ev = window._event;if (this._activeDragSource != null) {
this._unwireEvents();if (!cancelled) {
cancelled = (this._underlyingTarget == null);}
if (!cancelled && this._underlyingTarget != null) {
this._underlyingTarget.drop(this._activeDragSource.get_dragMode(), this._activeDragSource.get_dragDataType(),
this._activeDragSource.getDragData(this._activeContext));}
this._activeDragSource.onDragEnd(cancelled);var handler = this.get_events().getHandler('dragStop');if(handler) handler(this,Sys.EventArgs.Empty);this._activeDragVisual.style.position = this._activeDragVisual.originalPosition;this._activeDragSource = null;this._activeContext = null;this._activeDragVisual = null;this._isDragging = false;this._potentialTarget = null;ev.preventDefault();}
},
_drag : function(isInitialDrag) {
var ev = window._event;var mousePosition = { x: ev.clientX, y: ev.clientY };document._lastPosition = mousePosition;var scrollOffset = this.getScrollOffset(this._activeDragVisual,  true);var position = this.addPoints(this.subtractPoints(mousePosition, this._activeDragVisual.startingPoint), scrollOffset);if (!isInitialDrag && parseInt(this._activeDragVisual.style.left) == position.x && parseInt(this._activeDragVisual.style.top) == position.y) {
return;}
$common.setLocation(this._activeDragVisual, position);this._prepareForDomChanges();this._activeDragSource.onDrag();this._recoverFromDomChanges();this._potentialTarget = this._findPotentialTarget(this._activeDragSource, this._activeDragVisual);var movedToOtherTarget = (this._potentialTarget != this._underlyingTarget || this._potentialTarget == null);if (movedToOtherTarget && this._underlyingTarget != null) {
this._leaveTarget(this._activeDragSource, this._underlyingTarget);}
if (this._potentialTarget != null) {
if (movedToOtherTarget) {
this._underlyingTarget = this._potentialTarget;this._enterTarget(this._activeDragSource, this._underlyingTarget);}
else {
this._moveInTarget(this._activeDragSource, this._underlyingTarget);}
}
else {
this._underlyingTarget = null;}
},
_wireEvents : function() {
$addHandler(document, "mouseup", this._mouseUpHandler);$addHandler(document, "mousemove", this._documentMouseMoveHandler);$addHandler(document.body, "dragover", this._documentDragOverHandler);$addHandler(this._activeDragVisual, "dragstart", this._dragStartHandler);$addHandler(this._activeDragVisual, "dragend", this._mouseUpHandler);$addHandler(this._activeDragVisual, "drag", this._mouseMoveHandler);},
_unwireEvents : function() {
$removeHandler(this._activeDragVisual, "drag", this._mouseMoveHandler);$removeHandler(this._activeDragVisual, "dragend", this._mouseUpHandler);$removeHandler(this._activeDragVisual, "dragstart", this._dragStartHandler);$removeHandler(document.body, "dragover", this._documentDragOverHandler);$removeHandler(document, "mousemove", this._documentMouseMoveHandler);$removeHandler(document, "mouseup", this._mouseUpHandler);},
registerDropTarget : function(dropTarget) {
if (this._dropTargets == null) {
this._dropTargets = [];}
Array.add(this._dropTargets, dropTarget);this._wireDropTargetEvents(dropTarget);},
unregisterDropTarget : function(dropTarget) {
this._unwireDropTargetEvents(dropTarget);if (this._dropTargets) {
Array.remove(this._dropTargets, dropTarget);}
},
_wireDropTargetEvents : function(dropTarget) {
var associatedElement = dropTarget.get_dropTargetElement();associatedElement._dropTarget = dropTarget;$addHandler(associatedElement, "dragenter", this._dragEnterHandler);$addHandler(associatedElement, "dragleave", this._dragLeaveHandler);$addHandler(associatedElement, "dragover", this._dragOverHandler);$addHandler(associatedElement, "drop", this._dropHandler);},
_unwireDropTargetEvents : function(dropTarget) {
var associatedElement = dropTarget.get_dropTargetElement();if(associatedElement._dropTarget)
{
associatedElement._dropTarget = null;$removeHandler(associatedElement, "dragenter", this._dragEnterHandler);$removeHandler(associatedElement, "dragleave", this._dragLeaveHandler);$removeHandler(associatedElement, "dragover", this._dragOverHandler);$removeHandler(associatedElement, "drop", this._dropHandler);}
},
_onDragStart : function(ev) {
window._event = ev;document.selection.empty();var dt = ev.dataTransfer;if(!dt && ev.rawEvent) dt = ev.rawEvent.dataTransfer;var dataType = this._activeDragSource.get_dragDataType().toLowerCase();var data = this._activeDragSource.getDragData(this._activeContext);if (data) {
if (dataType != "text" && dataType != "url") {
dataType = "text";if (data.innerHTML != null) {
data = data.innerHTML;}
}
dt.effectAllowed = "move";dt.setData(dataType, data.toString());}
},
_onMouseUp : function(ev) {
window._event = ev;this._stopDragDrop(false);},
_onDocumentMouseMove : function(ev) {
window._event = ev;this._dragDrop();},
_onDocumentDragOver : function(ev) {
window._event = ev;if(this._potentialTarget) ev.preventDefault();},
_onMouseMove : function(ev) {
window._event = ev;this._drag();},
_onDragEnter : function(ev) {
window._event = ev;if (this._isDragging) {
ev.preventDefault();}
else {
var dataObjects = AjaxControlToolkit.IEDragDropManager._getDataObjectsForDropTarget(this._getDropTarget(ev.target));for (var i = 0;i < dataObjects.length;i++) {
this._dropTarget.onDragEnterTarget(AjaxControlToolkit.DragMode.Copy, dataObjects[i].type, dataObjects[i].value);}
}
},
_onDragLeave : function(ev) {
window._event = ev;if (this._isDragging) {
ev.preventDefault();}
else {
var dataObjects = AjaxControlToolkit.IEDragDropManager._getDataObjectsForDropTarget(this._getDropTarget(ev.target));for (var i = 0;i < dataObjects.length;i++) {
this._dropTarget.onDragLeaveTarget(AjaxControlToolkit.DragMode.Copy, dataObjects[i].type, dataObjects[i].value);}
}
},
_onDragOver : function(ev) {
window._event = ev;if (this._isDragging) {
ev.preventDefault();}
else {
var dataObjects = AjaxControlToolkit.IEDragDropManager._getDataObjectsForDropTarget(this._getDropTarget(ev.target));for (var i = 0;i < dataObjects.length;i++) {
this._dropTarget.onDragInTarget(AjaxControlToolkit.DragMode.Copy, dataObjects[i].type, dataObjects[i].value);}
}
},
_onDrop : function(ev) {
window._event = ev;if (!this._isDragging) {
var dataObjects = AjaxControlToolkit.IEDragDropManager._getDataObjectsForDropTarget(this._getDropTarget(ev.target));for (var i = 0;i < dataObjects.length;i++) {
this._dropTarget.drop(AjaxControlToolkit.DragMode.Copy, dataObjects[i].type, dataObjects[i].value);}
}
ev.preventDefault();},
_getDropTarget : function(element) {
while (element) {
if (element._dropTarget != null) {
return element._dropTarget;}
element = element.parentNode;}
return null;},
_dragDrop : function() {
if (this._isDragging) {
return;}
this._isDragging = true;this._activeDragVisual.dragDrop();document.selection.empty();},
_moveInTarget : function(dragSource, dropTarget) {
this._prepareForDomChanges();dropTarget.onDragInTarget(dragSource.get_dragMode(), dragSource.get_dragDataType(), dragSource.getDragData(this._activeContext));this._recoverFromDomChanges();},
_enterTarget : function(dragSource, dropTarget) {
this._prepareForDomChanges();dropTarget.onDragEnterTarget(dragSource.get_dragMode(), dragSource.get_dragDataType(), dragSource.getDragData(this._activeContext));this._recoverFromDomChanges();},
_leaveTarget : function(dragSource, dropTarget) {
this._prepareForDomChanges();dropTarget.onDragLeaveTarget(dragSource.get_dragMode(), dragSource.get_dragDataType(), dragSource.getDragData(this._activeContext));this._recoverFromDomChanges();},
_findPotentialTarget : function(dragSource, dragVisual) {
var ev = window._event;if (this._dropTargets == null) {
return null;}
var type = dragSource.get_dragDataType();var mode = dragSource.get_dragMode();var data = dragSource.getDragData(this._activeContext);var scrollOffset = this.getScrollOffset(document.body,  true);var x = ev.clientX + scrollOffset.x;var y = ev.clientY + scrollOffset.y;var cursorRect = { x: x - this._radius, y: y - this._radius, width: this._radius * 2, height: this._radius * 2 };var targetRect;for (var i = 0;i < this._dropTargets.length;i++) {
targetRect = $common.getBounds(this._dropTargets[i].get_dropTargetElement());if ($common.overlaps(cursorRect, targetRect) && this._dropTargets[i].canDrop(mode, type, data)) {
return this._dropTargets[i];}
}
return null;},
_prepareForDomChanges : function() {
this._oldOffset = $common.getLocation(this._activeDragVisual);},
_recoverFromDomChanges : function() {
var newOffset = $common.getLocation(this._activeDragVisual);if (this._oldOffset.x != newOffset.x || this._oldOffset.y != newOffset.y) {
this._activeDragVisual.startingPoint = this.subtractPoints(this._activeDragVisual.startingPoint, this.subtractPoints(this._oldOffset, newOffset));scrollOffset = this.getScrollOffset(this._activeDragVisual,  true);var position = this.addPoints(this.subtractPoints(document._lastPosition, this._activeDragVisual.startingPoint), scrollOffset);$common.setLocation(this._activeDragVisual, position);}
},
addPoints : function(p1, p2) {
return { x: p1.x + p2.x, y: p1.y + p2.y };},
subtractPoints : function(p1, p2) {
return { x: p1.x - p2.x, y: p1.y - p2.y };},
getScrollOffset : function(element, recursive) {
var left = element.scrollLeft;var top = element.scrollTop;if (recursive) {
var parent = element.parentNode;while (parent != null && parent.scrollLeft != null) {
left += parent.scrollLeft;top += parent.scrollTop;if (parent == document.body && (left != 0 && top != 0))
break;parent = parent.parentNode;}
}
return { x: left, y: top };},
getBrowserRectangle : function() {
var width = window.innerWidth;var height = window.innerHeight;if (width == null) {
width = document.body.clientWidth;}
if (height == null) {
height = document.body.clientHeight;}
return { x: 0, y: 0, width: width, height: height };},
getNextSibling : function(item) {
for (item = item.nextSibling;item != null;item = item.nextSibling) {
if (item.innerHTML != null) {
return item;}
}
return null;},
hasParent : function(element) {
return (element.parentNode != null && element.parentNode.tagName != null);}
}
AjaxControlToolkit.IEDragDropManager.registerClass('AjaxControlToolkit.IEDragDropManager', Sys.Component);AjaxControlToolkit.IEDragDropManager._getDataObjectsForDropTarget = function(dropTarget) {
if (dropTarget == null) {
return [];}
var ev = window._event;var dataObjects = [];var dataTypes = [ "URL", "Text" ];var data;for (var i = 0;i < dataTypes.length;i++) {
var dt = ev.dataTransfer;if(!dt && ev.rawEvent) dt = ev.rawEvent.dataTransfer;data = dt.getData(dataTypes[i]);if (dropTarget.canDrop(AjaxControlToolkit.DragMode.Copy, dataTypes[i], data)) {
if (data) {
Array.add(dataObjects, { type : dataTypes[i], value : data });}
}
}
return dataObjects;}
AjaxControlToolkit.GenericDragDropManager = function() {
AjaxControlToolkit.GenericDragDropManager.initializeBase(this);this._dropTargets = null;this._scrollEdgeConst = 40;this._scrollByConst = 10;this._scroller = null;this._scrollDeltaX = 0;this._scrollDeltaY = 0;this._activeDragVisual = null;this._activeContext = null;this._activeDragSource = null;this._oldOffset = null;this._potentialTarget = null;this._mouseUpHandler = null;this._mouseMoveHandler = null;this._keyPressHandler = null;this._scrollerTickHandler = null;}
AjaxControlToolkit.GenericDragDropManager.prototype = {
initialize : function() {
AjaxControlToolkit.GenericDragDropManager.callBaseMethod(this, "initialize");this._mouseUpHandler = Function.createDelegate(this, this._onMouseUp);this._mouseMoveHandler = Function.createDelegate(this, this._onMouseMove);this._keyPressHandler = Function.createDelegate(this, this._onKeyPress);this._scrollerTickHandler = Function.createDelegate(this, this._onScrollerTick);if (Sys.Browser.agent === Sys.Browser.Safari) {
AjaxControlToolkit.GenericDragDropManager.__loadSafariCompatLayer(this);}
this._scroller = new Sys.Timer();this._scroller.set_interval(10);this._scroller.add_tick(this._scrollerTickHandler);},
startDragDrop : function(dragSource, dragVisual, context) {
this._activeDragSource = dragSource;this._activeDragVisual = dragVisual;this._activeContext = context;AjaxControlToolkit.GenericDragDropManager.callBaseMethod(this, "startDragDrop", [dragSource, dragVisual, context]);},
_stopDragDrop : function(cancelled) {
this._scroller.set_enabled(false);AjaxControlToolkit.GenericDragDropManager.callBaseMethod(this, "_stopDragDrop", [cancelled]);},
_drag : function(isInitialDrag) {
AjaxControlToolkit.GenericDragDropManager.callBaseMethod(this, "_drag", [isInitialDrag]);this._autoScroll();},
_wireEvents : function() {
$addHandler(document, "mouseup", this._mouseUpHandler);$addHandler(document, "mousemove", this._mouseMoveHandler);$addHandler(document, "keypress", this._keyPressHandler);},
_unwireEvents : function() {
$removeHandler(document, "keypress", this._keyPressHandler);$removeHandler(document, "mousemove", this._mouseMoveHandler);$removeHandler(document, "mouseup", this._mouseUpHandler);},
_wireDropTargetEvents : function(dropTarget) {
},
_unwireDropTargetEvents : function(dropTarget) {
},
_onMouseUp : function(e) {
window._event = e;this._stopDragDrop(false);},
_onMouseMove : function(e) {
window._event = e;this._drag();},
_onKeyPress : function(e) {
window._event = e;var k = e.keyCode ? e.keyCode : e.rawEvent.keyCode;if (k == 27) {
this._stopDragDrop( true);}
},
_autoScroll : function() {
var ev = window._event;var browserRect = this.getBrowserRectangle();if (browserRect.width > 0) {
this._scrollDeltaX = this._scrollDeltaY = 0;if (ev.clientX < browserRect.x + this._scrollEdgeConst) this._scrollDeltaX = -this._scrollByConst;else if (ev.clientX > browserRect.width - this._scrollEdgeConst) this._scrollDeltaX = this._scrollByConst;if (ev.clientY < browserRect.y + this._scrollEdgeConst) this._scrollDeltaY = -this._scrollByConst;else if (ev.clientY > browserRect.height - this._scrollEdgeConst) this._scrollDeltaY = this._scrollByConst;if (this._scrollDeltaX != 0 || this._scrollDeltaY != 0) {
this._scroller.set_enabled(true);}
else {
this._scroller.set_enabled(false);}
}
},
_onScrollerTick : function() {
var oldLeft = document.body.scrollLeft;var oldTop = document.body.scrollTop;window.scrollBy(this._scrollDeltaX, this._scrollDeltaY);var newLeft = document.body.scrollLeft;var newTop = document.body.scrollTop;var dragVisual = this._activeDragVisual;var position = { x: parseInt(dragVisual.style.left) + (newLeft - oldLeft), y: parseInt(dragVisual.style.top) + (newTop - oldTop) };$common.setLocation(dragVisual, position);}
}
AjaxControlToolkit.GenericDragDropManager.registerClass('AjaxControlToolkit.GenericDragDropManager', AjaxControlToolkit.IEDragDropManager);if (Sys.Browser.agent === Sys.Browser.Safari) {
AjaxControlToolkit.GenericDragDropManager.__loadSafariCompatLayer = function(ddm) {
ddm._getScrollOffset = ddm.getScrollOffset;ddm.getScrollOffset = function(element, recursive) {
return { x: 0, y: 0 };}
ddm._getBrowserRectangle = ddm.getBrowserRectangle;ddm.getBrowserRectangle = function() {
var browserRect = ddm._getBrowserRectangle();var offset = ddm._getScrollOffset(document.body, true);return { x: browserRect.x + offset.x, y: browserRect.y + offset.y,
width: browserRect.width + offset.x, height: browserRect.height + offset.y };}
}
}

//END AjaxControlToolkit.Compat.DragDrop.DragDropScripts.js
//START ESRI.ArcGIS.ADF.Web.UI.WebControls.Runtime.JavaScript.ESRI.ADF.UI.Navigation.release.js
//----------------------------------------------------------
// Copyright (C) ESRI. All rights reserved.
//----------------------------------------------------------
Type.registerNamespace('ESRI.ADF.UI');ESRI.ADF.UI.Navigation = function(element) { 
ESRI.ADF.UI.Navigation.initializeBase(this, [element]);this._intervalRate = 25;this._moveX = 0;this._moveY = 0;this._speed = 3;this._interval = null;this._map = null;this._mouseUpHandler = null;this._mouseMoveHandler = null;this._panning = false;};ESRI.ADF.UI.Navigation.prototype = {
initialize : function() {
ESRI.ADF.UI.Navigation.callBaseMethod(this, 'initialize');var nav = this.get_element();nav.style["-moz-user-focus"]='normal';if (this._map === null)
{
nav.style.display = "none";nav.style.visibility = "hidden";}
else
{
this._mouseUpHandler = Function.createDelegate(this, this._doMouseUp);this._mouseMoveHandler = Function.createDelegate(this, this._doMouseMove);$addHandler(this.get_element(), 'mousedown', Function.createDelegate(this, this._doMouseDown));}
},
dispose : function() {
$clearHandlers(this.get_element());ESRI.ADF.UI.Navigation.callBaseMethod(this, 'dispose');},
_doMouseDown : function (e)
{
if (e.button == Sys.UI.MouseButton.leftButton)
{
if (this._panning === false)
{
this._panning = true;this._calculatePanDirection (e);this._panMap ();$addHandler(this.get_element(), 'mouseup', this._mouseUpHandler);$addHandler(this.get_element(), 'mousemove', this._mouseMoveHandler);$addHandler(document, 'mouseup', this._mouseUpHandler);$addHandler(document, 'mousemove', this._mouseMoveHandler);this._interval = window.setInterval(Function.createDelegate(this, this._panMap), this._intervalRate);}
}
else
{
if (this._panning === true)
{
this._stopPanning();}
}
},
_doMouseMove : function (e)
{
if (this._panning === true)
{
this._calculatePanDirection (e);e.preventDefault();e.stopPropagation();}
},
_doMouseUp : function (e)
{
if (this._panning === true)
{
this._stopPanning();}
},
_stopPanning : function ()
{
this._panning = false;window.clearInterval (this._interval);$removeHandler(this.get_element(), 'mouseup', this._mouseUpHandler);$removeHandler(this.get_element(), 'mousemove', this._mouseMoveHandler);$removeHandler(document, 'mouseup', this._mouseUpHandler);$removeHandler(document, 'mousemove', this._mouseMoveHandler);this._map._doContinuousPan(0, 0);},
_calculatePanDirection : function (e)
{
var bounds = Sys.UI.DomElement.getBounds (this.get_element());var location = Sys.UI.DomElement.getLocation (this.get_element());e = ESRI.ADF.System._makeMouseEventRelativeToElement(e,this.get_element(),location);var centerX = Math.round (bounds.width / 2);var centerY = Math.round (bounds.height / 2);var shiftX = e.offsetX - centerX;var shiftY = e.offsetY - centerY;var shift = (shiftX / shiftY);this._moveX = 0;this._moveY = 0;if (shift === 0)
{
if (shiftY > 0)
{
this._moveY = 1;}
else 
{
this._moveY = -1;}
}
else if (shiftX < 0)
{
if (shift >= 0 && shift <= 0.5)
{
this._moveY = -1;}
else if (shift > 0.5 && shift <= 1.5)
{
this._moveX = -1;this._moveY = -1;}
else if (shift > 1.5 || shift <= -1.5)
{
this._moveX = -1;}
else if (shift > -1.5 && shift <= -0.5)
{
this._moveX = -1;this._moveY = 1;}
else
{
this._moveY = 1;}
}
else {
if (shift >= 0 && shift <= 0.5)
{
this._moveY = 1;}
else if (shift > 0.5 && shift <= 1.5)
{
this._moveX = 1;this._moveY = 1;}
else if (shift > 1.5 || shift <= -1.5)
{
this._moveX = 1;}
else if (shift > -1.5 && shift <= -0.5)
{
this._moveX = 1;this._moveY = -1;}
else
{
this._moveY = -1;}
} 
},
_panMap : function ()
{
if (this._moveX !== 0 || this._moveY !== 0)
{
this._map._doContinuousPan (this._moveX * this._speed, this._moveY * this._speed);}
},
get_map : function ()
{
return this._map;},
set_map : function(value)
{
if (this._map != value) {
this._map = value;this.raisePropertyChanged('map');}
},
get_speed : function ()
{
return this._speed;},
set_speed : function (value)
{
if (this._speed != value) {
this._speed = value;this.raisePropertyChanged('speed');}
}
};ESRI.ADF.UI.Navigation.registerClass('ESRI.ADF.UI.Navigation', Sys.UI.Control);ESRI.ADF.UI.OverviewMap = function(element) { 
ESRI.ADF.UI.OverviewMap.initializeBase(this, [element]);this._map = null;this._width = 0;this._height = 0;this._boxLeft = 0;this._boxTop = 0;this._boxWidth = 0;this._boxHeight = 0;this._imageURL = "";this._blankURL = "";this._tooltip = "";this._boxColor = "Red";this._lineWidth = 3;this._lineType = "solid";this._aoiResizable = true;this._aoiDraggable = true;this._aoiMinWidth = 15;this._aoiMinHeight = 15;this._panMouseUpHandler = null;this._panMouseMoveHandler = null;this._resizeMouseUpHandler = null;this._resizeMouseMoveHandler = null;this._mouseDownOriginX = 0;this._mouseDownOriginY = 0;this._mousePanX = 0;this._mousePanY = 0;this._resizeWidth = 0;this._resizeHeight = 0;this._resizeOriginX = 0;this._resizeOriginY = 0;this._enabled = false;};ESRI.ADF.UI.OverviewMap.prototype = {
initialize : function() {
ESRI.ADF.UI.OverviewMap.callBaseMethod(this, 'initialize');var ovm = this.get_element();if (this._map === null)
{
ovm.style.display = "none";ovm.style.visibility = "hidden";}
else
{
this._enabled = true;this._right = this._width;this._bottom = this._height;this._boxRight = this._boxLeft + this._boxWidth;this._boxBottom = this._boxTop + this._boxHeight;this._aoiResizable = Boolean(this._aoiResizable);this._aoiDraggable = Boolean(this._aoiDraggable);this._divId = "OVDiv_" + this.get_id();this._imageId = "OVImage_" + this.get_id();this._boxDivId = "OVBoxDiv_" + this.get_id();this._boxImageId = "OVBoxImage_" + this.get_id();this._boxResizeDivId = "OVBoxResizeDiv_" + this.get_id();this._boxDivObject = null;this._imageObject = null;this._boxResizeObject = null;this._dragOVBox = false;this._dragOVResizeBox = false;this._mapXRatio = 1;this._mapYRatio = 1;this._mapXYRatio = 1;this._ovPanStartLeft = 0;this._ovPanStartTop = 0;this._createDivs (ovm);}
},
dispose : function() {
$clearHandlers(this._element);ESRI.ADF.UI.OverviewMap.callBaseMethod(this, 'dispose');},
_createDivs : function (ovm)
{
var leftAdjust = 0;var topAdjust = 0;if (this._boxLeft<0) {
leftAdjust = this._boxLeft;this._boxLeft = 0;}
if (this._boxTop<0) {
topAdjust = this._boxTop;this._boxTop = 0;}
if (this._boxLeft + this._boxWidth+(this._lineWidth*2)>=this._width)
{
this._boxWidth = this._width - this._boxLeft-(this._lineWidth*2) + leftAdjust;}
if (this._boxTop + this._boxHeight+(this._lineWidth*2)>=this._height)
{
this._boxHeight = this._height - this._boxTop-(this._lineWidth*2) + topAdjust;}
var s = "";s += '<div id="OVControlDiv_' + this.get_id() + '" style="position: relative; background-color: White; width: ' + this._width + 'px; height: ' + this._height + 'px; overflow:hidden;">\n';s += '<div id="' + this._divId + '" style="position: absolute; left: 0px; top: 0px; background-color: White; width: ' + this._width + 'px; height: ' + this._height + 'px; overflow:hidden;">\n';s += '<img id="' + this._imageId + '" alt="' + this._tooltip + '"  title="' + this._tooltip + '" src="' + this._imageURL + '" width="' + this._width + '" height="' + this._height + '" hspace="0" vspace="0" border="0" />\n';s += '</div>\n';var style = "border: " + this._lineWidth + "px " + this._lineType + " " + this._boxColor + ";";s += '<div id="' + this._boxDivId + '" style="position: absolute; left: ' + this._boxLeft + 'px; top: ' + this._boxTop + 'px;' + style + ' width: ' + this._boxWidth + 'px; height: ' + this._boxHeight + 'px; overflow:hidden; ">\n';s += '<img id="' + this._boxImageId + '" alt="' + this._tooltip + '"  title="' + this._tooltip + '" src="' + this._blankURL + '" width="100%" height="100%" hspace="0" vspace="0" border="0">\n';if (Sys.Browser.agent == Sys.Browser.Firefox)
{
s += '<div style=\"width: 100%; height: 100%; left: 0; top: 0; position: absolute\"></div>';}
s += '</div>\n';if (this._aoiResizable)
{
s += '<div id="' + this._boxResizeDivId + '" style="position: absolute; left: ' + (this._boxLeft + this._boxWidth - 5) + '; top: ' + (this._boxTop + this._boxHeight - 5) + '; cursor: nw-resize; width: 10px; height: 10px; overflow:hidden;">\n';s += '<img  alt="Resize AOI"  title="Resize AOI" src="' + this._blankURL + '" width="10" height="10" hspace="0" vspace="0" border="0" >\n';if (Sys.Browser.agent == Sys.Browser.Firefox)
{
s += '<div style=\"width: 100%; height: 100%; left: 0; top: 0; position: absolute\"></div>';}
s += '</div>\n';}
s += '</div>\n';ovm.innerHTML = s;this._setObjects();this._setEvents();this._updateMapRatio();},
_setObjects : function ()
{
this._divObject = $get(this._divId);this._boxDivObject = $get(this._boxDivId);this._imageObject = $get(this._imageId);if (this._aoiResizable)
{
this._boxResizeObject = $get(this._boxResizeDivId);}
},
_setEvents : function ()
{
if (this._aoiDraggable)
{
this._panMouseUpHandler = Function.createDelegate(this, this._doPanMouseUp);this._panMouseMoveHandler = Function.createDelegate(this, this._doPanMouseMove);this._boxDivObject.style.cursor = "move";this._divObject.style.cursor = "default";$addHandler(this._boxDivObject, 'mousedown', Function.createDelegate(this, this._doPanMouseDown));}
if (this._aoiResizable)
{ 
this._resizeMouseUpHandler = Function.createDelegate(this, this._doResizeMouseUp);this._resizeMouseMoveHandler = Function.createDelegate(this, this._doResizeMouseMove);$addHandler(this._boxResizeObject, 'mousedown', Function.createDelegate(this, this._doResizeMouseDown));}
},
_updateMapRatio : function ()
{
var bounds = Sys.UI.DomElement.getBounds (this._map.get_element());var mapWidth = bounds.width;var mapHeight = bounds.height;this._mapXRatio = mapWidth / this._boxWidth;this._mapYRatio = mapHeight / this._boxHeight;this._mapXYRatio = mapWidth / mapHeight;if (this._mapXYRatio > 1)
{
this._maxBoxWidth = this._width;this._maxBoxHeight = this._width / this._mapXYRatio;}
else
{
this._maxBoxWidth = this._height * this._mapXYRatio;this._maxBoxHeight = this._height;}
this._maxBoxWidth = Math.min(this._width, this._maxBoxWidth);this._maxBoxHeight = Math.min(this._height, this._maxBoxHeight);},
_doPanMouseDown : function (e)
{
if (e.button == Sys.UI.MouseButton.leftButton)
{
if (!this._dragOVBox)
{
this._dragOVBox = true;this._ovPanStartLeft = this._boxDivObject.offsetLeft;this._ovPanStartTop = this._boxDivObject.offsetTop;this._mouseDownOriginX = this._mousePanX = e.clientX;this._mouseDownOriginY = this._mousePanY = e.clientY;$addHandler(this.get_element(), 'mouseup', this._panMouseUpHandler);$addHandler(this.get_element(), 'mousemove', this._panMouseMoveHandler);e.preventDefault();e.stopPropagation();}
}
},
_doPanMouseMove : function (e)
{
if (this._dragOVBox)
{
var ex = this._ovPanStartLeft + (e.clientX - this._mouseDownOriginX);var ey = this._ovPanStartTop + (e.clientY - this._mouseDownOriginY);this._boxDivObject.style.left = ex + "px";this._boxDivObject.style.top = ey + "px";if (this._aoiResizable)
{
this._boxResizeObject.style.left = (ex + this._boxWidth - 5) + "px";this._boxResizeObject.style.top = (ey + this._boxHeight - 5) + "px";}
var nx = Math.round((e.clientX - this._mousePanX) * this._mapXRatio);var ny = Math.round((e.clientY - this._mousePanY) * this._mapYRatio);if (nx !== 0 || ny !== 0)
{
this._map._doContinuousPan (nx, ny);}
this._mousePanX = e.clientX;this._mousePanY = e.clientY;e.preventDefault();e.stopPropagation();}
},
_doPanMouseUp : function (e)
{
this._dragOVBox = false;$removeHandler(this.get_element(), 'mouseup', this._panMouseUpHandler);$removeHandler(this.get_element(), 'mousemove', this._panMouseMoveHandler);this._map._doContinuousPan (0, 0);},
_doResizeMouseDown : function (e)
{
if (e.button == Sys.UI.MouseButton.leftButton)
{
if (!this._dragOVResizeBox)
{
this._dragOVResizeBox = true;var bounds;bounds = Sys.UI.DomElement.getBounds (this.get_element());this._resizeOriginX = bounds.x + (bounds.width / 2);this._resizeOriginY = bounds.y + (bounds.height / 2);bounds = Sys.UI.DomElement.getBounds (this._boxDivObject);this._resizeWidth = bounds.width - (this._lineWidth * 2);this._resizeHeight = bounds.height - (this._lineWidth * 2);$addHandler(this.get_element(), 'mouseup', this._resizeMouseUpHandler);$addHandler(this.get_element(), 'mousemove', this._resizeMouseMoveHandler);e.preventDefault();e.stopPropagation();}
}
},
_doResizeMouseMove : function (e)
{
if (this._dragOVResizeBox)
{
var normalWidth = 0;var normalHeight = 0;var deltaX = Math.abs(e.clientX - this._resizeOriginX);var deltaY = Math.abs(e.clientY - this._resizeOriginY);if (deltaX > (deltaY * this._mapXYRatio))
{
normalWidth = deltaX * 2;if (normalWidth < this._aoiMinWidth)
{
normalWidth = this._aoiMinWidth;}
else if (normalWidth > this._maxBoxWidth)
{
normalWidth = this._maxBoxWidth;}
normalHeight = normalWidth / this._mapXYRatio;}
else
{
normalHeight = deltaY * 2;if (normalHeight < this._aoiMinHeight)
{
normalHeight = this._aoiMinHeight;}
else if (normalHeight > this._maxBoxHeight)
{
normalHeight = this._maxBoxHeight;}
normalWidth = normalHeight * this._mapXYRatio;}
this._boxDivObject.style.width = (normalWidth - (this._lineWidth * 2)) + "px";this._boxDivObject.style.height = (normalHeight - (this._lineWidth * 2)) + "px";this._boxDivObject.style.left = ((this._width - normalWidth) / 2) + "px";this._boxDivObject.style.top = ((this._height - normalHeight) / 2) + "px";this._boxWidth = normalWidth;this._boxHeight = normalHeight;e.preventDefault();e.stopPropagation();}
},
_doResizeMouseUp : function (e)
{
this._dragOVResizeBox = false;$removeHandler(this.get_element(), 'mouseup', this._resizeMouseUpHandler);$removeHandler(this.get_element(), 'mousemove', this._resizeMouseMoveHandler);if (!this._map.zoom(this._resizeWidth / this._boxWidth))
{
this._boxDivObject.style.width = this._resizeWidth + "px";this._boxDivObject.style.height = this._resizeHeight + "px";this._boxDivObject.style.left = ((this._width - this._resizeWidth) / 2) + "px";this._boxDivObject.style.top = ((this._height - this._resizeHeight) / 2) + "px";}
},
_updateAOI : function (boxLeft, boxTop, boxWidth, boxHeight)
{
this._boxLeft = boxLeft;this._boxTop = boxTop;this._boxWidth = boxWidth;this._boxHeight = boxHeight;this._boxRight = boxLeft + boxWidth;this._boxBottom = boxTop + boxHeight;if(!this.get_isInitialized()) { return;} 
this._boxDivObject.style.left = boxLeft + "px";this._boxDivObject.style.top = boxTop + "px";this._boxDivObject.style.width = boxWidth + "px";this._boxDivObject.style.height = boxHeight + "px";if (this._aoiResizable)
{
this._boxResizeObject.style.left = (boxLeft + boxWidth - 5) + "px";this._boxResizeObject.style.top = (boxTop + boxHeight - 5) + "px";}
this._updateMapRatio();},
processCallbackResult : function(action, params)
{
if (action=='aoiextent')
{
this._updateAOI (params[0], params[1], params[2], params[3]);if (params[4])
{
if(!this._imageObject.src.endsWith(params[4])) {
this._imageObject.src = params[4];}
}
}
},
show : function()
{
var ovm = this.get_element();if (ovm)
{
ovm.style.visibility = 'visible';}
},
hide : function()
{
var ovm = this.get_element();if (ovm)
{
ovm.style.visibility = 'hidden';}
},
isVisible : function()
{
var ovm = this.get_element();return ovm && ovm.style.visibility != 'hidden';},
get_map : function ()
{
return this._map;},
set_map : function(value)
{
if (this._map != value) {
this._map = value;this.raisePropertyChanged('map');}
},
get_width : function ()
{
return this._width;},
set_width : function(value)
{
if (this._width != value) {
this._width = value;this.raisePropertyChanged('width');}
},
get_height : function ()
{
return this._height;},
set_height : function(value)
{
if (this._height != value) {
this._height = value;this.raisePropertyChanged('height');}
},
get_boxLeft : function ()
{
return this._boxLeft;},
set_boxLeft : function(value)
{
if (this._boxLeft != value) {
this._boxLeft = value;this.raisePropertyChanged('boxLeft');}
},
get_boxTop : function ()
{
return this._boxTop;},
set_boxTop : function(value)
{
if (this._boxTop != value) {
this._boxTop = value;this.raisePropertyChanged('boxTop');}
},
get_boxWidth : function ()
{
return this._boxWidth;},
set_boxWidth : function(value)
{
if (this._boxWidth != value) {
this._boxWidth = value;this.raisePropertyChanged('boxWidth');}
},
get_boxHeight : function ()
{
return this._boxHeight;},
set_boxHeight : function(value)
{
if (this._boxHeight != value) {
this._boxHeight = value;this.raisePropertyChanged('boxHeight');}
},
get_imageURL : function ()
{
return this._imageURL;},
set_imageURL : function(value)
{
if (this._imageURL != value) {
this._imageURL = value;this.raisePropertyChanged('imageURL');}
},
get_blankURL : function ()
{
return this._blankURL;},
set_blankURL : function(value)
{
if (this._blankURL != value) {
this._blankURL = value;this.raisePropertyChanged('blankURL');}
},
get_tooltip : function ()
{
return this._tooltip;},
set_tooltip : function(value)
{
if (this._tooltip != value) {
this._tooltip = value;this.raisePropertyChanged('tooltip');}
},
get_boxColor : function ()
{
return this._boxColor;},
set_boxColor : function(value)
{
if (this._boxColor != value) {
this._boxColor = value;this.raisePropertyChanged('boxColor');}
},
get_lineWidth : function ()
{
return this._lineWidth;},
set_lineWidth : function(value)
{
if (this._lineWidth != value) {
this._lineWidth = value;this.raisePropertyChanged('lineWidth');}
},
get_lineType : function ()
{
return this._lineType;},
set_lineType : function(value)
{
if (this._lineType != value) {
this._lineType = value;this.raisePropertyChanged('lineType');}
},
get_aoiResizable : function ()
{
return this._aoiResizable;},
set_aoiResizable : function(value)
{
if (this._aoiResizable != value) {
this._aoiResizable = value;this.raisePropertyChanged('aoiResizable');}
},
get_aoiDraggable : function ()
{
return this._aoiDraggable;},
set_aoiDraggable : function(value)
{
if (this._aoiDraggable != value) {
this._aoiDraggable = value;this.raisePropertyChanged('aoiDraggable');}
},
get_aoiMinWidth : function ()
{
return this._aoiMinWidth;},
set_aoiMinWidth : function(value)
{
if (this._aoiMinWidth != value) {
this._aoiMinWidth = value;this.raisePropertyChanged('aoiMinWidth');}
},
get_aoiMinHeight : function ()
{
return this._aoiMinHeight;},
set_aoiMinHeight : function(value)
{
if (this._aoiMinHeight != value) {
this._aoiMinHeight = value;this.raisePropertyChanged('aoiMinHeight');}
}
};ESRI.ADF.UI.OverviewMap.registerClass('ESRI.ADF.UI.OverviewMap', Sys.UI.Control);ESRI.ADF.UI._ZoomLevelDragDropManagerInternal = function() {
ESRI.ADF.UI._ZoomLevelDragDropManagerInternal.initializeBase(this);this._instance = null;};ESRI.ADF.UI._ZoomLevelDragDropManagerInternal.prototype = {
_getInstance : function() {
this._instance = new AjaxControlToolkit.GenericDragDropManager();this._instance.initialize();this._instance.add_dragStart(Function.createDelegate(this, this._raiseDragStart));this._instance.add_dragStop(Function.createDelegate(this, this._raiseDragStop));return this._instance;}
};ESRI.ADF.UI._ZoomLevelDragDropManagerInternal.registerClass('ESRI.ADF.UI._ZoomLevelDragDropManagerInternal', AjaxControlToolkit._DragDropManager);ESRI.ADF.UI.ZoomLevelDragDropManagerInternal = new ESRI.ADF.UI._ZoomLevelDragDropManagerInternal();ESRI.ADF.UI.ZoomLevel = function(element) { 
ESRI.ADF.UI.ZoomLevel.initializeBase(this, [element]);this._steps = 0;this._level = -1;this._orientation = 1;this._dynamicZoomInFactor = 2.0;this._dynamicZoomOutFactor = 0.5;this._map = null;this._imgTop = "";this._imgBottom = "";this._imgSelected = "";this._imgDefault = "";this._hasLevels = false;this._topElement = null;this._bottomElement = null;this._railElement = null;this._handle = null;this._handleImage = null;this._isHorizontal = true;this._dragHandle = null;this._mouseupHandler = null;this._selectstartHandler = null;this._selectstartPending = false;this._imgHeight = 0;this._imgWidth = 0;};ESRI.ADF.UI.ZoomLevel.prototype = {
initialize : function()
{
ESRI.ADF.UI.ZoomLevel.callBaseMethod(this, 'initialize');this._hasLevels = (this._map.get_layers().get_levels() !== null);if (this._hasLevels)
{
this._steps = this._map.get_layers().get_levels().length;this._minimum = 0;this._maximum = this._steps - 1;this._mapExtentChangedHandler = Function.createDelegate(this, this._mapExtentChanged);this._map.add_extentChanged(this._mapExtentChangedHandler);}
this._initializeLayout();}, 
dispose : function()
{
if (this._hasLevels)
{
this._disposeHandlers();this._map.remove_extentChanged(this._mapExtentChangedHandler);}
ESRI.ADF.UI.ZoomLevel.callBaseMethod(this, 'dispose');},
_setFloat : function (element, direction)
{
if (Sys.Browser.agent == Sys.Browser.Firefox)
{
element.style.cssFloat = direction;}
else
{
element.style.styleFloat = direction;}
},
_initializeLayout : function()
{
var parentElement = this.get_element();this._isHorizontal = (this._orientation == -1);this._topElement = document.createElement('IMG');this._topElement.src = (this._isHorizontal ? this._imgBottom : this._imgTop);this._topElement.style.cursor = "pointer";if (this._isHorizontal)
{
this._setFloat (this._topElement, "left");}
else
{
this._topElement.style.verticalAlign = "bottom";this._topElement.style.display = "block";}
this._topElement.setAttribute("Alt", "Click to zoom in or out.");parentElement.appendChild(this._topElement);if (this._hasLevels)
{
this._railElement = document.createElement('DIV');this._railElement.innerHTML = '<div></div>';this._handle = this._railElement.childNodes[0];this._handle.style.overflow = 'hidden';this._handle.style.position = 'absolute';this._handle.style.height = this._imgHeight + 'px';this._handle.style.width = this._imgWidth + 'px';this._handle.style.left = '0px';this._handle.style.top = '0px';parentElement.appendChild(this._railElement);this._handleImage = document.createElement('IMG');this._handleImage.style.position = 'absolute';this._handleImage.style.left = '0px';this._handleImage.style.top = '0px';this._handleImage.src = this._imgSelected;this._handleImage.setAttribute("Alt", "Click to zoom in or out.");this._handle.appendChild(this._handleImage);if (this._isHorizontal)
{
this._railElement.style.backgroundRepeat = "repeat-x";this._railElement.style.height = this._imgHeight + "px";this._railElement.style.width = (this._steps * this._imgWidth) + "px";this._setFloat (this._railElement, "left");}
else
{
this._railElement.style.backgroundRepeat = "repeat-y";this._railElement.style.width = this._imgWidth + "px";this._railElement.style.height = (this._steps * this._imgHeight) + "px";}
this._railElement.style.cursor = "pointer";this._railElement.style.position = "relative";this._railElement.style.display = "block";this._railElement.style.backgroundImage = "url('" + this._imgDefault + "')";this._railElement.setAttribute("Alt", "Click to zoom in or out.");this._railElement.style.outline = "none";}
this._bottomElement = document.createElement('IMG');this._bottomElement.src = (this._isHorizontal ? this._imgTop : this._imgBottom);this._bottomElement.style.cursor = "pointer";if (this._isHorizontal)
{
this._setFloat (this._bottomElement, "left");}
else
{
this._bottomElement.style.verticalAlign = "top";}
this._bottomElement.setAttribute("Alt", "Click to zoom in or out.");parentElement.appendChild(this._bottomElement);this._initializeSlider();},
_initializeSlider : function()
{
if (this._hasLevels)
{
this._setCurrentLevel();this._initializeDragHandle();ESRI.ADF.UI.ZoomLevelDragDropManagerInternal.registerDropTarget(this);}
this._initializeHandlers();},
_startDragDrop : function(dragVisual)
{
this._resetDragHandle();ESRI.ADF.UI.ZoomLevelDragDropManagerInternal.startDragDrop(this, dragVisual, null);},
_onMouseDown : function(evt)
{
window._event = evt;evt.preventDefault();if(!ESRI.ADF.UI.ZoomLevel.DropPending) {
ESRI.ADF.UI.ZoomLevel.DropPending = this;$addHandler(document, 'selectstart', this._selectstartHandler);this._selectstartPending = true;this._startDragDrop(this._dragHandle);}
},
_onMouseUp : function(evt)
{
var srcElement = evt.target;if(ESRI.ADF.UI.ZoomLevel.DropPending == this) {
ESRI.ADF.UI.ZoomLevel.DropPending = null;if(this._selectstartPending) {
this._selectstartPending = false;$removeHandler(document, 'selectstart', this._selectstartHandler);}
}
},
_DragDropHandler : function(evt)
{
evt.preventDefault();},
_onSelectStart : function(evt)
{
evt.preventDefault();},
_calcValue : function(mouseOffset)
{
var val;var _minimum = this._minimum;var _maximum = this._maximum;var handleBounds = this._getHandleBounds();var sliderBounds = this._getRailBounds();var handleX = (mouseOffset) ? (mouseOffset - handleBounds.width / 2) : (handleBounds.x - sliderBounds.x);var extent = sliderBounds.width - handleBounds.width;var percent = handleX / extent;val = (handleX === 0) ? _minimum : (handleX == (sliderBounds.width - handleBounds.width)) ? _maximum : _minimum + percent * (_maximum - _minimum);if (this._steps > 0)
{
val = this._getNearestStepValue(val);}
val = (val < this._minimum) ? this._minimum : (val > this._maximum) ? this._maximum : val;this._setLevel(val);return val;},
_getBoundsInternal : function(element)
{
var bounds = $common.getBounds(element);if(!this._isHorizontal) {
bounds = { x : bounds.y, 
y : bounds.x, 
height : bounds.width, 
width : bounds.height, 
right : bounds.right,
bottom : bounds.bottom,
location : {x:bounds.y, y:bounds.x},
size : {width:bounds.height, height:bounds.width}
};}
return bounds;},
_getRailBounds : function()
{
return this._getBoundsInternal(this._railElement);},
_getHandleBounds : function()
{
return this._getBoundsInternal(this._handle);},
_initializeDragHandle : function()
{
this._dragHandle = document.createElement('DIV');var dh = this._dragHandle;dh.style.position = 'absolute';dh.style.width = '1px';dh.style.height = '1px';dh.style.overflow = 'hidden';dh.style.zIndex = '999';dh.style.background = 'none';document.body.appendChild(this._dragHandle);},
_resetDragHandle : function()
{
var handleBounds = $common.getBounds(this._handle);$common.setLocation(this._dragHandle, {x:handleBounds.x, y:handleBounds.y});},
_initializeHandlers : function()
{
$addHandlers(this._topElement,
{
'click': this._onTopClick
},
this);if (this._hasLevels)
{
this._selectstartHandler = Function.createDelegate(this, this._onSelectStart);this._mouseupHandler = Function.createDelegate(this, this._onMouseUp);$addHandler(document, 'mouseup', this._mouseupHandler);$addHandlers(this._handle, 
{
'mousedown': this._onMouseDown,
'dragstart': this._DragDropHandler,
'drag': this._DragDropHandler,
'dragend': this._DragDropHandler
},
this);$addHandlers(this._railElement,
{
'click': this._onRailClicked
},
this);}
$addHandlers(this._bottomElement,
{
'click': this._onBottomClick
},
this);},
_disposeHandlers : function()
{
$clearHandlers(this._topElement);$clearHandlers(this._bottomElement);if (this._hasLevels)
{
$clearHandlers(this._handle);$clearHandlers(this._railElement);$removeHandler(document, 'mouseup', this._mouseupHandler);this._mouseupHandler = null;this._selectstartHandler = null;}
if (this._handleImage)
{
$clearHandlers(this._handleImage);}
},
_setHandleOffset : function(value)
{
var _minimum = this._minimum;var _maximum = this._maximum;var handleBounds = this._getHandleBounds();var sliderBounds = this._getRailBounds();var Commons = AjaxControlToolkit.CommonToolkitScripts;if (handleBounds.width <= 0 && sliderBounds.width <= 0)
{
if(this._isHorizontal) {
handleBounds.width = parseInt(this._handle.style.width, 10);sliderBounds.width = parseInt(this._railElement.style.width, 10);}
else {
handleBounds.width = parseInt(this._handle.style.height, 10);sliderBounds.width = parseInt(this._railElement.style.height, 10);}
}
var extent = _maximum - _minimum;var fraction = (value - _minimum) / extent;var hypOffset = Math.round(fraction * (sliderBounds.width - handleBounds.width));var offset = (value == _minimum) ? 0 : (value == _maximum) ? (sliderBounds.width - handleBounds.width) : hypOffset;if (this._isHorizontal) {
this._handle.style.left = offset + 'px';}
else {
this._handle.style.top = offset + 'px';}
},
_getNearestStepValue : function(value) {
if (this._steps === 0)
{
return value;}
var extent = this._maximum - this._minimum;if (extent === 0)
{
return value;}
var delta = extent / (this._steps - 1);return Math.round(value / delta) * delta;},
_onHandleReleased : function() {
this._zoomMap();},
_onTopClick : function(evt)
{
if (this._hasLevels)
{
this._setLevel(this._getLevel() - 1);this._setHandleOffset(this._getLevel());this._zoomMap();}
else
{
this._map.zoom(this._isHorizontal ? this._dynamicZoomOutFactor : this._dynamicZoomInFactor);}
},
_onBottomClick : function(evt)
{
if (this._hasLevels)
{
this._setLevel(this._getLevel() + 1);this._setHandleOffset(this._getLevel());this._zoomMap();}
else
{
this._map.zoom(this._isHorizontal ? this._dynamicZoomInFactor : this._dynamicZoomOutFactor);}
},
_onRailClicked : function(evt) {
if (evt.target == this._railElement)
{
var handleBounds = this._getHandleBounds();var sliderBounds = this._getRailBounds();var offset = (this._orientation == -1) ? evt.offsetX : evt.offsetY;var minOffset = handleBounds.width / 2;var maxOffset = sliderBounds.width - minOffset;offset = (offset < minOffset) ? minOffset : (offset > maxOffset) ? maxOffset : offset;this._calcValue(offset);this._zoomMap();}
},
_zoomMap : function ()
{
var curLevel = this._map.get_layers().getLevelByNearestPixelsize(this._map._pixelsizeX);var levels = this._map.get_layers().get_levels();var mapLevel;if (this._isHorizontal)
{
mapLevel = this._getLevel();}
else
{
mapLevel = this._maximum - this._getLevel();}
if (curLevel != mapLevel)
{
var factor = this._map._pixelsizeX / levels[mapLevel];this._map.zoom (factor);}
},
_mapExtentChanged : function(sender, evt)
{
this._setCurrentLevel();},
_setCurrentLevel : function ()
{
if (this._hasLevels)
{
var level = this._map.get_layers().getLevelByNearestPixelsize(this._map._pixelsizeX);if (this._isHorizontal)
{
this._setLevel(level);}
else
{
this._setLevel(this._maximum - level);}
this._setHandleOffset(this._getLevel());}
},
_getLevel : function ()
{
return this._level;},
_setLevel : function (value)
{
if (this._level != value)
{
if (value >= this._minimum && value <= this._maximum)
{
this._level = value;}
}
},
get_dragDataType : function() {
return 'HTML';},
getDragData : function() {
return this._handle;},
get_dragMode : function() {
return AjaxControlToolkit.DragMode.Move;},
onDragStart : function() {
this._resetDragHandle();},
onDrag : function() {
var dragHandleBounds = this._getBoundsInternal(this._dragHandle);var handleBounds = this._getHandleBounds();var sliderBounds = this._getRailBounds();var handlePosition;if (this._isHorizontal)
{
handlePosition = { x:dragHandleBounds.x - sliderBounds.x, y:0 };}
else
{
handlePosition = { y:dragHandleBounds.x - sliderBounds.x, x:0 };}
$common.setLocation(this._handle, handlePosition);this._calcValue(null);this._setHandleOffset(this._getLevel());},
onDragEnd : function() {
this._onHandleReleased();},
get_dropTargetElement : function() {
return document.body;},
canDrop : function(dragMode, dataType) {
return dataType == 'HTML';},
drop : Function.emptyMethod,
onDragEnterTarget : Function.emptyMethod,
onDragLeaveTarget : Function.emptyMethod,
onDragInTarget : Function.emptyMethod,
get_map : function ()
{
return this._map;},
set_map : function(value)
{
if (this._map != value)
{
this._map = value;this.raisePropertyChanged('map');}
},
get_imgTop : function ()
{
return this._imgTop;},
set_imgTop : function(value)
{
if (this._imgTop != value)
{
this._imgTop = value;this.raisePropertyChanged('imgTop');}
},
get_imgBottom : function ()
{
return this._imgBottom;},
set_imgBottom : function(value)
{
if (this._imgBottom != value)
{
this._imgBottom = value;this.raisePropertyChanged('imgBottom');}
},
get_imgSelected : function ()
{
return this._imgSelected;},
set_imgSelected : function(value)
{
if (this._imgSelected != value)
{
this._imgSelected = value;this.raisePropertyChanged('imgSelected');}
},
get_imgDefault : function ()
{
return this._imgDefault;},
set_imgDefault : function(value)
{
if (this._imgDefault != value)
{
this._imgDefault = value;this.raisePropertyChanged('imgDefault');}
},
get_imageHeight : function ()
{
return this._imgHeight;},
set_imageHeight : function(value)
{
if (this._imgHeight != value)
{
this._imgHeight = value;this.raisePropertyChanged('imageHeight');}
},
get_imageWidth : function ()
{
return this._imgWidth;},
set_imageWidth : function(value)
{
if (this._imgWidth != value)
{
this._imgWidth = value;this.raisePropertyChanged('imageWidth');}
},
get_orientation : function ()
{
return this._orientation;},
set_orientation : function(value)
{
if (this._orientation != value)
{
this._orientation = value;this.raisePropertyChanged('orientation');}
},
get_dynamicZoomInFactor : function ()
{
return this._dynamicZoomInFactor;},
set_dynamicZoomInFactor : function(value)
{
if (this._dynamicZoomInFactor != value)
{
this._dynamicZoomInFactor = value;this.raisePropertyChanged('dynamicZoomInFactor');}
},
get_dynamicZoomOutFactor : function ()
{
return this._dynamicZoomOutFactor;},
set_dynamicZoomOutFactor : function(value)
{
if (this._dynamicZoomOutFactor != value)
{
this._dynamicZoomOutFactor = value;this.raisePropertyChanged('dynamicZoomOutFactor');}
}
};ESRI.ADF.UI.ZoomLevel.DropPending = null;ESRI.ADF.UI.ZoomLevel.registerClass('ESRI.ADF.UI.ZoomLevel', Sys.UI.Control);ESRI.ADF.UI.Magnifier = function() {
ESRI.ADF.UI.Magnifier.initializeBase(this);this._blankImagePath = null;this._magTableWidth = 200;this._magTableHeight = 200;this._magFactorRowHeight = 18;this._floatingPanel = null;};ESRI.ADF.UI.Magnifier.prototype = {
initialize: function() {
ESRI.ADF.UI.Magnifier.callBaseMethod(this, 'initialize');var fpID = this._floatingPanel.get_element().id;this.set_id(fpID + '_Magnifier');Sys.Application.addComponent(this);this._floatingPanelBodyCell = $get(fpID + '_BodyCell');this._contentDiv = $get(fpID + '_ContentDiv');this._contentTable = $get(fpID + '_Content');this._contentsContainer = $get(fpID + '_Contents');this._factorRow = $get(fpID + '_FactorRow');this._magnifierAOI = $get(fpID + '_AOIBox');this._magnifierCrosshair = $get(fpID + '_Crosshair');this._mapImage = $get(fpID + '_MapImage');this._mapArea = $get(fpID + '_MapArea');this._extentChangingHandler = Function.createDelegate(this, this._mapExtentChanging);this._map.add_extentChanging(this._extentChangingHandler);this._hideMapHandler = Function.createDelegate(this, this._hideMapImage);this._getMapImageHandler = Function.createDelegate(this, this._getMapImage)
this._resizeMagnifierArea = Function.createDelegate(this, this._resizeMagnifierArea);this._setEventHandlers();},
dispose: function() {
this._removeEventHandlers();this._map.remove_extentChanging(this._extentChangingHandler);this._extentChangingHandler = null;ESRI.ADF.UI.Magnifier.callBaseMethod(this, 'dispose');},
_mapExtentChanging: function(map, args) {
this._hideMapImage();},
doCallback: function(argument, context) {
ESRI.ADF.System._doCallback(this._callbackFunctionString, this.get_uniqueID(), this._floatingPanel.get_element().id, argument, context);},
_setAOIBox: function() {
var floatingPanel = this._floatingPanel.get_element();var controlName = floatingPanel.id;var magSelect = $get(controlName + "_MagFactor");var tDisplay = floatingPanel.style.display;var index = magSelect.selectedIndex;var val = parseInt(magSelect.options[index].value, 10);var wDiv = this._contentDiv;var aoi = this._magnifierAOI;var magcross = this._magnifierCrosshair;var winWidth = wDiv.clientWidth;var winHeight = wDiv.clientHeight;if (tDisplay == "none") {
winHeight = this._magTableHeight;winWidth = this._magTableWidth;} else {
this._magTableHeight = winHeight;this._magTableWidth = winWidth;}
var aoiWidth = Math.ceil(winWidth / val);var aoiHeight = Math.ceil(winHeight / val);var magMidX = Math.ceil(winWidth / 2);var magMidY = Math.ceil(winHeight / 2);var crossWidth = parseInt(magcross.style.width, 10);var crossHeight = parseInt(magcross.style.height, 10);aoi.style.width = aoiWidth + "px";aoi.style.height = aoiHeight + "px";aoi.style.left = Math.floor(magMidX - (aoiWidth / 2)) + "px";aoi.style.top = Math.floor(magMidY - (aoiHeight / 2)) + "px";magcross.style.left = (Math.floor(magMidX - (crossWidth / 2)) + 2) + "px";magcross.style.top = (Math.floor(magMidY - (crossHeight / 2)) + 2) + "px";crossHeight = parseInt(this._magnifierCrosshair.style.height, 10) + 2;},
_toggleMagnifierMapImage: function(visibility) {
if (visibility === null) { visibility = "visible";}
if (this._mapImage !== null) {
this._mapImage.style.visibility = visibility;if (visibility === "hidden") { this._mapImage.src = this._blankImagePath;}
}
},
_hideMapImage: function() {
var imgObj = this._mapImage;if (imgObj !== null) {
imgObj.style.visibility = "hidden";imgObj.src = this._blankImagePath;}
if (this._magnifierAOI !== null) {
this._setAOIBox();this._magnifierAOI.style.visibility = "visible";}
if (this._magnifierCrosshair !== null) { this._magnifierCrosshair.style.visibility = "visible";}
},
_showMapImage: function() {
var imgObj = this._mapImage;if (imgObj !== null) { imgObj.style.visibility = "visible";}
if (this._magnifierAOI !== null) {
this._magnifierAOI.style.visibility = "hidden";this._setAOIBox();}
if (this._magnifierCrosshair !== null) { this._magnifierCrosshair.style.visibility = "hidden";}
},
_requestMagnifierMapImage: function() {
var m = this._map;var coords = "";if (m !== null) {
var box = Sys.UI.DomElement.getBounds(this._magnifierAOI);var mbox = Sys.UI.DomElement.getBounds(m.get_element());var wDiv = this._contentDiv;var winWidth = parseInt(wDiv.clientWidth, 10);var winHeight = parseInt(this._mapArea.clientHeight, 10);if (!winWidth || !winHeight) { return;}
if (box !== null) {
var left = box.x - mbox.x;var top = box.y - mbox.y;var right = left + box.width;var bottom = top + box.height;coords = left + "," + top + "," + right + "," + bottom;}
var argument = "ControlType=Magnifier&PageID=" + m.pageID + "&EventArg=NewExtent&width=" + winWidth + "&height=" + winHeight + "&coords=" + coords;this.doCallback(argument, this);}
},
_onMagFactorChange: function() {
this._setAOIBox();this._requestMagnifierMapImage();},
_getMapImage: function() {
this._hideMapImage();this._requestMagnifierMapImage();},
_resizeMagnifierArea: function(sender, args) {
var height = args.height;var width = args.width;height -= (this._factorRow.clientHeight + 2);var crossHeight = parseInt(this._magnifierCrosshair.style.height, 10) + 2;if (height < crossHeight) { height = crossHeight;}
this._contentDiv.parentNode.style.height = height + "px";this._mapArea.style.height = height + "px";this._setAOIBox();},
_setStartSize: function() {
var floatingPanel = this._floatingPanel.get_element();var tDisplay = floatingPanel.style.display;floatingPanel.style.display = '';var tableheight = this._contentTable.clientHeight;var rowheight = this._factorRow.clientHeight;if (tDisplay == "none") {
tableheight = this._magTableHeight;rowheight = this._magFactorRowHeight;} else {
this._magTableHeight = tableheight;this._magFactorRowHeight = rowheight;}
var height = tableheight - rowheight - 2;if (height < 0) { height = 0;}
this._contentDiv.parentNode.style.height = height + "px";this._mapArea.style.height = height + "px";this._setAOIBox();floatingPanel.style.display = tDisplay;},
_setEventHandlers: function() {
this._floatingPanel.add_dragStart(this._hideMapHandler);this._floatingPanel.add_dragEnd(this._getMapImageHandler);this._floatingPanel.add_resizeStart(this._hideMapHandler);this._floatingPanel.add_resizing(this._resizeMagnifierArea);this._floatingPanel.add_resized(this._getMapImageHandler);this._floatingPanel.add_hide(this._hideMapHandler);this._floatingPanel.add_show(this._getMapImageHandler);this._floatingPanel.add_expanded(Function.createDelegate(this, this._setStartSize));this._floatingPanel.add_expanded(this._getMapImageHandler);var magSelect = $get(this._floatingPanel.get_id() + "_MagFactor");$addHandlers(magSelect, { 'change': this._onMagFactorChange }, this);this._setStartSize();},
_removeEventHandlers: function() {
if (!this._floatingPanel) { return;}
this._floatingPanel.remove_dragStart(this._hideMapHandler);this._floatingPanel.remove_dragEnd(this._getMapImageHandler);this._floatingPanel.remove_resizeStart(this._hideMapHandler);this._floatingPanel.remove_resizing(this._resizeMagnifierArea);this._floatingPanel.remove_resized(this._getMapImageHandler);this._floatingPanel.remove_hide(this._hideMapHandler);this._floatingPanel.remove_show(this._getMapImageHandler);this._floatingPanel.remove_expanded(this._getMapImageHandler);var magSelect = $get(this._floatingPanel.get_id() + "_MagFactor");if (magSelect) { $removeHandler(magSelect, 'change', this._onMagFactorChange);}
},
processCallbackResult: function(action, params) {
if (action === 'mapimage') {
this._mapImage.src = params[1];if (params.length > 5) {
var magcoord0 = Math.round(params[2] * 1000) / 1000;var magcoord1 = Math.round(params[3] * 1000) / 1000;var magcoord2 = Math.round(params[4] * 1000) / 1000;var magcoord3 = Math.round(params[5] * 1000) / 1000;var extString = "Extent: " + magcoord0 + ", " + magcoord1 + ", " + magcoord2 + ", " + magcoord3;this._mapImage.alt = extString;this._mapImage.title = extString;}
this._showMapImage();return true;}
},
get_map: function() {
return this._map;},
set_map: function(value) {
if (this._map !== value) {
if (this._extentChangedHandler) { this._map.remove_extentChanged(this._extentChangedHandler);}
this._map = value;if (this._extentChangedHandler) { this._map.add_extentChanged(this._extentChangedHandler);}
}
},
get_uniqueID: function() {
return this._uniqueID;},
set_uniqueID: function(value) { this._uniqueID = value;},
get_callbackFunctionString: function() {
return this._callbackFunctionString;},
set_callbackFunctionString: function(value) {
this._callbackFunctionString = value;},
get_transparency: function() {
return this._transparency;},
set_transparency: function(value) { this._transparency = value;},
get_magnifyFactor: function() {
return this._magnifyFactor;},
set_magnifyFactor: function(value) { this._magnifyFactor = value;},
get_blankImagePath: function() {
return this._blankImagePath;},
set_blankImagePath: function(value) { this._blankImagePath = value;},
get_blankImagePath: function() {
return this._floatingPanel;},
set_floatingPanel: function(value) { this._floatingPanel = value;}
};ESRI.ADF.UI.Magnifier.registerClass('ESRI.ADF.UI.Magnifier', Sys.Component);if (typeof(Sys) !== "undefined") { Sys.Application.notifyScriptLoaded();}

//END ESRI.ArcGIS.ADF.Web.UI.WebControls.Runtime.JavaScript.ESRI.ADF.UI.Navigation.release.js
//START ESRI.ArcGIS.ADF.Web.UI.WebControls.Runtime.JavaScript.ESRI.ADF.UI.Toolbar.release.js
//----------------------------------------------------------
// Copyright (C) ESRI. All rights reserved.
//----------------------------------------------------------
Type.registerNamespace('ESRI.ADF.UI');var Toolbars = [];var ToolbarGroups = [];var ToolbarName = [];ESRI.ADF.UI.Toolbar = function(element) { 
ESRI.ADF.UI.Toolbar.initializeBase(this, [element]);this._map = null;this._buddies = null;this._enabled = false;this._toolbarExtentChangedHandler = Function.createDelegate(this,this._toolbarExtentChanged);}
ESRI.ADF.UI.Toolbar.prototype = {
dispose : function() {
$clearHandlers(this._element);this._clearBuddyHandlers();ESRI.ADF.UI.Toolbar.callBaseMethod(this, 'dispose');},
_setupBuddyHandlers : function() { 
if (this._buddies != null) {
for (var i=0;i < this._buddies.length;i++) {
var component = $find(this._buddies[i]);if (component != null && ESRI.ADF.UI.MapBase.isInstanceOfType(component)) {
component.add_extentChanged(this._toolbarExtentChangedHandler);}
}
this._enabled = true;}
},
_clearBuddyHandlers : function() {
if (this._enabled && this._buddies != null) {
for (var i=0;i < this._buddies.length;i++)
{
var map = $find(this._buddies[i]);if (map != null && ESRI.ADF.UI.MapBase.isInstanceOfType(map)) {
map.remove_extentChanged(this._toolbarExtentChangedHandler);}
}
this._enabled = false;}
},
_toolbarExtentChanged : function(sender, eventArgs) {
var map = sender;var toolbar = Toolbars[this.get_element().id];if (toolbar == null) return;var backButton = toolbar.items[toolbar.btnMapBack];if (backButton) { backButton.disabled = false;}
var forwardButton = toolbar.items[toolbar.btnMapForward];if (forwardButton) { forwardButton.disabled = true;}
toolbar.refreshCommands();},
toolbarMapHistory : function(toolbarID, mapIDs, toolbarItemName, step) {
var toolbar = Toolbars[toolbarID];if (toolbar == null) return;var moreHistory = false;var toolbarBuddies = mapIDs.split(",");for (var i = 0;i < toolbarBuddies.length;i++) {
var map = $find(toolbarBuddies[i]);if (map) { moreHistory = map.stepExtentHistory(step);}
if (step < 0)
{ 
var backButton = toolbar.items[toolbarItemName];var forwardButton = toolbar.items[backButton.buddyItem];if (forwardButton) { forwardButton.disabled = false;}
if (!moreHistory) { backButton.disabled = true;}
}
else
{ 
var forwardButton = toolbar.items[toolbarItemName];var backButton = toolbar.items[forwardButton.buddyItem];if (backButton) { backButton.disabled = false;}
if (!moreHistory) { forwardButton.disabled = true;}
else { forwardButton.disabled = false;}
}
}
toolbar.refreshCommands();},
doCallback : function(argument, context) {
ESRI.ADF.System._doCallback(this._callbackFunctionString, this.get_uniqueID(), this.get_element().id, argument, context);},
processCallbackResult : function(action, params)
{
},
get_callbackFunctionString : function ()
{ 
return this._callbackFunctionString;},
set_callbackFunctionString : function(value)
{
if (this._callbackFunctionString != value) {
this._callbackFunctionString = value;this.raisePropertyChanged('callbackFunctionString');}
},
get_uniqueID : function ()
{ 
return this._uniqueID;},
set_uniqueID : function(value)
{
if (this._uniqueID != value) {
this._uniqueID = value;this.raisePropertyChanged('uniqueID');}
}, 
get_buddies : function ()
{ 
return this._buddies;},
set_buddies : function(value)
{
if (this._buddies != value) {
this._buddies = value;this._setupBuddyHandlers();this.raisePropertyChanged('buddies');}
},
get_map : function () {
},
set_map : function(value)
{
this._setupBuddyHandlers();},
add_onToolSelected : function(handler)
{
this.get_events().addHandler('onToolSelected', handler);},
remove_onToolSelected : function(handler)
{
this.get_events().removeHandler('onToolSelected', handler);}
}
ESRI.ADF.UI.Toolbar.registerClass('ESRI.ADF.UI.Toolbar', Sys.UI.Control);var esriClientActionFunction = null;/////////////////////////////////// Object Creation Functions /////////////////////////////////////
function ToolbarGroupObject(name, toolbars)
{
this.name = name;this.toolbars = toolbars.split(",");;}
function ToolbarItemObject(name, defaultImage, selectedImage, hoverImage, disabledImage, 
clientAction, isClientActionCustom, showLoading, disabled, buddyItem, selectAutoPostBack, cursor)
{
this.name = name;this.defaultImage = defaultImage;this.selectedImage = selectedImage;this.hoverImage = hoverImage;this.disabledImage = disabledImage;this.clientAction = clientAction;this.isClientActionCustom = isClientActionCustom;this.showLoading = showLoading;this.disabled = disabled;this.buddyItem = buddyItem;this.selectAutoPostBack = selectAutoPostBack;this.cursor = cursor;this.preExecFunction = null;}
function ToolbarObject(name, toolbarStyle, defaultStyle, selectedStyle, hoverStyle, disabledStyle, tools, commands, buddyControls, itemArray, group, currentToolField, callbackFunctionString)
{
this.name = name;this.toolbarStyle = toolbarStyle;this.defaultStyle = defaultStyle;this.selectedStyle = selectedStyle;this.hoverStyle = hoverStyle;this.disabledStyle = disabledStyle;this.tools = tools.split(",");this.commands = commands.split(",");if (buddyControls != "")
this.buddyControls = buddyControls.split(",");else
this.buddyControls = null;this.items = itemArray;this.group = group;this.currentToolField = currentToolField;this.enableClientPostBack = false;this.pageID = "";this.buttonsSupportingClientPostBack = "";this.document = document;this.btnMapBack = "";this.btnMapForward = "";if (callbackFunctionString!=null) 
this.callBackFunctionString = callbackFunctionString;else
this.callBackFunctionString = null;for (var i = 0;i < this.tools.length;i++)
{
var toolbarItemName = this.tools[i];if (toolbarItemName == "")
continue;var imageTag = this.name + toolbarItemName + "Image";var img = document.images[imageTag];if (img != null)
ESRI.ADF.System.setIEPngTransparency(img,img.src,true);}
for (var i = 0;i < this.commands.length;i++)
{
var toolbarItemName = this.commands[i];if (toolbarItemName == "")
continue;var imageTag = this.name + toolbarItemName + "Image";var img = document.images[imageTag];if (img != null)
ESRI.ADF.System.setIEPngTransparency(img,img.src,true);}
this.selectTool = function()
{
var f = document.forms[docFormID];var mode = f.elements[this.currentToolField].value;var selectedStyle = this.selectedStyle;var disabledStyle = this.disabledStyle;var style = this.defaultStyle;var tools = this.tools;var toolbarItemName,imageTag,cell;if (tools == null)
return;for (var i = 0;i < tools.length;i++)
{
toolbarItemName = tools[i];if (toolbarItemName == "")
continue;imageTag = this.name + toolbarItemName + "Image";cell = this.name + toolbarItemName;var toolbarItem = this.items[toolbarItemName];var cellElement = document.getElementById(cell);if ( cellElement == null || cellElement.style.display == "none")
continue;if (mode == toolbarItemName) 
{ 
cellElement.style.cssText = selectedStyle;if (this.toolbarStyle != "TextOnly")
{
var img = document.images[imageTag];switchImageSourceAndAlphaBlend(img,toolbarItem.selectedImage);}
}
else if (toolbarItem.disabled)
{
cellElement.style.cssText = disabledStyle;if (this.toolbarStyle != "TextOnly")
{
var img = document.images[imageTag];switchImageSourceAndAlphaBlend(img,toolbarItem.disabledImage);}
}
else
{
cellElement.style.cssText = style;if (this.toolbarStyle != "TextOnly")
{
var img = document.images[imageTag];switchImageSourceAndAlphaBlend(img,toolbarItem.defaultImage);}
}
}
}
this.refreshGroup = function()
{
var group = this.group;if (group == null || group == "")
return;var toolbarGroup = ToolbarGroups[group];if (toolbarGroup == null)
return;var toolbars = toolbarGroup.toolbars;if (toolbars == null)
return;for (var x = 0;x < toolbars.length;++x)
{
if (toolbars[x] != this.name)
{
Toolbars[toolbars[x]].selectTool();}
}
}
this.refreshCommands = function()
{
var f = document.forms[docFormID];var style = this.defaultStyle;var disabledStyle = this.disabledStyle;var commands = this.commands;var toolbarItemName,imageTag,cell;for (var i = 0;i < commands.length;i++)
{
toolbarItemName = commands[i];imageTag = this.name + toolbarItemName + "Image";cell = this.name + toolbarItemName;var toolbarItem = this.items[toolbarItemName];if (!toolbarItem)
continue;var cellElement = document.getElementById(cell);if ( cellElement == null || cellElement.style.display == "none")
continue;if (toolbarItem.disabled)
{
cellElement.style.cssText = disabledStyle;if (this.toolbarStyle != "TextOnly")
{
var img = document.images[imageTag];switchImageSourceAndAlphaBlend(img,toolbarItem.disabledImage);}
}
else
{
cellElement.style.cssText = style;if (this.toolbarStyle != "TextOnly")
{
var img = document.images[imageTag];switchImageSourceAndAlphaBlend(img,toolbarItem.defaultImage);}
}
}
}
}
/////////////////////////////////// Object Creation Functions /////////////////////////////////////
/////////////////////////////////// Mouse Action Functions /////////////////////////////////////
function ToolbarMouseDown(toolbarName, toolbarItemName, buttonType, e)
{
if (buttonType != "DropDownBox" && !isLeftButton(e))
return;var f = document.forms[docFormID];var imageTag = toolbarName + toolbarItemName + "Image";var cell = toolbarName + toolbarItemName;var toolbar = Toolbars[toolbarName];var toolbarComp = $find(toolbarName);if (toolbar === null || toolbarComp===null) return;if (toolbar.items[toolbarItemName].disabled) { return;}
if (buttonType == "Tool") {
f.elements[toolbar.currentToolField].value = toolbarItemName;var clientAction = toolbar.items[toolbarItemName].clientAction;if (clientAction != null) {
var clientActions = "";if (!toolbar.items[toolbarItemName].isClientActionCustom) {
var buddies = toolbar.buddyControls;if (buddies != null) {
for (var i = 0;i < buddies.length;i++)
{
var modeField = f.elements[buddies[i] + "_mode"];if (modeField != null)
modeField.value = toolbarItemName;var cursor = toolbar.items[toolbarItemName].cursor;if (cursor != null)
clientActions = clientActions + clientAction + " ( '" + buddies[i] + "' , '" + toolbarItemName + "', " + toolbar.items[toolbarItemName].showLoading + ",'" + cursor + "'); ";else
clientActions = clientActions + clientAction + " ( '" + buddies[i] + "' , '" + toolbarItemName + "', " + toolbar.items[toolbarItemName].showLoading + "); ";}
}
}
else
{
clientActions = clientAction;}
var tbObject = $find(toolbarName);if (tbObject!=null) {
var handler = tbObject.get_events().getHandler('onToolSelected');if(handler) 
handler(tbObject,{"name": toolbarItemName, "tool": toolbar.items[toolbarItemName]});}
if (toolbar.items[toolbarItemName].preExecFunction != null)
clientActions += toolbar.items[toolbarItemName].preExecFunction;var clientActionFunction = new Function(clientActions);clientActionFunction.call(null);Toolbars[toolbarName].selectTool();Toolbars[toolbarName].refreshGroup();}
}
else if (buttonType == "Command")
{
if (toolbar.items[toolbarItemName].preExecFunction != null)
eval(toolbar.items[toolbarItemName].preExecFunction);document.body.style.cursor = "wait";Toolbars[toolbarName].refreshCommands();Toolbars[toolbarName].selectTool();var toolbarComp = $find(toolbarName);var cellElement = document.getElementById(cell);cellElement.style.cssText = toolbar.selectedStyle;if (toolbar.toolbarStyle != "TextOnly")
{
var img = document.images[imageTag];switchImageSourceAndAlphaBlend(img,toolbar.items[toolbarItemName].selectedImage);}
cellElement.focus();var clientAction = toolbar.items[toolbarItemName].clientAction;if (clientAction != null && clientAction.length>0) {
esriClientActionFunction = clientAction;window.setTimeout("eval(esriClientActionFunction);", 0);}
else {
var arg = 'eventArg='+toolbarItemName+'&ControlID='+toolbarName+'&ControlType=Toolbar&PageID='+toolbar.pageID;toolbarComp.doCallback(arg,toolbarComp);}
document.body.style.cursor = "default";}
else if (buttonType == "DropDownBox")
{
var selectDropDown = toolbarName + toolbarItemName + "DropDownBox";var selectValueField = toolbarName + toolbarItemName + "Value";var arg = 'eventArg='+toolbarItemName+'&ControlID='+toolbarName+'&ControlType=Toolbar&PageID='+toolbar.pageID+'&'+selectValueField+'='+f.elements[selectDropDown].value;toolbarComp.doCallback(arg,toolbarComp);}
}
function ToolbarMouseOver(toolbarName, toolbarItemName)
{
var imageTag = toolbarName + toolbarItemName + "Image";var cell = toolbarName + toolbarItemName;var toolbar = Toolbars[toolbarName];if (toolbar == null) return;var f = document.forms[docFormID];var cellElement = document.getElementById(cell);if (toolbar.items[toolbarItemName].disabled)
cellElement.style.cssText = toolbar.disabledStyle;else
cellElement.style.cssText = toolbar.hoverStyle;if (toolbar.toolbarStyle != "TextOnly")
{
var img = document.images[imageTag];if (toolbar.items[toolbarItemName].disabled)
switchImageSourceAndAlphaBlend(img,toolbar.items[toolbarItemName].disabledImage);else
switchImageSourceAndAlphaBlend(img,toolbar.items[toolbarItemName].hoverImage);}
}
function ToolbarMouseOut(toolbarName, toolbarItemName) 
{
var toolbar = Toolbars[toolbarName];if (toolbar == null) return;var control = toolbar.tools[0];var f = document.forms[docFormID];var mode = f.elements[toolbar.currentToolField].value;var imageTag = toolbarName + toolbarItemName + "Image";var cell = toolbarName + toolbarItemName;var style, image;if (mode == toolbarItemName) 
{
style = toolbar.selectedStyle;image = toolbar.items[toolbarItemName].selectedImage;}
else
{
style = toolbar.defaultStyle;image = toolbar.items[toolbarItemName].defaultImage;}
if (toolbar.items[toolbarItemName].disabled)
{
style = toolbar.disabledStyle;image = toolbar.items[toolbarItemName].disabledImage;}
var cellElement = document.getElementById(cell);cellElement.style.cssText = style;if (toolbar.toolbarStyle != "TextOnly")
{
var img = document.images[imageTag];switchImageSourceAndAlphaBlend(img,image);}
}
if (typeof(Sys) !== 'undefined') Sys.Application.notifyScriptLoaded();
//END ESRI.ArcGIS.ADF.Web.UI.WebControls.Runtime.JavaScript.ESRI.ADF.UI.Toolbar.release.js
//START ESRI.ArcGIS.ADF.Web.UI.WebControls.Runtime.JavaScript.ESRI.ADF.UI.TreeViewPlus.release.js
//----------------------------------------------------------
// Copyright (C) ESRI. All rights reserved.
//----------------------------------------------------------
Type.registerNamespace('ESRI.ADF.UI');ESRI.ADF.UI.TreeViewPlus = function(element) { 
this._expandedImage = null;this._collapsedImage = null;this._callbackFunctionString = null;this._contentDivId = null;this._showClearAllOption = false;this._clearAllId = null;ESRI.ADF.UI.TreeViewPlus.initializeBase(this, [element]);};ESRI.ADF.UI.TreeViewPlus.prototype = {
initialize : function() {
ESRI.ADF.UI.TreeViewPlus.callBaseMethod(this, 'initialize');}, 
dispose : function() {
ESRI.ADF.UI.TreeViewPlus.callBaseMethod(this, 'dispose');},
get_expandedImage : function() {
return this._expandedImage;},
set_expandedImage : function(value) {
this._expandedImage = value;},
get_collapsedImage : function() {
return this._collapsedImage;},
set_collapsedImage : function(value) {
this._collapsedImage = value;},
get_contentDivId : function() {
return this._contentsDivId;},
set_contentDivId : function(value) {
this._contentsDivId = value;},
get_showClearAllOption : function() {
return this._showClearAllOption;},
set_showClearAllOption : function(value) {
if (this._showClearAllOption !== value){
this._showClearAllOption = value;this.updateClearAllControlVisibility();}
},
get_clearAllId : function() {
return this._clearAllId;},
set_clearAllId : function(value) {
this._clearAllId = value;},
get_uniqueID : function() {
return this._uniqueID;},
set_uniqueID : function(value) {
this._uniqueID = value;},
get_callbackFunctionString : function() {
return this._callbackFunctionString;},
set_callbackFunctionString : function(value) {
this._callbackFunctionString = value;}, 
processCallbackResult : function(action, params) {
return false;},
isNodeExpanded: function (nodeID) {
var childrenContainer=document.getElementById(nodeID+'_childrenContainer');return (childrenContainer && childrenContainer.style.display=='none') ? false : true;},
updateClearAllControlVisibility: function() {
var clearAll = $get(this._clearAllId);if (clearAll) {
if (this._showClearAllOption) {
var nodeContainer = document.getElementById(this._contentsDivId);if (nodeContainer && nodeContainer.childNodes && nodeContainer.childNodes.length > 1) {
clearAll.style.display = "";}
else {
clearAll.style.display = "none";}
}
else {
clearAll.style.display = "none";}
}
},
_toggleNodeState : function (nodeID, fireClickedEvent) {
var childrenContainer=document.getElementById(nodeID+'_childrenContainer');var argument='nodeID=' + nodeID + '&';var button=document.getElementById(nodeID + '_StateButton');if (childrenContainer===null || button===null) {
return;}
if (fireClickedEvent===null){
fireClickedEvent=false;}
var expanded = null;if (childrenContainer.style.display=='none'){ 
expanded = true;argument+='EventArg=expanded&Value=true';if (fireClickedEvent) {argument+='&Action=clicked';}
childrenContainer.style.display='';button.src=this._expandedImage;}
else { 
expanded = false;argument+='EventArg=expanded&Value=false';if (fireClickedEvent) {argument+='&Action=clicked';}
childrenContainer.style.display='none';button.src=this._collapsedImage;}
this._raiseEvent('nodeToggled', {"nodeID": nodeID, "expanded":expanded});var context = null;eval(this._callbackFunctionString);},
_nodeChecked : function (nodeID)
{
var argument='nodeID=' + nodeID + '&';var checkBox=document.getElementById(nodeID + '_CheckBox');if (checkBox===null) {return;}
if (checkBox.checked===false)
{
argument+='EventArg=checked&Value=false';checkBox.value=false;}
else
{
argument+='EventArg=checked&Value=true';checkBox.value=true;}
this._raiseEvent('nodeChecked', {"nodeID": nodeID, "checked":checkBox.checked});var context = null;eval(this._callbackFunctionString);},
_nodeClicked : function (nodeID)
{
var argument='nodeID=' + nodeID + '&EventArg=nodeClicked';var context = null;this._raiseEvent('nodeClicked', nodeID);eval(this._callbackFunctionString);},
_clearNode : function (nodeID)
{
var argument='nodeID=' + nodeID + '&EventArg=clearNode';var context = null;eval(this._callbackFunctionString);},
_nextPage : function (nodeID)
{
var argument='nodeID=' + nodeID + '&EventArg=nextPage';var context = null;eval(this._callbackFunctionString);},
_previousPage : function (nodeID)
{
var argument='nodeID=' + nodeID + '&EventArg=previousPage';var context = null;eval(this._callbackFunctionString);},
clearAllNodes : function ()
{
var argument='EventArg=clearAllNodes';var context = null;eval(this._callbackFunctionString);},
_nodeLegendClicked : function (nodeID)
{
var argument='nodeID=' + nodeID + '&EventArg=nodeLegendClicked';var context = null;eval(this._callbackFunctionString);},
_unselectNode : function (nodeID, backColor, hoverColor)
{
var node=document.getElementById(nodeID);if (node===null) {return;}
node.style.backgroundColor=backColor;node.onmouseover=function(){this.style.backgroundColor=hoverColor;};node.onmouseout=function(){this.style.backgroundColor=backColor;};},
_raiseEvent : function(name,e) {
var handler = this.get_events().getHandler(name);if (handler) { if(!e) { e = Sys.EventArgs.Empty;} handler(this, e);}
}, 
add_nodeClicked : function(handler) {
this.get_events().addHandler('nodeClicked', handler);}, 
remove_nodeClicked : function(handler) {
this.get_events().removeHandler('nodeClicked', handler);}, 
add_nodeChecked : function(handler) {
this.get_events().addHandler('nodeChecked', handler);},
remove_nodeChecked : function(handler) {
this.get_events().removeHandler('nodeChecked', handler);},
add_nodeToggled : function(handler) {
this.get_events().addHandler('nodeToggled', handler);},
remove_nodeToggled : function(handler) {
this.get_events().removeHandler('nodeToggled', handler);}
};ESRI.ADF.UI.TreeViewPlus.registerClass('ESRI.ADF.UI.TreeViewPlus', Sys.UI.Control);if (typeof(Sys) !== 'undefined') { Sys.Application.notifyScriptLoaded();}

//END ESRI.ArcGIS.ADF.Web.UI.WebControls.Runtime.JavaScript.ESRI.ADF.UI.TreeViewPlus.release.js
//START ESRI.ArcGIS.ADF.Web.UI.WebControls.Runtime.JavaScript.ESRI.ADF.UI.TaskResults.release.js
//----------------------------------------------------------
// Copyright (C) ESRI. All rights reserved.
//----------------------------------------------------------
var esriTaskResultsCancelledJobs = {};function esriTaskResultsCancelJob(jobID, nodeID, treeViewPlusID)
{
esriTaskResultsCancelledJobs[jobID]="cancelled";var node=document.getElementById(nodeID);if (node!==null)
{
node.parentNode.removeChild(node);var tvp = $find(treeViewPlusID);if (tvp){
tvp.updateClearAllControlVisibility();}
window.setTimeout("$find('" + treeViewPlusID + "')._clearNode('" + nodeID + "');",0);}
}
Type.registerNamespace('ESRI.ADF.UI');ESRI.ADF.UI.TaskResults = function(element) { 
this._hoverColor = "";this._map = null;ESRI.ADF.UI.TaskResults.initializeBase(this, [element]);};ESRI.ADF.UI.TaskResults.prototype = {
initialize : function() {
ESRI.ADF.UI.TaskResults.callBaseMethod(this, 'initialize');}, 
dispose : function() {
ESRI.ADF.UI.TaskResults.callBaseMethod(this, 'dispose');},
get_map : function() {
return this._map;},
set_map : function(value) {
this._map = value;},
get_hoverColor : function() {
return this._hoverColor;},
set_hoverColor : function(value) {
this._hoverColor = value;},
processCallbackResult : function(action, params) {
if (action == "insertTaskResultNode") {
this._insert(params[0], params[1], params[2], params[3]);return true;}
else if (action == "removeTaskResultNode") {
this._remove(params[0]);return true;}
else if (action == "replaceTaskResultNode") {
this._replace(params[0], params[1], params[2], params[3]);return true;}
else if (action == "refresh") {
this._refresh();return true;}
return ESRI.ADF.UI.TaskResults.callBaseMethod(this, 'processCallbackResult', [action, params]);},
_insert : function(nodeContent, index, taskJobId, nodeID) { 
if (taskJobId && esriTaskResultsCancelledJobs[taskJobId]) {
window.setTimeout("$find('" + this.get_id() + "')._clearNode('" + nodeID + "');",0);this._cancelled = true;}
else {
var taskContainer = document.getElementById(this.get_contentDivId());nodeContent = ESRI.ADF.System.templateBinder(null, nodeContent);var oldNode = $get(nodeID);if (oldNode) {
oldNode.innerHTML = nodeContent;}
else { 
var temp = document.createElement('div');temp.innerHTML = nodeContent;if (index !== null && index >= taskContainer.childNodes.length){
taskContainer.appendChild(temp.firstChild);}
else {
var sibling = taskContainer.childNodes[index];taskContainer.insertBefore(temp.firstChild, sibling);}
}
this.updateClearAllControlVisibility();var handler = this.get_events().getHandler('taskResultNodeInserted');if(handler){
handler(this,Sys.EventArgs.Empty);}
}
},
_remove : function(nodeId) {
var taskContainer = document.getElementById(this.get_contentDivId());var node = $get(nodeId);if (node) {
node.parentNode.removeChild(node);this.updateClearAllControlVisibility();var handler = this.get_events().getHandler('taskResultNodeRemoved');if(handler) {
handler(this,Sys.EventArgs.Empty);}
}
},
_replace : function(nodeContent, taskJobId, nodeID, newNodeID) { 
if (taskJobId && esriTaskResultsCancelledJobs[taskJobId]) {
window.setTimeout("$find('" + this.get_id() + "').clearNode('" + nodeID + "');",0);this._cancelled = true;}
else { 
var oldNode = $get(nodeID);if (oldNode) {
oldNode.innerHTML = nodeContent;oldNode.ID = newNodeID;}
}
},
_refresh : function() {
var taskContainer = document.getElementById(this.get_contentDivId());for(var i=0;i<taskContainer.childNodes.length;++i){
var node = taskContainer.childNodes[i];node.innerHTML = ESRI.ADF.System.templateBinder(null, node.innerHTML);}
},
_rerunTask : function(taskJobId) {
window.setTimeout("$find('" + this.get_id() + "')._rerunTask2('" + taskJobId + "');",0);}, 
_rerunTask2 : function(taskJobId) {
var argument='taskJobId=' + taskJobId+ '&EventArg=rerunTask';var context = null;eval(this._callbackFunctionString);},
_getNode : function(graphicId) {
var taskContainer = document.getElementById(this.get_contentDivId());if (taskContainer) {
var nodes = taskContainer.getElementsByTagName('DIV');for (var i = 0;i < nodes.length;++i) {
if (nodes[i].getAttribute("graphicId") == graphicId){
return nodes[i];}
}
return null;}
}, 
add_taskResultNodeInserted : function(handler) {
this.get_events().addHandler('taskResultNodeInserted', handler);},
remove_taskResultNodeInserted : function(handler) {
this.get_events().removeHandler('taskResultNodeInserted', handler);},
add_taskResultNodeRemoved : function(handler) {
this.get_events().addHandler('taskResultNodeRemoved', handler);},
remove_taskResultNodeRemoved : function(handler) {
this.get_events().removeHandler('taskResultNodeRemoved', handler);},
add_mouseOverNode : function(handler) {
this.get_events().addHandler('mouseOverNode', handler);},
remove_mouseOverNode : function(handler) {
this.get_events().removeHandler('mouseOverNode', handler);},
add_mouseOutNode : function(handler) {
this.get_events().addHandler('mouseOutNode', handler);},
remove_mouseOutNode : function(handler) {
this.get_events().removeHandler('mouseOutNode', handler);},
_mouseOverNode : function(element)
{ 
var handler = this.get_events().getHandler('mouseOverNode');if(handler) {
var graphicId = element.getAttribute('graphicId');handler(this, {"element":element, "graphicId":graphicId});}
},
_mouseOutNode : function(element)
{
var handler = this.get_events().getHandler('mouseOutNode');if(handler) {
var graphicId = element.getAttribute('graphicId');handler(this, {"element":element, "graphicId":graphicId});}
}
};ESRI.ADF.UI.TaskResults.registerClass('ESRI.ADF.UI.TaskResults', ESRI.ADF.UI.TreeViewPlus);ESRI.ADF.HighlightTaskResults = function() {
ESRI.ADF.HighlightTaskResults.initializeBase(this);this._taskResults = null;this._hoverColor = "";this._maptipNode = null;this._expandOnMaptipShown = false;}
ESRI.ADF.HighlightTaskResults.prototype = {
initialize : function() {
ESRI.ADF.HighlightTaskResults.callBaseMethod(this, 'initialize');if (this._taskResults != null) 
{
this._onMouseOverNodeHandler = Function.createDelegate(this, this._onMouseOverNode);this._taskResults.add_mouseOverNode(this._onMouseOverNodeHandler);this._onMouseOutNodeHandler = Function.createDelegate(this, this._onMouseOutNode);this._taskResults.add_mouseOutNode(this._onMouseOutNodeHandler);var map = this._taskResults.get_map();if (map) {
this._onMaptipShown = Function.createDelegate(this, this._onMaptipShown);map.__add_mapTipEvent(this._onMaptipShown);} 
}
},
get_hoverColor : function()
{
return this._hoverColor;},
set_hoverColor : function(value)
{
if (this._hoverColor != value) {
this._hoverColor = value;this.raisePropertyChanged('hoverColor');}
},
get_expandOnMaptipShown : function()
{
return this._expandOnMaptipShown;},
set_expandOnMaptipShown : function(value)
{
if (this._expandOnMaptipShown != value) {
this._expandOnMaptipShown = value;this.raisePropertyChanged('expandOnMaptipShown');}
},
get_taskResults : function()
{
return this._taskResults;},
set_taskResults : function(value)
{
this._taskResults = value;},
dispose : function() {
if (this._taskResults != null) {
this._taskResults.remove_mouseOverNode(this._onMouseOverNode);this._taskResults.remove_mouseOutNode(this._onMouseOverNode);}
if (this._onMaptipShown) {
var map = this._taskResults.get_map();if (map) {
map.__remove_mapTipEvent(this._onMaptipShown);}
}
ESRI.ADF.HighlightTaskResults.callBaseMethod(this, 'dispose');},
_onMouseOverNode : function(sender, args)
{
args.element.style.backgroundColor = this._hoverColor;this._highlightFeature(args.graphicId, true);},
_onMouseOutNode : function(sender, args)
{
args.element.style.backgroundColor = "";this._highlightFeature(args.graphicId, false);},
_onMaptipShown : function(sender, args)
{
if (args.action == "show") {
var maptip = args.maptip;if (maptip && maptip.get_isExpanded())
this._highlightElementNode(args.element);}
else if (args.action == "expand")
this._highlightElementNode(args.element);else if (args.action == "hide" && this._maptipNode) {
this._maptipNode.style.backgroundColor = "";this._maptipNode = null;}
},
_highlightElementNode : function(element) {
if (this._maptipNode) {
this._maptipNode.style.backgroundColor = "";this._maptipNode = null;}
if (element) {
var map = this._taskResults.get_map();var node = this._taskResults._getNode(element.get_id());if (node) {
node.style.backgroundColor = this._hoverColor;this._maptipNode= node;if (this._expandOnMaptipShown && !this._taskResults.isNodeExpanded(node.id))
this._taskResults._toggleNodeState(node.id);}
}
},
_highlightFeature : function(graphicId, highlight)
{
var graphic = $find(graphicId);if (graphic)
graphic.set_highlight(highlight);}
}
ESRI.ADF.HighlightTaskResults.registerClass('ESRI.ADF.HighlightTaskResults', Sys.Component);if (typeof(Sys) !== 'undefined') { Sys.Application.notifyScriptLoaded();}

//END ESRI.ArcGIS.ADF.Web.UI.WebControls.Runtime.JavaScript.ESRI.ADF.UI.TaskResults.release.js
//START ESRI.ArcGIS.ADF.Web.UI.WebControls.Runtime.JavaScript.display_contextmenu.js
//  COPYRIGHT � 2006 ESRI
//
//  TRADE SECRETS: ESRI PROPRIETARY AND CONFIDENTIAL
//  Unpublished material - all rights reserved under the
//  Copyright Laws of the United States and applicable international
//  laws, treaties, and conventions.
// 
//  For additional information, contact:
//  Environmental Systems Research Institute, Inc.
//  Attn: Contracts and Legal Services Department
//  380 New York Street
//  Redlands, California, 92373
//  USA
// 
//  email: contracts@esri.com

var esriContextMenus={};
var esriContextMenu=null;

function esriContextMenuObject(menuID, callbackFunctionString, htmlContent)
{
    this.id=menuID;
    this.callbackFunctionString=callbackFunctionString;
    this.htmlContent=htmlContent;
    this.controlShowed=null;
    this.contextShowed=null;
    this.tmpDocumentOnMouseDown=null;
    
    if (isIE)
    {
        if (window.addEventListener) window.addEventListener("load",esriRenderContextMenus,false);
        else if (window.attachEvent) window.attachEvent("onload",esriRenderContextMenus);
    }
    else
    {
        esriRenderContextMenu(menuID, htmlContent);
    }
}

function esriRenderContextMenus() {
    var cmName=null;
	for (cmName in esriContextMenus) {
		if (cmName!=null) {
            var cm = esriContextMenus[cmName];
			if (cm!=null && esriContextMenuObject.isInstanceOfType(cm)) {
                esriRenderContextMenu(cm.id,cm.htmlContent);
            }
        }
    }
}

function esriRenderContextMenu(id, htmlContent)
{
    if (document.getElementById(id)==null)
    {
        var menuDiv=document.createElement('div');
        menuDiv.id=id;
        document.body.appendChild(menuDiv);
        menuDiv.outerHTML=htmlContent;
        menuDiv.style.display="none";
    }
}

function esriShowContextMenu(e, menuID, controlShowed, contextShowed)
{
    if (esriContextMenu!=null)esriHideContextMenu();
    var menu=document.getElementById(menuID);
    if (menu==null)return;
    
    esriContextMenu=esriContextMenus[menuID];
    esriContextMenu.controlShowed=controlShowed;
    esriContextMenu.contextShowed=contextShowed;
    var pos = ESRI.ADF.System.__getAbsoluteMousePosition(e);
    menu.style.left=pos.mouseX + "px";
    menu.style.top=pos.mouseY + "px";
    
    if (isNav)
    {
        menu.style.width='';
    }
    
    changeOpacityObject(0,menu);
    menu.style.display="";
    fadeOpacity(menuID,0,100,500);
    
    esriContextMenu.tmpDocumentOnMouseDown=document.onmousedown;
    window.setTimeout("document.onmousedown=esriHideContextMenu;",0);
    return false;
}

function esriHideContextMenu(doCallback)
{
    if (esriContextMenu==null)return;
    var menuDiv=document.getElementById(esriContextMenu.id);
    if (menuDiv!=null)
    {
        menuDiv.style.display='none';
        changeOpacityObject(0,menuDiv);
    }
    
    if (doCallback==true || doCallback==null)
    {
        var argument="EventArg=contextMenuDismissed&control=" + esriContextMenu.controlShowed + "&context=" + esriContextMenu.contextShowed;
        var context=null;
        eval(esriContextMenu.callbackFunctionString);
    }
    
    document.onmousedown=esriContextMenu.tmpDocumentOnMouseDown;
    esriContextMenu=null;
}

function esriContextMenuItemClicked(itemID)
{
    if (esriContextMenu==null)return;
    
    var argument="EventArg=contextMenuItemClicked&control=" + esriContextMenu.controlShowed + "&context=" + esriContextMenu.contextShowed + "&itemID=" + itemID;
    var context=null;
    eval(esriContextMenu.callbackFunctionString);
    
    esriContextMenu.controlShowed=null;
    esriContextMenu.contextShowed=null;
    
    esriHideContextMenu(false);
}

function fadeOpacity(id, opacStart, opacEnd, millisec) { 
    //speed for each frame 
    var speed = Math.round(millisec / 100); 
    var timer = 0; 

    //determine the direction for the blending, if start and end are the same nothing happens 
    if(opacStart > opacEnd) { 
		for(var i = opacStart; i >= opacEnd; i--) {
            setTimeout("changeOpacity(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } else if(opacStart < opacEnd) { 
		for(var i = opacStart; i <= opacEnd; i++)
            { 
            setTimeout("changeOpacity(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } 
} 

//change the opacity for different browsers 
function changeOpacity(opacity, id)
{ 
    changeOpacityObject(opacity, document.getElementById(id));
}
 
function changeOpacityObject(opacity, object)
{
    object.style.opacity = (opacity / 100); 
    object.style.MozOpacity = (opacity / 100); 
    object.style.KhtmlOpacity = (opacity / 100); 
    object.style.filter = "alpha(opacity=" + opacity + ")"; 
}
//END ESRI.ArcGIS.ADF.Web.UI.WebControls.Runtime.JavaScript.display_contextmenu.js
//START ESRI.ArcGIS.ADF.Web.UI.WebControls.Runtime.JavaScript.ESRI.ADF.UI.FloatingPanel.release.js
//----------------------------------------------------------
// Copyright (C) ESRI. All rights reserved.
//----------------------------------------------------------
var esriDockContainersOnLoadChecked = false;Type.registerNamespace('ESRI.ADF.UI');ESRI.ADF.UI._FloatingPanelZLevel = 1;FloatingPanels = ESRI.ADF.UI._FloatingPanels = [];ESRI.ADF.UI.FloatingPanel = function(element) {
ESRI.ADF.UI.FloatingPanel.initializeBase(this, [element]);ESRI.ADF.UI._FloatingPanels[ESRI.ADF.UI._FloatingPanels.length] = this;this.id = this.get_id()
this.callbackFunctionString = null;this.expandedImage = null;this.collapsedImage = null;this.dockedImage = null;this.undockedImage = null;this.transparency = 0;this.minWidth = 0;this.minHeight = 0;this.forcePNG = false;this.tempMoveFunction = null;this.borderStyle = null;this.backgroundColor = null;this.bodyBorderStyle = null;this.dockedContextMenuID = null;this.dockParent = null;this._isResizing = false;this._isDragging = false;this._leftOffset = null;this._topOffset = null;this._keepInForm = false;this._x1 = null;this._y1 = null;this._restrictToPage = false;this.docked = false;this._isRtl = false;};ESRI.ADF.UI.FloatingPanel.prototype = {
initialize: function() {
ESRI.ADF.UI.FloatingPanel.callBaseMethod(this, 'initialize');this._borderStyle = this.get_element().style.borderStyle;var zIndex = parseInt(this.get_element().style.zIndex);if (zIndex > ESRI.ADF.UI._FloatingPanelZLevel) {
ESRI.ADF.UI._FloatingPanelZLevel = zIndex;}
else this.get_element().style.zIndex = ESRI.ADF.UI._FloatingPanelZLevel++;this._fixRtl();this._backgroundColor = this.get_element().style.backgroundColor;this._bodyCell = $get(this.get_id() + '_BodyCell');if (this._bodyCell != null)
this._bodyBorderStyle = this._bodyCell.style.borderStyle;this._moveWindowDragHandler = Function.createDelegate(this, this._moveWindowDrag);this._endWindowDragHandler = Function.createDelegate(this, this._endWindowDrag);this._dragWindowResizeHandler = Function.createDelegate(this, this._dragWindowResize);this._endWindowResizeHandler = Function.createDelegate(this, this._endWindowResize);this._onContextMenuHandler = Function.createDelegate(this, function(e) { esriShowContextMenu(e, this.dockedContextMenuID, "", "TitleRow");return false;});this._preventHandler = function(e) { e.preventDefault() };this._floatingPanelBodyCell = $get(this.get_id() + '_BodyCell');this._floatingPanelSideResizeCell = $get(this.get_id() + '_SideResizeCell');this._fpTitle = $get(this.get_id() + '_Title');if (Sys.Browser.agent === Sys.Browser.Firefox) {
this._fpTitle.style.MozUserSelect = 'none';}
this._checkDock();},
_checkRtl: function() {
if (document.defaultView && document.defaultView.getComputedStyle) { 
this._isRtl = (document.defaultView.getComputedStyle(this.get_element(), null)['direction'] == 'rtl');}
else if (this.get_element().currentStyle) { 
this._isRtl = (this.get_element().currentStyle.blockDirection == 'rtl')
}
return this._isRtl;},
_fixRtl: function() {
var rtl = this._isRtl;var rtl2 = this._checkRtl();if (rtl == rtl2) { return;}
var id = this.get_id();var btn = $get(id + '_ExpandButton');if (!btn) { btn = $get(id + '_CloseButton');}
if (!btn) { btn = $get(id + '_DockButton');}
if (btn) { btn.parentNode.align = this._isRtl ? 'left' : 'right';}
var corner = $get(id + '_CornerResizeImage');if (corner) { corner.style.cursor = this._isRtl ? 'sw-resize' : 'nw-resize';}
var title = $get(id + '_TitleCell');if (title) {
if (this._isRtl) { title.style.paddingRight = title.style.paddingLeft;title.style.paddingLeft = '';}
else { title.style.paddingLeft = title.style.paddingRight;title.style.paddingRight = '';}
}
var bodycell = $get(id + '_BodyCell');if (bodycell) {
if (this._isRtl) { bodycell.style.paddingRight = bodycell.style.paddingLeft;bodycell.style.paddingLeft = '';}
else { bodycell.style.paddingLeft = bodycell.style.paddingRight;bodycell.style.paddingRight = '';}
}
},
_checkDock: function() {
if (this.dockParent != null && this.dockParent.length > 0 && this.get_isDocked()) {
this.dock();}
else if (!this.get_isDocked()) {
var outsideContainerID = this.get_id() + "_Container";var outsideContainer = $get(outsideContainerID);if (outsideContainer != null) {
outsideContainer.parentNode.removeChild(outsideContainer);outsideContainer = null;this._element = $get(this.get_id());}
outsideContainer = document.createElement('div');outsideContainer.id = outsideContainerID;outsideContainer.style.margin = "0px";outsideContainer.style.padding = "0px";if (this._keepInForm && document.forms[0]) { document.forms[0].appendChild(outsideContainer);}
else { document.body.appendChild(outsideContainer);}
var fp = this.get_element();fp.parentNode.removeChild(fp);outsideContainer.appendChild(fp);}
},
bringToFront: function() {
if (this.get_isDocked() && this._dockParentElement != null) return;var fpDiv = this.get_element();if (parseInt(fpDiv.style.zIndex, 10) < ESRI.ADF.UI._FloatingPanelZLevel) {
fpDiv.style.zIndex = ++ESRI.ADF.UI._FloatingPanelZLevel;}
ie6Workarounds(this.get_id());return false;},
_makeTransparent: function() {
if (this.transparency <= 0) return;var element = this.get_element();if (element == null) return;var dragOpacity = 100 - this.transparency;var opac = dragOpacity / 100;element.style.opacity = opac;element.style.mozOpacity = opac;element.style.filter = "alpha(opacity=" + dragOpacity + ")";var expandButton = $get(this.get_id() + '_ExpandButton');var closeButton = $get(this.get_id() + '_CloseButton');var dockButton = $get(this.get_id() + '_DockButton');if (expandButton != null) expandButton.style.visibility = 'hidden';if (closeButton != null) closeButton.style.visibility = 'hidden';if (dockButton != null) dockButton.style.visibility = 'hidden';},
_makeOpaque: function() {
if (this.transparency <= 0) { return;}
if (document.onmousemove == this._moveWindowDragHandler) return;var element = this.get_element();if (element == null) { return;}
element.style.opacity = 1.0;element.style.mozOpacity = 1.0;element.style.filter = "";var expandButton = $get(this.get_id() + '_ExpandButton');var closeButton = $get(this.get_id() + '_CloseButton');var dockButton = $get(this.get_id() + '_DockButton');if (expandButton != null) expandButton.style.visibility = 'visible';if (closeButton != null) closeButton.style.visibility = 'visible';if (dockButton != null) dockButton.style.visibility = 'visible';},
get_isDragging: function() { return this._isDragging;},
get_isResizing: function() { return this._isResizing;},
_startWindowDrag: function(e) {
if (this._isDragging) return;this._fixRtl();this._isDragging = true;this._leftOffset = null;this._topOffset = null;this.get_element().style.position = "absolute";$addHandler(document, 'mousemove', this._moveWindowDragHandler);$addHandler(document, 'mouseup', this._endWindowDragHandler);$addHandler(document, 'selectstart', this._preventHandler);this._titleMouseOverFunction = this._fpTitle.onmouseover;this._titleMouseOutFunction = this._fpTitle.onmouseout;this._fpTitle.onmouseover = null;this._fpTitle.onmouseout = null;this._maxFloatingPanelDragRight = getWinWidth() - parseInt(this.get_element().offsetWidth, 10);var height = parseInt(document.body.scrollHeight, 10);var winHeight = getWinHeight();if (height < winHeight) { height = winHeight;}
this._maxFloatingPanelDragBottom = height - parseInt(this.get_element().clientHeight, 10);ie6Workarounds(this.get_id());this._raiseEvent('dragStart');return false;},
_moveWindowDrag: function(e) {
e = ESRI.ADF.System._makeMouseEventRelativeToElement(e, document, { "x": 0, "y": 0 });pos = { "mouseX": e.offsetX, "mouseY": e.offsetY };if (this._leftOffset == null || this._topOffset == null) {
var box = Sys.UI.DomElement.getLocation(this.get_element());this._leftOffset = pos.mouseX - box.x;this._topOffset = pos.mouseY - box.y;box = null;this._makeTransparent();}
this._moveTo(pos.mouseX - this._leftOffset, pos.mouseY - this._topOffset);ie6Workarounds(this.get_id());this._raiseEvent('dragging');e.preventDefault();e.stopPropagation();},
_moveTo: function(left, top) {
if (this._restrictToPage) {
if (left > this._maxFloatingPanelDragRight) { left = this._maxFloatingPanelDragRight;}
if (left < 0) { left = 0;}
if (top > this._maxFloatingPanelDragBottom) { top = this._maxFloatingPanelDragBottom;}
}
if (top < 0) { top = 0;}
var element = this.get_element();if (this._isRtl && Sys.Browser.agent === Sys.Browser.InternetExplorer) {
this.get_element().style.right = this._maxFloatingPanelDragRight - left + 'px';this.get_element().style.top = top + 'px';}
else {
Sys.UI.DomElement.setLocation(element, left, top);}
},
_endWindowDrag: function(e) {
if (!this._isDragging) { return;}
this._isDragging = false;$removeHandler(document, 'mousemove', this._moveWindowDragHandler);$removeHandler(document, 'mouseup', this._endWindowDragHandler);this._fpTitle.onmouseover = this._titleMouseOverFunction;this._fpTitle.onmouseout = this._titleMouseOutFunction;this._makeOpaque();ie6Workarounds(this.get_id());$removeHandler(document, 'selectstart', this._preventHandler);var hfTop = $get(this.get_id() + '_hfTop');var hfLeft = $get(this.get_id() + '_hfLeft');if (hfTop != null) hfTop.value = this.get_element().style.top;if (hfLeft != null) hfLeft.value = this.get_element().style.left;this._raiseEvent('dragEnd');resetAllTitleBarBackgroundImages();this._isDragging = false;e.preventDefault();e.stopPropagation();},
_startWindowResize: function(mode) {
/// Added for right button check on resize ****/
if (this._isResizing) return;this._isResizing = true;/// Added for right button check on resize ****/  
this._resizeMode = mode ? mode : null;if (!this._floatingPanelBodyCell.parentElement) {
this._floatingPanelBodyCell = $get(this.get_id() + '_BodyCell');this._floatingPanelSideResizeCell = $get(this.get_id() + '_SideResizeCell');this._fpTitle = $get(this.get_id() + '_Title');}
this._x1 = null;this._y1 = null;this._startWidth = null;this._startHeight = null;this.showFrame();this._tempMoveFunction = document.onmousemove;document.onmousemove = this._dragWindowResizeHandler;document.onmouseup = this._endWindowResizeHandler;this._raiseEvent('resizeStart', mode);return false;},
_dragWindowResize: function(e) {
/// Added for right button check on resize ****/
if (!isLeftButton(e)) return;if (!this._isResizing) return;/// Added for right button check on resize ****/ 
var pos = ESRI.ADF.System.__getAbsoluteMousePosition(e);if (this._x1 == null || this._y1 == null || this._startWidth == null || this._startHeight == null) {
var box = Sys.UI.DomElement.getBounds(this._floatingPanelBodyCell);this._startWidth = box.width;this._startHeight = box.height;this._x1 = pos.mouseX;this._y1 = pos.mouseY;}
var tempWidth = null;if (this._resizeMode == null || this._resizeMode == 'width') {
this._leftOffset = pos.mouseX - this._x1;if (this._isRtl) { this._leftOffset = this._x1 - pos.mouseX;}
else { this._leftOffset = pos.mouseX - this._x1;}
if (this._isRtl && Sys.Browser.agent !== Sys.Browser.InternetExplorer) {
this.get_element().style.left = pos.mouseX + 'px';}
tempWidth = this._startWidth + this._leftOffset;if (isNav) { tempWidth += 10;}
}
var tempHeight = null;if (this._resizeMode == null || this._resizeMode == 'height') {
this._topOffset = pos.mouseY - this._y1;tempHeight = this._startHeight + this._topOffset;}
this._resize(tempWidth, tempHeight);ie6Workarounds(this.get_id());if (tempWidth == null) { tempWidth = parseInt(this.get_element().style.width, 10);}
if (tempHeight == null) { tempHeight = parseInt(this._floatingPanelBodyCell.style.height, 10);}
this._raiseEvent('resizing', { "width": tempWidth, "height": tempHeight });return false;},
_resize: function(width, height) {
if (width != null && width > this.minWidth) {
this.get_element().style.width = width + "px";}
if (height != null && height > this.minHeight) {
this._floatingPanelBodyCell.style.height = height + "px";this._floatingPanelSideResizeCell.style.height = height + "px";}
},
_endWindowResize: function(e) {
document.onmousemove = this._tempMoveFunction;document.onmouseup = null;var hfHeight = $get(this.get_id() + '_hfHeight');var hfWidth = $get(this.get_id() + '_hfWidth');var width = this.get_element().style.width;var height = this._floatingPanelBodyCell.style.height;if (hfWidth) { hfWidth.value = width }
if (hfHeight) { hfHeight.value = height;}
this._raiseEvent('resized', { "width": parseInt(width, 10), "height": parseInt(height, 10) });this._isResizing = false;return false;},
hide: function(doCallback, argument) {
this.get_element().style.display = 'none';var hfVisible = $get(this.get_id() + '_hfVisible');if (hfVisible != null) { hfVisible.value = 'false';}
this._raiseEvent('hide');var fpContainer = $get(this.get_id() + "_Container");if (fpContainer != null) { fpContainer.style.display = 'none';}
ie6Workarounds(this.get_id());if (doCallback == true || doCallback == null) {
if (argument == null) { argument = 'EventArg=hidden';}
else { argument += '&EventArg=hidden';}
var context = null;eval(this.callbackFunctionString);}
},
show: function(doCallback, argument) {
this._fixRtl();this.get_element().style.display = '';var hfVisible = $get(this.get_id() + '_hfVisible');if (hfVisible != null) hfVisible.value = 'true';this._raiseEvent('show');var fpContainer = $get(this.get_id() + "_Container");if (fpContainer != null) { fpContainer.style.display = '';}
this.bringToFront();ie6Workarounds(this.get_id());if (doCallback == true || doCallback == null) {
if (argument == null) { argument = 'EventArg=shown';}
else { argument += '&EventArg=shown';}
var context = null;eval(this.callbackFunctionString);}
},
setTitle: function(argument) {
var titleCell = $get(this.get_id() + '_TitleCell');if (titleCell != null)
titleCell.innerHTML = argument;},
toggleVisibility: function(doCallback, argument) {
var hfVisible = $get(this.get_id() + '_hfVisible');if (hfVisible === null) {
var fp = this.get_element();if (fp.style.display == 'none') { showFloatingPanel(fpID, doCallback, argument);}
else if (hfVisible.value == 'false') { hideFloatingPanel(fpID, doCallback, argument);}
return;}
if (hfVisible.value == 'true') { this.hide(doCallback, argument);}
else if (hfVisible.value == 'false') { this.show(doCallback, argument);}
else {
var fp = this.get_element();hfVisible.value = fp.style.display == 'none' ? 'false' : 'true';if (hfVisible.value == 'true') { this.hide(doCallback, argument);}
else if (hfVisible.value == 'false') { this.show(doCallback, argument);}
}
},
expand: function() {
var fpBody = $get(this.get_id() + '_BodyRow');var expandButton = $get(this.get_id() + '_ExpandButton');var resizeRow = $get(this.get_id() + '_ResizeRow');var hfExpanded = $get(this.get_id() + '_hfExpanded');if (fpBody == null || expandButton == null) { return;}
if (fpBody.style.display == 'none') {
fpBody.style.display = '';if (resizeRow != null) resizeRow.style.display = '';switchImageSourceAndAlphaBlend(expandButton, this.expandedImage, this.forcePNG);if (hfExpanded != null) { hfExpanded.value = 'true';}
this._makeOpaque();}
this._raiseEvent('expanded');ie6Workarounds(this.get_id());},
collapse: function() {
var fpBody = $get(this.get_id() + '_BodyRow');var expandButton = $get(this.get_id() + '_ExpandButton');var resizeRow = $get(this.get_id() + '_ResizeRow');var hfExpanded = $get(this.get_id() + '_hfExpanded');if (fpBody == null || expandButton == null) { return;}
if (fpBody.style.display != 'none') {
fpBody.style.display = 'none';if (resizeRow != null) resizeRow.style.display = 'none';switchImageSourceAndAlphaBlend(expandButton, this.collapsedImage, this.forcePNG);if (hfExpanded != null) { hfExpanded.value = 'false';}
this._makeTransparent();}
this._raiseEvent('collapsed');ie6Workarounds(this.get_id());},
toggleState: function(fireServerSideExpandEvent, fireServerSideCollapseEvent) {
var fpBody = $get(this.get_id() + '_BodyRow');if (fpBody.style.display == 'none') {
this.expand();if (fireServerSideExpandEvent) {
var argument = 'EventArg=expanded';var context = null;eval(this.callbackFunctionString);}
}
else {
this.collapse();if (fireServerSideCollapseEvent) {
var argument = 'EventArg=collapsed';var context = null;eval(this.callbackFunctionString);}
}
},
dock: function() {
if (!this.dockParent) { return;}
this._dockParentElement = $get(this.dockParent);if (this._dockParentElement == null) {
this.set_isDocked(false);return;}
this._fixRtl();var fp = this.get_element();ie6SaveCheckboxState();fp.style.width = "100%";fp.style.position = "";fp.style.top = "0px";fp.style.left = "0px";fp.style.zIndex = '';if (this._dockParentElement == fp.parentElement) fp.parentNode.removeChild(fp);this._dockParentElement.appendChild(fp);var fpTitleRow = $get(this.get_id() + "_Title");fpTitleRow.style.cursor = "";fpTitleRow.onmousedown = null;if (this.dockedContextMenuID != null && this.dockedContextMenuID.length > 0) {
fpTitleRow = $get(this.get_id() + "_Title");fpTitleRow.oncontextmenu = this._onContextMenuHandler;}
var fpResizeImage = null;fpResizeImage = $get(this.get_id() + "_SideResizeImage");fpResizeImage.style.cursor = "";fpResizeImage.onmousedown = null;fpResizeImage = $get(this.get_id() + "_CornerResizeImage");fpResizeImage.style.cursor = "";fpResizeImage.onmousedown = null;var dockButton = $get(this.get_id() + "_DockButton");switchImageSourceAndAlphaBlend(dockButton, this.dockedImage, this.forcePNG);this.set_isDocked(true);ie6Workarounds(this.get_id());ie6RetrieveCheckboxState(fp);if (this.onDockFunction != null) this.onDockFunction(fp);this._raiseEvent('docked');},
undock: function() {
if (!this.dockParent) { this.dockParent = this.get_element().parentNode.id }
if (this.dockParent == null) { return;}
this._dockParentElement = $get(this.dockParent);if (this._dockParentElement == null) return;this._fixRtl();var fp = this.get_element();ie6SaveCheckboxState(fp);var outsideContainerID = this.get_id() + "_Container";var outsideContainer = $get(outsideContainerID);if (outsideContainer == null) {
outsideContainer = document.createElement('div');outsideContainer.id = outsideContainerID;outsideContainer.style.margin = "0px";outsideContainer.style.padding = "0px";if (this._keepInForm && document.forms[0]) { document.forms[0].appendChild(outsideContainer);}
else { document.body.appendChild(outsideContainer);}
}
fp.style.width = fp.clientWidth + "px";var rect = Sys.UI.DomElement.getBounds(this.get_element());fp.style.left = rect.x + rect.width + 10 + "px";fp.style.top = rect.y + "px";fp.style.position = "absolute";this._dockParentElement = fp.parentNode;this.dockParent = fp.parentNode.id;outsideContainer.appendChild(fp);var fpTitleRow = $get(this.get_id() + "_Title");fpTitleRow.style.cursor = "move";fpTitleRow.onmousedown = Function.createDelegate(this, function(e) { if (!isLeftButton(e)) return;this.bringToFront();this._startWindowDrag();});fpTitleRow = $get(this.get_id() + "_Title");fpTitleRow.oncontextmenu = null;var fpResizeImage = null;fpResizeImage = $get(this.get_id() + "_SideResizeImage");fpResizeImage.style.cursor = "w-resize";fpResizeImage.onmousedown = Function.createDelegate(this, function() { this._startWindowResize('width');if (!Sys.Browser.agent === Sys.Browser.InternetExplorer) return false;});fpResizeImage = $get(this.get_id() + "_BottomResizeImage");fpResizeImage.style.cursor = "s-resize";fpResizeImage.onmousedown = Function.createDelegate(this, function() { this._startWindowResize('height');if (!Sys.Browser.agent === Sys.Browser.InternetExplorer) return false;});fpResizeImage = $get(this.get_id() + "_CornerResizeImage");fpResizeImage.style.cursor = "nw-resize";fpResizeImage.onmousedown = Function.createDelegate(this, function() { this._startWindowResize();if (!Sys.Browser.agent === Sys.Browser.InternetExplorer) return false;});var dockButton = $get(this.get_id() + "_DockButton");switchImageSourceAndAlphaBlend(dockButton, this.undockedImage, this.forcePNG);this.set_isDocked(false);this.bringToFront();ie6Workarounds(this.get_id());ie6RetrieveCheckboxState(fp);this._raiseEvent('undocked');},
toggleDockState: function() {
if (this.get_isDocked()) { this.undock();}
else { this.dock();}
},
moveDockedUp: function() {
if (!this.get_isDocked()) { return;}
var parentNode = this.get_element().parentNode;var refNode = esriGetPreviousSibling(this.get_element());if (refNode == null) return;parentNode.removeChild(this.get_element());parentNode.insertBefore(this.get_element(), refNode);},
moveDockedDown: function() {
if (!this.get_isDocked()) { return;}
var parentNode = this.get_element().parentNode;if (parentNode == null) return;var nextNode = esriGetNextSibling(this.get_element());if (nextNode == null) return;var refNode = esriGetNextSibling(nextNode);if (refNode == null) {
parentNode.removeChild(this.get_element());parentNode.appendChild(this.get_element());}
else {
parentNode.removeChild(this.get_element());parentNode.insertBefore(this.get_element(), refNode);}
},
moveDockedToTop: function() {
if (!this.get_isDocked()) { return;}
var parentNode = this.get_element().parentNode;var refNode = esriGetFirstSibling(this.get_element());if (refNode == null || refNode == this.get_element()) { return;}
parentNode.removeChild(this.get_element());parentNode.insertBefore(this.get_element(), refNode);},
moveDockedToBottom: function() {
if (!this.get_isDocked()) { return;}
var parentNode = this.get_element().parentNode;parentNode.removeChild(this.get_element());parentNode.appendChild(this.get_element());},
hideFrame: function() {
var hfExpanded = $get(this.get_id() + '_hfExpanded');if (hfExpanded && hfExpanded.value == 'false') return;if (this.get_isDragging() || this.get_isResizing()) { return;}
var floatingPanel = this.get_element();var floatingPanelBodyCell = $get(this.get_id() + '_BodyCell');var floatingPanelSideResizeCell = $get(this.get_id() + '_SideResizeCell');floatingPanel.style.borderStyle = 'none';floatingPanel.style.backgroundColor = '';floatingPanelBodyCell.style.borderStyle = 'none';floatingPanelBodyCell.style.backgroundColor = '';floatingPanelSideResizeCell.style.borderStyle = 'none';floatingPanelSideResizeCell.style.backgroundColor = '';var fpTitle = $get(this.get_id() + '_Title');fpTitle.style.visibility = 'hidden';},
showFrame: function() {
if (this.get_isDragging() || this.get_isResizing()) { return;}
var floatingPanel = this.get_element();var floatingPanelBodyCell = $get(this.get_id() + '_BodyCell');var floatingPanelSideResizeCell = $get(this.get_id() + '_SideResizeCell');floatingPanel.style.borderStyle = this._borderStyle;floatingPanel.style.backgroundColor = this._backgroundColor;floatingPanelBodyCell.style.borderStyle = this._bodyBorderStyle;floatingPanelBodyCell.style.backgroundColor = this._backgroundColor;floatingPanelSideResizeCell.style.borderStyle = this._bodyBorderStyle;floatingPanelSideResizeCell.style.backgroundColor = this._backgroundColor;var fpTitle = $get(this.get_id() + '_Title');fpTitle.style.visibility = 'visible';},
get_transparency: function() { return this.transparency;},
set_transparency: function(value) { if (value < 0) { this.transparency = 0;} else if (value > 100) { this.transparency = 100;} else { this.transparency = value;} },
get_callbackFunctionString: function() { return this.callbackFunctionString;},
set_callbackFunctionString: function(value) { this.callbackFunctionString = value;},
get_expandedImage: function() { return this.expandedImage;},
set_expandedImage: function(value) { this.expandedImage = value;},
get_collapsedImage: function() { return this.collapsedImage;},
set_collapsedImage: function(value) { this.collapsedImage = value;},
get_dockedImage: function() { return this.dockedImage;},
set_dockedImage: function(value) { this.dockedImage = value;},
get_undockedImage: function() { return this.undockedImage;},
set_undockedImage: function(value) { this.undockedImage = value;},
get_dockedContextMenuID: function() { return this.dockedContextMenuID;},
set_dockedContextMenuID: function(value) { this.dockedContextMenuID = value;},
get_dockParent: function() { return this.dockParent;},
set_dockParent: function(value) { this.dockParent = value;if (value) { this._dockParentElement = $get(value);} },
get_forcePNG: function() { return this.forcePNG;},
set_forcePNG: function(value) { this.forcePNG = value;},
get_isDocked: function() { return this.docked;},
set_isDocked: function(value) { this.docked = value;},
get_restrictToPage: function() { return this._restrictToPage;},
set_restrictToPage: function(value) { this._restrictToPage = value;},
get_keepInForm: function() { return this._keepInForm;},
set_keepInForm: function(value) { this._keepInForm = value;},
_raiseEvent: function(name, e) {
if (!this.get_isInitialized()) { return;}
var handler = this.get_events().getHandler(name);if (handler) { if (e === null || e === 'undefined') { e = Sys.EventArgs.Empty;} handler(this, e);}
},
add_dragStart: function(handler) {
this.get_events().addHandler('dragStart', handler);},
remove_dragStart: function(handler) { this.get_events().removeHandler('dragStart', handler);},
add_dragMove: function(handler) {
this.get_events().addHandler('dragging', handler);},
remove_dragMove: function(handler) { this.get_events().removeHandler('dragging', handler);},
add_dragEnd: function(handler) { 
this.get_events().addHandler('dragEnd', handler);},
remove_dragEnd: function(handler) { this.get_events().removeHandler('dragEnd', handler);},
add_resizeStart: function(handler) {
this.get_events().addHandler('resizeStart', handler);},
remove_resizeStart: function(handler) { this.get_events().removeHandler('resizeStart', handler);},
add_resizing: function(handler) {
this.get_events().addHandler('resizing', handler);},
remove_resizing: function(handler) { this.get_events().removeHandler('resizing', handler);},
add_resized: function(handler) {
this.get_events().addHandler('resized', handler);},
remove_resized: function(handler) { this.get_events().removeHandler('resized', handler);},
add_hide: function(handler) {
this.get_events().addHandler('hide', handler);},
remove_hide: function(handler) { this.get_events().removeHandler('hide', handler);},
add_show: function(handler) {
this.get_events().addHandler('show', handler);},
remove_show: function(handler) { this.get_events().removeHandler('show', handler);},
add_expanded: function(handler) {
this.get_events().addHandler('expanded', handler);},
remove_expanded: function(handler) { this.get_events().removeHandler('expanded', handler);},
add_collapsed: function(handler) {
this.get_events().addHandler('collapsed', handler);},
remove_collapsed: function(handler) { this.get_events().removeHandler('collapsed', handler);},
add_docked: function(handler) {
this.get_events().addHandler('docked', handler);},
remove_docked: function(handler) { this.get_events().removeHandler('docked', handler);},
add_undocked: function(handler) {
this.get_events().addHandler('undocked', handler);},
remove_undocked: function(handler) { this.get_events().removeHandler('undocked', handler);}
};ESRI.ADF.UI.FloatingPanel.registerClass('ESRI.ADF.UI.FloatingPanel', Sys.UI.Control);makeOpaque = function(fpID) { var obj=$find(fpID);if(obj)obj._makeOpaque();};makeTransparent = function(fpID) { var obj=$find(fpID);if(obj)obj._makeTransparent();};esriBringFloatingPanelToFront = function(fpID) { var obj=$find(fpID);if(obj)obj.bringToFront();};startWindowDrag = function(fpID) { var obj=$find(fpID);if(obj)obj._startWindowDrag();};startWindowResize = function(fpID,mode) { var obj=$find(fpID);if(obj)obj._startWindowResize(mode);};hideFloatingPanel = function(fpID, doCallback, argument) { var obj=$find(fpID);if(obj)obj.hide(doCallback, argument);};showFloatingPanel = function(fpID, doCallback, argument) { var obj=$find(fpID);if(obj)obj.show(doCallback, argument);};expandFloatingPanel = function(fpID) { var obj=$find(fpID);if(obj)obj.expand();};collapseFloatingPanel = function(fpID) { var obj=$find(fpID);if(obj)obj.collapse();};dockFloatingPanel = function(fpID) { var obj=$find(fpID);if(obj)obj.dock();};undockFloatingPanel = function(fpID) {var obj=$find(fpID);if(obj)obj.undock();};toggleFloatingPanelDockState = function(fpID) { var obj=$find(fpID);if(obj)obj.toggleDockState();};toggleFloatingPanelVisibility = function(fpID, doCallback, argument) {var obj=$find(fpID);if(obj)obj.toggleVisibility(doCallback, argument);};toggleFloatingPanelState = function(fpID, fireServerSideExpandEvent, fireServerSideCollapseEvent) { var obj=$find(fpID);if(obj)obj.toggleState(fireServerSideExpandEvent, fireServerSideCollapseEvent);};showFloatingPanelFrame = function(fpID) { var obj=$find(fpID);if(obj)obj.showFrame();};hideFloatingPanelFrame = function(fpID) { var obj=$find(fpID);if(obj)obj.hideFrame();};esriMoveDockedFloatingPanelUp = function(fpID) { var obj=$find(fpID);if(obj)obj.moveDockedUp();};esriMoveDockedFloatingPanelDown = function(fpID) { var obj=$find(fpID);if(obj)obj.moveDockedDown();};esriMoveDockedFloatingPanelTop = function(fpID) { var obj=$find(fpID);if(obj)obj.moveDockedToTop();};esriMoveDockedFloatingPanelBottom = function(fpID) { var obj=$find(fpID);if(obj)obj.moveDockedToBottom();};FloatingPanelObject = function(fpID, transparency, callbackFunctionString, expandedImage, collapsedImage, dockedImage, undockedImage, dockedContextMenuID, dockParent, forcePNG, docked) {
return $create(ESRI.ADF.UI.FloatingPanel, {
"transparency":transparency,
"callbackFunctionString":callbackFunctionString,
"expandedImage": expandedImage, "collapsedImage": collapsedImage,
"dockedImage": dockedImage, "undockedImage": undockedImage,
"dockedContextMenuID": dockedContextMenuID, "dockParent": dockParent,
"forcePNG":forcePNG, "isDocked":docked} ,null,null,$get(fpID));};function resetAllTitleBarBackgroundImages() {
if (ESRI.ADF.System.__isIE6) {
for (var i=0;i<ESRI.ADF.UI._FloatingPanels.length;i++) {
var fp=ESRI.ADF.UI._FloatingPanels[i];if (fp!=null && fp.get_id().length>0) {
var fpTitle=$get(fp.get_id()+'_Title');if (fpTitle!=null && fpTitle.style!=null) {
fpTitle.style.backgroundImage=fpTitle.style.backgroundImage;}
}
}
}
}
function hideAllFloatingPanels() {
for (var i=0;i<ESRI.ADF.UI._FloatingPanels.length;i++) {
var fp=ESRI.ADF.UI._FloatingPanels[i];if (fp!=null && fp.get_id().length>0) {
fp.hide();}
}
}
function esriGetNextSibling(element)
{
if (element==null)return null;var p=element.parentNode;var sib=element.nextSibling;while(sib!=null)
{
if (sib.nodeType==1 && sib.clientHeight>0)
{
if ($find(sib.id)!=null) return sib;}
sib=sib.nextSibling;}
return null;}
function esriGetPreviousSibling(element)
{
if (element==null)return null;var p=element.parentNode;var sib=element.previousSibling;while(sib!=null)
{
if (sib.nodeType==1 && sib.clientHeight>0)
{
if ($find(sib.id)!=null) return sib;}
sib=sib.previousSibling;}
return null;}
function esriGetFirstSibling(element)
{
if (element==null)return null;var p=element.parentNode;if (p==null) return null;if (p.childNodes==null) return null;for (var i=0;i<p.childNodes.length;i++)
{
var sib=p.childNodes[i];if (sib==null)continue;if (sib.nodeType==1 && sib.clientHeight>0)
{
if ($find(sib.id)!=null) return sib;}
}
return null;}
function ie6Workarounds(fpID)
{ 
if (ESRI.ADF.System.__isIE6)
{
var fp=$get(fpID)
if (fp==null)return;var titleBarRow= $get(fpID + '_Title');if (titleBarRow!=null) titleBarRow.style.backgroundImage=titleBarRow.style.backgroundImage;var ifrmID = fpID + "_BackgroundIFrame";var ifrm = $get(ifrmID);if (ifrm==null)
{
ifrm=document.createElement('iframe');ifrm.id=ifrmID;ifrm.style.position="absolute";ifrm.src="javascript:false;";ifrm.frameborder="0";ifrm.scrolling="no";ifrm.style.margin="0px";ifrm.style.display="none";ifrm.style.padding="0px";ifrm.style.filter='progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)';document.body.appendChild(ifrm);}
if (fp.style.position=="absolute")
{
ifrm.style.zIndex=fp.style.zIndex-1;ifrm.style.width=fp.offsetWidth;ifrm.style.height=fp.offsetHeight;ifrm.style.top=fp.style.top;ifrm.style.left=fp.style.left;ifrm.style.display=fp.style.display;}
else
{
ifrm.style.zIndex=fp.style.zIndex-1;ifrm.style.width="0px";ifrm.style.height="0px";ifrm.style.top="0px";ifrm.style.left="0px";ifrm.style.display="none";}
}
return false;}
function ie6SaveCheckboxState(fp)
{
if (ESRI.ADF.System.__isIE6)
{
if (fp==null)return;var cbs=fp.getElementsByTagName('input');if (cbs==null)return;for (var i=0;i<cbs.length;i++)
{
var cb = cbs[i];if (cb==null)continue;if (cb.type!='checkbox')continue;cb.savedCheckedState=cb.checked;}
}
}
function ie6RetrieveCheckboxState(fp)
{
if (ESRI.ADF.System.__isIE6)
{
if (fp==null)return;var cbs=fp.getElementsByTagName('input');if (cbs==null)return;for (var i=0;i<cbs.length;i++)
{
var cb = cbs[i];if (cb==null)continue;if (cb.type!='checkbox')continue;if (cb.savedCheckedState!=null)
cb.checked=cb.savedCheckedState;}
}
}

//END ESRI.ArcGIS.ADF.Web.UI.WebControls.Runtime.JavaScript.ESRI.ADF.UI.FloatingPanel.release.js
//START ESRI.ArcGIS.ADF.Web.UI.WebControls.Runtime.JavaScript.ESRI.ADF.UI.MapCopyrightText.release.js
//----------------------------------------------------------
// Copyright (C) ESRI. All rights reserved.
//----------------------------------------------------------
Type.registerNamespace('ESRI.ADF.UI');ESRI.ADF.UI.MapCopyrightText = function(element) { 
ESRI.ADF.UI.MapCopyrightText.initializeBase(this, [element]);this._copyrightText = null;this._calloutWindowTitleText = '';this._calloutReference = null;var isRTL = (document.dir === 'rtl')
this._calloutTemplate = '<div style="width:300px;background-color:#fff;border: solid 1px #ddd;padding: 0px; margin:0;" ><div style="background:#eee; margin:0; height: 22px;"><span style="float: '+(isRTL?'right':'left')+';"><b>{@title}</b></span><span style="float: '+(isRTL?'left':'right')+'; cursor: pointer;" onclick="ESRI.ADF.UI.MapCopyrightText.closeClick(\''+this.get_id()+'\');">X</span></div><div style="padding:0;">{@content}</div></div>';};ESRI.ADF.UI.MapCopyrightText.prototype = {
initialize : function() {
ESRI.ADF.UI.MapCopyrightText.callBaseMethod(this, 'initialize');this._createCallout();$addHandler(this.get_element(), 'click', Function.createDelegate(this, this._doMouseClick));},
dispose : function() {
if(this._calloutReference !== null) {
this._calloutReference.dispose();}
$clearHandlers(this.get_element());ESRI.ADF.UI.MapCopyrightText.callBaseMethod(this, 'dispose');},
_createCallout : function() {
if(this._calloutReference === null) {
this._calloutReference = $create(ESRI.ADF.UI.Callout, { "parent":document.body,"animate":true, "template":this._calloutTemplate, "autoHide":false }, null);this._calloutReference.setContent({"content":this._copyrightText,"title":this._calloutWindowTitleText});}
},
get_map : function () {
return this._map;},
set_map : function(value) {
if (this._map != value) {
this._map = value;this.raisePropertyChanged('map');}
},
get_copyrightText : function () {
return this._copyrightText;},
set_copyrightText : function (value) {
if (this._copyrightText !== value) {
this._copyrightText = value;if(!value) {
this.get_element().style.display = 'none';}
else {
this.get_element().style.display = '';}
this.raisePropertyChanged('copyrightText');}
}, 
get_calloutWindowTitleText : function() {
return this._calloutWindowTitleText;},
set_calloutWindowTitleText : function(value) {
this._calloutWindowTitleText = value;},
get_callout : function() {
if(this._calloutReference===null) {
this._createCallout();}
return this._calloutReference;},
_doMouseClick : function (e) {
var alignment = this._getAlignmentToMap();var xy = this._computeXYAndAnchorForCallout(alignment);this._calloutReference.setPosition(xy.xCoOrd,xy.yCoOrd);this._calloutReference.set_anchorPoint(xy.aPoint);if(this._calloutReference.get_isOpen()) {
this._calloutReference.hide();}
else {
this._calloutReference.show();}
}, 
_getAlignmentToMap : function() {
var list = this.get_element()._behaviors;for(var j=0;list && j < list.length;j++) {
var behav = this.get_element()._behaviors[j];if(ESRI.ADF.Extenders.Dock.isInstanceOfType(behav)) {
return behav.get_alignment();}
}
var ctlBounds = Sys.UI.DomElement.getBounds(this.get_element());if(ctlBounds.x+ctlBounds.width/2>parseInt(document.body.offsetWidth,10)/2)
return ESRI.ADF.System.ContentAlignment.BottomRight;else
return ESRI.ADF.System.ContentAlignment.BottomLeft;},
_computeXYAndAnchorForCallout : function(alignment) {
var ctlBounds = Sys.UI.DomElement.getBounds(this.get_element());var x = ctlBounds.x;var y = ctlBounds.y;var width = ctlBounds.width;var height = ctlBounds.height;var spacing = 3;switch (alignment) {
case ESRI.ADF.System.ContentAlignment.TopCenter:
case ESRI.ADF.System.ContentAlignment.TopRight:
case ESRI.ADF.System.ContentAlignment.TopLeft:
y += (height + spacing);break;case ESRI.ADF.System.ContentAlignment.BottomLeft:
case ESRI.ADF.System.ContentAlignment.BottomCenter:
case ESRI.ADF.System.ContentAlignment.BottomRight:
y -= (spacing);break;}
x += spacing + width/2;var anchorPoint = ESRI.ADF.UI.AnchorPoint.BottomLeft;switch(alignment) {
case ESRI.ADF.System.ContentAlignment.TopLeft:
case ESRI.ADF.System.ContentAlignment.TopCenter:
case ESRI.ADF.System.ContentAlignment.MiddleCenter:
anchorPoint = ESRI.ADF.UI.AnchorPoint.TopLeft;break;case ESRI.ADF.System.ContentAlignment.MiddleLeft:
case ESRI.ADF.System.ContentAlignment.BottomCenter:
case ESRI.ADF.System.ContentAlignment.BottomLeft:
anchorPoint = ESRI.ADF.UI.AnchorPoint.BottomLeft;break;case ESRI.ADF.System.ContentAlignment.TopRight:
case ESRI.ADF.System.ContentAlignment.MiddleRight:
anchorPoint = ESRI.ADF.UI.AnchorPoint.TopRight;break;case ESRI.ADF.System.ContentAlignment.BottomRight:
anchorPoint = ESRI.ADF.UI.AnchorPoint.BottomRight;break;}
return {"xCoOrd":x,"yCoOrd":y,"aPoint":anchorPoint};}
};ESRI.ADF.UI.MapCopyrightText.closeClick = function(id) {
var component = $find(id);if(component) { component._doMouseClick();}
};ESRI.ADF.UI.MapCopyrightText.registerClass('ESRI.ADF.UI.MapCopyrightText', Sys.UI.Control);if (typeof(Sys) !== 'undefined') { Sys.Application.notifyScriptLoaded();}

//END ESRI.ArcGIS.ADF.Web.UI.WebControls.Runtime.JavaScript.ESRI.ADF.UI.MapCopyrightText.release.js
//START ESRI.ArcGIS.ADF.Web.UI.WebControls.Runtime.JavaScript.ESRI.ADF.Tasks.release.js
//----------------------------------------------------------
// Copyright (C) ESRI. All rights reserved.
//----------------------------------------------------------
Type.registerNamespace('ESRI.ADF');ESRI.ADF._Tasks = function() {
ESRI.ADF._Tasks.initializeBase(this);ESRI.ADF._taskJobIDCounter;};ESRI.ADF._Tasks.prototype = {
executeTask : function(callbackArguments, callbackFunctionString, taskJobID) {
if (taskJobID == null) {
if (!ESRI.ADF._taskJobIDCounter){
ESRI.ADF._taskJobIDCounter = new Date().getTime();}
taskJobID = ++ESRI.ADF._taskJobIDCounter;}
this.startActivityIndicator(callbackArguments, callbackFunctionString, taskJobID);var fnc = Function.createDelegate(this,function() { this.startJob(callbackArguments,callbackFunctionString,taskJobID);});window.setTimeout(fnc,1000);},
startActivityIndicator : function(callbackArguments, callbackFunctionString, taskJobID) { 
var argument = "EventArg=startTaskActivityIndicator&taskJobID=" + taskJobID;if (callbackArguments.length > 0) argument += "&" + callbackArguments;var context = null;eval(callbackFunctionString);},
startJob : function (callbackArguments, callbackFunctionString, taskJobID) {
var argument = "EventArg=executeTask&taskJobID=" + taskJobID;if (callbackArguments.length > 0) argument += "&" + callbackArguments;var context = null;eval(callbackFunctionString);}
};ESRI.ADF._Tasks.registerClass('ESRI.ADF._Tasks');ESRI.ADF.Tasks = new ESRI.ADF._Tasks();executeTask = ESRI.ADF.Tasks.executeTask;startActivityIndicator = ESRI.ADF.Tasks.startActivityIndicator;startJob = ESRI.ADF.Tasks.startJob;
//END ESRI.ArcGIS.ADF.Web.UI.WebControls.Runtime.JavaScript.ESRI.ADF.Tasks.release.js
if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();
(function() {var fn = function() {$get('AjaxToolkitScriptManager_HiddenField').value += ';;AjaxControlToolkit, Version=1.0.10920.32880, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e:en-US:816bbca1-959d-46fd-928f-6347d6f2c9c3:9ea3f0e2:e2e86ef9:9e8e87e9;ESRI.ArcGIS.ADF.Web.UI.WebControls, Version=9.3.1.3500, Culture=neutral, PublicKeyToken=8fc3cc631e44ad86:en-US:572dbb50-d69a-4def-a1fd-4980642ad3b4:29d50843:8071b9f9:74aa143e:25c320d5:d44fda31:6767844d:e7fbf59c:712e3e4e:13b601de;AjaxControlToolkit, Version=1.0.10920.32880, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e:en-US:816bbca1-959d-46fd-928f-6347d6f2c9c3:c7c04611;ESRI.ArcGIS.ADF.Web.UI.WebControls, Version=9.3.1.3500, Culture=neutral, PublicKeyToken=8fc3cc631e44ad86:en-US:572dbb50-d69a-4def-a1fd-4980642ad3b4:5aabb63:d9392677:3f3db8d8:a4c8c948:16a170b2:9a2190c5:fc38de60:cd5133c';Sys.Application.remove_load(fn);};Sys.Application.add_load(fn);})();
