
// png 이미지
function setPng24(obj) {
	obj.width = obj.height = 1;
	obj.style.width = obj.width + "px";
	obj.style.height = obj.height + "px";
	obj.className = obj.className.replace(/\bpng24\b/i, '');
	obj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + obj.src + "',sizingMethod='image');"
	obj.src = '';
	return '';
}

// 기본 플래시
function flashObj(SizeX, SizeY, URL, LnkId, Frm, Flag) // quick
{
	document.write('            <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ');
	document.write('                    codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" ');
	document.write('                    width="' + SizeX + '" height="' + SizeY + '"  id="' + LnkId + '" align="middle">');
	document.write('            <param name="movie"     value="' + URL + '" />');
	document.write('            <param name="quality"   value="high" />');
	if (Flag == null || Flag != 'N') {
		document.write('        <param name="wmode"     value="transparent"/>');
	}
	document.write('   <param name="allowScriptAccess" value="always"/> ');
	document.write('   <param name="base" value="." />');
	document.write('            <embed base="." src="' + URL + '" quality="high" width="' + SizeX + '" height="' + SizeY + '"  align="middle" ');
	if (Flag == null || Flag != 'N') {
		document.write('         wmode="transparent" ');
	}
	document.write('             type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" allowScriptAccess="always" swLiveConnect=true name="' + LnkId + '"  />');
	document.write('            </embed></object>');
	if (Frm == 'Y') { // form 태그 들어가는 페이지에 적용
		eval("window." + LnkId + " = document.forms[0]." + LnkId + "; ");
	}
}

function flash(c, d, e, f, g, h) {
	var flash_tag = "";
	flash_tag = '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';
	flash_tag += 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" ';
	flash_tag += 'WIDTH="' + c + '" HEIGHT="' + d + '" >';
	flash_tag += '<param name="movie" value="' + e + '">';
	flash_tag += '<embed movie=' + e + '>';
	flash_tag += '<param name="quality" value="high">';
	flash_tag += '<param name="FlashVars" VALUE="logValue=' + f + '&subNum=' + g + '&subNum1=' + h + '">';
	flash_tag += '<param name="wmode" value="transparent">';
	flash_tag += '<embed wmode="transparent" >';
	flash_tag += '<param name="base" value=".">';
	flash_tag += '<embed base=".">';
	flash_tag += '<embed src="' + e + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" ';
	flash_tag += 'type="application/x-shockwave-flash"  WIDTH="' + c + '" HEIGHT="' + d + '"></embed></object>'
	document.write(flash_tag);
}


//quick_top
function initMoving(target, position, topLimit, btmLimit) {
	if (!target)
		return false;

	var obj = target;
	obj.initTop = position;
	obj.topLimit = topLimit;
	obj.bottomLimit = document.documentElement.scrollHeight - btmLimit;

	obj.style.position = "absolute";
	obj.style.zIndex = "10";
	obj.top = obj.initTop;
	obj.left = obj.initLeft;

	if (typeof (window.pageYOffset) == "number") {
		obj.getTop = function() {
			return window.pageYOffset;
		}
	} else if (typeof (document.documentElement.scrollTop) == "number") {
		obj.getTop = function() {
			return document.documentElement.scrollTop;
		}
	} else {
		obj.getTop = function() {
			return 0;
		}
	}

	if (self.innerHeight) {
		obj.getHeight = function() {
			return self.innerHeight;
		}
	} else if (document.documentElement.clientHeight) {
		obj.getHeight = function() {
			return document.documentElement.clientHeight;
		}
	} else {
		obj.getHeight = function() {
			return 1000;
		}
	}

	obj.move = setInterval(function() {
		if (obj.initTop > 0) {
			pos = obj.getTop() + obj.initTop;
		} else {
			pos = obj.getTop() + obj.getHeight() + obj.initTop;
			//pos = obj.getTop() + obj.getHeight() / 2 - 15;
		}

		if (pos > obj.bottomLimit)
			pos = obj.bottomLimit;
		if (pos < obj.topLimit)
			pos = obj.topLimit;

		interval = obj.top - pos;
		obj.top = obj.top - interval / 3;
		obj.style.top = obj.top + "px";
	}, 30)
}

//팝업띄우기 스크롤 있는 거
function popsn(url, trgt, w, h) {
	window.open(url, trgt, 'width=' + w + ',height=' + h + ',scrollbars=no,resizable=no,copyhistory=no,toolbar=no,status=no');
}
//팝업띄우기 스크롤 없는 거
function popsy(url, trgt, w, h) {
	window.open(url, trgt, 'width=' + w + ',height=' + h + ',scrollbars=yes,resizable=no,copyhistory=no,toolbar=no,status=no,left=0,top=0');
}


