/**
* RoundedWidget
*
* Widget with rounded corners  
*
* Rounded widget supports the following style_set elements
*   -style_set_rw : The overall widget width (only put width in this style)
*   -style_set_rw_container : The content container container
*   -style_set_rw_content : The content container style
*   -style_set_rw_top_and_bottom : Style for the b elements in the top and bottom
* 
* @param style_set
**/
function RoundedWidget( style_set ) { 

	this.style_set = style_set;

	this.content_array = new Array();
	
	this.container_dom = document.createElement( 'div' );
	this.content_container_container = document.createElement( 'div' );
	this.content_container = document.createElement( 'div' );

	this.rounded_top = document.createElement( 'b' );
	this.rounded_bottom = document.createElement( 'b' );

	this.rounded_top.style.display = "block";
	this.rounded_bottom.style.display = "block";

	for ( var i=4; i>0; i-- ) { 
		var b = document.createElement( 'b' );
		b.className = this.style_set + "_rw_top_and_bottom";

		b.style.height = "1px";
		b.style.display = "block";
		b.style.overflow = "hidden";

		switch( i ) { 
			case 4: b.style.margin = "0 5px"; break;
			case 3: b.style.margin = "0 3px"; break;
			case 2: b.style.margin = "0 2px"; break;
			case 1: b.style.margin = "0 1px"; b.style.height = "2px"; break;
		}

		this.rounded_top.appendChild( b );

		var b2 = b.cloneNode( false );
		this.rounded_bottom.insertBefore( b2, this.rounded_bottom.firstChild );
	
	}

	this.content_container_container.className = this.style_set + "_rw_container";
	this.content_container.className = this.style_set + "_rw_content";
	this.container_dom.className = this.style_set + "_rw";

	this.content_container_container.appendChild( this.content_container );

	this.container_dom.appendChild( this.rounded_top );
	this.container_dom.appendChild( this.content_container_container );
	this.container_dom.appendChild( this.rounded_bottom );

}

RoundedWidget.prototype = new AbstractWidget();

/**
* RoundedWidgetFactory
*
* A factory for rounded widgets
*
* @param style_set
**/
function RoundedWidgetFactory( style_set ) { 

	this.style_set = style_set;

}

new RoundedWidgetFactory();

RoundedWidgetFactory.prototype.build = function() { 

	return new RoundedWidget( this.style_set );

}

