﻿// Copyright (c) ComponentOne L.L.C., All rights reserved.
Type.registerNamespace("C1.Web.UI.Controls.C1HeaderContentControl");C1.Web.UI.Controls.C1HeaderContentControl.C1HeaderContentControl=function(a){this.$2_1=-1;this.$2_C={};this.$2_F=-1;this.$2_10=-1;this.$2_11=-1;this.$2_12=-1;C1.Web.UI.Controls.C1HeaderContentControl.C1HeaderContentControl.initializeBase(this,[a]);this.mainElement=a;this._propertiesState={};this.setHeaderContentClassNames();this.headerPanelElement=C1.Web.UI.Utils.Common.getElementByCssClass(this.get_element(),this._headerPanelClassName);this.contentPanelElement=C1.Web.UI.Utils.Common.getElementByCssClass(this.get_element(),this._contentPanelClassName)};C1.Web.UI.Controls.C1HeaderContentControl.C1HeaderContentControl.prototype={isCreatedDynamically:false,$2_0:null,$2_2:null,_propertiesState:null,_jsonHelper:null,_flowPanel:null,_isHover:false,_isMouseDown:false,_headerPanelClassName:null,_contentPanelClassName:null,setHeaderContentClassNames:function(){this._headerPanelClassName="C1hHeaderPanel";this._contentPanelClassName="C1hContentPanel"},headerPanelElement:null,contentPanelElement:null,mainElement:null,get_accessKey:function(){return(C1.Web.UI.Utils.Common.testIsNull(this._propertiesState.AccessKey))?"":this._propertiesState.AccessKey},set_accessKey:function(a){if(this.get_accessKey()!==""){C1.Web.UI.Utils.AccessKeyHelper.unRegisterAccessKey(this.get_accessKey(),this.get_element())}this._propertiesState.AccessKey=a;this.saveState();if(this.get_accessKey()!==""){C1.Web.UI.Utils.AccessKeyHelper.registerAccessKey(this.get_accessKey(),this.get_element(),this.get_$2_20())}return a},get_enabled:function(){return(C1.Web.UI.Utils.Common.testIsNull(this._propertiesState.Enabled))?true:this._propertiesState.Enabled},set_enabled:function(a){this.get_element().disabled=!a;this._propertiesState.Enabled=a;this.saveState();return a},get_visualStyle:function(){return(C1.Web.UI.Utils.Common.testIsNull(this._propertiesState.VisualStyle))?"":this._propertiesState.VisualStyle},set_visualStyle:function(c){var b=this.get_visualStyle();if(b!==""&&b!==c){var a=new RegExp("("+b+")","g");this._propertiesState.VisualStyle=c;var d=this.get_element().className;d=d.replace(a,c);this.restoreInitialLayout();this.get_element().className=d;this.invalidate()}return c},get_width:function(){return((!this._propertiesState.Width)?"":this._propertiesState.Width)},set_width:function(a){this._propertiesState.Width=a;this.saveState();this.invalidate();return a},get_height:function(){return((!this._propertiesState.Height)?"":this._propertiesState.Height)},set_height:function(a){this._propertiesState.Height=a;this.saveState();this.invalidate();return a},get_contentUrl:function(){return((C1.Web.UI.Utils.Common.testIsNull(this._propertiesState.ContentUrl))?"":this._propertiesState.ContentUrl)},set_contentUrl:function(a){this._propertiesState.ContentUrl=a;this.get_contentPanel().set_contentUrl(a);this.saveState();return a},get_autoPostBack:function(){return(C1.Web.UI.Utils.Common.testIsNull(this.get_propertiesState()["AutoPostBack"]))?false:this.get_propertiesState()["AutoPostBack"]},set_autoPostBack:function(a){this.get_propertiesState()["AutoPostBack"]=a;return a},get_displayVisible:function(){return((C1.Web.UI.Utils.Common.testIsNull(this._propertiesState.DisplayVisible))?true:this._propertiesState.DisplayVisible)},set_displayVisible:function(a){this._propertiesState.DisplayVisible=a;C1.Web.UI.Utils.Common.setVisible(this.mainElement,a);this.saveState();return a},get_suppressHeaderPostbacks:function(){return(this._propertiesState.SuppressHeaderPostbacks||false)},set_suppressHeaderPostbacks:function(a){this._propertiesState.SuppressHeaderPostbacks=a;return a},get_flowPanel:function(){if(!this._flowPanel){this._flowPanel=new C1.Web.UI.FlowPanel(this.$2_1F())}return this._flowPanel},get_headerPanel:function(){if(!this.$2_3){this.$2_3=this.createHeaderPanel()}return this.$2_3},get_contentPanel:function(){if(!this.$2_4){this.$2_4=this.createContentPanel()}return this.$2_4},$2_3:null,$2_4:null,get_headerSize:function(){return((C1.Web.UI.Utils.Common.testIsNull(this._propertiesState.HeaderSize))?"":this._propertiesState.HeaderSize)},set_headerSize:function(a){this.$2_19=null;this.$2_1A=null;this._propertiesState.HeaderSize=a;this.saveState();this.invalidate();return a},$2_5:null,$2_6:null,$2_7:null,$2_8:false,setDropTargets:function(b){if(this.$2_5){this.$2_5.dispose();this.$2_5=null}this.$2_6=b;if(!b){return}if(!this.$2_7){this.$2_7=document.createElement("div");this.$2_7.className="c1-drag-visual-sample"}this.$2_5=new C1.Web.UI.DragDrop(this.mainElement);this.$2_5.initialize();this.$2_5.set_useElementAsDragVisual(true);this.$2_5.set_useModalLayer(true);this.$2_5.set_startDragOnMouseMove(true);this.$2_5.add_dragStart(Function.createDelegate(this,this.ddobj_DragStart));this.$2_5.add_dropped(Function.createDelegate(this,this.ddobj_Dropped));this.$2_5.add_dragOver(Function.createDelegate(this,this.ddobj_DragOver));for(var a=0;a<this.$2_6.length;a++){if(this.$2_6[a].id!==this.get_id()){this.$2_5.setDropTarget(this.$2_6[a])}}this.$2_5.setDragHandle(this.get_headerPanel().element)},ddobj_DragStart:function(a,b){this.$2_8=false;Sys.UI.DomElement.addCssClass(this.mainElement,"c1-dragging-active");C1.Web.UI.Utils.Common.setSize(this.$2_7,new C1.Web.UI.Utils.Size(this.mainElement.offsetWidth,this.mainElement.offsetHeight));this.$2_7.style.position="";if(this.$2_7.parentNode){this.$2_7.parentNode.removeChild(this.$2_7)}this.mainElement.parentNode.insertBefore(this.$2_7,this.mainElement)},ddobj_DragOver:function(b,c){var a=c.get_dropTarget();if(a){if(this.$2_7.parentNode){this.$2_7.parentNode.removeChild(this.$2_7)}a.parentNode.insertBefore(this.$2_7,a);this.$2_8=true}},ddobj_Dropped:function(a,b){Sys.UI.DomElement.removeCssClass(this.mainElement,"c1-dragging-active");if(this.$2_7&&this.$2_7.parentNode){if(this.$2_8){this.mainElement.parentNode.removeChild(this.mainElement);this.$2_7.parentNode.insertBefore(this.mainElement,this.$2_7)}this.$2_7.parentNode.removeChild(this.$2_7);b.set_handled(true)}else{}this.mainElement.style.position="";this.$2_8=false},dispose:function(){if(this.get_accessKey()!==""){C1.Web.UI.Utils.AccessKeyHelper.unRegisterAccessKey(this.get_accessKey(),this.get_element())}if(this.$2_9){C1.Web.UI.Utils.RawEvent.removeHandler(window,"resize",this.$2_9);this.$2_9=null}if(this.$2_A){C1.Web.UI.Utils.RawEvent.removeHandler(window,"load",this.$2_A);this.$2_A=null}if(this.$2_2){C1.Web.UI.Utils.Common.unListenVisibleState(this.get_element(),this.$2_2);this.$2_2=null}C1.Web.UI.Controls.C1HeaderContentControl.C1HeaderContentControl.callBaseMethod(this,"dispose")},saveState:function(){if(this._jsonHelper){this._jsonHelper.saveState()}},$2_9:null,$2_A:null,initialize:function(){C1.Web.UI.Controls.C1HeaderContentControl.C1HeaderContentControl.callBaseMethod(this,"initialize");if(!this.isCreatedDynamically){this._jsonHelper=new C1.Web.UI.Interfaces.JsonSerializableHelper(this.get_element().id,this)}if(!this.headerPanelElement){this.headerPanelElement=$get(this._propertiesState.HeaderPanelID)}if(!this.contentPanelElement){this.contentPanelElement=$get(this._propertiesState.ContentPanelID)}if(!this.$2_2){this.$2_2=Function.createDelegate(this,this.$2_21);C1.Web.UI.Utils.Common.listenVisibleState(this.get_element(),this.$2_2)}Sys.UI.DomEvent.addHandler(this.headerPanelElement,"click",Function.createDelegate(this,this.onHeaderMouseClick));Sys.UI.DomEvent.addHandler(this.headerPanelElement,"mousedown",Function.createDelegate(this,this.onHeaderMouseDown));Sys.UI.DomEvent.addHandler(this.headerPanelElement,"mouseup",Function.createDelegate(this,this.onHeaderMouseUp));Sys.UI.DomEvent.addHandler(this.headerPanelElement,"mouseover",Function.createDelegate(this,this.onHeaderMouseOver));Sys.UI.DomEvent.addHandler(this.headerPanelElement,"mouseout",Function.createDelegate(this,this.onHeaderMouseOut));this.get_contentPanel().set_contentUrl(this.get_contentUrl());if(!this.$2_A){this.$2_A=Function.createDelegate(this,this.onLoad);C1.Web.UI.Utils.RawEvent.addHandler(window,"load",this.$2_A)}this.invalidate();if(this.get_accessKey()!==""){C1.Web.UI.Utils.AccessKeyHelper.registerAccessKey(this.get_accessKey(),this.get_element(),this.get_$2_20())}},onLoad:function(a){this.invalidate();return true},$2_B:false,storeInitialLayout:function(a){if(!a&&this.$2_B){return}try{this.$2_C.h1=this.headerPanelElement.style.height;this.$2_C.h2=this.get_headerPanel().get_contentElement().style.height;this.$2_C.h3=this.headerPanelElement.style.width;this.$2_C.h4=this.get_headerPanel().get_contentElement().style.width;this.$2_C.c1=this.contentPanelElement.style.height;this.$2_C.c2=this.get_contentPanel().get_contentElement().style.height;this.$2_C.c3=this.contentPanelElement.style.width;this.$2_C.c4=this.get_contentPanel().get_contentElement().style.width}catch(b){}this.$2_B=true},restoreInitialLayout:function(){try{this.$2_19=null;this.$2_1A=null;this.headerPanelElement.style.height=this.$2_C.h1;this.get_headerPanel().get_contentElement().style.height=this.$2_C.h2;this.headerPanelElement.style.width=this.$2_C.h3;this.get_headerPanel().get_contentElement().style.width=this.$2_C.h4;this.contentPanelElement.style.height=this.$2_C.c1;this.get_contentPanel().get_contentElement().style.height=this.$2_C.c2;this.contentPanelElement.style.width=this.$2_C.c3;this.get_contentPanel().get_contentElement().style.width=this.$2_C.c4}catch(a){}},invalidate:function(){this.storeInitialLayout(false);var i=""+this.get_width()+"";var h=""+this.get_height()+"";var g=""+this.get_headerSize()+"";if(i===""||h===""){return}var f=false;var e=(!this.determineOrientation());var d=this.determineIsExpanded();var c=this.$2_17();var b=this.$2_18();var a=this.$2_1D(i);var m=this.$2_1D(h);if(i.indexOf("%")!==-1){a=Math.round(c*a/100);f=true}if(h.indexOf("%")!==-1){m=Math.round(b*m/100);f=true}if(g===""){g=this.$2_1B(e)}var l=this.$2_1D(g);if(g.indexOf("%")!==-1){if(e){l=Math.round(l*a/100)}else{l=Math.round(l*m/100)}f=true}if(e&&!d){this.get_element().style.width=g}else{this.get_element().style.width=i}if(!e&&!d){this.get_element().style.height=g}else{this.get_element().style.height=h}if(e){C1.Web.UI.Utils.Common.setWidth(this.headerPanelElement,l);this.$2_D(this.get_headerPanel(),l);C1.Web.UI.Utils.Common.setHeight(this.contentPanelElement,m);this.$2_E(this.get_contentPanel(),m);C1.Web.UI.Utils.Common.setHeight(this.headerPanelElement,m)}else{C1.Web.UI.Utils.Common.setHeight(this.headerPanelElement,l);this.$2_E(this.get_headerPanel(),l);C1.Web.UI.Utils.Common.setWidth(this.contentPanelElement,a);this.$2_D(this.get_contentPanel(),a);C1.Web.UI.Utils.Common.setWidth(this.headerPanelElement,a)}if(e){var k=a-this.headerPanelElement.offsetWidth;if(k<0){k=0}C1.Web.UI.Utils.Common.setWidth(this.contentPanelElement,k);this.$2_D(this.get_contentPanel(),k)}else{var j=m-this.headerPanelElement.offsetHeight;if(j<0){j=0}C1.Web.UI.Utils.Common.setHeight(this.contentPanelElement,j)}if(f){if(!this.$2_9){this.$2_9=Function.createDelegate(this,this.onWindowResize);C1.Web.UI.Utils.RawEvent.addHandler(window,"resize",this.$2_9)}}else{if(this.$2_9){C1.Web.UI.Utils.RawEvent.removeHandler(window,"resize",this.$2_9);this.$2_9=null}}},$2_D:function(i,h){var g=i.element;var f=i.get_outerElement();var e=i.get_innerElement();var d=i.get_contentElement();var c=C1.Web.UI.Utils.Common.getBorderBox(g);var b=C1.Web.UI.Utils.Common.getPaddingBox(g);var a=c.horizontal+b.horizontal;h=h-a;if(h<0){h=0}C1.Web.UI.Utils.Common.setWidth(d,h)},$2_E:function(i,h){var g=i.element;var f=i.get_outerElement();var e=i.get_innerElement();var d=i.get_contentElement();var c=C1.Web.UI.Utils.Common.getBorderBox(g);var b=C1.Web.UI.Utils.Common.getPaddingBox(g);var a=c.vertical+b.vertical;h=h-a;if(h<0){h=0}C1.Web.UI.Utils.Common.setHeight(d,h)},$2_13:null,$2_14:null,$2_15:null,$2_16:null,$2_17:function(){var b=this.get_element().parentNode;if(b.tagName==="FORM"){b=b.parentNode}var a=C1.Web.UI.Utils.Common.getContentWidth(b);if(b.tagName==="BODY"||b.tagName==="HTML"){a=C1.Web.UI.Utils.Measurement.getWindowClientAreaSize().width}if(this.determineIsExpanded()){if(this.$2_F<=0||(this.$2_13!==b.style.width)){this.$2_F=a;this.$2_13=b.style.width}return this.$2_F}else{if(this.$2_10<0||(this.$2_14!==b.style.width)){this.$2_10=a;this.$2_14=b.style.width}return this.$2_10}},$2_18:function(){var b=this.get_element().parentNode;if(b.tagName==="FORM"){b=b.parentNode}var a=C1.Web.UI.Utils.Common.getContentHeight(b);if(b.tagName==="BODY"||b.tagName==="HTML"){a=C1.Web.UI.Utils.Measurement.getWindowClientAreaSize().height}if(this.determineIsExpanded()){if(this.$2_11<=0||(this.$2_15!==b.style.height)){this.$2_11=a;this.$2_15=b.style.height}return this.$2_11}else{if(this.$2_12<0||(this.$2_16!==b.style.height)){this.$2_12=a;this.$2_16=b.style.height}return this.$2_12}},notifyParentBoundsChanged:function(a){this.$2_F=-1;this.$2_10=-1;this.$2_11=-1;this.$2_12=-1;if(C1.Web.UI.Utils.Common.testIsNull(a)||a){this.invalidate()}},$2_19:null,$2_1A:null,$2_1B:function(b){var a=this.get_headerSize();if(a===""){if(b){if(C1.Web.UI.Utils.Common.testIsNull(this.$2_19)){this.$2_19=""+C1.Web.UI.Utils.Common.getOuterWidth(this.headerPanelElement)+"px"}a=this.$2_19}else{if(C1.Web.UI.Utils.Common.testIsNull(this.$2_1A)){this.$2_1A=""+C1.Web.UI.Utils.Common.getOuterHeight(this.headerPanelElement)+"px"}a=this.$2_1A}}return a},$2_1C:function(a){return(a&&a!==""&&(a.indexOf("%")===-1))},$2_1D:function(a){return parseInt(a.replace("px","").replace("%",""))},isDOMVisible:function(){return C1.Web.UI.Utils.Common.isVisible(this.get_element())},get_propertiesState:function(){return this._propertiesState},assignPropertiesState:function(a){this._propertiesState=a},createInstance:function(a){return new C1.Web.UI.Controls.C1HeaderContentControl.C1HeaderContentControl(a)},onAccessKeyDown:function(a){return false},onHeaderMouseClick:function(a){if(this.get_suppressHeaderPostbacks()){a.preventDefault();a.stopPropagation();a.rawEvent.returnValue=false}},onHeaderMouseDown:function(a){if(!this.get_enabled()){return}this._isMouseDown=true;Sys.UI.DomElement.addCssClass(this.headerPanelElement,"C1Active");this.updateCompoundCssClasses();if(this.$2_6){a.preventDefault()}},onHeaderMouseUp:function(a){if(!this.get_enabled()){return}this._isMouseDown=false;Sys.UI.DomElement.removeCssClass(this.headerPanelElement,"C1Active");this.updateCompoundCssClasses()},onHeaderMouseOver:function(a){if(!this.get_enabled()){return}this._isHover=true;Sys.UI.DomElement.addCssClass(this.headerPanelElement,"C1Hover");this.updateCompoundCssClasses()},onHeaderMouseOut:function(a){if(!this.get_enabled()){return}this._isHover=false;this._isMouseDown=false;Sys.UI.DomElement.removeCssClass(this.headerPanelElement,"C1Active");Sys.UI.DomElement.removeCssClass(this.headerPanelElement,"C1Hover");this.updateCompoundCssClasses()},_prevWindowSize:null,onWindowResize:function(b){var a=C1.Web.UI.Utils.Measurement.getWindowClientAreaSize();if(C1.Web.UI.Utils.Common.testIsNull(this._prevWindowSize)){this._prevWindowSize=a;this.notifyParentBoundsChanged(false)}else{if(this._prevWindowSize.width!==a.width||this._prevWindowSize.height!==a.height){this.notifyParentBoundsChanged(false)}}this._prevWindowSize=a;if(this.$2_1!==-1){window.clearTimeout(this.$2_1);this.$2_1=-1}this.$2_1=window.setTimeout(Function.createDelegate(this,this.$2_1E),1);return true},$2_1E:function(){this.$2_1=-1;this.invalidate()},updateCompoundCssClasses:function(){var b=this.getVisualStyleCssClassName();if(b===""){b=this.getControlClassName()}var a=b;if(this.get_element().disabled){a+="-C1Disabled"}a+=("-"+this.determineExpandDirectionCssClass());var e=""+this.get_element().className+"";var d=new RegExp("\\s*"+b+"-*\\S*(-C1Top|-C1Right|-C1Bottom|-C1Left)");this.get_element().className=e.replace(d,"");Sys.UI.DomElement.addCssClass(this.get_element(),a);var c="";if(this.determineIsExpanded()){c+="C1Opened-"}else{c+="C1Closed-"}if(this._isMouseDown){c+="C1Active-"}if(this._isHover){c+="C1Hover-"}a=c+this._headerPanelClassName;e=""+this.headerPanelElement.className+"";d=new RegExp("\\s*(C1Opened-|C1Closed-)\\S*("+this._headerPanelClassName+"|"+this._contentPanelClassName+")");this.headerPanelElement.className=e.replace(d,"");Sys.UI.DomElement.addCssClass(this.headerPanelElement,a);a=c+this._contentPanelClassName;e=""+this.contentPanelElement.className+"";d=new RegExp("\\s*(C1Opened-|C1Closed-)\\S*("+this._headerPanelClassName+"|"+this._contentPanelClassName+")");this.contentPanelElement.className=e.replace(d,"");Sys.UI.DomElement.addCssClass(this.contentPanelElement,a)},determineOrientation:function(){return 1},determineExpandDirectionCssClass:function(){return"C1Bottom"},determineIsExpanded:function(){return true},getControlClassName:function(){return"C1HeaderContentControl"},getVisualStyleCssClassName:function(){var a=this._propertiesState.VisualStyle;if(!a||a===""){a=this.getControlClassName()+"_Default"}else{a=this.getControlClassName()+"_"+a}return a},createContentPanel:function(){var a=new C1.Web.UI.ContentPanel(this.contentPanelElement);a.setInnerElementsClassNames("C1hOuter","C1hInner","C1hContent");return a},createHeaderPanel:function(){var a=new C1.Web.UI.ContentPanel(this.headerPanelElement);a.setInnerElementsClassNames("C1hOuter","C1hInner","C1hContent");return a},$2_1F:function(){return this.get_element()},get_$2_20:function(){if(!this.$2_0){this.$2_0=Function.createDelegate(this,this.onAccessKeyDown)}return this.$2_0},$2_21:function(b,a){if(a){this.invalidate()}}};C1.Web.UI.Controls.C1HeaderContentControl.C1HeaderContentControl.registerClass("C1.Web.UI.Controls.C1HeaderContentControl.C1HeaderContentControl",Sys.UI.Control,C1.Web.UI.Interfaces.IJsonSerializableSupport);
if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();