var Browser = {
	isIE : navigator.userAgent.toLowerCase().indexOf("msie")!=-1,
	isIE_6 : navigator.userAgent.toLowerCase().indexOf("msie 6")!=-1,
	isIE_7 : navigator.userAgent.toLowerCase().indexOf("msie 7")!=-1,
	isIE_8 : navigator.userAgent.toLowerCase().indexOf("msie 8")!=-1,
	isFirefox : navigator.userAgent.toLowerCase().indexOf("firefox")!=-1,
	isSafari : navigator.userAgent.toLowerCase().indexOf("safari")!=-1 && navigator.userAgent.toLowerCase().indexOf("chrome")==-1,
	isOpera : navigator.userAgent.toLowerCase().indexOf("opera")!=-1,
	isChrome : navigator.userAgent.toLowerCase().indexOf("safari")!=-1 && navigator.userAgent.toLowerCase().indexOf("chrome")!=-1,
	isNetscape : navigator.userAgent.toLowerCase().indexOf("netscape")!=-1,
	isEtc : navigator.userAgent.toLowerCase().indexOf("gecko")!=-1 && navigator.userAgent.toLowerCase().indexOf("firefox")==-1 && navigator.userAgent.toLowerCase().indexOf("netscape")==-1
};

// getId : ID가 id인 [object] 검색
function getId(id){
	return document.getElementById(id);
}

// obj_checker : [object] || [object].id 검색
function obj_checker(obj){
	if (!obj.tagName){ // obj가 [object]가 아니고
		if (getId(obj)){ // obj가 [object].id인 경우
			obj = getId(obj);
		} else { // object Id 입력 오류
			return false;
		}
	} // obj가 [object]인 경우는 그대로 전달
	return obj;
}

// getTagName: [object] 내 TagName이 name인 개체 검색
function getTagName(name,obj){
	if (!obj){
		if (name == "body"){
			obj = document;
		} else {
			obj = document.body;
		}
	} else {
		obj = obj_checker(obj);
	}
	return obj.getElementsByTagName(name);
}

// bodyBrowserType_Set : body class에 브라우저타입 셋팅
function bodyBrowserType_Set(){
	var bodyObj = getTagName('body')[0];

	var browtype;
	if (Browser.isIE){
		if (Browser.isIE_6){ browtype = "brow_ie_6"; }
		else if (Browser.isIE_7){ browtype = "brow_ie_7"; }
		else if (Browser.isIE_8){ browtype = "brow_ie_8"; }
		else {browtype = "brow_ie";}
	} else if (Browser.isFirefox){ browtype = "brow_firefox"; 
	} else if (Browser.isSafari){ browtype = "brow_safari"; 
	} else if (Browser.isOpera){ browtype = "brow_opera"; 
	} else if (Browser.isChrome){ browtype = "brow_chrome"; 
	} else if (Browser.isNetscape){ browtype = "brow_netscape"; 
	} else if (Browser.isEtc){ browtype = "brow_etc"; }
	bodyObj.className = browtype;
}

addLoadEvent(function(){
	// common
	bodyBrowserType_Set();
})

// addLoadEvent
function addLoadEvent(func) {
	var oldload = window.onload;
	if(typeof window.onload != 'function') {
		window.onload = func;
	} else {
		window.onload = function() {
			oldload();
			func();
		}
	}
}

try {
  document.execCommand('BackgroundImageCache', false, true);
} catch(e) {}

// OBJECT 통합생성 스크립트
function makeobject(type,path,w,h,id,vars,transparent,bg) {
	this.type = type; // flash, applet, movie
	this.id = id;
	this.path = path;
	this.w = w;
	this.h = h;
	this.vars = (vars) ? vars : '';
	this.trnasparent = (transparent) ? transparent : 'transparent';
	this.bg = (bg) ? bg : '#ffffff';

	this.gettag =
		function() {
			switch(this.type) {
				case 'flash' :
					this.classid = 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000';

					this.codebase = 'http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0';
					this.tag = "<object classid='"+this.classid+"' codebase='"+this.codebase+"' id='"+this.id+"' width='"+this.w+"' height='"+this.h+"'>";
					this.tag += "<param name='movie' value='"+this.path+"' />";
					this.tag += "<param name='allowScriptAccess' value='always' />";
					if(this.vars) this.tag += "<param name='FlashVars' value='"+this.vars+"' />";
					if(this.trnasparent) this.tag += "<param name='wmode' value='"+this.trnasparent+"' />";
					this.tag += "<param name='menu' value='false' />";
					this.tag += "<param name='quality' value='high' />"
					this.tag += "<param name='bgcolor' value='"+this.bg+"' />";
					this.tag += "<param value='"+this.path+"'>";
					this.tag += "<param name='base' value='.'>";
					this.tag += "<embed src='"+this.path+"'";
					if(this.vars) this.tag += " FlashVars='"+this.vars+"'";
					if(this.trnasparent) this.tag += " wmode='"+this.trnasparent+"'";
					this.tag += " width='"+this.w+"'";
					this.tag += " height='"+this.h+"'";
					this.tag += " bgcolor='"+this.bg+"'";
					this.tag += " name='"+this.id+"'";
					this.tag += " menu='false'";
				    this.tag += " base='.'";
					this.tag += " quality='high'";
					this.tag += " allowScriptAccess='always'";
					this.tag += " type='application/x-shockwave-flash'";
					this.tag += " pluginspage='http://www.macromedia.com/go/etflashplayer'";
					this.tag += " />";
					this.tag += "</object>";
					return this.tag;
					break;
			}

		}

	this.writetag =
		function() {
			document.write(this.gettag());
			//Flash의 ExternalInterface가 Form Tag내에서 오류나는 버그를 해결하는 코드
			eval("window." + this.id + " = document.getElementById('" + this.id + "');");
		}
}


