jQuery.fn.check = function(mode) {
   // se mode não está definido, usaremos 'on' como padrão
   var mode = mode || 'on';
   return this.each(function() {
  	 switch(mode) {
  	   case 'on':
  		 this.checked = true;
  		 break;
  	   case 'off':
  		 this.checked = false;
  		 break;
  	   case 'toggle':
  		 this.checked = !this.checked;
  		 break;
  	 }
   });
};

jQuery.fn.joinValues = function(separator) {
  var a = new Array();
  var separator = separator || ',';
  this.each(function(){
    a.push(this.value);
  });
  return a.join(separator);
}
