
/*
self.onError=null;
currentX = 761;
currentY = 249;  
whichIt = null;           
lastScrollX = 0; lastScrollY = 0;
NS = (document.layers) ? 1 : 0;
IE = (document.all) ? 1: 0;
<!-- STALKER CODE -->
function heartBeat() {
	    if(IE) { 
			diffY = document.body.scrollTop; 
 			diffX = 0; 
		    }
	if(NS) { diffY = self.pageYOffset; diffX = self.pageXOffset; }
	if(diffY != lastScrollY) {
	            percent = .1 * (diffY - lastScrollY);
	            if(percent > 0) percent = Math.ceil(percent);
	            else percent = Math.floor(percent);
		if(IE) document.all.rb.style.pixelTop += percent;
		if(NS) document.rb.top += percent; 
	            lastScrollY = lastScrollY + percent;
	}
	if(diffX != lastScrollX) {
		percent = .1 * (diffX - lastScrollX);
		if(percent > 0) percent = Math.ceil(percent);
		else percent = Math.floor(percent);
		if(IE) document.all.rb.style.pixelLeft += percent;
		if(NS) document.rb.top += percent;
		lastScrollY = lastScrollY + percent;
	}	
}	
if(NS || IE) action = window.setInterval("heartBeat()",1);
*/



/* =======================================================================================================
	프로그램 : A2YSlide Ver 1.0
	개 발 자 : 박민권
	설    명 : 원하는 레이어 객체를 문서의 상단이나 하단에 슬라이드되며 위치한다.
			   W3C 규정을 준수함.
	ex)	var a2slide = new A2YSlide('a2slide','SMenu',0.2,10,0,50);
	클래스를 통한 객체생성을 사용하는 것이므로 위와같이 사용한다.
	단, 디자이너가 사용시 불편함이 따르므로 A2Wzd_YSlide() 함수를 사용한다.
	
	A2YSlide(객체명str,레이어str,이동값,이동초int,상하배치bool,상하위치에서 떨어질 범위int)
	-> 상하배치(false) ? 상 : 하
	
	※주 의 : 비표준으로 웹을 개발하시는 분은 사용을 금합니다.
			  xthml 1.0 dtd가 선언된 문서에서 테스트하였습니다.

   ====================================================================================================== */

//객체명,레이어id,이동값,이동초,상하위치(false)?t:b,계산된 상하 위치에서 떨어질 범위
function A2YSlide(name,id,range,sec,tb,margin)
{ 
	//속성
	this.name = name;
	this.obj = document.getElementById(id);
	this.range = range;
	this.sec = sec;
	this.tb = tb;
	this.margin = margin;
	
	this.Timer();
}

/* private 메소드 함수 선언부 */
A2YSlide.prototype.Move = function A2YSlide_Move(fix_y){
	objY = parseInt(this.obj.style.top);	
	if(objY != fix_y){
		this.obj.style.top = (objY + this.GetMoveValue(objY,fix_y)) + 'px';
	}
	this.Timer();
}

A2YSlide.prototype.GetMoveValue = function A2YSlide_GetMoveValue(start, end){ //현재 위치와 이동할 위치에 따른 이동거리를 리턴한다.
	return (end - start) * this.range;
}

A2YSlide.prototype.GetDocTnB = function A2YSlide_GetDocTnB(bTB){ //문서의 상단or하단 픽셀값을 반환한다. (!bTB) ? Top : Bottom
	return ((bTB)?document.documentElement.clientHeight:0) + document.documentElement.scrollTop;
}

A2YSlide.prototype.Timer = function A2YSlide_Timer(){
	setTimeout(this.name + '.Move('+(this.GetDocTnB(this.tb)+this.margin)+')',this.sec);
}


/* 외부 마법사 코드 */
function A2Wzd_YSlide(id,range,sec,tb,margin){ //A2YSlide의 생성을 도와준다.
	eval('C'+id+" = new A2YSlide('C"+id+"','"+id+"',"+range+","+sec+","+tb+","+margin+');');
	//실행예 - CSMenu = new A2YSlide('CSMenu','SMenu',0.2,10,0,50); => var을 사용하지 않은 전역변수를 생성한다.
}