//png

function setPng24(obj) {
	obj.width=obj.height=1;
	obj.className=obj.className.replace(/\bpng24\b/i,'');
	obj.style.filter =
	"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ obj.src +"',sizingMethod='image');"
	obj.src='';
	return '';
}

//tool tip (ex, 광고 리스트)
function floorTooltipController(tid,o) { //tid : target, o : this;
	var tips = document.getElementById(tid);
	
	o.onmouseout = function() {
		this.onmouseover = function() {
			tips.style.display="block";
		}
		tips.style.display="none";
	}
	
	tips.style.display="block";
	tips.onmouseout = function() {
		this.onmouseover = function() {
			this.style.display="block";
		}
		this.style.display="none";
	}
}

//popup

function popOpen_scroll(url,name,w,h) {
	window.open(url,name,'width='+w+',height='+h+',scrollbars=yes,status=1,left=0,top=0')
}

function popOpen(url,name,w,h) {
	window.open(url,name,'width='+w+',height='+h+',scrollbars=no,status=1,left=0,top=0')
}


//image_rollover - gif

function menuOn(imgEl) {
	imgEl.onmouseout = function() {
		imgEl.src = imgEl.src.replace("_on.gif", ".gif");
	}
	imgEl.src = imgEl.src.replace(".gif", "_on.gif");
}

//image_rollover - jpg

function menuOn2(imgEl) {
	imgEl.onmouseout = function() {
		imgEl.src = imgEl.src.replace("_on.jpg", ".jpg");
	}
	imgEl.src = imgEl.src.replace(".jpg", "_on.jpg");
}

//FAQ

function nextNode(o) {
	o = o.nextSibling;
	while(o) {
		if(o.nodeType != 1) o = o.nextSibling;
		else break;
	}
	return o;
}

function switchBlockController(o) {

	var targetObj;
	if(typeof(o) == 'object') targetObj = nextNode(o);
	else targetObj = document.getElementById(o);

	if(o.className == "on") {
		o.className = "";
		targetObj.className = "";
	}
	else {
		o.className = "on"
		targetObj.className = "on";
	}
}

/**
 * @title : Element의 절대 위치,너비,높이값 알아내기
 * @version : 1.0
 * @writer : 이희원
 * @what's new :
 */
function eMatrix(element) {
	var matrix = new Array();
	matrix.x = 0;
	matrix.y = 0;
	matrix.w = element.clientWidth;
	matrix.h = element.clientHeight;
	while(element) {
		matrix.x += element.offsetLeft;
		matrix.y += element.offsetTop;
		element = element.offsetParent;
	}
	return matrix;
}

/**
 * @title : 브라우저 버전 체크
 * @version : 1.0
 * @writer : 이희원
 * @what's new :
 */
function browserCheck(cv) { // cv : check version;
	var agt=navigator.userAgent.toLowerCase();
	var is_major = parseInt(navigator.appVersion);
	var is_minor = parseFloat(navigator.appVersion);

	var is_ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
	var is_ie3    = (is_ie && (is_major < 4));
	var is_ie4    = (is_ie && (is_major == 4) && (agt.indexOf("msie 4")!=-1) );
	var is_ie4up  = (is_ie && (is_major >= 4));
	var is_ie5    = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1) );
	var is_ie5_5  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.5") !=-1));
	var is_ie5up  = (is_ie && !is_ie3 && !is_ie4);
	var is_ie5_5up =(is_ie && !is_ie3 && !is_ie4 && !is_ie5);
	var is_ie6    = (is_ie && (is_major == 4) && (agt.indexOf("msie 6.")!=-1) );
	var is_ie6up  = (is_ie && !is_ie3 && !is_ie4 && !is_ie5 && !is_ie5_5);
	var is_ie6down  = (is_ie || is_ie3  || is_ie4 || is_ie5  || is_ie5_5 || is_ie6);
	var is_ie7    = (is_ie && (is_major == 4) && (agt.indexOf("msie 7.")!=-1) );
	var is_ie8    = (is_ie && (is_major == 4) && (agt.indexOf("msie 8.")!=-1) );


	if(!cv) {
		if(is_ie3) return "ie3";
		if(is_ie4) return "ie4";
		if(is_ie5) return "ie5";
		if(is_ie5_5) return "ie5_5";
		if(is_ie6) return "ie6";
		if(is_ie7) return "ie7";
		if(is_ie8) return "ie8";
	}

}

