﻿//----------------------------------------------------------
// Copyright (C) ESRI. All rights reserved.
//----------------------------------------------------------
Type.registerNamespace('ESRI.ADF.Extenders');ESRI.ADF.Extenders.Dock = function(element) {
ESRI.ADF.Extenders.Dock.initializeBase(this, [element]);this._dockControlId = null;this._map = null;this._alignment = ESRI.ADF.System.ContentAlignment.TopLeft;}
ESRI.ADF.Extenders.Dock.prototype = {
initialize : function() {
ESRI.ADF.Extenders.Dock.callBaseMethod(this, 'initialize');if (this._map != null) 
{
this._onMapResizedHandler = Function.createDelegate(this, this._onMapResized);this._map.add_mapResized(this._onMapResizedHandler);}
this._dockControl();},
dispose : function() {
if (this._map != null)
this._map.remove_mapResized(this._onMapResizedHandler);ESRI.ADF.Extenders.Dock.callBaseMethod(this, 'dispose');},
_onMapResized : function(sender, args)
{
this._dockControl();},
_dockControl : function() {
var target = this.get_element();if (!target)
return;var mapDock = $get(this._dockControlId);if (!mapDock)
return;while (target.offsetParent && target.offsetParent.offsetParent)
target = target.offsetParent;if (target.style.position != "absolute")
target.style.position = "absolute"
target.style.zIndex = Math.max(target.style.zIndex, mapDock.style.zIndex + 1);var mapBounds = Sys.UI.DomElement.getBounds(mapDock);var width = mapBounds.width;var height = mapBounds.height;var x = mapBounds.x;var y = mapBounds.y;var ctlBounds = Sys.UI.DomElement.getBounds(target);switch (this._alignment) {
case ESRI.ADF.System.ContentAlignment.TopCenter:
case ESRI.ADF.System.ContentAlignment.MiddleCenter:
case ESRI.ADF.System.ContentAlignment.BottomCenter:
x += Math.max(0, Math.floor(width / 2.0 - ctlBounds.width / 2.0));break;case ESRI.ADF.System.ContentAlignment.TopRight:
case ESRI.ADF.System.ContentAlignment.MiddleRight:
case ESRI.ADF.System.ContentAlignment.BottomRight:
x += Math.max(0, width - ctlBounds.width);break;}
switch (this._alignment) {
case ESRI.ADF.System.ContentAlignment.MiddleLeft:
case ESRI.ADF.System.ContentAlignment.MiddleCenter:
case ESRI.ADF.System.ContentAlignment.MiddleRight:
y += Math.max(0, Math.floor(height / 2.0 - ctlBounds.height / 2.0));break;case ESRI.ADF.System.ContentAlignment.BottomLeft:
case ESRI.ADF.System.ContentAlignment.BottomCenter:
case ESRI.ADF.System.ContentAlignment.BottomRight:
y += Math.max(0, height - ctlBounds.height);break;}
Sys.UI.DomElement.setLocation(target, x, y);},
get_dockControlId : function() {
return this._dockControlId;},
set_dockControlId : function(value) {
if (this._dockControlId != value) {
this._dockControlId = value;this.raisePropertyChanged('dockControlId');}
},
get_map : function()
{
return this._map;},
set_map : function(value)
{
if (this._map != value) {
this._map = value;this.raisePropertyChanged('map');}
},
get_alignment : function() {
return this._alignment;},
set_alignment : function(value) {
if (this._alignment != value) {
this._alignment = value;this.raisePropertyChanged('alignment');}
}
}
ESRI.ADF.Extenders.Dock.registerClass('ESRI.ADF.Extenders.Dock', AjaxControlToolkit.BehaviorBase);ESRI.ADF.Extenders.HoverExpand = function(element) {
ESRI.ADF.Extenders.HoverExpand.initializeBase(this, [element]);this._parentDiv = null;this._thumbImgObject = null;this._ctlObject = null;this._mouseOverOpacity = 1.0;this._mouseOutOpacity = 0.5;this._thumbnailImageUrl = "";this._thumbnailImageAlignment = ESRI.ADF.System.ContentAlignment.TopLeft;this._pinnedImageUrl = "";this._unpinnedImageUrl = "";this._pinned = false;this._pinImgObject = null;this._isPinnable = false;this._isPinned = false;this._isThumbable = false;};ESRI.ADF.Extenders.HoverExpand.prototype = {
initialize : function() {
ESRI.ADF.Extenders.HoverExpand.callBaseMethod(this, 'initialize');this._createParentDiv();},
dispose : function() {
$clearHandlers(this._element);ESRI.ADF.Extenders.HoverExpand.callBaseMethod(this, 'dispose');},
_createParentDiv : function() {
this._ctlObject = this.get_element();if (!this._isThumbable)
{
this._isPinnable = false;}
if (this._isThumbable || this._isPinnable)
{
var div = document.createElement("DIV");if (this._ctlObject.id)
{
div.id = this._ctlObject.id + "_HoverExpand";}
var bounds = Sys.UI.DomElement.getBounds(this._ctlObject);if (this._ctlObject.style.position == "absolute")
{
div.style.left = bounds.x + "px";div.style.top = bounds.y + "px";div.style.position = this._ctlObject.style.position;this._ctlObject.style.left = 0 + "px";this._ctlObject.style.top = 0 + "px";div.style.zIndex = this._ctlObject.style.zIndex;this._ctlObject.style.zIndex = 0;}
else
{
div.style.position = "relative";}
div.style.height = bounds.height + "px";div.style.width = bounds.width + "px";this._parentDiv = div;this._ctlObject.parentNode.replaceChild(div, this._ctlObject);div.appendChild(this._ctlObject);if (this._isThumbable)
{
this._thumbImgObject = document.createElement("IMG");this._thumbImgObject.style.position = "absolute";div.appendChild(this._thumbImgObject);$addHandler(this._thumbImgObject, 'load', Function.createDelegate(this, this._onThumbImageLoaded));this._thumbImgObject.src = this._thumbnailImageUrl;}
if (this._isPinnable)
{
this._isPinned = this._pinned;this._pinImgObject = document.createElement("IMG");this._pinImgObject.style.position = "absolute";div.appendChild(this._pinImgObject);$addHandler(this._pinImgObject, 'load', Function.createDelegate(this, this._onPinImageLoaded));this._pinImgObject.src = this._getPinnedImage();$addHandler(this._pinImgObject, 'click', Function.createDelegate(this, this._doClick));}
if (this._isPinnable && this._pinned)
{
this._showTargetControl(true);}
else
{
this._showTargetControl(false);}
}
else
{
this._parentDiv = this._ctlObject;}
$addHandler(this._parentDiv, 'mouseover', Function.createDelegate(this, this._doMouseOver));$addHandler(this._parentDiv, 'mouseout', Function.createDelegate(this, this._doMouseOut));this._setOpacity(this._mouseOutOpacity);},
_getPinnedImage : function()
{
if (this._isPinnable)
{
return this._isPinned ? this._pinnedImageUrl : this._unpinnedImageUrl;}
},
_onThumbImageLoaded : function()
{
this._setImagePosition(this._thumbImgObject, this._thumbnailImageAlignment);},
_onPinImageLoaded : function()
{
this._setImagePosition(this._pinImgObject, ESRI.ADF.System.ContentAlignment.TopRight);},
_setImagePosition : function(imageObject, alignment)
{
var imgBounds = $common.getBounds(imageObject);var ctlBounds = $common.getBounds(this._ctlObject);var x = 0;var y = 0;switch (alignment) {
case ESRI.ADF.System.ContentAlignment.TopCenter:
case ESRI.ADF.System.ContentAlignment.MiddleCenter:
case ESRI.ADF.System.ContentAlignment.BottomCenter:
x += Math.max(0, Math.floor(ctlBounds.width / 2.0 - imgBounds.width / 2.0));break;case ESRI.ADF.System.ContentAlignment.TopRight:
case ESRI.ADF.System.ContentAlignment.MiddleRight:
case ESRI.ADF.System.ContentAlignment.BottomRight:
x += Math.max(0, ctlBounds.width - imgBounds.width);break;}
switch (alignment) {
case ESRI.ADF.System.ContentAlignment.MiddleLeft:
case ESRI.ADF.System.ContentAlignment.MiddleCenter:
case ESRI.ADF.System.ContentAlignment.MiddleRight:
y += Math.max(0, Math.floor(ctlBounds.height / 2.0 - imgBounds.height / 2.0));break;case ESRI.ADF.System.ContentAlignment.BottomLeft:
case ESRI.ADF.System.ContentAlignment.BottomCenter:
case ESRI.ADF.System.ContentAlignment.BottomRight:
y += Math.max(0, ctlBounds.height - imgBounds.height);break;}
Sys.UI.DomElement.setLocation(imageObject, x, y);},
_setPinnable : function ()
{
this._isPinnable = (this._pinnedImageUrl !== "") && (this._unpinnedImageUrl !== "");},
_setOpacity : function(opacity) {
ESRI.ADF.System.setOpacity(this._parentDiv, opacity);},
_showTargetControl : function(boolVal)
{
if (this._isThumbable)
{
if (!boolVal && this._isPinned)
{
return;}
this._ctlObject.style.visibility = boolVal ? "visible" : "hidden";if (this._isPinnable)
{
this._pinImgObject.style.visibility = boolVal ? "visible" : "hidden";}
boolVal = !boolVal;this._thumbImgObject.style.visibility = boolVal ? "visible" : "hidden";}
},
_doMouseOver : function (e)
{
this._setOpacity(this._mouseOverOpacity);this._showTargetControl(true);},
_doMouseOut : function (e)
{
this._setOpacity(this._mouseOutOpacity);this._showTargetControl(false);},
_doClick : function (e)
{
this.setPinned(!this._isPinned);},
setPinned : function(boolVal)
{
if (this._isPinnable)
{
this._isPinned = boolVal;this._pinImgObject.src = this._getPinnedImage();if (this._isPinned)
{
this._showTargetControl(true);}
}
},
get_mouseOverOpacity : function() {
return this._mouseOverOpacity;},
set_mouseOverOpacity : function(value) {
if (this._mouseOverOpacity != value) {
this._mouseOverOpacity = value;this.raisePropertyChanged('mouseOverOpacity');}
},
get_mouseOutOpacity : function() {
return this._mouseOutOpacity;},
set_mouseOutOpacity : function(value) {
if (this._mouseOutOpacity != value) {
this._mouseOutOpacity = value;this.raisePropertyChanged('mouseOutOpacity');}
},
get_thumbnailImageUrl : function() {
return this._thumbnailImageUrl;},
set_thumbnailImageUrl : function(value) {
if (this._thumbnailImageUrl != value) {
this._thumbnailImageUrl = value;this._isThumbable = this._thumbnailImageUrl === "" ? false : true;this.raisePropertyChanged('thumbnailImageUrl');}
},
get_thumbnailImageAlignment : function() {
return this._thumbnailImageAlignment;},
set_thumbnailImageAlignment : function(value) {
if (this._thumbnailImageAlignment != value) {
this._thumbnailImageAlignment = value;this.raisePropertyChanged('thumbnailImageAlignment');}
},
get_pinnedImageUrl : function() {
return this._pinnedImageUrl;},
set_pinnedImageUrl : function(value) {
if (this._pinnedImageUrl != value) {
this._pinnedImageUrl = value;this._setPinnable();this.raisePropertyChanged('pinnedImageUrl');}
},
get_unpinnedImageUrl : function() {
return this._unpinnedImageUrl;},
set_unpinnedImageUrl : function(value) {
if (this._unpinnedImageUrl != value) {
this._unpinnedImageUrl = value;this._setPinnable();this.raisePropertyChanged('unpinnedImageUrl');}
},
get_pinned : function() {
return this._pinned;},
set_pinned : function(value) {
if (this._pinned != value) {
this._pinned = value;this.raisePropertyChanged('pinned');}
}
};ESRI.ADF.Extenders.HoverExpand.registerClass('ESRI.ADF.Extenders.HoverExpand', AjaxControlToolkit.BehaviorBase);if (typeof(Sys) !== "undefined") { Sys.Application.notifyScriptLoaded();}

if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();