var TA;
if(!TA) TA={};
if(!TA.GUI) TA.GUI={};
TA.GUI.RADIO=function(element,json,opt)
{
	this.ele=element;
	this.element=Spry.$(element);
	this.name=this.element.getAttribute('name');
	this.json=json;
	this.checked=[];
	this.template=this.set_template();
	TA.U.setOptions(this,opt);	
	this.bind();
}
TA.GUI.RADIO.prototype.bind=function(){
	this.element.innerHTML=this.template;
	var r= new TA.U.DataTemplate(this.ele,{name:this.name,rows:this.json});
	if(this.checked.length > 0 ) this.check(this.checked);
	//return r;
};
TA.GUI.RADIO.prototype.set_template=function(){
	return '<div style="overflow: auto; height: 100%;"><table cellspacing="1" cellpadding="0" border="0" width="100%"><tr TA="repeate"><th width="10"><input type="checkbox" value="{key}" name="{name}[]" id="checkbox_{key}"/></th><td><label style="width:100%;cursor:pointer;" for="checkbox_{key}">{val}</label></td></tr></table></div>';
};
TA.GUI.RADIO.prototype.check=function(selected){
	for(var id in selected)
		if(Spry.$('checkbox_' + selected[id])!= null)
		Spry.$('checkbox_' + selected[id]).checked=true;

};
