function et_cycle_integration(){
			var $featured = jQuery('#featured'),
				$featured_content = jQuery('#slides'),
				$controller = jQuery('#controllers'),
				$slider_control_tab = $controller.find('a.switch');
		
			if ($featured_content.length) {
				//jQuery('div.slide .description').css('opacity','0');
				
				$featured_content.cycle({
					fx: 'fade',
					timeout: 0,
					speed: 700,
					cleartypeNoBg: true
				});
				
				/*
				$featured_content.hover(function(){
					jQuery('div.slide:visible .description').stop().animate({opacity: 1, top:43},300);
				},function(){
					jQuery('div.slide:visible .description').stop().animate({opacity: 0, top:33},300);
				});
				*/
			};
			
			$slider_control_tab.hover(function(){
				jQuery(this).find('img').stop().animate({opacity: 1},300);
			}).mouseleave(function(){
				if (!jQuery(this).hasClass("active")) jQuery(this).find('img').stop().animate({opacity: 0.7},300);
			});
			
			
			var ordernum;				
			
			function gonext(this_element){
				$controller.find("a.active").removeClass('active');
				
				this_element.addClass('active');
				
				ordernum = this_element.attr("rel");
				$featured_content.cycle(ordernum-1);
				
				//jQuery('div.slide:visible .description').stop().animate({opacity: 0, top:33},500);
				
				if (typeof interval != 'undefined') {
					clearInterval(interval);
					auto_rotate();
				};
			}
			
			$slider_control_tab.click(function(){
				gonext(jQuery(this));
				return false;
			});
			

			var $nextArrow = $featured.find('a#right-arrow'),
				$prevArrow = $featured.find('a#left-arrow');
			
			$nextArrow.click(function(){
				var activeSlide = $controller.find('a.active').attr("rel"),
					$nextSlide = $controller.find('a.switch:eq('+ activeSlide +')');
								
				if ($nextSlide.length) gonext($nextSlide)
				else gonext($controller.find('a.switch:eq(0)'));
				
				return false;
			});
			
			$prevArrow.click(function(){
				var activeSlide = $controller.find('a.active').attr("rel")-2,
					$nextSlide = $controller.find('a.switch:eq('+ activeSlide +')');
								
				if ($nextSlide.length) gonext($nextSlide);
				else {
					var slidesNum = $slider_control_tab.length - 1;
					gonext($controller.find('a.switch:eq('+ slidesNum +')'));
				};
				
				return false;
			});
					
						
						
				auto_rotate();
				
				function auto_rotate(){
					interval = setInterval(function() {
						$nextArrow.click();
					}, 5000);
				}
			
							
		};


