$(document).ready(function(){
	
	if ( $.pslide ) {
		
		$('.imagefader-widget').each(function(){
			
			var opt = {
				width				: parseInt($(this).find('.imagefader-width').text()),
				height				: parseInt($(this).find('.imagefader-height').text()),
				items 		        : parseInt($(this).find('.imagefader-items').text()),
				duration			: parseInt($(this).find('.imagefader-duration').text()),
				delay				: parseInt($(this).find('.imagefader-delay').text())
		    };
		    
		    
		    
			if ( !opt.width ) 			opt.width 			= parseInt($(this).find('img:first').css('width'));
			if ( !opt.height ) 			opt.height 			= parseInt($(this).find('img:first').css('height'));
			if ( !opt.visibleItems ) 	opt.visibleItems 	= 1;
			if ( !opt.duration ) 		opt.duration 		= 5000;
			if ( !opt.delay ) 			opt.delay	 		= 500;
			
			$(this).css({
				width: opt.width,
				height: opt.height
			});
			
			$(this).find('span').remove();
			$(this).pslide(opt);
	
		});
	
	}
	
});
