/**
 * @author Thomas Pimentel
 */
jQuery.fn.mySlider = function(getFrom){
	
	var element = this;
	var image = [];
	var imageCount = $(element).children('img').size();
	var count = 0;
	var imagesListing = $(element).children('img');
	var divWidth = $(element).children('img').attr('width');
	var divHeight = $(element).children('img').attr('height');
	
	var imageSource = imagesListing.each(function(index){
		image[index] = $(this);
		$(this).css("position", "absolute");

		$(this).hide();
	});
	$(element).css("width", divWidth);
	$(element).css("height", divHeight);
	$(element).css("margin-bottom", "20px");
	$(image[0]).show();
	loopThrough();
	
	function loopThrough(){
	setInterval(function(){
				count++;

				if(count >= imageCount){
					count = 0;
						image[count].css("z-index", "1");
						image[imageCount-1].css("z-index", "2");										
						image[count].show();
						image[imageCount-1].fadeOut("slow")
				}
				else
					{	
						image[count].css("z-index", "1");
						image[count-1].css("z-index", "2");										
						image[count].show();
						image[count-1].fadeOut("slow");
					}
			
		}, 10000);
	}
};