/**
 * @title : 등가속 계산 알고리즘
 * @version : 1.0
 * @writer : 이희원
 * @modify(date,writer) :
 */
function removeNullNode(obj) {
	for(k=0;k<obj.length;k++) {
		if(obj[k].nodeType != 1) obj[k].parentNode.removeChild(obj[k]);
	}

	return obj;
}

var speedCalculate = function(result,targetResult,speedPercent) {
	if(result>targetResult) {
		check = (((targetResult - result) * speedPercent) < -1) ? true : false;
	} else {
		check = (((targetResult - result) * speedPercent) > 1) ? true : false;
	}

	if(result==targetResult) {
		return targetResult;
	} else {
		if(check) {
			result += (targetResult - result) * speedPercent;
		} else {
			result = ((targetResult - result)>0) ? result+1 : result-1;
		}
		return parseInt(result,10);
	}
}

/**
 * @title : 롤링배너 스크립트
 * @version : 3.0
 * @writer : 이희원
 * @modify(date,writer) : 09.07.06, 이희원
 * @type : 가로세로통합
 */
function rollingController(o,c) { // o : 롤링모체, c : 목록

	var obj = new Object();
	var owner = this;
	var controllLeft,controllRight,controllPause,motionStatus;
	var controllLeft,controllRight,controllTop,controllBottom,controllPause,motionStatus;
	var rollingTimer, rollingTimerWrap, result, targetMatrix, moveCount, doTimer, menuStatus, perCount, displayCount;
	var activeStatus = true;
	var runStatus = false;

	this.moveLeft = function() {

		this.doStart();

		if(menuStatus >1) {
			menuStatus = menuStatus-2;
			runStatus = true;
			doing();
		}
	}

	this.moveRight = function() {
		this.doStart();

		runStatus = true;
		doing();
	}

	this.doPause = function() {

		if(controllPause) {

			controllPause.src = controllPause.src.replace("pause","start");
			controllPause.setAttribute("title","시작");
			controllPause.setAttribute("alt","시작");

			controllPause.onclick = owner.doStart;
		}

		killAction();
	}

	this.doStart = function(e) {

		if(controllPause) {

			controllPause.src = controllPause.src.replace("start","pause");
			controllPause.setAttribute("title","멈춤");
			controllPause.setAttribute("alt","멈춤");

			controllPause.onclick = owner.doPause;

		}

		killAction();

		runStatus = true;
		doAction();
	}

	function doAction() {
		doTimer = setInterval(function() { doing() },time*1000);
	}

	function killAction() {
		runStatus = false;
		clearInterval(doTimer);
	}

	function actionHandler() {

		if(document.addEventListener) {
			obj.general.addEventListener("mouseover",owner.doPause,false);
			obj.general.addEventListener("mouseout",owner.doStart,false);

			if(controllLeft) {
				controllLeft.addEventListener("mouseover",owner.doPause,false);
				controllLeft.addEventListener("mouseout",owner.doStart,false);
			}

			if(controllRight) {
				controllRight.addEventListener("mouseover",owner.doPause,false);
				controllRight.addEventListener("mouseout",owner.doStart,false);
			}

			if(controllPause) {
				controllPause.addEventListener("mouseover",owner.doPause,false);
				controllPause.addEventListener("mouseout",owner.doStart,false);
			}

		} else {
			obj.general.attachEvent("onmouseover",owner.doPause);
			obj.general.attachEvent("onmouseout",owner.doStart);

			if(controllLeft) {
				controllLeft.attachEvent("onmouseover",owner.doPause);
				controllLeft.attachEvent("onmouseout",owner.doStart);
			}

			if(controllRight) {
				controllRight.attachEvent("onmouseover",owner.doPause);
				controllRight.attachEvent("onmouseout",owner.doStart);
			}

			if(controllPause) {
				controllPause.attachEvent("onmouseover",owner.doPause);
				controllPause.attachEvent("onmouseout",owner.doStart);
			}
		}

		owner.doStart();
	}

	function numberMenucontroll(n) {

		var numberobj = removeNullNode(typeNumber.childNodes);
		var tagetImage;

		var tn = (numberobj.length-1) - n;

		for(i=0,j=numberobj.length;i<j;i++) {

			tagetImage = numberobj[i].getElementsByTagName('img')[0];
			if(numberobj[tn].getElementsByTagName('img').item(0) != tagetImage) menuOut(tagetImage);
			else menuOn(tagetImage);

		}

	}

	function numactionHandler() {

		var tagetImage,targetNumber;
		var numberobj = removeNullNode(typeNumber.childNodes);

		function listControll() {
			targetNumber = this.alt;
			menuStatus = targetNumber-1;
			runStatus = true;
			doing();
		}

		for(i=0,j=numberobj.length;i<j;i++) {

			tagetImage = numberobj[i].getElementsByTagName('img')[0];
			tagetImage.onmouseover = listControll;

		}
	}

	function doing() {

		var tagetImage,numberobj;

		clearTimeout(rollingTimerWrap);

		if(runStatus) {
			rollingTimerWrap = setTimeout(function() {

				var targetMatrix;
				if(menuStatus==obj.content.list.length) { targetMatrix = 0; menuStatus = 0; }
				else targetMatrix = (perNum*menuStatus)*(-1);

				if(typeNumber) {
					numberMenucontroll(menuStatus)
				}

				if(motionStatus) {

					function doscroll() {

						clearInterval(rollingTimer);
						rollingTimer = setInterval(function() {
							if(direction == 'x') result = parseInt(obj.content.style.marginLeft,10);
							else result = parseInt(obj.content.style.marginTop,10);
							moveCount = speedCalculate(result,targetMatrix,motionSpeed/10);
							if(result == targetMatrix) {
								clearInterval(rollingTimer);
								menuStatus++;
							} else {
								if(direction == 'x') obj.content.style.marginLeft = moveCount + "px";
								else obj.content.style.marginTop = moveCount + "px";
							}

						},20);

					}

					doscroll();
				} else {
					menuStatus++;
					obj.content.style.marginLeft = targetMatrix + "px";
				}

			});
		}
	}

	function activeOff() {
		var imgObj;
		if(controllLeft) {
			if(controllLeft.getElementsByTagName('img')[0]) imgObj = controllLeft.getElementsByTagName('img')[0];
			else imgObj = controllLeft;

			//imgObj.src = imgObj.src.replace('.gif','_off.gif');
			imgObj.style.display = "none"
			imgObj.style.cursor = "text";
		}

		if(controllRight) {
			if(controllRight.getElementsByTagName('img')[0]) imgObj = controllRight.getElementsByTagName('img')[0];
			else imgObj = controllRight;

			//imgObj.src = imgObj.src.replace('.gif','_off.gif');
			imgObj.style.display = "none"
			imgObj.style.cursor = "text";
		}

		if(controllTop) {
			if(controllTop.getElementsByTagName('img')[0]) imgObj = controllTop.getElementsByTagName('img')[0];
			else imgObj = controllTop;

			imgObj.style.visibility = "hidden";
		}

		if(controllBottom) {
			if(controllBottom.getElementsByTagName('img')[0]) imgObj = controllBottom.getElementsByTagName('img')[0];
			else imgObj = controllBottom;

			imgObj.style.visibility = "hidden";
		}

		if(controllPause) {
			if(controllPause.getElementsByTagName('img')[0]) imgObj = controllPause.getElementsByTagName('img')[0];
			else imgObj = controllPause;

			imgObj.src = imgObj.src.replace('.gif','_off.gif');
			imgObj.style.cursor = "text";
		}
	}

	this.initialize = function() {

		if(this.motion) motionStatus = this.motion;
		if(this.direction) direction = this.direction;
		else direction = 'x';
		if(this.number) typeNumber = document.getElementById(this.number);
		else typeNumber = false;
		if(this.controllLeft) controllLeft = document.getElementById(this.controllLeft);
		if(this.controllRight) controllRight = document.getElementById(this.controllRight);
		if(this.controllPause) controllPause = document.getElementById(this.controllPause);
		if(this.displayCount) displayCount = this.displayCount-1;
		else displayCount = 1;
		if(this.speed) motionSpeed = this.speed;
		else motionSpeed = 2;
		if(this.time) time = this.time;
		else time = 3;

		obj.general = document.getElementById(o);
		obj.content = document.getElementById(c);
		obj.content.list = removeNullNode(obj.content.childNodes);

		if(direction == 'x') {
			perNum = parseInt(obj.content.list[0].offsetWidth,10);
			obj.content.style.width = perNum*(obj.content.list.length) + "px";
		} else {
			perNum = parseInt(obj.content.list[0].offsetHeight,10);
			obj.content.style.height = perNum*(obj.content.list.length) + "px";
		}

		obj.content.style.margin = "0";

		menuStatus = 1;

		if(obj.content.list.length <= displayCount+1) {
			activeOff();
		}
		else actionHandler();

		if(typeNumber) { numactionHandler(); }
	}
}

