jQuery.fn.fadeSlideShow4 = function(options) {
	return this.each(function(){
		settings4 = jQuery.extend({
     		width4: 150, // default width4 of the Slides4how
     		height4: 320, // default height4 of the Slides4how
			speed4: 1000, // default animation transition speed4
			interval: 5500, // default interval between image change
			PlayPauseElement4: 'fssPlayPause4', // default css id for the play / pause element
			PlayText4: '', // default play text
			PauseText4: '', // default pause text
			NextElement4: 'fssNext4', // default id for next button
			NextElementText4: 'Next >', // default text for next button
			PrevElement4: 'fssPrev4', // default id for prev button
			PrevElementText4: '< Prev', // default text for prev button
			ListElement4: 'fssList_hide4', // default id for image / content controll list
			ListLi4: 'fssLi4', // default class for li's in the image / content controll 
			ListLiActive4: 'fssActive4', // default class for active state in the controll list
			addListToId4: false, // add the controll list to special id in your code - default false
			allowKeyboardCtrl4: true, // allow keyboard controlls left / right / space
			autoplay4: true // autoplay4 the Slides4how
	 	}, options);
		
		// set style for wrapper element
		jQuery(this).css({
			width: settings4.width4,
			height: settings4.height4,
			position: 'relative',
			overflow: 'hidden'
		});
		
		// set styles for child element
		jQuery('> *',this).css({
			position: 'absolute',
			width: settings4.width4,
			height: settings4.height4
		});
		
		// count number of Slides4
		Slides4 = jQuery('> *', this).length;
		Slides4 = Slides4 - 1;
		ActSlide4 = Slides4;
		// Set jQuery Slide short var
		jQslide4 = jQuery('> *', this);
		// save this
		fssThis4 = this;
		
		autoplay4 = function(){
			intval4 = setInterval(function(){
				jQslide4.eq(ActSlide4).fadeOut(settings4.speed4);
				
				// if list is on change the active class
				if(settings4.ListElement4){
					setActLi4 = (Slides4 - ActSlide4) + 1;
					if(setActLi4 > Slides4){setActLi4=0;}
					jQuery('#'+settings4.ListElement4+' li').removeClass(settings4.ListLiActive4);
					jQuery('#'+settings4.ListElement4+' li').eq(setActLi4).addClass(settings4.ListLiActive4);
				}
				
				if(ActSlide4 <= 0){
					jQslide4.fadeIn(settings4.speed4);
					ActSlide4 = Slides4;
				}else{
					ActSlide4 = ActSlide4 - 1;	
				}
			}, settings4.interval);
			
			if(settings4.PlayPauseElement4){
				jQuery('#'+settings4.PlayPauseElement4).html(settings4.PauseText4);
			}
		}
		
		stopautoplay4 = function(){
			clearinterval(intval4);
			intval4 = false;
			if(settings4.PlayPauseElement4){
				jQuery('#'+settings4.PlayPauseElement4).html(settings4.PlayText4);
			}
		}
		
		jumpTo4 = function(ListLi4){
			if(ListLi4 < 0){ListLi4 = Slides4;}
			else if(ListLi4 > Slides4){ListLi4 = 0;}
			if( ListLi4 >= ActSlide4 ){
				jQuery('> *:lt('+(ListLi4+1)+')', fssThis4).fadeIn(settings4.speed4);
			}else if(ListLi4 <= ActSlide4){
				jQuery('> *:gt('+ListLi4+')', fssThis4).fadeOut(settings4.speed4);
			}
			
			// set the active slide
			ActSlide4 = ListLi4;

			if(settings4.ListElement4){
				// set active
				jQuery('#'+settings4.ListElement4+' li').removeClass(settings4.ListLiActive4);
				jQuery('#'+settings4.ListElement4+' li').eq((Slides4-ListLi4)).addClass(settings4.ListLiActive4);
			}
		}
		
		// if list is on render it
		if(settings4.ListElement4){
			i=0;
			li = '';
			while(i<=Slides4){
				if(i==0){
					li = li+'<li class="'+settings4.ListLi4+i+' '+settings4.ListLiActive4+'"><a href="#">'+(i+1)+'<\/a><\/li>';
				}else{
					li = li+'<li class="'+settings4.ListLi4+i+'"><a href="#">'+(i+1)+'<\/a><\/li>';
				}
				i++;
			}
			List = '<ul id="'+settings4.ListElement4+'">'+li+'<\/ul>';
			
			// add list to a special id or append after the Slides4how
			if(settings4.addListToId4){
				jQuery('#'+settings4.addListToId4).append(List);
			}else{
				jQuery(this).after(List);
			}
			
			jQuery('#'+settings4.ListElement4+' a').bind('click', function(){
				index = jQuery('#'+settings4.ListElement4+' a').index(this);
				stopautoplay4();
				ReverseIndex = Slides4-index;
				
				jumpTo4(ReverseIndex);
				
				return false;
			});
		}
		
		if(settings4.PlayPauseElement4){
			if(!jQuery('#'+settings4.PlayPauseElement4).css('display')){
				jQuery(this).after('<a href="#" id="'+settings4.PlayPauseElement4+'"><\/a>');
			}
			
			if(settings4.autoplay4){
				jQuery('#'+settings4.PlayPauseElement4).html(settings4.PauseText4);
			}else{
				jQuery('#'+settings4.PlayPauseElement4).html(settings4.PlayText4);
			}
			
			jQuery('#'+settings4.PlayPauseElement4).bind('click', function(){
				if(intval4){
					stopautoplay4();
				}else{
					autoplay4();
				}
				return false;
			});
		}
		
		if(settings4.NextElement4){
			if(!jQuery('#'+settings4.NextElement4).css('display')){
				jQuery(this).after('<a href="#" id="'+settings4.NextElement4+'">'+settings4.NextElementText4+'<\/a>');
			}
			
			jQuery('#'+settings4.NextElement4).bind('click', function(){
				nextSlide4 = ActSlide4-1;
				stopautoplay4();
				jumpTo4(nextSlide4);
				return false;
			});
		}
		
		if(settings4.PrevElement4){
			if(!jQuery('#'+settings4.PrevElement4).css('display')){
				jQuery(this).after('<a href="#" id="'+settings4.PrevElement4+'">'+settings4.PrevElementText4+'<\/a>');
			}
			
			jQuery('#'+settings4.PrevElement4).bind('click', function(){
				prevSlide4 = ActSlide4+1;
				stopautoplay4();
				jumpTo4(prevSlide4);
				return false;
			});
		}
		
		if(settings4.allowKeyboardCtrl4){
			jQuery(document).bind('keydown', function(e){
				if(e.which==39){
					nextSlide4 = ActSlide4-1;
					stopautoplay4();
					jumpTo4(nextSlide4);
				}else if(e.which==37){
					prevSlide4 = ActSlide4+1;
					stopautoplay4();
					jumpTo4(prevSlide4);
				}else if(e.which==32){
					if(intval4){stopautoplay4();}
					else{autoplay4();}
					return false;
				}
			});
		}
		
		// start autoplay4 or set it to false
		if(settings4.autoplay4){autoplay4();}else{intval4=false;}
	});
};

/*
 * fadeSlideshow4
 * v.2.0.0
 *
 * Copyright (c) 2010 Pascal Bajorat (http://www.pascal-bajorat.com)
 * Dual licensed under the MIT (below)
 * and GPL (http://www.gnu.org/licenses/gpl.txt) licenses.
 *
 *
 * http://plugins.jquery.com/project/fadeSlideshow4
 * http://www.pascal-bajorat.com

MIT License

Copyright (c) 2010 Pascal Bajorat

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */


