ASPxClientNavBar = _aspxCreateClass(ASPxClientControl, {
 constructor: function(name){
  this.constructor.prototype.constructor.call(this, name);
  this.animationOffset = 10;
  this.animationDelay = 10;
  this.animationMaxDelay = 400;
  this.autoCollapse = false;
  this.allowExpanding = true;
  this.allowSelectItem = false;
  this.cookieName = "";
  this.groupCount = 0;
  this.enableAnimation = false;
  this.groups = [];
  this.groupsExpanding = new Array();
  this.groupsExpandingRequest = [];
  this.mouseOverActionDelay = 300;
  this.mouseOverActionTimerID = -1;
  this.ItemClick = new ASPxClientEvent();
  this.ExpandedChanged = new ASPxClientEvent();
  this.ExpandedChanging = new ASPxClientEvent();
  this.HeaderClick = new ASPxClientEvent();
 }, 
 InlineInitialize: function(){
  this.InitializeSelectedItem();
  this.InitializeEnabledAndVisible();
 },
 InitializeEnabledAndVisible: function(){
  for(var i = 0; i < this.groups.length; i++){
   var group = this.groups[i];
   for(var j = 0; j < group.items.length; j++){
    this.SetItemEnabled(i, j, group.items[j].clientEnabled, true);
    this.SetItemVisible(i, j, group.items[j].clientVisible, true);
   }
   this.SetGroupVisible(i, group.clientVisible, true);
  }
 },
 InitializeSelectedItem: function(){
  if(!this.allowSelectItem) return;
  this.SelectItem(this.GetSelectedItemIndexPath());
 },
 InitializeCallBackData: function(){
  for(var i = 0; i < this.GetGroupCountCore(); i ++){
   if(this.groupsExpanding[i]){
    var element = this.GetGroupContentElement(i);
    if(element != null) element.loaded = true;
   }
  }
 }, 
 GetClickableGroupHeaderElement: function(index) {
  var isDisplayed = false;
  var element = this.GetGroupHeaderExpandedElement(index);
  if (element != null) isDisplayed = !_aspxGetElementDisplay(element) || !this.allowExpanding ;
  if (!isDisplayed)
   element = this.GetGroupHeaderCollapsedElement(index);
  return element;
 },
 GetGroupHeaderExpandedElement: function(index){
  return this.GetChild("_GHE" + index);
 },
 GetGroupHeaderCollapsedElement: function(index){
  return this.GetChild("_GHC" + index);
 },
 GetGroupContentElement: function(index){
  return this.GetChild("_GC" + index);
 },
 GetGroupContentAnimationElement: function(index){
  return this.GetChild("_GCA" + index);
 },
 GetRowElement: function(cellElement){
  return cellElement.parentNode;
 },
 GetItemElement: function(groupIndex, itemIndex){
  return this.GetChild("_I" + this.GetIndexPath(groupIndex, itemIndex) + "_");
 },
 GetItemSeparatorElement: function(groupIndex, itemIndex){
  return this.GetChild("_I" + this.GetIndexPath(groupIndex, itemIndex) + "S");
 },
 GetItemTextElementByIndexPath: function(indexPath){
  return this.GetChild("_I" + indexPath + "_T");
 },
 GetItemImageElementByIndexPath: function(indexPath){
  return this.GetChild("_I" + indexPath + "_I");
 },
 GetGroupRow: function(groupIndex){
  return this.GetChild("_GR" + groupIndex);
 },
 GetGroupSeparatorRow: function(groupIndex){
  return this.GetChild("_GSR" + groupIndex);
 },
 GetGroupStateInputElement: function(index){
  return _aspxGetElementById(this.name + "GS");
 },
 GetSelectedItemInputElement: function(){
  return _aspxGetElementById(this.name + "SI");
 },
 DoItemClick: function(groupIndex, itemIndex, hasItemLink, htmlEvent){
  var processOnServer = this.RaiseItemClick(groupIndex, itemIndex, htmlEvent);
  if(processOnServer && !hasItemLink)
   this.SendPostBack("CLICK:" + this.GetIndexPath(groupIndex, itemIndex));
 },
 GetAutoCollapseCoGroupIndex: function(groupIndex){
  if(this.autoCollapse){
   for(var i = 0; i < this.GetGroupCountCore(); i ++){
    if(i != groupIndex && this.groupsExpanding[i])
     return i;
   }
  }
  return -1;
 },
 SetExpandedInternal: function(groupIndex, expanded){
  if(expanded == this.groupsExpanding[groupIndex]) return;
  var processingMode = this.RaiseExpandedChanging(groupIndex);
  if(processingMode == "Client"){
   if(expanded || !this.autoCollapse)
    this.ChangeExpanding(groupIndex, expanded);
  }
  else if(processingMode == "Server")
   this.SendPostBack("EXPAND:" + groupIndex);
 },
 ChangeExpanding: function(groupIndex, expanded){
  var element = this.GetGroupContentElement(groupIndex);
  if(expanded && _aspxIsFunction(this.callBack)  && element != null && !element.loaded){
   this.DoChangeExpanding(groupIndex, expanded, false);
   if(!element.loading){
    element.loading = true;
    this.CreateLoadingPanelInsideContainer(this.GetGroupContentElement(groupIndex));
    this.CreateCallback(groupIndex);
    _aspxArrayPush(this.groupsExpandingRequest, groupIndex);
   }
  }
  else{
   this.DoChangeExpanding(groupIndex, expanded, this.enableAnimation);
   if(!this.enableAnimation)
    this.RaiseExpandedChanged(groupIndex);
  }
 },
 DoChangeExpanding: function(groupIndex, expanded, doAnimation){
  var autoCollapseCoGroupIndex = this.GetAutoCollapseCoGroupIndex(groupIndex);
  this.ChangeGroupExpandState(groupIndex, expanded);
  if(autoCollapseCoGroupIndex > -1)
   this.ChangeGroupExpandState(autoCollapseCoGroupIndex, !expanded);
  if(doAnimation){
   var element = this.GetGroupContentAnimationElement(groupIndex);
   if(element != null){
    var controlHeight = this.GetMainElement().offsetHeight;
    this.PrepareGroupElementsForAnimation(groupIndex, expanded, 0);
    if(autoCollapseCoGroupIndex > -1){
     var heightDelta = controlHeight - this.GetMainElement().offsetHeight;
     this.PrepareGroupElementsForAnimation(autoCollapseCoGroupIndex, !expanded, heightDelta);
    }
    element.expanding = expanded;
    element.animationCount = 1;
    element.animationStart = new Date();
    element.autoCollapseCoGroupIndex = autoCollapseCoGroupIndex;
    element.timerID = window.setTimeout("aspxNBAnimT(\"" + this.name + "\", " + groupIndex + ")", this.animationDelay);
    return;
   }
  }
  this.ChangeGroupElementsExpandState(groupIndex, expanded);
  if(autoCollapseCoGroupIndex > -1)
   this.ChangeGroupElementsExpandState(autoCollapseCoGroupIndex, !expanded);
 },
 PrepareGroupElementsForAnimation: function(groupIndex, expanding, heightCorrection){
  var element = this.GetGroupContentAnimationElement(groupIndex);
  var contentElement = this.GetGroupContentElement(groupIndex);
  if(element == null || contentElement == null) return;
  element.style.overflow = "hidden";
  if(expanding){
   element.style.height = "0px";
   _aspxSetElementDisplay(this.GetRowElement(contentElement), true);
   if(__aspxNetscapeFamily && !__aspxFirefox){
    var innerElement = _aspxGetChildByTagName(element, "TABLE", 0);
    if(innerElement != null)
     element.style.width = innerElement.offsetWidth + "px";
    else{
     innerElement = _aspxGetChildByTagName(element, "UL", 0);
     if(innerElement != null)
      element.style.width = element.clientWidth + "px";
    }
   }
  }
  else{
   var height = element.offsetHeight + heightCorrection;
   if(height < 0) height = element.offsetHeight;
   element.style.height = height + "px";
  } 
 },
 ChangeGroupExpandState: function(groupIndex, expanded){
  this.groupsExpanding[groupIndex] = expanded;
  this.UpdateGroupStateInputElement();
  this.UpdateGroupStateCookie();
 },
 ChangeGroupElementsExpandState: function(groupIndex, expanded){
  var element = this.GetGroupContentElement(groupIndex);
  if(element != null) _aspxSetElementDisplay(this.GetRowElement(element), expanded);
  element = this.GetGroupHeaderExpandedElement(groupIndex);
  if(element != null) _aspxSetElementDisplay(this.GetRowElement(element), expanded);
  element = this.GetGroupHeaderCollapsedElement(groupIndex);
  if(element != null) _aspxSetElementDisplay(this.GetRowElement(element), !expanded);
  if (expanded)
   aspxGetControlCollection().AdjustControls(this.GetGroupContentElement(groupIndex), __aspxCheckSizeCorrectedFlag);
 },
 GetGroupCountCore: function(){
  return (this.groups.length > 0) ? this.groups.length : this.groupCount;
 },
 GetIndexPath: function(groupIndex, itemIndex){
  return (groupIndex != -1 && itemIndex != -1) ? groupIndex + __aspxItemIndexSeparator + itemIndex : "";
 },
 GetGroupIndex: function(indexPath){
  var indexes = indexPath.split(__aspxItemIndexSeparator);
  return (indexes.length > 0) ? indexes[0] : -1;
 },
 GetItemIndex: function(indexPath){
  var indexes = indexPath.split(__aspxItemIndexSeparator);
  return (indexes.length > 1) ? indexes[1] : -1;
 },
 GetGroupState: function(){
  var state = "";
  for(var i = 0; i < this.GetGroupCountCore(); i ++) {
   state += this.groupsExpanding[i] ? "1" : "0";
   if(i < this.GetGroupCountCore() - 1) state += ";";
  }
  return state;
 },
 UpdateGroupStateCookie: function(){
  if(this.cookieName == "") return;
  _aspxDelCookie(this.cookieName);
  _aspxSetCookie(this.cookieName, this.GetGroupState());
 },
 UpdateGroupStateInputElement: function(){
  var element = this.GetGroupStateInputElement();
  if(element != null) element.value = this.GetGroupState();
 },
 SelectItem: function(indexPath){
  element = this.GetItemTextElementByIndexPath(indexPath);
  if(element != null)
   aspxGetStateController().SelectElementBySrcElement(element);
 },
 DeselectItem: function(indexPath){
  var element = this.GetItemTextElementByIndexPath(indexPath);
  if(element != null)
   aspxGetStateController().DeselectElementBySrcElement(element);
 },
 GetSelectedItemIndexPath: function(){
  var inputElement = this.GetSelectedItemInputElement();
  if(inputElement != null)
   return inputElement.value;
  return ""; 
 },
 SetSelectedItemInternal: function(groupIndex, itemIndex){
  var indexPath = this.GetIndexPath(groupIndex, itemIndex);
  if(this.allowSelectItem){
   var inputElement = this.GetSelectedItemInputElement();
   if(inputElement != null){
    this.DeselectItem(inputElement.value);
    inputElement.value = indexPath;
    var item = _aspxIsExists(this.GetGroup(groupIndex)) ? this.GetGroup(groupIndex).GetItem(itemIndex) : null;
    if(item == null || item.GetEnabled())
     this.SelectItem(inputElement.value);
   }
  }
 },
 OnAnimationTimer: function(groupIndex){
  var element = this.GetGroupContentAnimationElement(groupIndex);
  if(element != null){
   window.clearTimeout(element.timerID);
   var autoCollapseCoGroupIndex = element.autoCollapseCoGroupIndex;
   var animationOffset = this.animationOffset * element.animationCount;
   var height = element.offsetHeight + (element.expanding ? animationOffset : -animationOffset);
   var innerElement = _aspxGetChildByTagName(element, "TABLE", 0);
   if(innerElement == null)
    innerElement = _aspxGetChildByTagName(element, "UL", 0);
   var finished = (element.expanding ? (height >= innerElement.offsetHeight) : (height <= 0)) ||
    (new Date() - element.animationStart > this.animationMaxDelay);
   if(finished){
    this.ChangeGroupElementsExpandState(groupIndex, element.expanding);
    if(autoCollapseCoGroupIndex > -1)
     this.ChangeGroupElementsExpandState(autoCollapseCoGroupIndex, !element.expanding);
    element.style.overflow = "";
    element.style.height = "";
    element.style.width = "";
    this.RaiseExpandedChanged(groupIndex);
    if(autoCollapseCoGroupIndex > -1)
     this.RaiseExpandedChanged(groupIndex);
   }
   else{
    element.style.height = height + "px";
    if(autoCollapseCoGroupIndex > -1){
     var coGroupElement = this.GetGroupContentAnimationElement(autoCollapseCoGroupIndex);
     if(coGroupElement != null){
      var coGroupHeight = coGroupElement.offsetHeight + (!element.expanding ? animationOffset : -animationOffset);
      if(coGroupHeight <= 0) coGroupHeight = 1;
      coGroupElement.style.height = coGroupHeight + "px";
     }
    }
    element.animationCount ++;
    element.timerID = window.setTimeout("aspxNBAnimT(\"" + this.name + "\", " + groupIndex + ")", this.animationDelay);
   }
  }
 },
 OnHeaderClick: function(groupIndex, evt){
  this.ClearMouseMoverTimer();
  var processingMode = this.RaiseHeaderClick(groupIndex, evt);
  var linkElement = (evt != null) ? _aspxGetParentByTagName(_aspxGetEventSource(evt), "A") : null;
  if(linkElement == null || linkElement.href == __aspxAccessibilityEmptyUrl){
   if(processingMode == "Client" && this.allowExpanding){
    var expanded = this.groupsExpanding[groupIndex];
    this.SetExpandedInternal(groupIndex, !expanded);
    if(evt != null)
     aspxUpdateHoverState(evt);
   }
   else if(processingMode == "Server")
    this.SendPostBack("HEADERCLICK:" + groupIndex);
  }
 },
 OnHeaderMouseMove: function(groupIndex, evt){
  if(ASPxClientNavBar.MouseOverActiveNavBar != this || ASPxClientNavBar.MouseOverActiveGroupIndex != groupIndex){
   ASPxClientNavBar.MouseOverActiveNavBar = this; 
   ASPxClientNavBar.MouseOverActiveGroupIndex = groupIndex;
   this.ClearMouseMoverTimer();
   this.mouseOverActionTimerID = _aspxSetTimeout("aspxNBHMMoveTimer(\"" + this.name + "\", " + groupIndex + ");", this.mouseOverActionDelay);
  }
 },
 OnHeaderMouseMoveTimer: function(groupIndex){
  this.ClearMouseMoverTimer();
  if(ASPxClientNavBar.MouseOverActiveNavBar == this || ASPxClientNavBar.MouseOverActiveGroupIndex == groupIndex)
   this.OnHeaderClick(groupIndex, null)
 },
 ClearMouseMoverTimer: function(){
  if(this.mouseOverActionTimerID > -1){
   _aspxClearTimer(this.mouseOverActionTimerID);
   this.mouseOverActionTimerID = -1;
  }
 },
 OnItemClick: function(groupIndex, itemIndex, evt){
  var element = this.GetItemElement(groupIndex, itemIndex);
  var clickedLinkElement = _aspxGetParentByTagName(_aspxGetEventSource(evt), "A");
  var isLinkClicked = (clickedLinkElement != null && clickedLinkElement.href != __aspxAccessibilityEmptyUrl);
  var linkElement = (element != null) ? _aspxGetChildByTagName(element, "A", 0) : null;
  if(linkElement != null && linkElement.href == __aspxAccessibilityEmptyUrl)
   linkElement = null;
  aspxClearHoverState();
  this.SetSelectedItemInternal(groupIndex, itemIndex);
  aspxUpdateHoverState(evt);
  this.DoItemClick(groupIndex, itemIndex, isLinkClicked || (linkElement != null), evt);
  if(!isLinkClicked && linkElement != null) 
   _aspxNavigateUrl(linkElement.href, linkElement.target);
 },
 OnCallbackInternal: function(html, index, isError){
  this.SetCallbackContent(html, index, isError);
  if(!isError)
   this.RaiseExpandedChanged(index);
  _aspxArrayRemoveAt(this.groupsExpandingRequest, 0);
 },
 OnCallback: function(result){
  this.OnCallbackInternal(result.html, result.index, false);
 },
 OnCallbackError: function(result, data){
  this.OnCallbackInternal(result, data, true);
 },
 OnCallbackGeneralError: function(result){
  var callbackGroupIndex = (this.groupsExpandingRequest.length > 0) ? this.groupsExpandingRequest[0] : 0;
  this.SetCallbackContent(result, callbackGroupIndex, true);
  _aspxArrayRemoveAt(this.groupsExpandingRequest, 0);
 },
 SetCallbackContent: function(html, index, isError) {
  var element = this.GetGroupContentElement(index);
  if(element != null) {
   _aspxSetInnerHtml(element, html);
   if(!isError)
    element.loaded = true;
   element.loading = false;
  }
 },
 CreateGroups: function(groupsProperties){
  for(var i = 0; i < groupsProperties.length; i ++){
   var groupName = _aspxIsExists(groupsProperties[i][0]) ? groupsProperties[i][0] : "";
   var group = new ASPxClientNavBarGroup(this, i, groupName);
   if(_aspxIsExists(groupsProperties[i][1]))
    group.enabled = groupsProperties[i][1];
   if(_aspxIsExists(groupsProperties[i][2]))
    group.visible = groupsProperties[i][2];
   if(_aspxIsExists(groupsProperties[i][3]))
    group.clientVisible = groupsProperties[i][3];
   _aspxArrayPush(this.groups, group);
   group.CreateItems(groupsProperties[i][4]);
  }
 },
 RaiseItemClick: function(groupIndex, itemIndex, htmlEvent){
  var processOnServer = this.autoPostBack || this.IsServerEventAssigned("ItemClick");
  if(!this.ItemClick.IsEmpty()){
   var htmlElement = this.GetItemElement(groupIndex, itemIndex);   
   var args = new ASPxClientNavBarItemEventArgs(processOnServer, this.GetGroup(groupIndex).GetItem(itemIndex), htmlElement, htmlEvent);
   this.ItemClick.FireEvent(this, args);
   processOnServer = args.processOnServer;
  }
  return processOnServer;
 },
 RaiseExpandedChanged: function(groupIndex){
  if(!this.ExpandedChanged.IsEmpty()){
   var args = new ASPxClientNavBarGroupEventArgs(this.GetGroup(groupIndex));
   this.ExpandedChanged.FireEvent(this, args);
  }
 },
 RaiseExpandedChanging: function(groupIndex){
  var processingMode = this.autoPostBack ? "Server" : "Client";
  if(!this.ExpandedChanging.IsEmpty()){
   var args = new ASPxClientNavBarGroupCancelEventArgs(processingMode == "Server", this.GetGroup(groupIndex));
   this.ExpandedChanging.FireEvent(this, args);
   if(args.cancel)
    processingMode = "Handled";
   else 
    processingMode = args.processOnServer ? "Server" : "Client";
  }
  return processingMode;
 },
 RaiseHeaderClick: function(groupIndex, htmlEvent){
  var processingMode = this.autoPostBack || this.IsServerEventAssigned("HeaderClick") ? "Server" : "Client";
  if(!this.HeaderClick.IsEmpty()){
   var htmlElement = this.GetClickableGroupHeaderElement(groupIndex);
   var args = new ASPxClientNavBarGroupClickEventArgs(processingMode == "Server", this.GetGroup(groupIndex), htmlElement, htmlEvent);
   this.HeaderClick.FireEvent(this, args);
   if(args.cancel)
    processingMode = "Handled";
   else 
    processingMode = args.processOnServer ? "Server" : "Client";
  }
  return processingMode;
 },
 GetGroupCount: function(){
  return this.groups.length;
 },
 GetGroup: function(index){
  return (0 <= index && index < this.groups.length) ? this.groups[index] : null;
 },
 GetGroupByName: function(name){
  for(var i = 0; i < this.groups.length; i ++)
   if(this.groups[i].name == name) return this.groups[i];
  return null;
 },
 GetActiveGroup: function(){
  if(this.autoCollapse) {
   for(var i = 0; i < this.groups.length; i ++){
    if(this.groups[i].GetExpanded())
     return this.groups[i];
   }
  }
  return null;
 },
 SetActiveGroup: function(group){
  if(this.autoCollapse && group != null) 
   group.SetExpanded(true);
 },
 GetItemByName: function(name){
  for(var i = 0; i < this.groups.length; i ++){
   var item = this.groups[i].GetItemByName(name);
   if(item != null) return item;
  }
  return null;
 },
 GetSelectedItem: function(){
  var indexPath = this.GetSelectedItemIndexPath();
  if(indexPath != ""){
    var groupIndex = this.GetGroupIndex(indexPath);
    var itemIndex = this.GetItemIndex(indexPath);
    if(groupIndex > -1 && itemIndex > -1)
    return this.GetGroup(groupIndex).GetItem(itemIndex);
  }
  return null;
 },
 SetSelectedItem: function(item){
  var groupIndex = (item != null) ? item.group.index : -1;
  var itemIndex = (item != null) ? item.index : -1;
  this.SetSelectedItemInternal(groupIndex, itemIndex);
 },
 CollapseAll: function(){
  for(var i = 0; i < this.groupsExpanding.length; i++){
   if(this.groupsExpanding[i])
    this.SetExpandedInternal(i, false);
  }    
 },
 ExpandAll: function(){
  for(var i = 0; i < this.groupsExpanding.length; i++){
   if(!this.groupsExpanding[i])
    this.SetExpandedInternal(i, true);
  }    
 },
 ChangeItemElementsEnabledAttributes: function(groupIndex, itemIndex, method, styleMethod){
  var indexPath = this.GetIndexPath(groupIndex, itemIndex);
  var imageElement = this.GetItemImageElementByIndexPath(indexPath);
  if(_aspxIsExists(imageElement)){
   method(imageElement, "onclick");
   styleMethod(imageElement, "cursor");
      var link = this.GetInternalHyperlinkElement(imageElement, 0);
      if(link != null){
       method(link, "href");
       styleMethod(link, "cursor");
      }
  }
  var textElement = this.GetItemTextElementByIndexPath(indexPath);
  if(_aspxIsExists(textElement)){
   method(textElement, "onclick");
   styleMethod(textElement, "cursor");
      var link = this.GetInternalHyperlinkElement(textElement, 0);
      if(link != null){
       method(link, "href");
       styleMethod(link, "cursor");
       link = this.GetInternalHyperlinkElement(textElement, 1);
       if(link != null){
        method(link, "href");
        styleMethod(link, "cursor");
       }
      }
  }
  var itemElement = this.GetItemElement(groupIndex, itemIndex);
  if(_aspxIsExists(itemElement)){
   method(itemElement, "onclick");
   if(imageElement == null && textElement == null){
    styleMethod(itemElement, "cursor");
       var link = this.GetInternalHyperlinkElement(itemElement, 0);
       if(link != null){
        method(link, "href");
        styleMethod(link, "cursor");
       }
      }
  }
 },
 SetItemEnabled: function(groupIndex, itemIndex, enabled, initialization){
  if(!this.groups[groupIndex].items[itemIndex].enabled) return;
  var indexPath = this.GetIndexPath(groupIndex, itemIndex);
  if(!enabled){
   if(this.GetSelectedItemIndexPath() == indexPath)
    this.DeselectItem(indexPath);
  }
  if(!initialization || !enabled)
   this.ChangeItemEnabledStateItems(groupIndex, itemIndex, enabled);
  this.ChangeItemEnabledAttributes(groupIndex, itemIndex, enabled);
  if(enabled){
   if(this.GetSelectedItemIndexPath() == indexPath)
    this.SelectItem(indexPath);
  }
 },
 ChangeItemEnabledAttributes: function(groupIndex, itemIndex, enabled){
  this.ChangeItemElementsEnabledAttributes(groupIndex, itemIndex, _aspxChangeAttributesMethod(enabled), 
   _aspxChangeStyleAttributesMethod(enabled));
 },
 ChangeItemEnabledStateItems: function(groupIndex, itemIndex, enabled){
  var indexPath = this.GetIndexPath(groupIndex, itemIndex);
  var element = this.GetItemTextElementByIndexPath(indexPath);
  if(element == null)
   element = this.GetItemImageElementByIndexPath(indexPath);
  if(element == null)
   element = this.GetItemElement(groupIndex, itemIndex);
  if(element != null)
   aspxGetStateController().SetElementEnabled(element, enabled);
 },
 GetItemImageUrl: function(groupIndex, itemIndex){
  var indexPath = this.GetIndexPath(groupIndex, itemIndex);
  var element = this.GetItemImageElementByIndexPath(indexPath);
  if(element != null){
   var img = _aspxGetChildByTagName(element, "IMG", 0);
   if(img != null)
    return img.src;
  }
  element = this.GetItemTextElementByIndexPath(indexPath);
  if(element != null){
   var img = _aspxGetChildByTagName(element, "IMG", 0);
   if(img != null)
    return img.src;
  }
  return "";
 },
 SetItemImageUrl: function(groupIndex, itemIndex, url){
  var indexPath = this.GetIndexPath(groupIndex, itemIndex);
  var element = this.GetItemImageElementByIndexPath(indexPath);
  if(element != null){
   var img = _aspxGetChildByTagName(element, "IMG", 0);
   if(img != null)
    img.src = url;
  }
  element = this.GetItemTextElementByIndexPath(indexPath);
  if(element != null){
   var img = _aspxGetChildByTagName(element, "IMG", 0);
   if(img != null)
    img.src = url;
  }
 },
 GetItemNavigateUrl: function(groupIndex, itemIndex){
  var indexPath = this.GetIndexPath(groupIndex, itemIndex);
  var element = this.GetItemTextElementByIndexPath(indexPath);
  if(element != null){
   var link = _aspxGetChildByTagName(element, "A", 0);
   if(link != null)
    return link.href;
  }
  else{
   element = this.GetItemImageElementByIndexPath(indexPath);
   if(element != null){
    var link = _aspxGetChildByTagName(element, "A", 0);
    if(link != null)
     return link.href;
   }
   else{
    element = this.GetItemElement(groupIndex, itemIndex);
    if(element != null){
     var link = _aspxGetChildByTagName(element, "A", 0);
     if(link != null)
      return link.href;
    }
   }
  }
  return "";
 },
 SetItemNavigateUrl: function(groupIndex, itemIndex, url){
  var indexPath = this.GetIndexPath(groupIndex, itemIndex);
  var textElement = this.GetItemTextElementByIndexPath(indexPath);
  if(textElement != null){
   var link = _aspxGetChildByTagName(textElement, "A", 0);
   if(link != null){
    link.href = url;
    link = _aspxGetChildByTagName(textElement, "A", 1);
    if(link != null)
     link.href = url;
   }
  }
  var imageElement = this.GetItemImageElementByIndexPath(indexPath);
  if(imageElement != null){
   var link = _aspxGetChildByTagName(imageElement, "A", 0);
   if(link != null)
    link.href = url;
  }
  if(textElement == null && imageElement == null){
   var element = this.GetItemElement(groupIndex, itemIndex);
   if(element != null){
    var link = _aspxGetChildByTagName(element, "A", 0);
    if(link != null)
     link.href = url;
   }
  }
 },
 GetItemText: function(groupIndex, itemIndex){
  var indexPath = this.GetIndexPath(groupIndex, itemIndex);
  var element = this.GetItemTextElementByIndexPath(indexPath);
  if(element == null)
   element = this.GetItemElement(groupIndex, itemIndex);
  if(element != null){
   var textNode = _aspxGetChildTextNode(element, 0);
   if(textNode != null)
    return textNode.nodeValue;
  }
  return "";
 },
 SetItemText: function(groupIndex, itemIndex, text){
  var indexPath = this.GetIndexPath(groupIndex, itemIndex);
  var element = this.GetItemTextElementByIndexPath(indexPath);
  if(element == null)
   element = this.GetItemElement(groupIndex, itemIndex);
  if(element != null){
   var textNode = _aspxGetChildTextNode(element, 0);
   if(textNode != null)
    textNode.nodeValue = text;
  }
 },
 SetItemVisible: function(groupIndex, itemIndex, visible, initialization){
  if(!this.groups[groupIndex].items[itemIndex].visible) return;
  if(visible && initialization) return;
  var element = this.GetItemElement(groupIndex, itemIndex);
  if(element != null) _aspxSetElementDisplay(element, visible);
  this.SetItemSeparatorsVisiblility(groupIndex);
 },
 SetItemSeparatorsVisiblility: function(groupIndex){
  var group = this.groups[groupIndex];
  for(var i = 0; i < group.items.length; i++){
   var separatorVisible = group.items[i].GetVisible() && this.HasNextVisibleItems(group, i);
   var separatorElement = this.GetItemSeparatorElement(groupIndex, i);
   if(separatorElement != null) _aspxSetElementDisplay(separatorElement, separatorVisible);
  }
 },
 HasNextVisibleItems: function(group, index){
  for(var i = index + 1; i < group.items.length; i++){
   if(group.items[i].GetVisible())
    return true;
  }
  return false;
 },
 SetGroupVisible: function(groupIndex, visible, initialization){
  if(!this.groups[groupIndex].visible) return;
  if(visible && initialization) return;
  var element = this.GetGroupRow(groupIndex);
  if(element != null) _aspxSetElementDisplay(element, visible);
  this.SetGroupSeparatorsVisiblility();
 },
 SetGroupSeparatorsVisiblility: function(){
  for(var i = 0; i < this.groups.length; i++){
   var separatorVisible = this.groups[i].GetVisible() && this.HasNextVisibleGroups(i);
   var separatorElement = this.GetGroupSeparatorRow(i);
   if(separatorElement != null) _aspxSetElementDisplay(separatorElement, separatorVisible);
  }
 },
 HasNextVisibleGroups: function(index){
  for(var i = index + 1; i < this.groups.length; i++){
   if(this.groups[i].GetVisible())
    return true;
  }
  return false;
 }
});
ASPxClientNavBarGroup = _aspxCreateClass(null, {
 constructor: function(navBar, index, name){
  this.navBar = navBar;
  this.index = index;
  this.name = name;
  this.enabled = true;
  this.visible = true;
  this.clientVisible = true;
  this.items = []; 
 },
 CreateItems: function(itemsProperties){
  for(var i = 0; i < itemsProperties.length; i ++){
   var itemName = _aspxIsExists(itemsProperties[i][0]) ? itemsProperties[i][0] : "";
   var item = new ASPxClientNavBarItem(this.navBar, this, i, itemName);
   if(_aspxIsExists(itemsProperties[i][1]))
    item.enabled = itemsProperties[i][1];
   if(_aspxIsExists(itemsProperties[i][2]))    
    item.clientEnabled = itemsProperties[i][2];
   if(_aspxIsExists(itemsProperties[i][3]))
    item.visible = itemsProperties[i][3];
   if(_aspxIsExists(itemsProperties[i][4]))
    item.clientVisible = itemsProperties[i][4];
   _aspxArrayPush(this.items, item);
  }
 },
 GetEnabled: function(){
  return this.enabled;
 },
 GetExpanded: function(){
  return this.navBar.groupsExpanding[this.index];
 },
 SetExpanded: function(value){
  this.navBar.SetExpandedInternal(this.index, value);
 },
 GetVisible: function(){
  return this.visible && this.clientVisible;
 },
 SetVisible: function(value){
  if (this.clientVisible != value) {
   this.clientVisible = value;
   this.navBar.SetGroupVisible(this.index, value, false);
  }
 },
 GetItemCount: function(groupIndex){
  return this.items.length;
 },
 GetItem: function(index){
  return (0 <= index && index < this.items.length) ? this.items[index] : null;
 },
 GetItemByName: function(name){
  for(var i = 0; i < this.items.length; i ++)
   if(this.items[i].name == name) return this.items[i];
  return null;
 }
});
ASPxClientNavBarItem = _aspxCreateClass(null, {
 constructor: function(navBar, group, index, name){
  this.navBar = navBar;
  this.group = group;
  this.index = index;
  this.name = name;
  this.enabled = true;
  this.clientEnabled = true;
  this.visible = true;
  this.clientVisible = true;
 },
 GetEnabled: function(){
  return this.enabled && this.clientEnabled;
 },
 SetEnabled: function(value){
  if (this.clientEnabled != value) {
   this.clientEnabled = value;
   this.navBar.SetItemEnabled(this.group.index, this.index, value, false);
  }
 },
 GetImageUrl: function(){
  return this.navBar.GetItemImageUrl(this.group.index, this.index);
 },
 SetImageUrl: function(value){
  this.navBar.SetItemImageUrl(this.group.index, this.index, value);
 },
 GetNavigateUrl: function(){
  return this.navBar.GetItemNavigateUrl(this.group.index, this.index);
 },
 SetNavigateUrl: function(value){
  this.navBar.SetItemNavigateUrl(this.group.index, this.index, value);
 },
 GetText: function(){
  return this.navBar.GetItemText(this.group.index, this.index);
 },
 SetText: function(value){
  this.navBar.SetItemText(this.group.index, this.index, value);
 },
 GetVisible: function(){
  return this.visible && this.clientVisible;
 },
 SetVisible: function(value){
  if (this.clientVisible != value) {
   this.clientVisible = value;
   this.navBar.SetItemVisible(this.group.index, this.index, value, false);
  }
 } 
});
ASPxClientNavBarItemEventArgs = _aspxCreateClass(ASPxClientProcessingModeEventArgs, {
 constructor: function(processOnServer, item, htmlElement, htmlEvent){
  this.constructor.prototype.constructor.call(this, processOnServer);
  this.item = item;
  this.htmlElement = htmlElement;
  this.htmlEvent = htmlEvent;
 }
});
ASPxClientNavBarGroupEventArgs = _aspxCreateClass(ASPxClientEventArgs, {
 constructor: function(group){
  this.group = group;
 }
});
ASPxClientNavBarGroupCancelEventArgs = _aspxCreateClass(ASPxClientCancelEventArgs, {
 constructor: function(processOnServer, group){
  this.constructor.prototype.constructor.call(this, processOnServer);
  this.group = group;
 }
});
ASPxClientNavBarGroupClickEventArgs = _aspxCreateClass(ASPxClientNavBarGroupCancelEventArgs, {
 constructor: function(processOnServer, group, htmlElement, htmlEvent){
  this.constructor.prototype.constructor.call(this, processOnServer, group);
  this.htmlElement = htmlElement;
  this.htmlEvent = htmlEvent;  
 }
});
function aspxNBAnimT(name, groupIndex){
 var nb = aspxGetControlCollection().Get(name);
 if(nb != null) nb.OnAnimationTimer(groupIndex);
}
function aspxNBHClick(evt, name, groupIndex){
 var nb = aspxGetControlCollection().Get(name);
 if(nb != null) nb.OnHeaderClick(groupIndex, evt);
 if(!__aspxNetscapeFamily)
  evt.cancelBubble = true;
 return true;
}
function aspxNBHMMove(evt, name, groupIndex){
 var nb = aspxGetControlCollection().Get(name);
 if(nb != null) nb.OnHeaderMouseMove(groupIndex, evt);
}
function aspxNBHMMoveTimer(name, groupIndex){
 var nb = aspxGetControlCollection().Get(name);
 if(nb != null) nb.OnHeaderMouseMoveTimer(groupIndex);
}
function aspxNBIClick(evt, name, groupIndex, itemIndex){
 var nb = aspxGetControlCollection().Get(name);
 if(nb != null) nb.OnItemClick(groupIndex, itemIndex, evt);
 if(!__aspxNetscapeFamily)
  evt.cancelBubble = true;
 return true;
}
ASPxClientNavBar.MouseOverActiveNavBar = null;
ASPxClientNavBar.MouseOverActiveGroupIndex = -1;
ASPxClientNavBar.DocMouseMoveHandler = function(evt) {
 if(ASPxClientNavBar.MouseOverActiveNavBar != null && ASPxClientNavBar.MouseOverActiveGroupIndex != -1){
  var srcElement = _aspxGetEventSource(evt);
  var headerElement = ASPxClientNavBar.MouseOverActiveNavBar.GetGroupHeaderExpandedElement(ASPxClientNavBar.MouseOverActiveGroupIndex);
  if(headerElement == null || (srcElement != headerElement && !_aspxGetIsParent(headerElement, srcElement))){
   headerElement = ASPxClientNavBar.MouseOverActiveNavBar.GetGroupHeaderCollapsedElement(ASPxClientNavBar.MouseOverActiveGroupIndex);
   if(headerElement == null || (srcElement != headerElement && !_aspxGetIsParent(headerElement, srcElement))){
    ASPxClientNavBar.MouseOverActiveNavBar = null;
    ASPxClientNavBar.MouseOverActiveGroupIndex = -1;
   }
  }
 }
};
_aspxAttachEventToDocument("mousemove", ASPxClientNavBar.DocMouseMoveHandler);
