﻿// (c) 2010 CodePlex Foundation
(function(){var b="ExtendedRoundedCorners";function a(){var b=null,a=true;Type.registerNamespace("Sys.Extended.UI");Sys.Extended.UI.BoxCorners=function(){throw Error.invalidOperation();};Sys.Extended.UI.BoxCorners.prototype={None:0,TopLeft:1,TopRight:2,BottomRight:4,BottomLeft:8,Top:1|2,Right:2|4,Bottom:4|8,Left:8|1,All:1|2|4|8};Sys.Extended.UI.BoxCorners.registerEnum("Sys.Extended.UI.BoxCorners",a);Sys.Extended.UI.RoundedCornersBehavior=function(d){var c=this;Sys.Extended.UI.RoundedCornersBehavior.initializeBase(c,[d]);c._corners=Sys.Extended.UI.BoxCorners.All;c._radius=5;c._color=b;c._parentDiv=b;c._originalStyle=b;c._borderColor=b;c._isDirty=a};Sys.Extended.UI.RoundedCornersBehavior.prototype={initialize:function(){Sys.Extended.UI.RoundedCornersBehavior.callBaseMethod(this,"initialize");this.update()},dispose:function(){this.disposeParentDiv();Sys.Extended.UI.RoundedCornersBehavior.callBaseMethod(this,"dispose")},update:function(){var d="1px",j="solid",i="none",h="px",c=this,g=c.get_element();if(!g||!c._isDirty||c.get_isUpdating())return;c.disposeParentDiv();var v=c.getBackgroundColor(),q=g.offsetWidth,e=g.cloneNode(false);c.moveChildren(g,e);c._originalStyle=g.style.cssText;g.style.backgroundColor="transparent";g.style.verticalAlign="top";g.style.padding="0";g.style.overflow="";g.style.className="";if(g.style.height&&g.style.height!="auto")g.style.height=parseInt($common.getCurrentStyle(g,"height"))+c._radius*2+h;else if(!g.style.width&&0<q)g.style.width=q+h;e.style.position="";e.style.border="";e.style.margin="";e.style.width="100%";if(e.style.overflow==""&&$common.getCurrentStyle(g,"overflow")=="visible")e.style.overflow="auto";e.id="";e.removeAttribute("control");if(c._borderColor){e.style.borderTopStyle=i;e.style.borderBottomStyle=i;e.style.borderLeftStyle=j;e.style.borderRightStyle=j;e.style.borderLeftColor=c._borderColor;e.style.borderRightColor=c._borderColor;e.style.borderLeftWidth=d;e.style.borderRightWidth=d;if(c._radius==0){e.style.borderTopStyle=j;e.style.borderBottomStyle=j;e.style.borderTopColor=c._borderColor;e.style.borderBottomColor=c._borderColor;e.style.borderTopWidth=d;e.style.borderBottomWidth=d}}else{e.style.borderTopStyle=i;e.style.borderBottomStyle=i;e.style.borderLeftStyle=i;e.style.borderRightStyle=i}for(var m=b,p=c._radius,t=c._radius,r=0,o=t;o>0;o--){var u=Math.acos(o/p),n=p-Math.round(Math.sin(u)*p),f=document.createElement("DIV");f.__roundedDiv=a;f.style.backgroundColor=v;f.style.marginLeft=n+h;f.style.marginRight=n-(c._borderColor?2:0)+h;f.style.height=d;f.style.fontSize=d;f.style.overflow="hidden";if(c._borderColor){f.style.borderLeftStyle=j;f.style.borderRightStyle=j;f.style.borderLeftColor=c._borderColor;f.style.borderRightColor=c._borderColor;var s=Math.max(0,r-n-1);f.style.borderLeftWidth=s+1+h;f.style.borderRightWidth=s+1+h;if(o==t){f.__roundedDivNoBorder=a;f.style.backgroundColor=c._borderColor}}g.insertBefore(f,m);var l=f;f=f.cloneNode(a);f.__roundedDiv=a;g.insertBefore(f,m);var k=f;m=f;r=n;if(!c.isCornerSet(Sys.Extended.UI.BoxCorners.TopLeft)){l.style.marginLeft="0";if(c._borderColor)l.style.borderLeftWidth=d}if(!c.isCornerSet(Sys.Extended.UI.BoxCorners.TopRight)){l.style.marginRight="0";if(c._borderColor){l.style.borderRightWidth=d;l.style.marginRight="-2px"}}if(!c.isCornerSet(Sys.Extended.UI.BoxCorners.BottomLeft)){k.style.marginLeft="0";if(c._borderColor)k.style.borderLeftWidth=d}if(!c.isCornerSet(Sys.Extended.UI.BoxCorners.BottomRight)){k.style.marginRight="0";if(c._borderColor){k.style.borderRightWidth=d;k.style.marginRight="-2px"}}}g.insertBefore(e,m);c._parentDiv=e;c._isDirty=false},disposeParentDiv:function(){var a=this;if(a._parentDiv){for(var d=a.get_element(),f=d.childNodes,e=f.length-1;e>=0;e--){var c=f[e];if(c){c==a._parentDiv&&a.moveChildren(c,d);try{d.removeChild(c)}catch(d){}}}if(a._originalStyle){d.style.cssText=a._originalStyle;a._originalStyle=b}a._parentDiv=b}},getBackgroundColor:function(){return this._color?this._color:$common.getCurrentStyle(this.get_element(),"backgroundColor")},moveChildren:function(b,d){var c=0;while(b.hasChildNodes()){var a=b.childNodes[0];a=b.removeChild(a);d.appendChild(a);c++}return c},isCornerSet:function(a){return(this._corners&a)!=Sys.Extended.UI.BoxCorners.None},setCorner:function(b,c){var a=this;if(c)a.set_Corners(a._corners|b);else a.set_Corners(a._corners&~b)},get_Color:function(){return this._color},set_Color:function(c){var b=this;if(c!=b._color){b._color=c;b._isDirty=a;b.update();b.raisePropertyChanged("Color")}},get_Radius:function(){return this._radius},set_Radius:function(c){var b=this;if(c!=b._radius){b._radius=c;b._isDirty=a;b.update();b.raisePropertyChanged("Radius")}},get_Corners:function(){return this._corners},set_Corners:function(c){var b=this;if(c!=b._corners){b._corners=c;b._isDirty=a;b.update();b.raisePropertyChanged("Corners")}},get_BorderColor:function(){return this._borderColor},set_BorderColor:function(c){var b=this;if(c!=b._borderColor){b._borderColor=c;b._isDirty=a;b.update();b.raisePropertyChanged("BorderColor")}}};Sys.Extended.UI.RoundedCornersBehavior.registerClass("Sys.Extended.UI.RoundedCornersBehavior",Sys.Extended.UI.BehaviorBase);Sys.registerComponent(Sys.Extended.UI.RoundedCornersBehavior,{name:"rounded"})}if(window.Sys&&Sys.loader)Sys.loader.registerScript(b,["ExtendedBase","ExtendedCommon"],a);else a()})();
if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();