/* 
	Author: Bluekora - Agência Web & comunicação (José P. Airosa)
	Description: 
*/
(function($) {
	$.fn.readble = function(settings) {
		settings = jQuery.extend({
			// Configuration
			opacity:			.3,		// (float) All the elements that should be excluded from the height fix. (Example: ["#header","#footer","#sidebar"])
			speedIn:				125,		// (int) All the elements that should be excluded from the height fix. (Example: ["#header","#footer","#sidebar"])
			speedOut:				350,		// (int) All the elements that should be excluded from the height fix. (Example: ["#header","#footer","#sidebar"])
			applyTo:			"p"		// (string) All the elements that should be excluded from the height fix. (Example: ["#header","#footer","#sidebar"])
		},settings);
		
		return this.each(function() {
			obj = $(this);
			$(this).children(settings.applyTo).hover(
				function(){
					// Keep out element readable
					$(this).attr("hovered","1").animate({
						opacity: 1
					},settings.speedIn);
					
					// Seet all others as faded
					$(this).parent().children(settings.applyTo).each(function(){
						if($(this).attr("hovered") != "1") {
							$(this).animate({
								opacity: settings.opacity
							},settings.speedOut);
						}
					});
				},
				function(){
					$(this).attr("hovered","0");
				}
			);
			$(this).mouseout(function(){
				$(this).children(settings.applyTo).animate({
					opacity: 1
				},settings.speedIn);
			});
		});
	}
})(jQuery);
