// Text Element Wrapping ÇÑ Class

var RHCheckBox = Class.create(RBaseElementObject,{

	initialize :

		function($super,rhForm,key)
		{
			$super(rhForm,key) ;
		},

	// Ã¼Å© µÇ¾ú´ÂÁö ¿©ºÎ ¸®ÅÏ
	// return : Array<boolean>
	getC : 

		function(index)
		{
			var array = [] ;

			this.iter(
				function(item,cur)
				{
					if( index == undefined ) 
						array.push(item.checked) ;
					else if( index == cur )
						array.push(item.checked) ;
				}
			) ;

			return array ;
		},

	// Ã¼Å©µÈ °ª °¡Á®¿À±â	
	// return : Array<string>
	getV :

		function()
		{
			var array = [] ;

			this.iter(
				function(item,cur)
				{
					if( item.checked )
						array.push(item.getV()) ;
				}
			) ;

			return array ;
		},

	// °ª Ã¼Å©ÇÏ±â
	// return : this 
	setV :

		function(value)
		{
			this.iter(
				function(item,cur) {

					if( item.getV() == value )
						item.checked = true ;
				}
			) ;

			return this ;
		},


	// ¼±ÅÃ/ºñ¼±ÅÃ ÇÏ±â
	// return : this 
	doCheck :

		function(is)
		{
			this.iter(
				function(item,cur)
				{
					item.checked = is ;
				}
			) ;

			return this ;
		},

	// Å¸ÄÏ Radio Checked µû¶óÃ³¸®ÇÏ±â
	// return : this 
	doCheckChain :

		function(target,isReverse)
		{
			isReverse = ( isReverse == undefined ) ? false : true ;

			var tChecked = this.getaOrg().checked ;

			tChecked = ( isReverse == true ) ? !tChecked : tChecked ;

			target.doCheck(tChecked) ;

			return this ;
		},

	// Ã¼Å© µÈ Ã¼Å©¹Ú½º °¹¼ö °¡Á®¿À±â
	// return : number 
	getCheckedCount : 

		function()
		{
			var cnt = 0 ;

			this.iter(
				function(item,cur)
				{
					cnt += ( item.checked ) ? 1 : 0 ;
				}
			) ;

			return cnt ;
		},

	// ¶óµð¿À ¹öÆ° Ã³·³ µ¿ÀÛÃ³¸® ÇÏ±â
	// return : this 	
	radiolize :

		function()
		{

			this.rhForm.oBody.attachEvent(this.getOrg(),"onclick",this.radiolizeHandler) ;

			return this ;
		},

	// ¶óµð¿À ¹öÆ° Ã³·³ µ¿ÀÛÃ³¸®¸¦ À§ÇÑ Å¬¸¯ ÇÚµé·¯
	radiolizeHandler :

		function(str)
		{
			var eventEle = this.getOrgEv() ;

			this.iter(
				function(item,index)
				{
					item.checked = ( item == eventEle )	;
				}
			) ;
		}



}) ;



