(function($){
	
	$.fn.radioSel = function(params){
    var defaults = {
			auto_slide : 0 ,
      stop_slide : 0 ,  
      hover_pause : 0 ,   
      hover_start : 1 ,
      auto_slide_seconds : 5000 , 
      fade_in : 2000 ,
      fade_out : 2000 
		}
		
		if(params) $.extend(defaults, params);	
  
  	var seldiv = $(this).find('.radio_div');
  	
  	  $(seldiv).find('img:last').fadeIn(defaults.fade_in);   
     
     
          if(defaults.auto_slide == 1){ 
           
              $('#hidden_auto_slide_seconds').val(defaults.auto_slide_seconds);  
          
              $(this).find(".radio_div").everyTime(defaults.auto_slide_seconds, 'controlled', function() {       
  
                $(this).find('img:first').fadeIn(defaults.fade_in);
                $(this).find('img:last').fadeOut(defaults.fade_out);
                $(this).find('img:last').after($(this).find('img:first'));  
              
              });
          }
          if(defaults.stop_slide == 1){ 
           
             $(this).find(".radio_div").stopTime('controlled');
             $(this).find(".radio_div").stop();
          }
     
     //check if hover pause is enabled  
     
         if(defaults.hover_pause == 1){  
             //when mouesenter/leave
             	$(this).find(".radio_div").bind("mouseleave",function(){		
                 	
  	             $(this).find('img:first').fadeIn(defaults.fade_in);
                 $(this).find('img:last').fadeOut(defaults.fade_out);
                 $(this).find('img:last').after($(this).find('img:first'));   
                 
                 $(this).everyTime(defaults.auto_slide_seconds, 'controlled', function() {  
                    $(this).find('img:first').fadeIn(defaults.fade_in);
                    $(this).find('img:last').fadeOut(defaults.fade_out);
                    $(this).find('img:last').after($(this).find('img:first'));  
                 });
          		});
          		$(this).find(".radio_div").bind("mouseenter",function(){	        		
          		  $(this).stopTime('controlled');
          		  $(this).stop();
          		});
             
         } 
         if(defaults.hover_start == 1){  
             //when mouesenter/leave
             	$(this).find(".radio_div").bind("mouseleave",function(){		
                  $(this).stopTime('controlled');
          		    $(this).stop();	  	            
          		});
          		$(this).find(".radio_div").bind("mouseenter",function(){	        		
          		 
          		// $(this).find('img:first').fadeIn(defaults.fade_in);
              //   $(this).find('img:last').fadeOut(defaults.fade_out);
              //   $(this).find('img:last').after($(this).find('img:first'));   
                 
              $(this).everyTime(defaults.auto_slide_seconds, 'controlled', function() {  
                 $(this).find('img:first').fadeIn(defaults.fade_in);
                 $(this).find('img:last').fadeOut(defaults.fade_out);
                 $(this).find('img:last').after($(this).find('img:first'));  
              });                            
             });
             
         }     
   };
})(jQuery);