/* file: ui.inputCheckbox.js - v1.0.0 | minified on 2011/01/27 with http://jscompress.com/ */ (function($) {var publicMethods={init:function(opt) {return this.each(function() {var $this=$(this),data=$this.data('options'),objects=$this.data('objects'),properties=$this.data('properties'),options={values:{forced:false,checked:'yes',unchecked:'no'},returnMode:'selected',change:null};$this.data('options',options).addClass('ui-inputCheckbox');if(!properties) {$this.data('properties',{initialized:false,isValid:true,checkboxList:null,isCB:true});properties=$this.data('properties');} if($this.get(0).tagName=='INPUT'&&$this.get(0).type=='checkbox') {properties.checkboxList=$this;} else {properties.checkboxList=$this.find('input[type=checkbox]');properties.isCB=false;} properties.checkboxList.bind('click.inputCheckbox',function(event) {privateMethods.setValue($this,$(this).attr('id'),$(this).attr('checked')?options.values.checked:options.values.unchecked,false);});privateMethods.setOptions($this,opt);});},destroy:function() {return this.each(function() {var properties=this.data('properties');properties.checkboxList.unbind('.inputCheckbox');this.removeClass('ui-inputCheckbox');});},options:function(value) {return(this.each(function() {privateMethods.setOptions($(this),value);}));},disabled:function(value) {if(value!=null) {return(this.each(function() {privateMethods.setDisabled($(this),value);}));} else {return(privateMethods.getDisabled($(this)));}},values:function(value) {if(value!=null) {return(this.each(function() {privateMethods.setValues($(this),value);}));} else {var options=this.data('options');return(options.values);}},value:function(id,value) {var properties=this.data('properties');if(properties.isCB) {value=id;id=$(this).get(0).id;} if(value!=null||id==':all'||id==':invert'||id==':none') {return(this.each(function() {privateMethods.setValue($(this),id,value,true);}));} else if(id!=null&&id!='') {var options=this.data('options');return($(this).find('#'+id).attr('checked')?options.values.checked:options.values.unchecked);} else {var options=this.data('options'),returned=[];if(options.values.forced) {$(this).find('input').each(function() {returned.push({id:$(this).attr('id'),value:$(this).attr('checked')?options.values.checked:options.values.unchecked});});} else {var filter=(options.returnMode=='selected'?':checked':':not(:checked)');$(this).find('input'+filter).each(function() {returned.push($(this).attr('value'));});} return(returned);}},returnMode:function(value) {if(value!=null) {return this.each(function() {privateMethods.setReturnMode($(this),value);});} else {var options=this.data('options');if(options) {return(options.returnMode);} else {return('selected');}}},isValid:function(value) {if(value!=null) {return(this.each(function() {privateMethods.setIsValid($(this),value);}));} else {var properties=this.data('properties');return(properties.isValid);}},change:function(value) {if(value!=null&&$.isFunction(value)) {return(this.each(function() {privateMethods.setEventChange($(this),value);}));} else {var options=this.data('options');if(options) {return(options.change);} else {return(null);}}}};var privateMethods={setOptions:function(object,value) {var properties=object.data('properties'),options=object.data('options');if(!$.isPlainObject(value))return(false);properties.initialized=false;privateMethods.setReturnMode(object,(value.returnMode!=null)?value.returnMode:options.returnMode);privateMethods.setValues(object,(value.values!=null)?value.values:options.values);privateMethods.setEventChange(object,(value.change!=null)?value.change:options.change);properties.initialized=true;},setIsValid:function(object,value) {var properties=object.data('properties');if(properties.isValid!=value&&properties.initialized) {properties.isValid=value;if(properties.isValid) {if(properties.isCB) {object.parent().removeClass('ui-inputCheckbox ui-error');} else {object.removeClass('ui-error');}} else {if(properties.isCB) {object.parent().addClass('ui-inputCheckbox ui-error');} else {object.addClass('ui-error');}}} return(properties.isValid);},setReturnMode:function(object,value) {var options=object.data('options'),properties=object.data('properties');if((!properties.initialized||options.returnMode!=value)&&(value=='selected'||value=='notSelected')) {options.returnMode=value;} return(options.returnMode);},setValues:function(object,value) {var options=object.data('options');if(value.forced!=null)options.values.forced=value.forced;if(value.checked!=null)options.values.checked=value.checked;if(value.unchecked!=null)options.values.unchecked=value.unchecked;return(options.values);},setValue:function(object,id,value,apply) {var options=object.data('options'),properties=object.data('properties');if(apply) {if(id==':all'||id==':none'||id==':invert') {switch(id) {case':all':properties.checkboxList.attr('checked',true);break;case':none':properties.checkboxList.attr('checked',false);break;case':invert':properties.checkboxList.each(function() {$(this).attr('checked',!$(this).attr('checked'));});break;}} else if($.isArray(value)&&!properties.isCB) {properties.checkboxList.attr('checked',false);for(var i=0;i