(function ($) {

jQuery(document).ready(function(){

/*
	jQuery("div#slider-area img").each(function() {
		if (jQuery(this).attr("src").length == 0) {
			jQuery(this).parent().remove();
		}
	});
	
	jQuery("div#slider-area").easySlider({
		prevId: 'prevBtn',
		nextId: 'nextBtn',
		prevText: 'Previous',
		nextText: 'Next',
		autogeneratePagination: true,
		orientation: 'horizontal',
		speed: 800,
		autoplayDuration: 3000,
		restartDuration: 3000,
		loop: true,
		hoverPause: 0,
		hover: false,
		easing: null,
		pauseable: true,
		pauseButtons: false,
		numeric: true,
		numericId: 'controls',
		showComment: false
	});

*/


	var sliderDuration = 3000;
	var sliderEasing = "easeInOutQuart";
	
	if(jQuery.fn.NewsRotator) 
	{
        
		var oSlide = $('#slider-area').addClass('js');
		
		oSlide.find('.badge-01,.badge-02,.badge-03,.badge-04').css({
			display: 'none'	
		});
		
		var badgeEffectDuration = 900;
		
		var slider = oSlide.find('#slider-area-content').NewsRotator({
            type: 'slideshow',
			interval: 9000,
			duration: 50,
            items_query: 'ul',
            item_query: 'li',
            current_class: 'current',
            duration: sliderDuration,
            easing: sliderEasing,
			buttons: '#slider-nav a',
			button_active_class: 'slider-current',
			
			beforeStart: function(){
				//oSlide.find('.badge-01').css('display','block');	
				var sRel = '';
				$('#slider-nav').find('a').each(function($key,$value){
					if($(this).hasClass('slider-current'))sRel = $(this).attr('rel');	
				});
				
				
				if ( $.browser.msie && $.browser.version < 9 ) 
				{		
					  oSlide.find('.' + sRel).css({
						  display: 'block'	
					  });
								
						
						
						setTimeout(function(){
							
							oSlide.find('.' + sRel).css({
									display: 'none'	
								
							});
							
						},8150);	
						
				} else {
					oSlide.find('.' + sRel).css({
						  opacity:1,
						  display: 'block'	
					  });
								
						
						
						setTimeout(function(){
							
							oSlide.find('.' + sRel).animate({
								opacity: 0	
							},badgeEffectDuration,sliderEasing,function(){
								$(this).css({
									display: 'none',
									opacity: '1'	
								});	
							});
							
						},8150);	
				}
			
			},
			
			afterSlide: function(){
				var sRel = '';
				$('#slider-nav').find('a').each(function($key,$value){
					if($(this).hasClass('slider-current'))sRel = $(this).attr('rel');	
				});
				
				if ( $.browser.msie && $.browser.version < 9 ) 
				{
					setTimeout(function(){
						oSlide.find('.' + sRel).css({
							display: 'block'	
						});
					},100);	
					
					setTimeout(function(){
						oSlide.find('.' + sRel).css({
							display: 'none'	
						});	
					},8150);
				
				} else {
					
					setTimeout(function(){
						
						oSlide.find('.' + sRel).css({
							opacity:0,
							display: 'block'	
						}).animate({
							opacity: 1	
						},badgeEffectDuration,sliderEasing);
							
					},100);	
					
					setTimeout(function(){
						
						oSlide.find('.' + sRel).animate({
							opacity: 0	
						},badgeEffectDuration,sliderEasing,function(){
							$(this).css({
								display: 'none',
								opacity: '1'	
							});	
						});
						
					},8150);	
					
				}
			},
			
			onClick: function(){
				var sRel = '';
				$('#slider-nav').find('a').each(function($key,$value){
					if($(this).hasClass('slider-current'))sRel = $(this).attr('rel');	
				});	
				oSlide.find('.' + sRel).css('display','none');	
			}
		});
		
		
		
	}




});
	
})(jQuery);
