text: /*
  Copyright (c) 2012 jqWidgets.
  http://jqwidgets.com/license/
  */
  
  (function(a){a.jqx.jqxWidget("jqxWindow","",{});a.extend(a.jqx._jqxWindow.prototype,{defineInstance:function(){this.height="auto";this.width=200;this.minHeight=50;this.maxHeight=600;this.minWidth=50;this.maxWidth=600;this.showCloseButton=true;this.disabled=false;this.autoOpen=true;this.keyboardCloseKey="esc";this.title="";this.content="";this.draggable=true;this.resizable=true;this.animationType="fade";this.closeAnimationDuration=250;this.showAnimationDuration=250;this.isModal=false;this.position="center";this.closeButtonSize=16;this.closeButtonAction="hide";this.modalOpacity=0.3;this.dragArea=null;this.okButton=null;this.cancelButton=null;this.dialogResult={OK:false,Cancel:false,None:true};this._events=["created","closed","moving","moved","open"];this._invalidArgumentExceptions={invalidHeight:"Invalid height!",invalidWidth:"Invalid width!",invalidMinHeight:"Invalid minHeight!",invalidMaxHeight:"Invalid maxHeight!",invalidMinWidth:"Invalid minWidth!",invalidMaxWidth:"Invalid maxWidth",invalidKeyCode:"Invalid keyCode!",invalidAnimationType:"Invalid animationType!",invalidCloseAnimationDuration:"Invalid closeAnimationDuration!",invalidShowAnimationDuration:"Invalid showAnimationDuration!",invalidPosition:"Invalid position!",invalidCloseButtonSize:"Invalid closeButtonSize!",invalidCloseButtonAction:"Invalid cluseButtonAction!",invalidModalOpacity:"Invalid modalOpacity!",invalidDragArea:"Invalid dragArea!",invalidDialogResult:"Invalid dialogResult!",invalidIsModal:"You can have just one modal window!"};this._mouseDown=false;this._isDragging=false;this._rightContentWrapper=null;this._leftContentWrapper=null;this._headerContentWrapper=null;this._closeButton=null;this._title=null;this._content=null;this._mousePosition={};this._windowPosition={};this._modalBackground=null;this._SCROLL_WIDTH=21;this._visible=true;this._touchEvents={mousedown:"touchstart",mouseup:"touchend",mousemove:"touchmove",mouseenter:"mouseenter",mouseleave:"mouseleave",click:"touchstart"}},createInstance:function(){this.host.detach();a(document.body).append(this.host);this._isTouchDevice=a.jqx.mobile.isTouchDevice();this._validateProperties();this._createStructure();this._refresh();this._fixWindowZIndex();this._setStartupSettings();this._positionWindow();this._raiseEvent(0)},_setStartupSettings:function(){if(this.disabled){this.disable()}if(!this.autoOpen){this.hide(null,0.001,true);this._visible=false}if(this.title!==null&&this.title!==""){this.setTitle(this.title)}if(this.content!==null&&this.content!==""){this.setContent(this.content)}this.title=this._headerContentWrapper.html();this.content=this._content.html()},_fixWindowZIndex:function(){var c=a.data(document.body,"jqxwindows-list")||[],e=901,b;if(!this.isModal){if(this._indexOf(this.host,c)<0){c.push(this.host)}a.data(document.body,"jqxwindows-list",c);if(c.length>1){var d=c[c.length-2];e=parseInt(d.css("z-index"),10)+1}}else{if(c){c=this._removeFromArray(this.host,c);a.data(document.body,"jqxwindows-list",c)}a.data(document.body,"jqxwindow-modal",this.host);e=1800}this.host.css("z-index",e);this._sortByStyle("z-index",c)},_validateProperties:function(){try{this._validateSize();this._validateAnimationProperties();this._validateInteractionProperties();this._validateModalProperties();if(!this.position){throw new Error(this._invalidArgumentExceptions.invalidPosition)}if(isNaN(this.closeButtonSize)||parseInt(this.closeButtonSize)<0){throw new Error(this._invalidArgumentExceptions.invalidCloseButtonSize)}}catch(b){alert(b)}},_validateModalProperties:function(){if(this.modalOpacity<0||this.modalOpacity>1){throw new Error(this._invalidArgumentExceptions.invalidModalOpacity)}if(this.isModal&&!this._singleModalCheck()){throw new Error(this._invalidArgumentExceptions.invalidIsModal)}},_validateSize:function(){this._validateSizeLimits();if(this.height!=="auto"&&isNaN(parseInt(this.height))){throw new Error(this._invalidArgumentExceptions.invalidHeight)}if(isNaN(parseInt(this.width))){throw new Error(this._invalidArgumentExceptions.invalidWidth)}if(this.height!=="auto"&&this.height<this.minHeight){this.height=this.minHeight}if(this.width<this.minWidth){this.width=this.minWidth}if(this.height!=="auto"&&this.height>this.maxHeight){this.height=this.maxHeight}if(this.width>this.maxWidth){this.width=this.maxWidth}if(this.dragArea===null){return}if(this.dragArea&&((this.dragArea.height!==null&&this.host.height()>this.dragArea.height)||(parseInt(this.height,10)>this.dragArea.height))||(this.dragArea.width!==null&&this.width>this.dragArea.width)||(this.maxHeight>this.dragArea.height||this.maxWidth>this.dragArea.width)){}},_validateSizeLimits:function(){if(isNaN(parseInt(this.minHeight))){throw new Error(this._invalidArgumentExceptions.invalidMinHeight)}if(isNaN(parseInt(this.maxHeight))){throw new Error(this._invalidArgumentExceptions.invalidMaxHeight)}if(isNaN(parseInt(this.minWidth))){throw new Error(this._invalidArgumentExceptions.invalidMinWidth)}if(isNaN(parseInt(this.maxWidth))){throw new Error(this._invalidArgumentExceptions.invalidMaxWidth)}if(this.minHeight>this.maxHeight){throw new Error(this._invalidArgumentExceptions.invalidMinHeight)}if(this.minWidth>this.maxWidth){throw new Error(this._invalidArgumentExceptions.invalidMinWidth)}},_validateAnimationProperties:function(){if(this.animationType!=="fade"&&this.animationType!=="slide"&&this.animationType!=="combined"&&this.animationType!=="none"){throw new Error(this._invalidArgumentExceptions.invalidAnimationType)}if(isNaN(parseInt(this.closeAnimationDuration),10)||this.closeAnimationDuration<0){throw new Error(this._invalidArgumentExceptions.invalidCloseAnimationDuration)}if(isNaN(parseInt(this.showAnimationDuration),10)||this.showAnimationDuration<0){throw new Error(this._invalidArgumentExceptions.invalidShowAnimationDuration)}},_validateInteractionProperties:function(){if(parseInt(this.keyCode,10)<0||parseInt(this.keyCode,10)>130&&this.keyCode!=="esc"){throw new Error(this._invalidArgumentExceptions.invalidKeyCode)}if(this.dragArea!==null&&(typeof this.dragArea.width==="undefined"||typeof this.dragArea.height==="undefined"||typeof this.dragArea.left==="undefined"||typeof this.dragArea.top==="undefined")){throw new Error(this._invalidArgumentExceptions.invalidDragArea)}if(!this.dialogResult||(!this.dialogResult.OK&&!this.dialogResult.Cancel&&!this.dialogResult.None)){throw new Error(this._invalidArgumentExceptions.invalidDialogResult)}if(this.closeButtonAction!=="hide"&&this.closeButtonAction!=="close"){throw new Error(this._invalidArgumentExceptions.invalidCloseButtonAction)}},_singleModalCheck:function(){var b=a.data(document.body,"jqxwindows-list")||[],c=b.length;while(c){c-=1;if(a(b[c].attr("id")).jqxWindow("isModal")){return false}}return true},_createStructure:function(){var b=this.host.children("DIV");if(b.length===1){this._header=a("<div>"+this.host.attr("caption")+"</div>");this.host.prepend(this._header);this.host.attr("caption","");this._content=a(b[0])}else{if(b.length===2){this._header=a(b[0]);this._content=a(b[1])}else{throw new Error("Invalid structure!")}}},_refresh:function(){this._render();this._addStyles();this._performLayout();this._removeEventHandlers();this._addEventHandlers();this._initializeResize()},_render:function(){this._addHeaderWrapper();this._addCloseButton();this._removeModal();this._makeModal()},_addHeaderWrapper:function(){if(!this._headerContentWrapper){this._header.wrapInner('<div style="float:left;"></div>');this._headerContentWrapper=this._header.children(0)}},_addCloseButton:function(){if(!this._closeButton){this._closeButtonWrapper=a('<div class="'+this.toThemeProperty("jqx-window-close-button-background")+'"></div>');this._closeButton=a('<div style="width: 100%; height: 100%;" class="'+this.toThemeProperty("jqx-window-close-button")+'"></div>');this._closeButtonWrapper.append(this._closeButton);this._header.append(this._closeButtonWrapper)}},_removeModal:function(){if(!this.isModal&&typeof this._modalBackground==="object"&&this._modalBackground!==null&&this._modalBackground.length>=1){a("."+this.toThemeProperty("jqx-window-modal")).remove();this._modalBackground=null}},_makeModal:function(){if(this.isModal&&(!this._modalBackground||this._modalBackground.length<1)){var b=a.data(document.body,"jqxwindows-list");if(b){this._removeFromArray(this.host,b);a.data(document.body,"jqxwindows-list",b)}this._modalBackground=a("<div></div>");this._modalBackground.addClass(this.toThemeProperty("jqx-window-modal"));this._setModalBackgroundStyles();a(document.body).append(this._modalBackground);this.addHandler(this._modalBackground,this._getEvent("click"),function(){return false})}},_addStyles:function(){this.host.addClass(this.toThemeProperty("jqx-rc-all"));this.host.addClass(this.toThemeProperty("jqx-window"));this._header.addClass(this.toThemeProperty("jqx-rc-t"));this._header.addClass(this.toThemeProperty("jqx-window-header"));this._content.addClass(this.toThemeProperty("jqx-window-content"));this._header.addClass(this.toThemeProperty("jqx-disableselect"));this.element.tabIndex=0;this.host.find("DIV").css("tab-index",0);this.host.attr("hideFocus","true").css("outline","none")},_performHeaderLayout:function(){if(!this.showCloseButton){this._closeButtonWrapper.css("display","none")}else{this._closeButtonWrapper.css("display","block");this._closeButtonWrapper.width(this.closeButtonSize);this._closeButtonWrapper.height(this.closeButtonSize)}this._performHeaderCloseButtonLayout();this._centerElement(this._headerContentWrapper,this._header,"y","margin");this._centerElement(this._closeButtonWrapper,this._header,"y","margin")},_performHeaderCloseButtonLayout:function(){var b=parseInt(this._header.css("padding-right"),10);if(!isNaN(b)){this._closeButtonWrapper.width(this._closeButton.width()+b)}this._closeButtonWrapper.css({position:"absolute",right:"0px"})},_performWidgetLayout:function(){this.host.width(this.width);if(this.height!=="auto"){this.host.height(this.height)}else{this.host.height(this.host.height())}this._content.width(this.width-this._content.outerWidth(true)-this._content.width());this._content.height(this.host.height()-this._header.outerHeight(true)-(this._content.outerHeight(true)-this._content.height()));this._validateMinSize();this.host.css({"min-height":this.minHeight,"min-width":this.minWidth,"max-height":this.maxHeight,"max-width":this.maxWidth})},_validateMinSize:function(){if(this.minHeight<this._header.height()){this.minHeight=this._header.height()}var d=this._header.children(0).outerWidth(true),b=this._header.children(1).outerWidth(true),c=d+b;if(this.minWidth<100){this.minWidth=Math.min(c,100)}},_centerElement:function(e,c,b,d){if(typeof c.left==="number"&&typeof c.top==="number"&&typeof c.height==="number"&&typeof c.width==="number"){this._centerElementInArea(e,c,b)}else{this._centerElementInParent(e,c,b,d)}},_centerElementInParent:function(b,i,e,c){e=e.toLowerCase();if(c){c+="-"}else{c=""}if(e.indexOf("y")>=0){var d=b.outerHeight(true),g=i.height(),f=(g-d)/2;b.css(c+"top",f+"px")}if(e.indexOf("x")>=0){var k=b.outerWidth(true);var j=i.width();var h=(j-k)/2;b.css(c+"left",h+"px")}},_centerElementInArea:function(c,b,e){e=e.toLowerCase();if(e.indexOf("y")>=0){var d=c.outerHeight(true);var g=b.height;var f=(g-d)/2;c.css("top",f+b.top+"px")}if(e.indexOf("x")>=0){var j=c.outerWidth(true);var i=b.width;var h=(i-j)/2;c.css("left",h+b.left+"px")}},_removeEventHandlers:function(){this.removeHandler(this._closeButton,this._getEvent("mousedown"));this.removeHandler(this._header,this._getEvent("mousedown"));this.removeHandler(this._header,this._getEvent("mousemove"));this.removeHandler(a(document),this._getEvent("mousemove")+"."+this.host.attr("id"),this._dragHandler);this.removeHandler(a(document),this._getEvent("mouseup")+"."+this.host.attr("id"),this._dropHandler);this.removeHandler(this.host,"keydown");this.removeHandler(this._closeButton,this._getEvent("mouseenter"));this.removeHandler(this._closeButton,this._getEvent("mouseleave"));this.removeHandler(this.host,this._getEvent("mousedown"));this.removeHandler(a(this.okButton),this._getEvent("click"),this._setDialogResultHandler);this.removeHandler(a(this.cancelButton),this._getEvent("click"),this._setDialogResultHandler);this.removeHandler(this._header,this._getEvent("mouseenter"));this.removeHandler(this._header,this._getEvent("mouseleave"))},_removeFromArray:function(b,d){var c=this._indexOf(b,d);if(c>=0){return d.splice(this._indexOf(b,d),1)}else{return d}},_sortByStyle:function(b,g){for(var e=0;e<g.length;e++){for(var c=g.length-1;c>e;c--){var h=g[c],f=g[c-1],d;if(parseInt(h.css(b),10)<parseInt(f.css(b),10)){d=h;g[c]=f;g[c-1]=d}}}},_initializeResize:function(){if(this.resizable){var b=this;this.initResize({target:this.host,alsoResize:b._content,maxWidth:b.maxWidth,minWidth:b.minWidth,maxHeight:b.maxHeight,minHeight:b.minHeight,indicatorSize:10,resizeParent:b.dragArea})}},_removeResize:function(){this.removeResize()},_getEvent:function(b){if(this._isTouchDevice){return this._touchEvents[b]}else{return b}},_addEventHandlers:function(){this._addDragDropHandlers();this._addCloseHandlers();this._addFocusHandlers();this._documentResizeHandlers();this._closeButtonHover();this._addDialogButtonsHandlers();this._addHeaderHoverEffect();this.addHandler(this._header,this._getEvent("mousemove"),this._addHeaderCursorHandlers,{self:this})},_addHeaderHoverEffect:function(){var b=this;this.addHandler(this._header,this._getEvent("mouseenter"),function(){a(this).addClass(b.toThemeProperty("jqx-window-header-hover"))});this.addHandler(this._header,this._getEvent("mouseleave"),function(){a(this).removeClass(b.toThemeProperty("jqx-window-header-hover"))})},_addDialogButtonsHandlers:function(){if(this.okButton){this.addHandler(a(this.okButton),this._getEvent("click"),this._setDialogResultHandler,{self:this,result:"ok"})}if(this.cancelButton){this.addHandler(a(this.cancelButton),this._getEvent("click"),this._setDialogResultHandler,{self:this,result:"cancel"})}},_documentResizeHandlers:function(){var b=this;if(this.isModal){a(window).resize(function(){if(typeof b._modalBackground==="object"&&b._modalBackground!==null){b._modalBackground.width(b._getDocumentSize().width);b._modalBackground.height(b._getDocumentSize().height)}})}},_setDialogResultHandler:function(c){var b=c.data.self;b._setDialogResult(c.data.result);b.closeWindow()},_setDialogResult:function(b){this.dialogResult.OK=false;this.dialogResult.None=false;this.dialogResult.Cancel=false;b=b.toLowerCase();switch(b){case"ok":this.dialogResult.OK=true;break;case"cancel":this.dialogResult.Cancel=true;break;default:this.dialogResult.None=true}},_getDocumentSize:function(){var b=(a.browser.msie)?4:0,c=(a.browser.msie)?4:0;if(document.body.scrollHeight>document.body.clientHeight&&a.browser.msie){b=this._SCROLL_WIDTH}if(document.body.scrollWidth>document.body.clientWidth&&a.browser.msie){c=this._SCROLL_WIDTH}return{width:a(document).width()-b,height:a(document).height()-c}},_closeButtonHover:function(){var b=this;this.addHandler(this._closeButton,this._getEvent("mouseenter"),function(){b._closeButton.addClass(b.toThemeProperty("jqx-window-close-button-hover"))});this.addHandler(this._closeButton,this._getEvent("mouseleave"),function(){b._closeButton.removeClass(b.toThemeProperty("jqx-window-close-button-hover"))})},_setModalBackgroundStyles:function(){if(this.isModal){this._modalBackground.fadeTo(0,this.modalOpacity);this._modalBackground.css({position:"absolute",top:"0px",left:"0px",width:this._getDocumentSize().width,height:this._getDocumentSize().height,"z-index":1299})}},_addFocusHandlers:function(){var b=this;this.addHandler(this.host,this._getEvent("mousedown"),function(){if(!b.isModal){b.bringToFront()}})},_indexOf:function(c,d){for(var b=0;b<d.length;b++){if(d[b][0]===c[0]){return b}}return -1},_addCloseHandlers:function(){var b=this;this.addHandler(this._closeButton,this._getEvent("mousedown"),this._closeWindow,{self:this});if(this.keyboardCloseKey!=="none"){if(typeof this.keyboardCloseKey!=="number"&&this.keyboardCloseKey.toLowerCase()==="esc"){this.keyboardCloseKey=27}this.addHandler(this.host,"keydown",function(c){if(c.keyCode===b.keyboardCloseKey){b._closeWindow(c)}},{self:this})}},_closeWindow:function(c){var b=c.data.self.closeWindow()},_addHeaderCursorHandlers:function(c){if(c.data==null){return}var b=c.data.self;if(b.resizeArea&&b.resizable){b._header.css("cursor",b._resizeWrapper.css("cursor"));return}else{if(b.draggable){b._header.css("cursor","move");return}}b._header.css("cursor","default");if(b._resizeWrapper&&b._resizeWrapper.length>0){b._resizeWrapper.css("cursor","default")}},_addDragDropHandlers:function(){if(this.draggable){var b=this;this.addHandler(this._header,this._getEvent("mousedown"),this._headerMouseDownHandler,{self:this});this.addHandler(this._header,this._getEvent("mousemove"),this._headerMouseMoveHandler,{self:this});this.addHandler(a(document),this._getEvent("mousemove")+"."+this.host.attr("id"),this._dragHandler,{self:this});this.addHandler(a(document),this._getEvent("mouseup")+"."+this.host.attr("id"),this._dropHandler,{self:this})}},_headerMouseDownHandler:function(c){var b=c.data.self;b._mousePosition.x=(b._isTouchDevice)?c.originalEvent.touches[0].pageX:c.pageX;b._mousePosition.y=(b._isTouchDevice)?c.originalEvent.touches[0].pageY:c.pageY;b._mouseDown=true;b._isDragging=false},_headerMouseMoveHandler:function(e){if(e.data==null){return}var b=e.data.self;if(b._mouseDown&&!b._isDragging){var d=(b._isTouchDevice)?e.originalEvent.touches[0].pageX:e.pageX,c=(b._isTouchDevice)?e.originalEvent.touches[0].pageY:e.pageY;if((d+3<b._mousePosition.x||d-3>b._mousePosition.x)||(c+3<b._mousePosition.y||c-3>b._mousePosition.y)){b._isDragging=true;b._mousePosition={x:d,y:c};b._windowPosition={x:parseInt(b.host.css("left"),10),y:parseInt(b.host.css("top"),10)};a(document.body).addClass(b.toThemeProperty("jqx-disableselect"))}}},_dropHandler:function(d){var c=d.data.self;if(c._isDragging){var b=parseInt(c.host.css("left"),10),e=parseInt(c.host.css("top"),10);c._raiseEvent(3,b,e)}c._isDragging=false;c._mouseDown=false;a(document.body).removeClass(c.toThemeProperty("jqx-disableselect"))},_dragHandler:function(e){var i=e.data.self;if((i._isDragging&&!i.isResizing)||i._isTouchDevice){var h=(i._isTouchDevice)?e.originalEvent.which:e.which;if(h===0&&a.browser.msie&&a.browser.version<9){i._dropHandler(e);return false}var g=(i._isTouchDevice)?e.originalEvent.touches[0].pageX:e.pageX,f=(i._isTouchDevice)?e.originalEvent.touches[0].pageY:e.pageY,d=g-i._mousePosition.x,b=f-i._mousePosition.y,c=i._windowPosition.x+d,j=i._windowPosition.y+b;i.move(c,j,e);return false}},_validateCoordinates:function(b,h,f,g){var e=this._getDraggingArea();b=(b<e.left)?e.left:b;h=(h<e.top)?e.top:h;var c=this.host.outerWidth(true);var d=this.host.outerHeight(true);if(b+c>=e.width+e.left-2*g){b=e.width+e.left-c-g}if(h+d>=e.height+e.top-f){h=e.height+e.top-d-f}return{x:b,y:h}},_performLayout:function(){this._performHeaderLayout();this._performWidgetLayout()},_parseDragAreaAttributes:function(){if(this.dragArea!==null){this.dragArea.height=parseInt(this.dragArea.height,10);this.dragArea.width=parseInt(this.dragArea.width,10);this.dragArea.top=parseInt(this.dragArea.top,10);this.dragArea.left=parseInt(this.dragArea.left,10)}},_positionWindow:function(){this._parseDragAreaAttributes();if(this.position instanceof Array&&this.position.length===2&&typeof this.position[0]==="number"&&typeof this.position[1]==="number"){this.host.css({left:this.position[0],top:this.position[1]})}else{if(this.position instanceof Object&&this.position.x!==undefined&&this.position.y!=undefined){this.host.css({left:this.position.x,top:this.position.y})}else{this._positionFromLiteral()}}},_getDraggingArea:function(){var b={};b.left=((this.dragArea&&this.dragArea.left)?this.dragArea.left:0);b.top=((this.dragArea&&this.dragArea.top)?this.dragArea.top:0);b.width=((this.dragArea&&this.dragArea.width)?this.dragArea.width:this._getDocumentSize().width);b.height=((this.dragArea&&this.dragArea.height)?this.dragArea.height:this._getDocumentSize().height);return b},_positionFromLiteral:function(){if(!(this.position instanceof Array)){this.position=this.position.split(",")}var b=this.position.length,c=this._getDraggingArea();while(b){b-=1;this.position[b]=this.position[b].replace(/ /g,"");switch(this.position[b]){case"top":this.host.css("top",c.top);break;case"left":this.host.css("left",c.left);break;case"bottom":this.host.css("top",c.height-this.host.height()+c.top);break;case"right":this.host.css("left",c.left+c.width-this.host.width());break;default:if(!this.dragArea){c=a(window)}this._centerElement(this.host,c,"xy");break}}},_raiseEvent:function(d){var c=this._events[d],e=a.Event(c),b={};if(d===2||d===3){b.x=arguments[1];b.y=arguments[2]}if(c==="closed"){b.dialogResult=this.dialogResult}e.args=b;return this.host.trigger(e)},_destroy:function(){this.host.remove();if(this._modalBackground!==null){this._modalBackground.remove()}},_toClose:function(c,b){return((c&&b[0]===this.element)||(b[0]!==this.element&&typeof b[0]==="object"))},propertyChangedHandler:function(b,c,e,d){this._validateProperties();switch(c){case"dragArea":this._positionWindow();break;case"closeButtonSize":this._performLayout();break;case"isModal":this._refresh();this._fixWindowZIndex();break;case"keyboardCloseKey":this._removeEventHandlers();this._addEventHandlers();break;case"disabled":if(d){this.disable()}else{this.disabled=true;this.enable()}break;case"showCloseButton":this._refresh();break;case"height":this._performLayout();break;case"width":this._performLayout();break;case"title":this.setTitle(d);break;case"content":this.setContent(d);break;case"draggable":this._removeEventHandlers();this._addEventHandlers();break;case"resizable":if(d){this._initializeResize()}else{this._removeResize()}break;case"position":this._positionWindow();break;case"modalOpacity":this._setModalBackgroundStyles();break;case"okButton":if(d){this._addDialogButtonsHandlers()}else{this.removeHandler(this.okButton)}break;case"cancelButton":if(d){this._addDialogButtonsHandlers()}else{this.removeHandler(this.cancelButton)}break;default:return}},closeAll:function(e){e=(typeof e==="object")?false:e;var d=a.data(document.body,"jqxwindows-list"),c=d.length,b=a.data(document.body,"jqxwindow-modal")||[];while(c){c-=1;if(this._toClose(e,d[c])){d[c].jqxWindow("closeWindow","close");d.splice(c,1)}}if(this._toClose(e,b)){b.jqxWindow("closeWindow","close");a.data(document.body,"jqxwindow-modal",[])}a.data(document.body,"jqxwindows-list",d)},setTitle:function(b){this._headerContentWrapper.html(b);this._performLayout()},setContent:function(b){this._content.html(b);this._performLayout()},disable:function(){this.disabled=true;this._removeEventHandlers();this._header.addClass(this.toThemeProperty("jqx-window-header-disabled"));this._content.addClass(this.toThemeProperty("jqx-window-content-disabled"));this.host.addClass(this.toThemeProperty("jqx-window-disabled"));this._removeResize()},enable:function(){if(this.disabled){this._removeEventHandlers();this._header.removeClass(this.toThemeProperty("jqx-window-header-disabled"));this._content.removeClass(this.toThemeProperty("jqx-window-content-disabled"));this.host.removeClass(this.toThemeProperty("jqx-window-disabled"));this.disabled=false;this._initializeResize()}},isOpen:function(){return this._visible},closeWindow:function(c){var b=this;c=(typeof c==="undefined")?this.closeButtonAction:c;this.hide(function(){if(c==="close"){b._destroy()}})},bringToFront:function(){var c=a.data(document.body,"jqxwindows-list"),g=c[c.length-1],f=parseInt(g.css("z-index"),10),d=this._indexOf(this.host,c);for(var b=c.length-1;b>d;b-=1){var e=parseInt(c[b].css("z-index"),10)-1;c[b].css("z-index",e)}this.host.css("z-index",f);this._sortByStyle("z-index",c)},hide:function(d,c,b){c=c||this.closeAnimationDuration;switch(this.animationType){case"none":this.host.css("display","none");break;case"fade":this.host.fadeOut(c,function(){if(d instanceof Function){d()}});case"slide":this.host.slideUp(c,function(){if(d instanceof Function){d()}});case"combined":this.host.hide(c,function(){if(d instanceof Function){d()}})}this._visible=false;if(this.isModal){this._modalBackground.fadeTo(c,0,function(){a(this).css("display","none")})}if(b!==true){this._raiseEvent(1)}},show:function(c,b){this._setDialogResult("none");b=b||this.showAnimationDuration;switch(this.animationType){case"none":this.host.css("display","block");break;case"fade":this.host.fadeIn(b,function(){if(c instanceof Function){c()}});case"slide":this.host.slideDown(b,function(){if(c instanceof Function){c()}});case"combined":this.host.show(b,function(){if(c instanceof Function){c()}})}if(this.isModal){this._modalBackground.fadeTo(b,this.modalOpacity)}if(!this._visible){this._raiseEvent(4)}this._visible=true},move:function(c,g,d){var f=0,e=0,b;if(a.browser.msie){if(a(window).width()>a(document).width()&&!this.dragArea){e=this._SCROLL_WIDTH}if(a(window).height()<a(document).height()&&document.documentElement.clientWidth>document.documentElement.scrollWidth&&!this.dragArea){f=this._SCROLL_WIDTH}}b=this._validateCoordinates(c,g,e,f);if(parseInt(this.host.css("left"),10)!==b.x||parseInt(this.host.css("top"),10)!==b.y){this._raiseEvent(2,b.x,b.y)}this.element.style.left=b.x+"px";this.element.style.top=b.y+"px"}})}(jQuery));var resizeModule=(function(a){return{resizeConfig:function(){this.resizeTarget=null;this.resizeIndicatorSize=10;this.resizeTargetChildren=null;this.isResizing=false;this.resizeArea=false;this.minWidth=1;this.maxWidth=100;this.minHeight=1;this.maxHeight=100;this.resizeParent=null;this._resizeEvents=["resizing","resized"];this._resizeMouseDown=false;this._resizeCurrentMode=null;this._mouseResizePosition={};this._resizeMethods=null;this._SCROLL_WIDTH=21;this._clearSelection=true},_resizeExceptions:{invalidTarget:"Invalid target!",invalidMinHeight:"Invalid minimal height!",invalidMaxHeight:"Invalid maximum height!",invalidMinWidth:"Invalid minimum width!",invalidMaxWidth:"Invalid maximum width!",invalidIndicatorSize:"Invalid indicator size!",invalidSize:"Invalid size!"},removeResize:function(){this._removeResizeEventListeners();if(a(this.resizeTarget.children(0).children(0)).length>0){a(this.resizeTarget.children(0).children(0)).unwrap()}this.resizeTarget.children(".jqx-resize").remove()},initResize:function(c){this.resizeConfig();this.resizeTarget=a(c.target);this.resizeIndicatorSize=c.indicatorSize||10;if(this.resizeTarget.is("textarea")){var b=this._resizableTextArea();this.resizeIndicatorSize=((this.resizeIndicatorSize>=10)?this.resizeIndicatorSize:10)}this.maxWidth=c.maxWidth||100;this.minWidth=c.minWidth||1;this.maxHeight=c.maxHeight||100;this.minHeight=c.minHeight||1;this.resizeParent=c.resizeParent;this._parseResizeParentProperties();this._validateResizeProperties();this._validateResizeTargetDimensions();this._getChildren(this.resizeTarget.maxWidth,this.resizeTarget.minWidth,this.resizeTarget.maxHeight,this.resizeTarget.minHeight,c.alsoResize,b);this._refreshResize()},_validateResizeTargetDimensions:function(){this.resizeTarget.maxWidth=this.maxWidth;this.resizeTarget.minWidth=((3*this.resizeIndicatorSize>this.minWidth)?3*this.resizeIndicatorSize:this.minWidth);this.resizeTarget.maxHeight=this.maxHeight;this.resizeTarget.minHeight=((3*this.resizeIndicatorSize>this.minHeight)?3*this.resizeIndicatorSize:this.minHeight)},_parseResizeParentProperties:function(){if(this.resizeParent){this.resizeParent.left=parseInt(this.resizeParent.left,10);this.resizeParent.top=parseInt(this.resizeParent.top,10);this.resizeParent.width=parseInt(this.resizeParent.width,10);this.resizeParent.height=parseInt(this.resizeParent.height,10)}},_resizableTextArea:function(){var b=this.resizeTarget;b.wrap(a("<div></div>"));this.resizeTarget=b.parent();this.resizeTarget.css({position:"absolute",left:b.offset().left,top:b.offset().top,margin:"5px"});b.css({"z-index":0,position:"relative",top:"0px",left:"0px",margin:this.resizeIndicatorSize+"px",resize:"none"});return b},_getChildren:function(g,d,f,h,b,c){this.resizeTargetChildren=a(b);this.resizeTargetChildren.toArray();this.resizeTargetChildren.push(c);var e=this.resizeTargetChildren.length;while(e){e-=1;this.resizeTargetChildren[e]=a(this.resizeTargetChildren[e])}},_refreshResize:function(){this._renderResize();this._performResizeLayout();this._removeResizeEventListeners();this._addResizeEventHandlers()},_renderResize:function(){this.resizeTarget.wrapInner(a("<div></div>"));this._resizeWrapper=this.resizeTarget.children(0);this._resizeWrapper.addClass("jqx-resize");this._resizeWrapper.css("z-index",8000)},_performResizeLayout:function(){this._resizeWrapper.height(this.resizeTarget.height());this._resizeWrapper.width(this.resizeTarget.width())},_removeResizeEventListeners:function(){this._resizeWrapper.unbind("mousemove.resize"+this.resizeTarget.attr("id"),this._resizeCursorChangeHandler);this._resizeWrapper.unbind("mousedown.resize"+this.resizeTarget.attr("id"),this._resizeMouseDownHandler);a(document).unbind("mousemove.resize"+this.resizeTarget.attr("id"),this._resizeHandler);a(document).unbind("mouseup.resize"+this.resizeTarget.attr("id"),this._stopResizing)},_addResizeEventHandlers:function(){var b=this;this._resizeWrapper.bind("mousemove.resize."+this.resizeTarget.attr("id"),{self:this},this._resizeCursorChangeHandler);this._resizeWrapper.bind("mousedown.resize."+this.resizeTarget.attr("id"),{self:this},this._resizeMouseDownHandler);a(document).bind("mousemove.resize."+this.resizeTarget.attr("id"),{self:this},this._resizeHandler);a(document).bind("mouseup.resize."+this.resizeTarget.attr("id"),{self:this},this._stopResizing)},_stopResizing:function(c){var b=c.data.self;if(b.isResizing){b._raiseResizeEvent(1)}b._resizeMouseDown=false;b.isResizing=false;b._resizeDirection=null;b.resizeTarget.removeClass("jqx-disableselect")},_resizeHandler:function(c){var b=c.data.self;if(b.isResizing&&b._resizeDirection){if(c.which===0&&a.browser.msie&&a.browser.version<9){b._stopResizing(c)}b._performResize(c.pageX,c.pageY);return false}else{return b._resizeCaptureCursor(c.pageX,c.pageY)}},_resizeCaptureCursor:function(c,b){if(this._resizeMouseDown&&!this.isResizing&&this._resizeDirection){if((c+3<this._mouseResizePosition.x||c-3>this._mouseResizePosition.x)||(b+3<this._mouseResizePosition.y||b-3>this._mouseResizePosition.y)){this._changeCursor(c-parseInt(this.resizeTarget.css("left")),b-parseInt(this.resizeTarget.css("top")));this._mouseResizePosition={x:c,y:b};this._prepareResizeMethods(this._resizeDirection);this._resizeBackupData();this.isResizing=true;this.resizeTarget.addClass("jqx-disableselect");return false}}},_resizeBackupData:function(){this.resizeTarget.lastWidth=this.resizeTarget.width();this.resizeTarget.lastHeight=this.resizeTarget.height();this.resizeTarget.x=parseInt(this.resizeTarget.css("left"),10);this.resizeTarget.y=parseInt(this.resizeTarget.css("top"),10);this._resizeBackupChildrenSize()},_resizeBackupChildrenSize:function(){var b=this.resizeTargetChildren.length,c;while(b){b-=1;c=this.resizeTargetChildren[b];this.resizeTargetChildren[b].lastWidth=c.width();this.resizeTargetChildren[b].lastHeight=c.height()}},_performResize:function(e,d){var c=e-this._mouseResizePosition.x,b=d-this._mouseResizePosition.y;if(this._resizeDirection){this._resize(this.resizeTarget,c,b)}},_resizeCursorChangeHandler:function(c){var b=c.data.self;if(!b.isResizing){b._changeCursor(c.pageX-parseInt(b.resizeTarget.css("left")),c.pageY-parseInt(b.resizeTarget.css("top")))}},_resizeMouseDownHandler:function(c){var b=c.data.self;if(b._resizeDirection!==null){b._resizeMouseDown=true;b._mouseResizePosition.x=c.pageX;b._mouseResizePosition.y=c.pageY;c.preventDefault()}},_validateResizeProperties:function(){try{if(!this.resizeTarget||this.resizeTarget.length!==1){throw new Error(this._resizeExceptions.invalidTarget)}if(this.minHeight<0||isNaN(parseInt(this.minHeight))){throw new Error(this._resizeExceptions.invalidMinHeight)}if(this.maxHeight<=0||isNaN(parseInt(this.maxHeight))){throw new Error(this._resizeExceptions.invalidMaxHeight)}if(this.minWidth<0||isNaN(parseInt(this.minWidth))){throw new Error(this._resizeExceptions.invalidMinWidth)}if(this.maxWidth<0||isNaN(parseInt(this.maxWidth))){throw new Error(this._resizeExceptions.invalidMaxWidth)}if(this.resizeIndicatorSize<0||isNaN(parseInt(this.resizeIndicatorSize))){throw new Error(this._resizeExceptions.invalidIndicatorSize)}if(this.minHeight>this.maxHeight||this.minWidth>this.maxWidth){throw new Error(this._resizeExceptions.invalidSize)}if(this.resizeParent&&this.resizeParent.width&&this.resizeParent.height&&this.resizeParent.left&&this.resizeParent.top&&((this.resizeParent.width<this.resizeTarget.width()||this.resizeParent.width<this.maxWidth)||(this.resizeParent.height<this.resizeTarget.height()||this.resizeParent.height<this.maxHeight))){throw new Error(this._resizeExceptions.invalidSize)}}catch(b){alert(b)}},_changeCursor:function(b,c){if(this.isResizing||this._resizeMouseDown){return}this.resizeArea=true;if(b<=this.resizeIndicatorSize&&b>=0&&c<=this.resizeIndicatorSize&&c>0){this._resizeWrapper.css("cursor","nw-resize");this._resizeDirection="topleft";return}else{if(c<=this.resizeIndicatorSize&&c>0&&b>=this.resizeTarget.width()-this.resizeIndicatorSize){this._resizeWrapper.css("cursor","ne-resize");this._resizeDirection="topright";return}else{if(c>=this.resizeTarget.height()-this.resizeIndicatorSize&&c<this.resizeTarget.height()&&b<=this.resizeIndicatorSize&&b>=0){this._resizeWrapper.css("cursor","sw-resize");this._resizeDirection="bottomleft";return}else{if(c>=this.resizeTarget.height()-this.resizeIndicatorSize&&c<this.resizeTarget.height()&&b>=this.resizeTarget.width()-this.resizeIndicatorSize&&b<this.resizeTarget.width()){this._resizeWrapper.css("cursor","se-resize");this._resizeDirection="bottomright";return}else{if(b<=this.resizeIndicatorSize&&b>=0){this._resizeWrapper.css("cursor","e-resize");this._resizeDirection="left"}else{if(c<=this.resizeIndicatorSize&&c>0){this._resizeWrapper.css("cursor","n-resize");this._resizeDirection="top"}else{if(c>=this.resizeTarget.height()-this.resizeIndicatorSize&&c<this.resizeTarget.height()){this._resizeWrapper.css("cursor","n-resize");this._resizeDirection="bottom"}else{if(b>=this.resizeTarget.width()-this.resizeIndicatorSize&&b<this.resizeTarget.width()){this._resizeWrapper.css("cursor","e-resize");this._resizeDirection="right"}else{this._resizeWrapper.css("cursor",this.resizeTarget.css("cursor"));this._resizeDirection=null;this.resizeArea=false}}}}}}}}},_prepareResizeMethods:function(b){this._resizeMethods=[];if(b.indexOf("left")>=0){this._resizeMethods.push(this._resizeLeft)}if(b.indexOf("top")>=0){this._resizeMethods.push(this._resizeTop)}if(b.indexOf("right")>=0){this._resizeMethods.push(this._resizeRight)}if(b.indexOf("bottom")>=0){this._resizeMethods.push(this._resizeBottom)}},_validateResize:function(e,b,f,d,c){if(f==="horizontal"||f==="both"){return this._validateWidth(e,d,c)}else{if(f==="vertical"||f==="both"){return this._validateHeight(b,d,c)}}return{result:false,fix:0}},_getParent:function(){if(this.resizeParent!==null&&this.resizeParent!==undefined&&this.resizeParent.height&&this.resizeParent.width&&this.resizeParent.top&&this.resizeParent.left){return this.resizeParent}return{left:0,top:0,width:a(document).width(),height:a(document).height()}},_validateHeight:function(d,h,g){var i=0,c=(h.outerHeight(true)-h.height()),b=false,f=d,e=this._getParent();if(a(window).width()>a(document).width()&&a.browser.msie&&e.height===a(document).height()){i=this._SCROLL_WIDTH}if(g==="bottom"&&(d+h.position().top+i+c>e.height+e.top)){return{fix:e.height-h.position().top-i-c+e.top,result:false}}if(g==="top"&&h.lastHeight-d+h.y<e.top){return{fix:d+(h.lastHeight-d+h.y)-e.top,result:false}}if(d<h.minHeight){return{fix:h.minHeight,result:false}}if(d>h.maxHeight){return{fix:h.maxHeight,result:false}}return{result:true,fix:d}},_validateWidth:function(h,g,f){var i=0,c=(g.outerWidth(true)-g.width()),b=false,e=h,d=this._getParent();if(a(window).height()<a(document).height()&&a.browser.msie&&document.documentElement.clientWidth>=document.documentElement.scrollWidth&&d.width===a(document).width()){i=this._SCROLL_WIDTH}if(f==="right"&&(h+g.position().left+i+c>d.width+d.left)){return{fix:d.width-g.position().left-i-c+d.left,result:false}}if(f==="left"&&(g.lastWidth-h+g.x<d.left)){return{fix:h+(g.lastWidth-h+g.x)-d.left,result:false}}if(h<g.minWidth){return{fix:g.minWidth,result:false}}if(h>g.maxWidth){return{fix:g.maxWidth,result:false}}return{result:true,fix:h}},_resize:function(e,c,b){var f=this._resizeDirection;for(method in this._resizeMethods){if(this._resizeMethods[method] instanceof Function){var d={element:e,x:c,y:b,self:this};this._resizeMethods[method](d)}}this._performResizeLayout()},_setResizeChildrenSize:function(c,d){var f=this.resizeTargetChildren.length;while(f){f--;if(d==="width"){var e=this.resizeTargetChildren[f].lastWidth-(this.resizeTarget.lastWidth-c);if(e<this.resizeTarget.maxWidth&&e>0){this.resizeTargetChildren[f].width(e)}}else{var b=this.resizeTargetChildren[f].lastHeight-(this.resizeTarget.lastHeight-c);if(b<this.resizeTarget.maxHeight&&b>0){this.resizeTargetChildren[f].height(b)}}}},_resizeRight:function(c){var d=c.element.lastWidth+c.x,b=c.self._validateResize(d,0,"horizontal",c.element,"right");if(!b.result){d=b.fix}if(c.element.width()!==d){c.self._setResizeChildrenSize(d,"width");c.element.width(d);c.self._raiseResizeEvent(0)}return d},_resizeLeft:function(d){var e=d.element.lastWidth-d.x,c=d.self._validateResize(e,0,"horizontal",d.element,"left"),b=d.element.x+d.x;if(!c.result){b=d.element.x+(d.element.lastWidth-c.fix);e=c.fix;return}if(d.element.width()!==e){d.self._setResizeChildrenSize(e,"width");d.element.width(e);d.element.css("left",b);d.self._raiseResizeEvent(0)}return e},_resizeBottom:function(d){var c=d.element.lastHeight+d.y,b=d.self._validateResize(0,c,"vertical",d.element,"bottom");if(!b.result){c=b.fix}if(d.element.height()!==c){d.self._setResizeChildrenSize(c,"height");d.element.height(c);d.self._raiseResizeEvent(0)}return c},_resizeTop:function(d){var c=d.element.lastHeight-d.y,b=d.self._validateResize(0,c,"vertical",d.element,"top"),e=d.element.y+d.y;if(!b.result){e=d.element.y+(d.element.lastHeight-b.fix);c=b.fix;return}if(d.element.height()!==c){d.self._setResizeChildrenSize(c,"height");d.element.height(c);d.element.css("top",e);d.self._raiseResizeEvent(0)}return c},_raiseResizeEvent:function(d){var c=this._resizeEvents[d],e=a.Event(c),b={};b.width=this.resizeTarget.width();b.height=this.resizeTarget.height();e.args=b;return this.resizeTarget.trigger(e)}}}(jQuery));$.extend($.jqx._jqxWindow.prototype,resizeModule);