/**
 * @title : 가로 세로 스크롤 제어 스크립트
 * @version : 2.0
 * @writer : 이희원
 * @wha's new :
 * - v2.0
 *   움직임시 유연하게 변경
 */
function scrollLogic(o,statusForm) {

	var obj = new Object();
	var ratio,startX,startMatrix,origX,origMatrix,moveNumber,limitMatrix,moveTimer;
	var statusForm = statusForm;
	obj.general = document.getElementById(o);
	obj.content = removeNullNode(obj.general.childNodes)[0];
	obj.scrollZone = removeNullNode(obj.general.childNodes)[1];
	obj.movingBar = obj.scrollZone.getElementsByTagName('img')[0];
	obj.movingBar.w = obj.movingBar.offsetWidth;
	obj.movingBar.h = obj.movingBar.offsetHeight;

	this.initialize = function() { // Initialize of value
		var baseinfo = new Object(); // 기준이 되는 정보
		baseinfo.w = parseInt(obj.scrollZone.offsetWidth,10);
		baseinfo.h = parseInt(obj.scrollZone.offsetHeight,10);
		baseinfo.currentw = parseInt(obj.content.offsetWidth,10);
		baseinfo.currenth = parseInt(obj.content.offsetHeight,10);

		/* 속성 제한 */
		obj.general.style.overflow = "hidden";
		if(statusForm == 'y') {
			obj.general.style.height = baseinfo.h + "px";
			ratio = (baseinfo.currenth-baseinfo.h <=0) ? false : (baseinfo.currenth-baseinfo.h)/(baseinfo.h-obj.movingBar.h);

			limitMatrix = baseinfo.h - obj.movingBar.h;

		} else {
			obj.general.style.width = baseinfo.w + "px";
			ratio = (baseinfo.currentw-baseinfo.w <=0) ? false : (baseinfo.currentw-baseinfo.w)/(baseinfo.w-obj.movingBar.w);

			limitMatrix = baseinfo.w - obj.movingBar.w;
		}

		actionHandler();
	}

	function moveContent(v,s) { // Moving Content

		var targetValue = parseInt(v,10);
		var margin;

		if(s == 'y') {
			if(statusForm == 'y') {
				moveTimer = setInterval(function() {

					if(window.getComputedStyle) margin = (window.getComputedStyle(obj.content,null).getPropertyValue("margin-top") == 'auto' ) ? 0 : parseInt(window.getComputedStyle(obj.content,null).getPropertyValue("margin-top"),10);
					else margin = (obj.content.currentStyle.marginTop == 'auto' ) ? 0 : parseInt(obj.content.currentStyle.marginTop,10);

					if(margin == -targetValue) clearInterval(moveTimer);
					targetmoveCount = speedCalculate(-margin,targetValue,0.3);

					obj.content.style.marginTop = -targetmoveCount + "px";

				},20);
			} else {

				moveTimer = setInterval(function() {

					if(window.getComputedStyle) margin = (window.getComputedStyle(obj.content,null).getPropertyValue("margin-left") == 'auto' ) ? 0 : parseInt(window.getComputedStyle(obj.content,null).getPropertyValue("margin-left"),10);
					else margin = (obj.content.currentStyle.marginLeft == 'auto' ) ? 0 : parseInt(obj.content.currentStyle.marginLeft,10);

					if(margin == -targetValue) clearInterval(moveTimer);
					targetmoveCount = speedCalculate(-margin,targetValue,0.3);

					obj.content.style.marginLeft = -targetmoveCount + "px";

				},20);
			}
		} else {
			if(statusForm == 'y') obj.content.style.marginTop = -v + "px";
			else obj.content.style.marginLeft = -v + "px";
		}

	}

	function moveScroll(v,s) { // Moving Scroll

		if(statusForm == 'y') obj.movingBar.style.top = v + "px";
		else obj.movingBar.style.left = v + "px";

		v = v*ratio;
		clearInterval(moveTimer);
		moveContent(v,s);
	}

	function calculateMoving(s,m) { // s:처음위치, m:이동거리

		if(s+m > 0) {
			 if(s+m > limitMatrix) m = limitMatrix;
			 else m = s + m;
		} else {
			m = 0;
		}

		return m;
	}

	function mousemove(e) {

		clearInterval(moveTimer);

		if(!e) e = window.event;

		if(statusForm == 'y') moveCount = e.clientY;
		else moveCount = e.clientX;

		moveNumber = (moveCount - startMatrix); // 이동거리
		moveNumber = calculateMoving(origMatrix,moveNumber);
		moveScroll(moveNumber);

	}

	function getwhellData(e) {
		var wheelData;

		if(e.wheelDelta) {
			wheelData = e.wheelDelta/120; // Dom Cross
			if(window.opera) wheelVal = -wheelVal;
		} else if(e.detail) {
			wheelData = -e.detail/3;
		}
		return wheelData*(-1);
	}

	function wheelHandler(e) {

		clearInterval(moveTimer);

		if(!e) e = window.event;

		if(e.stopPropagation) e.stopPropagation();
		else e.cancelBubble = true;
		if(e.preventDefault) e.preventDefault();
		else e.returnValue = false;

		var step = 20;
		var wheelVal;

		wheelVal = getwhellData(e);
		wheelVal = wheelVal * step;

		if(statusForm == 'y') wheelVal = calculateMoving(obj.movingBar.offsetTop,wheelVal);
		else wheelVal = calculateMoving(obj.movingBar.offsetLeft,wheelVal);

		moveScroll(wheelVal,'y');
	}

	function mousedown(e) {

		if(!e) e = window.event;
		if(document.addEventListener) {
			document.addEventListener("mousemove",mousemove,false);
			document.addEventListener("mouseup",upHandler,false);
		} else {
			obj.movingBar.setCapture();
			obj.movingBar.attachEvent("onmousemove",mousemove);
			obj.movingBar.attachEvent("onmouseup",upHandler);
		}

		if(e.stopPropagation) e.stopPropagation();
		else e.cancelBubble = true;
		if(e.preventDefault) e.preventDefault();
		else e.returnValue = false;

		if(statusForm == 'y') {
			startMatrix = e.clientY;
			origMatrix = obj.movingBar.offsetTop;
		} else {
			startMatrix = e.clientX;
			origMatrix = obj.movingBar.offsetLeft;
		}
	}

	function actionHandler() { // Event registration?

		if(ratio == false) return false;
		if(document.addEventListener) {
			obj.content.addEventListener("DOMMouseScroll",wheelHandler,false);
			obj.movingBar.addEventListener("mousedown",mousedown,false);
		} else {
			obj.content.attachEvent("onmousewheel",wheelHandler);
			obj.movingBar.attachEvent("onmousedown",mousedown);
			obj.movingBar.attachEvent("onlosecapture",upHandler);
		}

	}

	function upHandler() { // Event delete.

		if(document.addEventListener) {
			document.removeEventListener("mousemove",mousemove,false);
			document.removeEventListener("mouseup",upHandler,false);
		} else {
			obj.movingBar.releaseCapture();
			obj.movingBar.detachEvent("onmousemove",mousemove);
			obj.movingBar.detachEvent("onmouseup",upHandler);
		}

	}

	this.initialize();

}

