(function($) {
	$.fn.customFadeIn = function(speed, callback) {
		$(this).fadeIn(speed, function() {
			if(jQuery.browser.msie)
				$(this).get(0).style.removeAttribute('filter');
			if(callback != undefined)
				callback();
		});
	};
	$.fn.customFadeOut = function(speed, callback) {
		$(this).fadeOut(speed, function() {
			if(jQuery.browser.msie)
				$(this).get(0).style.removeAttribute('filter');
			if(callback != undefined)
				callback();
		});
	};
	
	$.fn.centerTo = function(obj)
	{
	    var c = $(this);
	    c.css('left', (obj.width() - c.width()) / 2);
        c.css('top', (obj.height() - c.height()) / 2);
	};
	
	$.fn.centerToWindow = function()
	{
	    var w = $(window);
	    var s = $(this);
	    
	    var l = (w.width() - s.width()) / 2;
	    var t = (w.height() - s.height()) / 2;
	    
	    s.css('left', l + w.scrollLeft());
	    s.css('top', t + w.scrollTop());
	};
	
	$.fn.hideForm = function()
	{
	    var disable = ['input', 'select', 'textarea'];
        $(this).hide();
	    for(var i = 0, l = disable.length; i < l; i++)
	    {
	        $.each($(this).find(disable[i]), function()
	        {
	            var t = $(this);
	            if (t.attr('disabled'))
	            {
	                t.attr('disabledx', true);
	            }
	            t.attr('disabled', true);
	        });
	    }
	};
	
	$.fn.showForm = function()
	{
	    var disable = ['input', 'select', 'textarea'];
	    $(this).show();
	    for(var i = 0, l = disable.length; i < l; i++)
	    {
	        $.each($(this).find(disable[i]), function()
	        {
	            var t = $(this);
	            if (t.attr('disabledx'))
	            {
	                t.removeAttr('disabledx');
	                t.attr('disabled', true);
	            }
	            else
	            {
	                t.removeAttr('disabled');
	            }
	        });
	    }
	};
})(jQuery);