



// inum
function GEID(src){
	return document.getElementById(src);
}



function MoveDivClass (_cName, _objDiv, _objTD){

	if(_cName == null || _objDiv == null || _objTD == null) {
		alert("클래스 변수명 그리고 대상 객체를 설정해 주세요");
		return;
	}

	var cName = _cName;
	var runningID = [];

	var obj = _objDiv;
	var objTd = _objTD;

	var COOM2 = new CookieClass();
	COOM2.setADay(30, 1, 1);

	var cooPos = COOM2.getCookie("DCLMENU_DIV_POS");
	var cooWid = COOM2.getCookie("DCLMENU_TD_WIDTH");


	var divInfo = {
		defPos : 10, // default position - Div
		maxLeft : -150 
	};
	var tdInfo = {
		defWid : 200, // default width - td
		minWid : 50
	};


	


	if(cooPos != null && cooPos != "" && cooWid != null && cooWid != "") {
		obj.style.left = cooPos + "px";
		objTd.width = cooWid;
	}else{
		obj.style.left = divInfo.defPos + "px";
		objTd.width = tdInfo.defWid;
	}



	var resetTimer = function(){
			try{
				for(var i = 0 ; i < runningID.length ; i++)	 window.clearTimeout(runningID[i]);
				runningID = [];
			}catch(e){
				//errAlert is in commonInum.js file
				errAlert(e, className + "resetTimer");
			}
		
	}


	this.H_Move_Left = function(pos) {
		resetTimer();
		for(var i = 1 ; i < 100 ; i++){
			runningID[runningID.length] = setTimeout(cName+".setWidth(" + pos + ");", 100 * i);

		}
		
	}
	this.H_Move_Right = function(pos){
		resetTimer();
		for(var i = 1 ; i < 100 ; i++){
			runningID[runningID.length] = setTimeout(cName+".setWidth2(" + pos + ");", 100 * i);

		}
	}

	this.setWidth = function(pos){
		var currPos = obj.style.left.replace(/px/ig, "");
		
		mpos = currPos - Number((currPos - pos) / 2) -1;

		obj.style.left = mpos + "px";


		var currWid = objTd.width;
		objTd.width -=  Number((currWid - tdInfo.minWid) / 2) ;

		
		if(pos >= mpos) {
			resetTimer();
			objTd.width=tdInfo.minWid;
			obj.style.left = divInfo.maxLeft+"px";
			COOM2.setCookie("DCLMENU_DIV_POS", pos);
			COOM2.setCookie("DCLMENU_TD_WIDTH", GEID('testTD').width);

		}
	}

	this.setWidth2 = function(pos){
		var currPos = obj.style.left.replace(/px/ig, "");
		
		if(currPos < 0) mpos = currPos - Number((currPos - pos ) / 2) +1;
		else mpos = currPos - Number(( currPos - pos ) / 2) +1;

		obj.style.left = mpos + "px";


		var currWid = objTd.width;
		
		objTd.width -= Number((currWid - tdInfo.defWid ) / 2) ;

		if(pos <= mpos) {
			objTd.width = tdInfo.defWid;
			resetTimer();
			obj.style.left = divInfo.defPos+"px";
			COOM2.setCookie("DCLMENU_DIV_POS", pos);
			COOM2.setCookie("DCLMENU_TD_WIDTH", GEID('testTD').width);

		}
	}


}