//메인 플래시 사이즈와 푸터 사이즈 조절 
function changeMainHeight(size) {
	var footer_resize = document.getElementById('footer');
	var main_resize = document.getElementById('main_flash');
	//alert(size)
	footer_resize.style.top = (size-29) + "px";
}

// img quick view
var oldSelectBestSellerDetailnumber = 0;
function bestsellerDetail(n,page) {
	if(oldSelectBestSellerDetailnumber != n){
		var thum_list =  document.getElementById("bestseller_list").getElementsByTagName("li");
		for(var i=1; i<= thum_list.length; i++) {
			if(i != n){
				document.getElementById(page+i).style.display = "none";
				changImg = document.getElementById("tab"+i);
				changImg.src = changImg.src.replace("_on.jpg",".jpg");
			}
			else if(i == n){
				document.getElementById(page+i).style.display = "block";
				changImg = document.getElementById("tab"+i);
				changImg.src = changImg.src.replace(".jpg","_on.jpg");
			}
		}
		oldSelectBestSellerDetailnumber = n;
	}
	return false;
}

// tab menu

function tabview(n,page){
var thum_list =  document.getElementById("tab").getElementsByTagName("li");

	for(var i=1; i<= thum_list.length; i++) {
		if(i != n){
			document.getElementById(page+i).style.display = "none";
			changImg = document.getElementById("tab"+i);
			changImg.src = changImg.src.replace("on.gif","off.gif");
			changImg.parentNode.parentNode.className = changImg.parentNode.parentNode.className.replace("on"," ");
		}
		else if(i == n){
			document.getElementById(page+i).style.display = "block";
			changImg = document.getElementById("tab"+i);
			changImg.src = changImg.src.replace("off.gif","on.gif");
			changImg.parentNode.parentNode.className = changImg.parentNode.parentNode.className.replace(""," on");
		}
	}
	return false;
}

