/**
 * The DesignersFactory jQuery plugins!
 */
 
(function($) {
	
	$.fn.disable = function() {
		return $(this).each(function() {
			$(this).attr("disabled", "disabled");
		});
	}
	
	$.fn.enable = function() {
		return $(this).each(function() {
			$(this).removeAttr("disabled");
		});
	}
	
	function flash(o, options) {
		var css = { 'backgroundColor':options.startColor };
		var anim = { 'backgroundColor':options.endColor };
		
		if(options.flashText == true) {
			css = { 'color':options.startTextColor };
			anim = { 'color':options.endTextColor };
		} else if(options.flashText == 'both') {
			css = {
				'color':options.startTextColor,
				'backgroundColor':options.startColor
				};
			anim = {
				'color':options.endTextColor,
				'backgroundColor':options.endColor
			};
		}
		o.css(css).animate(anim, options.speed, options.easing, options.callback);
	}
	
	$.fn.flash = function(options) {
		return $(this).each(function() {
			var me = $(this);
			
			var defaults = {
				startColor:'#ffffcc',
				endColor:'#ffffff',
				startTextColor:'#ff0000',
				endTextColor:'#000000',
				flashText:false,
				speed:1500
			}
			if(typeof options == 'undefined') options = {};
			var settings = $.extend({}, defaults, options);
			
			flash(me, settings);
		});
	};
})(jQuery);