/*************************************************************
  
  클래스 형태의 라이브러리성 함수를 제공
   
 **************************************************************/
 
// 배너 로테이션
function cls_bannerRotation(){
	this.n =- 1; // 방 번호 (줄)
	this.delay = 3000; // 딜레이
	this.active = true;		
	this.rotationObj;
	this.instance;

	this.rotation = function(){
		if(!this.active){
			setTimeout(this.instance + ".rotation()",this.delay);
			return;
		}
		this.n++;
		if(this.n>=this.rotationObj.length){
			this.n =0;
		}		
		this.display();
		setTimeout(this.instance + ".rotation()",this.delay);
	}
	
	// 레이어 표시 
	this.display = function() {
		for(var i=0 ;i< this.rotationObj.length;i++){
			this.rotationObj[i].style.display="none";
		}					
		this.rotationObj[this.n].style.display="block";		
	}
	
	// 이전으로 가기
	this.prev = function(){
		this.n--;
		if(this.n < 0){
			this.n =  this.rotationObj.length - 1;
		}
		this.display();
	}

	// 이후로  가기
	this.next = function(){
		this.n++;
		if(this.n >= this.rotationObj.length){
			this.n = 0;
		}
		this.display();
	}

	// 시작
	this.start = function(){
		this.rotation();
	}

	// 재시작
	this.play = function(){
		this.active = true;
	}

	// 멈춤
	this.stop = function(){
		this.active = false;
	}
}
	 
// 이미지 로테이션 객체
function cls_imageRotation(){
	this.n=0; // 이미지 방번호
	this.imageHolder = new Array; // 로테이션될 이미지 경로가 들어갈 배열
	this.delay=3000; // 딜레이
	this.imageObj; // 이미지 객체 아이디
	this.active = true;;
	this.instance = ""; //인스턴스 이름

	this.rotation = function(){
		if(!this.active){
			setTimeout(this.instance + ".rotation()",this.delay);
			return;
		}
		if(this.n>=this.imageHolder.length){
			this.n =0;
		}
		document.all[this.imageObj].src = this.imageHolder[this.n];
		this.n++;
		setTimeout(this.instance + ".rotation()",this.delay);

	}

	// 시작
	this.start = function(){
		this.rotation();
	}

	// 재시작
	this.play = function(){
		this.active = true;
	}

	// 멈춤
	this.stop = function(){
		this.active = false;
	}

}
	 