(function($)
	{
		$.fn.et_shortcodes_switcher = function(options)
		{
			var defaults =
			{
			   slides: '>div',
			   activeClass: 'active',
			   linksNav: '',
			   findParent: true, //use parent elements to define active states
			   lengthElement: 'li', //parent element, used only if findParent is set to true
			   useArrows: false,
			   arrowLeft: 'a#prev-arrow',
			   arrowRight: 'a#next-arrow',
			   auto: false,
			   autoSpeed: 5000,
			   slidePadding: '',
			   pauseOnHover: true,
			   fx: 'fade',
			   sliderType: ''
			};

			var options = $.extend(defaults, options);

			return this.each(function()
			{
								
				var slidesContainer = jQuery(this).parent().css('position','relative'),
					$slides = jQuery(this).css({'overflow':'hidden','position':'relative'}),
					$slide = $slides.find(options.slides).css({'opacity':'1','position':'absolute','top':'0px','left':'0px','display':'none'}),
					slidesNum = $slide.length,
					zIndex = slidesNum,
					currentPosition = 1,
					slideHeight = 0,
					$activeSlide,
					$nextSlide;
				
				if (options.fx === 'slide') {
					$slide.css({'opacity':'0','position':'absolute','top':'0px','left':'0px','display':'block'});
				} else {
					$slide.filter(':first').css({'display':'block'});
				}
				
				if (options.slidePadding != '') $slide.css('padding',options.slidePadding);
				
				$slide.each(function(){
					jQuery(this).css('z-index',zIndex).addClass('clearfix');
					if (options.fx === 'slide') zIndex--;
					
					slideH = jQuery(this).innerHeight();
					if (slideH > slideHeight) slideHeight = slideH;
				});
				$slides.css('height', slideHeight);
				$slides.css('width', $slides.width());
								
				var slideWidth = $slide.width(),
					slideOuterWidth = $slide.outerWidth();
				
				$slide.css('width',slideWidth);
				
				$slide.filter(':first').css('opacity','1');
				
				if (options.sliderType != '') {
					if (options.sliderType === 'images') {
						controllersHtml = '<div class="controllers-wrapper"><div class="controllers"><a href="#" class="left-arrow">Previous</a>';
						for ($i=1; $i<=slidesNum; $i++) {
							controllersHtml += '<a class="switch" href="#">'+$i+'</a>';
						}
						controllersHtml += '<a href="#" class="right-arrow">Next</a></div><div class="controllers-right"></div></div>';		
						$controllersWrap = jQuery(controllersHtml).prependTo($slides.parent());
					}
					
					var etimage_width = $slide.width();
		
					slidesContainer.css({'width':etimage_width});
					$slides.css({'width':etimage_width});
					
					if (options.sliderType === 'images') {
						slidesContainer.css({'height':$slide.height()});
						$slides.css({'height':$slide.height()});
						
						var controllers_width = $controllersWrap.width(),
						leftPosition = Math.round((etimage_width - controllers_width) / 2);
					
						$controllersWrap.css({left: leftPosition});
					}	
				}
				
				
				if (options.linksNav != '') {
					var linkSwitcher = jQuery(options.linksNav);
					
					var linkSwitcherTab = '';
					if (options.findParent) linkSwitcherTab = linkSwitcher.parent();
					else linkSwitcherTab = linkSwitcher;
					
					if (!linkSwitcherTab.filter('.active').length) linkSwitcherTab.filter(':first').addClass('active');
									
					linkSwitcher.click(function(){
						
						var targetElement;

						if (options.findParent) targetElement = jQuery(this).parent();
						else targetElement = jQuery(this);
						
						var orderNum = targetElement.prevAll(options.lengthElement).length+1;
						
						if (orderNum > currentPosition) gotoSlide(orderNum, 1);
						else gotoSlide(orderNum, -1); 
						
						return false;
					});
				}
				
				
				if (options.useArrows) {
					var $right_arrow = jQuery(options.arrowRight),
						$left_arrow = jQuery(options.arrowLeft);
										
					$right_arrow.click(function(){				
						if (currentPosition === slidesNum) 
							gotoSlide(1,1);
						else 
							gotoSlide(currentPosition+1),1;
						
						if (options.linksNav != '') changeTab();
												
						return false;
					});
					
					$left_arrow.click(function(){
						if (currentPosition === 1)
							gotoSlide(slidesNum,-1);
						else 
							gotoSlide(currentPosition-1,-1);
						
						if (options.linksNav != '') changeTab();
						
						return false;
					});
					
				}
				
								
				function changeTab(){
					if (linkSwitcherTab != '') { 
						linkSwitcherTab.siblings().removeClass('active');
						linkSwitcherTab.filter(':eq('+(currentPosition-1)+')').addClass('active');
					}
				}
				
				function gotoSlide(slideNumber,dir){
					if ($slide.filter(':animated').length) return;
				
					$slide.css('opacity','0');
																		
					$activeSlide = $slide.filter(':eq('+(currentPosition-1)+')').css('opacity','1');
									
					if (currentPosition === slideNumber) return;
									
					$nextSlide = $slide.filter(':eq('+(slideNumber-1)+')').css('opacity','1');
									
					if ((currentPosition > slideNumber || currentPosition === 1) && (dir === -1)) {
						if (options.fx === 'slide') slideBack(500);
						if (options.fx === 'fade') slideFade(500);
					} else {
						if (options.fx === 'slide') slideForward(500);
						if (options.fx === 'fade') slideFade(500);
					}
					
					currentPosition = $nextSlide.prevAll().length + 1;
					
					if (options.linksNav != '') changeTab();
					
					if (typeof interval != 'undefined' && options.auto) {
						clearInterval(interval);
						auto_rotate();
					}
										
					return false;
				}
				
				
				if (options.auto) {
					auto_rotate();
					var pauseSlider = false;
				}
				
				if (options.pauseOnHover) { 				
					slidesContainer.hover(function(){
						pauseSlider = true;
					},function(){
						pauseSlider = false;
					});
				}
				
				function auto_rotate(){
					
					interval = setInterval(function(){
						if (!pauseSlider) { 
							if (currentPosition === slidesNum) 
								gotoSlide(1,1);
							else 
								gotoSlide(currentPosition+1),1;
							
							if (options.linksNav != '') changeTab();
						}
					},options.autoSpeed);
					
				}
				
				function slideForward(speed){
					$nextSlide.css('left',slideOuterWidth+'px');
					$activeSlide.animate({left: '-'+slideOuterWidth},speed);
					$nextSlide.animate({left: 0},speed);
				}
				
				function slideBack(speed){
					$nextSlide.css('left','-'+slideOuterWidth+'px');
					$activeSlide.animate({left: slideOuterWidth},speed);
					$nextSlide.animate({left: 0},speed);
				}
				
				function slideFade(speed){					
					$activeSlide.css({zIndex: slidesNum}).fadeOut(700);
					$nextSlide.css({zIndex: (slidesNum+1)}).fadeIn(700);
				}
				
			});
		} 
	})(jQuery);