function tabviewAddOverOutEvent(n,page){
var thum_list =  document.getElementById("tab").getElementsByTagName("li");
var changImg = null;

for(var i=1; i<= thum_list.length; i++) {
	 changImg = document.getElementById("tab"+i);
	 if(i != n){
				document.getElementById(page+i).style.display = "none";
				changImg.src = changImg.src.replace("on.gif","off.gif");
				changImg.onmouseover = function(){this.src = this.src.replace("off.gif","on.gif");};
				changImg.onmouseout = function(){this.src = this.src.replace("on.gif","off.gif");};
	 }
	 else if(i == n){
				document.getElementById(page+i).style.display = "block";
				changImg.src = changImg.src.replace("off.gif","on.gif");
				changImg.onmouseover = null;
				changImg.onmouseout = null;
	 }
}
return false;
}

// tab menu - 뷰티아티클

function tabbeauty(n,page){
var thum_list =  document.getElementById("beauty_tab").getElementsByTagName("li");
//alert(thum_list.length)
	for(var i=1; i<= page; i++) {
		if(i != n){
			document.getElementById('beauty_page'+i).style.display = "none";
		}
		else if(i == n){
			document.getElementById('beauty_page'+i).style.display = "block";
		}
	}
	return false;
}

//패밀리 사이트 

