var SRD ={};
jQuery(document).ready(function($){
	
	SRD = {
			Slider:{	
				containerImage: new Array(),
				//INITIALIZE SLIDER
				initialize: function(node, index, config){
					SRD.Slider.containerImage[index] = $(node);
					SRD.Slider.prepare(SRD.Slider.containerImage[index], index, config);
					SRD.Slider.start(SRD.Slider.containerImage[index], index, config);
					
				},
				
				//PREPARE HTML STRUCTURE
				prepare: function(node, index, config){
					node.find('.lock').remove();
					node.find('.item:first').fadeIn(1500);
				},
				start: function (node, index, config){
					if (config.navigation==0){
						node.cycle({
							fx:config.effect, 
							speed:    config.duration , timeout:config.show_time*1000  
						});
					}else if(config.navigation==1){
						node.before('<div id="SlideMenuNav'+index+'">').cycle({
							fx:config.effect, 
							speed:    config.duration , 
							timeout:0,
							prev:   '#prev', 
							next:   '#next', 
							after:   onAfter, 
						}); 
					}else if(config.navigation==2){
						node.cycle({
							fx:config.effect, 
							speed:    config.duration , 
							timeout:config.show_time*1000,
							prev:   '#prev', 
							next:   '#next', 
							after:   onAfter, 
						}); 
					}
				},

			}
	};
	
	
});

function onAfter(curr, next, opts) {
    var index = opts.currSlide;
    jQuery('#prev')[index == 0 ? 'hide' : 'show']();
    jQuery('#next')[index == opts.slideCount - 1 ? 'hide' : 'show']();
}
