// JavaScript Document

var imgSlider = function(param){
	var counter = 0;
	var param = param;
	var that = this;
	
	this.imgLoader = function(){
		image_item = param.target_items;
		$.each(image_item,function(i){
			if(i == counter){
				$(this).fadeIn(param.fadeduration);
			}else{
				$(this).fadeOut(param.fadeduration);
			}
		});
		
		if(counter == image_item.length-1){
			counter = 0;
		}else{
			counter++;
		}
	};
	
	this.autoPlay = function(){
		setInterval(function(){that.imgLoader()},param.autoPlayDuration);
	};
	
	this.start = function(){
		this.autoPlay();
	};
};

(function(){
	$(function(){
		option = {
			fadeduration: 1000,
			autoPlayDuration: 3000,
			target_items: $(".top")
		};
		
		imgslider = new imgSlider(option);	
		imgslider.start();
	});
})()



;var imgSlider2 = function(param){
	var counter = 0;
	var param = param;
	var that = this;
	
	this.imgLoader = function(){
		image_item = param.target_items;
		$.each(image_item,function(i){
			if(i == counter){
				$(this).fadeIn(param.fadeduration);
			}else{
				$(this).fadeOut(param.fadeduration);
			}
		});
		
		if(counter == image_item.length-1){
			counter = 0;
		}else{
			counter++;
		}
	};
	
	this.autoPlay = function(){
		setInterval(function(){that.imgLoader()},param.autoPlayDuration);
	};
	
	this.start = function(){
		this.autoPlay();
	};
};

(function(){
	$(function(){
		option = {
			fadeduration: 1000,
			autoPlayDuration: 3000,
			target_items: $(".bot")
		};
		
		imgslider2 = new imgSlider2(option);	
		imgslider2.start();
	});
})();