function sites(o,type) {
var tips = document.getElementById(o);

 if (type == 'main')
 {
  tips.style.left = 365 + "px";
  tips.style.top = -223 + "px";
  tips.onmouseout = function() {
   this.onmouseover = function() {
    this.style.left = 365 + "px";
    this.style.top = -223 + "px";
   }
  this.style.left = -10000 + "px";
  this.style.top = -10000 + "px";
  }
 }

 else if(type == 'language'){
  tips.style.left = 870 + "px";
  tips.style.top = -46 + "px";
  tips.onmouseout = function() {
  this.onmouseover = function() {
   this.style.left = 870 + "px";
   this.style.top = -46 + "px";
  }
  this.style.left = -10000 + "px";
  this.style.top = -10000 + "px";
  }
 }
//sct.initialize();
}

//DOC type v2

function resizeQuick(o) {
	layers = document.getElementById('mylist');
	layers_body = document.getElementById('quick');
	mainflashObject = layers.getElementsByTagName('object')[0];
	//mainflashEmbed = layers.getElementsByTagName('embed')[0];

	if (o == 'Y')
	{
		layers.style.height = 219 + "px"
		layers_body.style.height = 219 + "px"
		mainflashObject.height = 219 + "px";
	}
	else 
	{
		mainflashObject.height = 30 + "px";
		layers_body.style.height = 30 + "px"
		layers.style.height = 30 + "px"
	}
}



//게시판 배경색 변경 
function bbsBg(n) {
	var tbList = document.getElementById(n).getElementsByTagName('tr');
	var tmpObj;
	for(i=0;i<tbList.length;i++) 
	{
		tbList[i].onmouseover = function() 
		{	
			tmpObj = this.getElementsByTagName('td');
			for(j=0;j<tmpObj.length;j++)
			{
				//tmpObj[j].style.backgroundColor = "#edf5f9";
				tmpObj[j].style.backgroundImage= "url(/laneigekor/resources/images/common/bg_bbs.gif)";
			}

		}
		
		tbList[i].onmouseout = function() 
		{ 
			if(!this.getElementsByTagName('td')[0]) return false;
			tmpObj = this.getElementsByTagName('td');
			for(j=0;j<tmpObj.length;j++)
			{
				//tmpObj[j].style.backgroundColor = "";
				tmpObj[j].style.backgroundImage= "none";
			}
		}
	}
}

function evtBg(o) {
	//alert(o);
	o.onmouseout = function() {
		o.style.backgroundColor = "#fff";
	}
	o.style.backgroundColor = "#edf5f9"; 
}

//******************************************* 
// PPG 
//*******************************************

// img quick view - ver 2.0
function imgView(imgsrc,url) {
	var bigImg = document.getElementById(imgsrc).src;
	var origin = bigImg.lastIndexOf('/');
	var folder = bigImg.substr(0,origin);
	document.getElementById(imgsrc).src = folder + '/' + url;
}

//이용후기 

function qna(index,n){
	
	var answerArea = document.getElementsByName(n);

	if(answerArea[index].style.display == "block") {
		answerArea[index].style.display = "none";
		return;
	}


	if(answerArea.length == undefined) {
		answerArea.style.display = "block";
	}
	else {
		for( var i = 0 ; i < answerArea.length; i++){
		 answerArea[i].style.display = "none";
		 }
		 answerArea[index].style.display = "block";
	}
	parent.resizeFrame(parent.document.getElementById("embeded-content"));
}