//탭
function imgOver(imgName) {
	imgName.src = imgName.src.replace(/(_on.gif|.gif)$/i, "_on.gif");
	imgName.src = imgName.src.replace(/(_on.jpg|.jpg)$/i, "_on.jpg");
}
function imgOut(imgName) {
	imgName.src = imgName.src.replace(/(_on.gif|.gif)$/i, ".gif");
	imgName.src = imgName.src.replace(/(_on.jpg|.jpg)$/i, ".jpg");
}

function tabOver(tabName) {
	tabName = tabName.className = "on";
}
function tabOut(tabName) {
	tabName = tabName.className = "";
}

function layer_events() {
	if (document.layers) {
		document.layers['gnb_area'].captureEvents(Event.MOUSEOVER | Event.MOUSEOUT | Event.MOUSEUP);
		document.layers['gnb_area'].onmouseout = new Function("this.style.height='115'");
		document.layers['gnb_area'].onmouseover = new Function("this.style.height='260'");
	}
}

/*하단장바구니
var slideTime = 700;
var floatAtBottom = true;

window.onload = function()
{
winOnResize(); // set initial position
xAddEventListener(window, 'resize', winOnResize, false);
xAddEventListener(window, 'scroll', winOnScroll, false);
}
function winOnResize() {
xWidth('menu1', xClientWidth());
winOnScroll(); // initial slide
}
function winOnScroll() {
var y = xScrollTop();
if (floatAtBottom) {
y += xClientHeight() - xHeight('menu1');
}
xSlideTo('menu1', 0, y, slideTime);
}*/




function layer_view(n, size) {
	div_name = document.getElementById(n);
	max_size = document.getElementById(n + "_a");


	
	if (div_name.style.visibility == "visible") {
		div_name.style.visibility = "hidden";
	} else {
		div_name.style.visibility = "visible";
		if (size == null) {
			div_name.style.bottom = "0px";
		} else {
			div_name.style.top = size.height - 52 + "px";
		}
	}
}

//qna
function qna_list(n) {
	for (i = 1; i <= 10; i++) {
		qna = document.getElementById("qna" + i);
		if (i == n) {
			qna.style.display = "block";
		} else {
			qna.style.display = "";
		}
	}
}

function qna_list2(tot, n) {
	for (i = 1; i <= tot; i++) {
		qna = document.getElementById("pro" + i);
		if (i == n) {
			qna.style.display = "block";
		} else {
			qna.style.display = "";
		}
	}
}

function theme_tab(n) {
	for (i = 1; i <= 4; i++) {
		con = document.getElementById("theme_con_0" + i);
		if (i == n) {
			con.style.display = "block";
		} else {
			con.style.display = "none";
		}
	}
}


function cate_tab(n) {
	for (i = 1; i <= 5; i++) {
		tab_img = document.getElementById("cate_tab");
		con_div = document.getElementById("cate_con" + i);

		if (i == n) {
			con_div.style.display = "block";
			tab_img.src = "../images/main/new_category_tab0" + i + ".gif";

		} else {
			con_div.style.display = "none";
		}
	}
}




function point_tab(n) {
	for (i = 1; i <= 2; i++) {
		tab_img = document.getElementById("img0" + i);
		con_div = document.getElementById("con" + i);

		if (i == n) {
			tab_img.src = "../images/myenprani/point_tab0" + i + "_on.gif";
			con_div.style.display = "block";

		} else {
			tab_img.src = "../images/myenprani/point_tab0" + i + ".gif";
			con_div.style.display = "none";
		}
	}
}
var imgPath = "../../images/common";

function flipTopMenu() {
	var isOpen = document.getElementById("topHiddenBtn").src.endsWith("_open.gif") ? true : false;
	setCookie("adminTopMenuFlip", (isOpen ? "open" : "close"), 0);
	new Effect.Tween('Ffloating', { height: (isOpen ? 139 : 28), onComplete: function() {
		var img = imgPath + "/btn";
		document.getElementById("topHiddenBtn").src = img + (isOpen ? "_close.gif" : "_open.gif");
	}
	});
}

function flipMenuPreset() {
	var topMenu = getCookie("adminTopMenuFlip");
	if (topMenu == "close" && document.getElementById("calendar_pos2")) {
		document.getElementById("calendar_pos2").setStyle({ overflow: "hidden", height: "0" });
		document.getElementById("topHiddenBtn").src = imgPath + "/btn_top_cal_open.gif";
	}
}



function cart_tab(n) {
	for (i = 1; i <= 2; i++) {
		con_div = document.getElementById("cart_tab" + i);

		if (i == n) {
			con_div.style.display = "block";
			var isOpen = document.getElementById("topHiddenBtn").src.endsWith("_open.gif") ? true : false;
			if (isOpen) {
				flipTopMenu()
			}

		} else {
			con_div.style.display = "none";
		}
	}
}

