function RoundedCornersInterface(){this.elemId=null;this.cornerStyle=null;this.init=RoundedCornersInterface_Init;this.draw=RoundedCornersInterface_Draw;this.erase=RoundedCornersInterface_Erase;this.cornersDrawn=false;this.init();}
RoundedCornersInterface.prototype=new Interface;RoundedCornersInterface.prototype.constructor=RoundedCornersInterface;RoundedCornersInterface.superclass=Interface.prototype;RoundedCornersInterface.styles={Default:{images:{tr:{src:'http://i.pgcdn.com/images/balloon/top_right_6x6.gif',width:6,height:6},tl:{src:'http://i.pgcdn.com/images/balloon/top_left_6x6.gif',width:6,height:6},bl:{src:'http://i.pgcdn.com/images/balloon/bottom_left_6x6.gif',width:6,height:6},br:{src:'http://i.pgcdn.com/images/balloon/bottom_right_6x6.gif',width:6,height:6}}}};RoundedCornersInterface.settings={style:'Default'};RoundedCornersInterface.imgIds={tr:0,tl:1,bl:2,br:3};function RoundedCornersInterface_Init(){var style=RoundedCornersInterface.styles[RoundedCornersInterface.settings.style];if(typeof(window.preloadImage)=='function'){window.preloadImage(style.images.tr.src,style.images.tr.width,style.images.tr.height);window.preloadImage(style.images.tl.src,style.images.tl.width,style.images.tl.height);window.preloadImage(style.images.bl.src,style.images.bl.width,style.images.bl.height);window.preloadImage(style.images.br.src,style.images.br.width,style.images.br.height);}}
function RoundedCornersInterface_Draw(){if(this.cornersDrawn){RoundedCornersInterface_Erase.call(this);}
var elem=document.getElementById(this.elemId);if(elem){var style=RoundedCornersInterface.styles[RoundedCornersInterface.settings.style];var div=document.createElement('div');div.id='roundedCorners_Background';div.style.position='absolute';div.style.left=style.images.tl.width+'px';div.style.top=style.images.tl.height+'px';var eHeight=DomUtils.getElementHeight(elem);var tlHeight=style.images.tl.height;var blHeight=style.images.bl.height;var eWidth=DomUtils.getElementWidth(elem);var tlWidth=style.images.tl.width;var blWidth=style.images.bl.width;div.style.height=(parseInt(eHeight)-tlHeight-blHeight)+'px';div.style.width=(parseInt(eWidth)-tlWidth-blWidth)+'px';div.style.backgroundColor='#ffffff';div.style.zIndex='-1';elem.appendChild(div);elem.style.backgroundColor='transparent';div=document.createElement('div');div.id='roundedCorners_BottomEdge';div.style.position='absolute';div.style.left=style.images.bl.width+'px';div.style.top=(parseInt(DomUtils.getElementHeight(elem))-style.images.bl.height)+'px';div.style.height=(style.images.bl.height)+'px';div.style.width=(parseInt(DomUtils.getElementWidth(elem))-style.images.bl.width-style.images.br.width)+'px';div.style.borderBottom='1px solid #999999';div.style.backgroundColor='#ffffff';div.style.overflow='hidden';elem.appendChild(div);div=document.createElement('div');div.id='roundedCorners_TopEdge';div.style.position='absolute';div.style.left=style.images.tl.width+'px';div.style.top='0px';div.style.height=(style.images.tl.height)+'px';div.style.width=(parseInt(DomUtils.getElementWidth(elem))-style.images.tl.width-style.images.tr.width)+'px';div.style.borderTop='1px solid #999999';div.style.backgroundColor='#ffffff';div.style.overflow='hidden';elem.appendChild(div);div=document.createElement('div');div.id='roundedCorners_LeftEdge';div.style.position='absolute';div.style.left='0px';div.style.top=style.images.tl.height+'px';div.style.width=(style.images.tl.width)+'px';div.style.height=(parseInt(DomUtils.getElementHeight(elem))-style.images.tl.height-style.images.bl.height)+'px';div.style.borderLeft='1px solid #999999';div.style.backgroundColor='#ffffff';div.style.overflow='hidden';elem.appendChild(div);div=document.createElement('div');div.id='roundedCorners_RightEdge';div.style.position='absolute';div.style.left=(parseInt(DomUtils.getElementWidth(elem))-style.images.tr.width)+'px';div.style.top=style.images.tr.height+'px';div.style.width=(style.images.tr.width)+'px';div.style.height=(parseInt(DomUtils.getElementHeight(elem))-style.images.tr.height-style.images.br.height)+'px';div.style.borderRight='1px solid #999999';div.style.backgroundColor='#ffffff';div.style.overflow='hidden';elem.appendChild(div);var img=document.createElement('img');img.id='roundedCorners_TopRightCorner';img.src=style.images.tr.src;img.height=style.images.tr.height;img.width=style.images.tr.width;img.border=0;img.style.position='absolute';img.style.left=parseInt(parseInt(DomUtils.getElementWidth(elem))-(img.width))+'px';img.style.top='0px';elem.appendChild(img);var img=document.createElement('img');img.id='roundedCorners_TopLeftCorner';img.src=style.images.tl.src;img.height=style.images.tl.height;img.width=style.images.tl.width;img.border=0;img.style.position='absolute';img.style.left='0px';img.style.top='0px';elem.appendChild(img);var img=document.createElement('img');img.id='roundedCorners_BottomLeftCorner';img.src=style.images.bl.src;img.height=style.images.bl.height;img.width=style.images.bl.width;img.border=0;img.style.position='absolute';img.style.left='0px';img.style.top=parseInt(parseInt(DomUtils.getElementHeight(elem))-parseInt(img.height))+'px';elem.appendChild(img);var img=document.createElement('img');img.id='roundedCorners_BottomRightCorner';img.src=style.images.br.src;img.height=style.images.br.height;img.width=style.images.br.width;img.border=0;img.style.position='absolute';img.style.left=parseInt(parseInt(DomUtils.getElementWidth(elem))-(img.width))+'px';img.style.top=parseInt(parseInt(DomUtils.getElementHeight(elem))-(img.height))+'px';elem.appendChild(img);this.cornersDrawn=true;}
}
function RoundedCornersInterface_Erase(){var elem=document.getElementById(this.elemId);if(elem.hasChildNodes()){for(var i=elem.childNodes.length;i>0;i--){var nodeId=elem.childNodes[i-1].id;var eq='!=';var idPre='roundedCorners_';if(nodeId&&nodeId.substr(0,idPre.length)==idPre){eq='==';DomUtils.removeElement(elem.childNodes[i-1]);}
}}
this.cornersDrawn=false;}