//이용후기 리사이즈
function resizeFrame(frm) {
	frm.style.height = "auto";
	contentHeight = frm.contentWindow.document.documentElement.scrollHeight;
	frm.style.height = contentHeight + 4 + "px";
}


//-------------------------------------------------------
//라네즈 이전 데이타 마이그레이션 용 시작
//-------------------------------------------------------

//Element ID 불러쓰기

function dEI(elementID){
	return document.getElementById(elementID);

}

// first 예외처리 firstChild(블럭Id, 태그네임, 처리할 아이템 번호) // 아이템번호는 0번부터 반환
function firstChild(Elid, Etn, Num){
	if(Num==""){Num=0;}
	liEl = dEI(Elid).getElementsByTagName(Etn);
	if (liEl.item(Num)) {
		liEl.item(Num).className += " first-child";
	}
}

//페이지 넘기기 (paging이 위아래 있을경우)
function zinePage(zinName,num){
	var linkTab=document.getElementById("zinPage1").getElementsByTagName("a");
	var linkTab2=document.getElementById("zinPage2").getElementsByTagName("a");

	for(i=0;i<linkTab.length;i++){
		var tabimg=linkTab.item(i).getElementsByTagName("img").item(0);
		var tabimg2=linkTab2.item(i).getElementsByTagName("img").item(0);

		if(i == (num-1)){
			if(document.getElementById(zinName+num).style.display=="none"){
				tabimg.src=tabimg.src.replace(".gif", "_on.gif");
				tabimg2.src=tabimg2.src.replace(".gif", "_on.gif");
				document.getElementById(zinName+num).style.display="block";
			}
		}else{
			document.getElementById(zinName+(i+1)).style.display="none";
			tabimg.src=tabimg.src.replace("_on.gif", ".gif");
			tabimg2.src=tabimg2.src.replace("_on.gif", ".gif");
		}
	}
}

//페이지 넘기기 (paging이 하나만있을경우)
function zinePage2(zinName,num){
	var linkTab=document.getElementById("zinPage").getElementsByTagName("a");

	if(num==1){
		document.getElementById("hmmZineTitImg").style.display="block";
	}else{
		document.getElementById("hmmZineTitImg").style.display="none";
	}
	for(i=0;i<linkTab.length;i++){
		var tabimg=linkTab.item(i).getElementsByTagName("img").item(0);

		if(i == (num-1)){
			if(document.getElementById(zinName+num).style.display=="none"){
				tabimg.src=tabimg.src.replace(".gif", "_on.gif");
				document.getElementById(zinName+num).style.display="block";
			}
		}else{
			document.getElementById(zinName+(i+1)).style.display="none";
			tabimg.src=tabimg.src.replace("_on.gif", ".gif");
		}
	}
}



//시즌 메이크업 룩
function seasonList(season){
	//alert(season);
	self.location.href = "/beauty/"+season;
}

//시즌 메이크업 룩 - 리스트 selectBox check
function seasonCh(){
	var fullUrl = document.URL;

	var fn=fullUrl.replace("http://", "");
	fn = fn.match(/\/([a-z0-9_-]+\.\w+)/i);
//	return (fn == null) ? "": fn[1];

	var thisSeason=document.seasonSelect.select;

	for(i=0; i<thisSeason.options.length; i++){
		if(thisSeason.options[i].value==fn[1]){
			thisSeason.options[i].selected=true;
		}
	}
}

//시즌 메이크업 룩 - 서브메뉴(시즌별공통)
function seasonSubMenu(){
	if (window.addEventListener){
		window.addEventListener("load", createcssmenu2, false);
	}
	else if (window.attachEvent){
		window.attachEvent("onload", createcssmenu2);
	}
	
	function createcssmenu2(){
	var cssmenuids=["seasonMenu"]; //Enter id(s) of CSS Horizontal UL menus, separated by commas
	var csssubmenuoffset=-1; //Offset of submenus from main menu. Default is 0 pixels.

		for (var i=0; i<cssmenuids.length; i++){
		var ultags=document.getElementById(cssmenuids[i]).getElementsByTagName("ul");

			for (var t=0; t<ultags.length; t++){
				ultags[t].style.top=ultags[t].parentNode.offsetHeight+csssubmenuoffset+"px";
				var spanref=document.createElement("span");
				ultags[t].parentNode.getElementsByTagName("a")[0].appendChild(spanref);
				ultags[t].parentNode.onmouseover=function(){
					this.getElementsByTagName("ul")[0].style.visibility="visible"
				}
				ultags[t].parentNode.onmouseout=function(){
					this.getElementsByTagName("ul")[0].style.visibility="hidden"
				}
			}
		}
	}
}
//-------------------------------------------------------
//라네즈 이전 데이타 마이그레이션 용 끝
//-------------------------------------------------------
