(function($){

	$.fn.enabled = function(flag)
	{
	    if (flag) {
	        return $(this).removeAttr('disabled');
	    } else {
	        return $(this).attr('disabled', 'disabled');
	    }
	};
	
	$.fn.readonly = function(flag)
	{
		if (flag) {
			return $(this).attr('readonly', 'readonly');
		} else {
			return $(this).removeAttr('readonly');
		}
	};

	$.fn.id = function()
	{
		return $(this).attr('id') || null;
	};

	$.fn.bg = function(url)
	{
		if (url == undefined) {
			var bg = $(this).css('background-image');
			bg = bg.replace(/^url\(("|)/,'');
			bg = bg.replace(/("|)\)$/,'');
			return bg;
		} else {
			$(this).css('background-image', 'url("' + url + '")');
		}
	};

	$.fn.clickpress = function(func)
	{
		$(this).click(function(){ return func(); });
		$(this).keypress(function(e){
			var keyCode;
			if (e.keyCode) keyCode = e.keyCode;
			else if (e.which) keyCode = e.which;
			if (keyCode != 13 && keyCode != 32) return true;
			return func();
		});
		return $(this);
	};

	$.css.add=function(a,b){var c=$.css.sheet,d=!$.browser.msie,e=document,f,g,h=-1,i="replace",j="appendChild";if(!c){if(d){c=e.createElement("style");c[j](e.createTextNode(""));e.documentElement[j](c);c=c.sheet}else{c=e.createStyleSheet()}$.css.sheet=c}if(d)return c.insertRule(a,b||c.cssRules.length);if((f=a.indexOf("{"))!==-1){a=a[i](/[\{\}]/g,"");c.addRule(a.slice(0,f)[i](g=/^\s+|\s+$/g,""),a.slice(f)[i](g,""),h=b||c.rules.length)}return h};
	$.css.remove=function(a){var b=$.css.sheet;b&&b[$.browser.msie?"removeRule":"deleteRule"](a)};

})(jQuery);

