var ssoUrl = "https://www.designdb.com/login/index.asp";
var ssoLogout = "https://www.designdb.com/login/logOut.asp";
//var ssoUrl = "http://www.designdb.com/login/index.asp";
//var ssoLogout = "http://www.designdb.com/login/logOut.asp";
// 2008-04-25 5:11¿ÀÈÄ
// haroc
// ##############################################################################################
// ÆäÀÌÁö ·Îµå½Ã¿¡ °øÅëÀûÀ¸·Î »ç¿ëÇÒ ÇÔ¼ö¸¦ ¿©±â¿¡ ¸ð¾Æ³õ´Â´Ù.
Event.observe(window, 'load', function() {
	if ( $("scrapBox") ) {
		p_ScrapResizeBox.initScrapBox($("scrapBox"));
	}

	if ( $("thumbBox") ) {
		p_ThumbResizeBox.initScrapBox($("thumbBox"));
	}

	if($("loginbox")){
		login_button_roll();
	}

	if($("selectLay")){
		$("selectLay").style.display="none";
		initLayers("select",2);
	}

	if($("selectLay")){
		$("selectLay").style.display="none";
		initLayers("select",2);
	}

	if($("selectLay2")){
		$("selectLay2").style.display="none";
		initLayers("select2",2);
	}
});

function login_button_roll(){
	var nav = document.getElementById("loginbox");
	nav.menu = new Array();
	nav.current = null;
	nav.menuseq = 0;
	navLen = nav.childNodes.length;
	var seq = 0;

	allA = nav.getElementsByTagName("a")
	for(k = 0; k < allA.length; k++) {
		allA.item(k).onmouseover = allA.item(k).onfocus = function () {
			nav.isOver = true;
			if(this.firstChild.src.indexOf("_over.gif")==-1)	this.firstChild.src=this.firstChild.src.replace(".gif", "_over.gif");			
		}

		allA.item(k).onmouseout = allA.item(k).onblur = function () {
			nav.isOver = false;
			setTimeout(function () {
				if (nav.isOver == false) {
					if (nav.menu[seq])
						nav.menu[seq].onmouseover();
					else if(nav.current) {
						menuImg = nav.current.childNodes.item(0);
						menuImg.src = menuImg.src.replace("_over.gif", ".gif");
						if (nav.current.submenu)
							nav.current.submenu.style.display = "none";
						/*nav.current = null;*/
					}	
				}
			}, 200);
			if(this.parentNode.parentNode.id!="ul-navigation")	this.firstChild.src=this.firstChild.src.replace("_over.gif", ".gif");	
		}
	}
}

var vLogined = "N";
// 2008-10-07 4:23¿ÀÈÄ
// haroc
// ##############################################################################################
// ÇÃ·¡½Ã¿¡¼­ È£ÃâÇÏ±â À§ÇÑ ÇÔ¼ö
function toggleScrap(){
		if ( vLogined != "Y" ) {
			if ( $("scrapBox_Container") ) {
				if ( '' == $("scrapBox_Container").innerHTML.strip()){
					scrapList('', '', '');
				}
				$("scrapBox").show();
				if ( $("thumbBox").getAttribute("switch") == "ON" ) {
					$("thumbBox").hide();
					p_ThumbResizeBox.toggle();
				}
				p_ScrapResizeBox.toggle();
			}
		}
		else {
			alert ( "Member login or join to continue" ) ;
		}
}

// 2008-10-07 4:24¿ÀÈÄ
// haroc
// ##############################################################################################
// ÇÃ·¡½Ã¿¡¼­ È£ÃâÇÏ±â À§ÇÑ ÇÔ¼ö
function toggleThumb(){
	if ( $("thumbBox_Container") ) {
		if ( !$("thumbBox_Container").innerHTML.strip() ) {
			thumbList('', '');
		}
		$("thumbBox").show();
		if ( $("scrapBox").getAttribute("switch") == "ON" ) {
			$("scrapBox").hide();
			p_ScrapResizeBox.toggle();
		}
		p_ThumbResizeBox.toggle();
	}
}

// 2008-04-22 11:36¿ÀÀü
// haroc
// ##############################################################################################
// ½½¶óÀÌµå¸¦ Åä±ÛÇÑ´Ù.
// »ç¿ë¹ý : À©µµ onload, resize ÀÌº¥Æ®¿¡ p_ScrapResizeBox.initScrapBox($("objSlide1"));
var p_ScrapResizeBox = {
	slideInterval : "",
	vInterval : 10,
	vSlide : 10,
	objSlide : "",
	onDoing : false,
	objName : "",
	// 2008-04-22 11:36¿ÀÀü
	// haroc
	// ##############################################################################################
	// ½½¶óÀÌµå¸¦ Åä±ÛÇÑ´Ù.
	toggle:function () {
		this.objName = this.objSlide.getAttribute("id");
		if ( this.objSlide.getAttribute("switch") == 'OFF' ){
			if ( p_ScrapResizeBox.onDoing )
				return false;

			this.onSlide();
			this.objSlide.setAttribute("switch", "ON");
			this.slideInterval = setInterval ("p_ScrapResizeBox.onSlide()", this.vInterval);
			p_ScrapResizeBox.onDoing = true;
		}
		else {
			if ( p_ScrapResizeBox.onDoing )
				return false;
			this.offSlide();
			this.objSlide.setAttribute("switch", "OFF");
			this.slideInterval = setInterval ("p_ScrapResizeBox.offSlide()", this.vInterval);
			p_ScrapResizeBox.onDoing = true;
		}
	},
	// 2008-04-22 11:36¿ÀÀü
	// haroc
	// ##############################################################################################
	// ½½¶óÀÌµå¸¦ onÇÑ´Ù.
	onSlide:function () {
		this.objSlide.setStyle({'visible': 'show'});

		var currHeight = getStyleWithNumber(this.objName, "height");

		if ( eval(currHeight) > 330 ) {
			this.objSlide.setStyle({'height': '350px'});
			clearInterval(this.slideInterval);
			p_ScrapResizeBox.onDoing = false;
		}
		else {
			currHeight = eval(currHeight) + eval(p_ScrapResizeBox.vSlide);
			this.objSlide.setStyle({'height': currHeight+'px'});
		}
	},
	// 2008-04-22 11:37¿ÀÀü
	// haroc
	// ##############################################################################################
	// ½½¶óÀÌµå¸¦ offÇÑ´Ù.
	offSlide:function () {
		var currHeight = getStyleWithNumber(this.objName, "height");

		if ( eval(currHeight) < 30 ) {
			this.objSlide.setStyle({'height': 0});
			this.objSlide.setStyle({'visible': 'hide'});
			clearInterval(this.slideInterval);
			p_ScrapResizeBox.onDoing = false;
		}
		else {
			currHeight = eval(currHeight) - eval(p_ScrapResizeBox.vSlide);
			this.objSlide.setStyle({'height': currHeight+'px'});
		}
	},
	// 2008-04-22 1:07¿ÀÈÄ
	// haroc
	// ##############################################################################################
	// ¾Æ·¡ ¹Ú½º½½¶óÀÌµå¸¦ ÃÊ±âÈ­ÇÑ´Ù.
	initScrapBox:function (obj) {
		var vBodyHeight = getBodyHeight();
		// var objSlide = $("objSlide");
		this.objSlide	= obj;
		var opt = this.objSlide.getAttribute("switch")
		var pos_top;

		pos_top = 155;

		this.objSlide.setStyle({'top': eval(pos_top)+'px'});
	}
}

// 2009-01-16 9:55¿ÀÀü
// haroc
// ##############################################################################################
// global.designdb.com ·Î±×ÀÎ
function disko_login(){
	toggleDiskoLoginArea();
}

// 2009-01-16 9:55¿ÀÀü
// haroc
// ##############################################################################################
// global.designdb.com È¸¿ø°¡ÀÔ
function disko_join() {
	location.href = "/disko/join.asp";
}

// 2009-01-16 5:47¿ÀÈÄ
// haroc
// ##############################################################################################
// global.designdb.com È¸¿ø Á¤º¸¼öÁ¤
function disko_modify() {
	window.open('http://www.designdb.com/mypage/memberOutForeigner.asp', 'disko', '');
}

// 
function disko_logout() {
	NewAjaxLogout();
}

// 2008-04-22 11:36¿ÀÀü
// haroc
// ##############################################################################################
// ½½¶óÀÌµå¸¦ Åä±ÛÇÑ´Ù.
// »ç¿ë¹ý : À©µµ onload, resize ÀÌº¥Æ®¿¡ p_ThumbResizeBox.initScrapBox($("objSlide1"));
var p_ThumbResizeBox = {
	slideInterval : "",
	vInterval : 10,
	vSlide : 10,
	objSlide : "",
	onDoing : false,
	objName : "",
	// 2008-04-22 11:36¿ÀÀü
	// haroc
	// ##############################################################################################
	// ½½¶óÀÌµå¸¦ Åä±ÛÇÑ´Ù.
	toggle:function () {
		this.objName = this.objSlide.getAttribute("id");
		if ( this.objSlide.getAttribute("switch") == 'OFF' ){
			if ( p_ThumbResizeBox.onDoing )
				return false;

			this.onSlide();
			this.objSlide.setAttribute("switch", "ON");
			this.slideInterval = setInterval ("p_ThumbResizeBox.onSlide()", this.vInterval);
			p_ThumbResizeBox.onDoing = true;
		}
		else {
			if ( p_ThumbResizeBox.onDoing )
				return false;
			this.offSlide();
			this.objSlide.setAttribute("switch", "OFF");
			this.slideInterval = setInterval ("p_ThumbResizeBox.offSlide()", this.vInterval);
			p_ThumbResizeBox.onDoing = true;
		}
	},
	// 2008-04-22 11:36¿ÀÀü
	// haroc
	// ##############################################################################################
	// ½½¶óÀÌµå¸¦ onÇÑ´Ù.
	onSlide:function () {
		this.objSlide.setStyle({'visible': 'show'});

		var currHeight = getStyleWithNumber(this.objName, "height");

		if ( eval(currHeight) > 480 ) {
			this.objSlide.setStyle({'height': '485px'});
			clearInterval(this.slideInterval);
			p_ThumbResizeBox.onDoing = false;
		}
		else {
			currHeight = eval(currHeight) + eval(p_ThumbResizeBox.vSlide);
			this.objSlide.setStyle({'height': currHeight+'px'});
		}
	},
	// 2008-04-22 11:37¿ÀÀü
	// haroc
	// ##############################################################################################
	// ½½¶óÀÌµå¸¦ offÇÑ´Ù.
	offSlide:function () {
		var currHeight = getStyleWithNumber(this.objName, "height");

		if ( eval(currHeight) < 30 ) {
			this.objSlide.setStyle({'height': 0});
			this.objSlide.setStyle({'visible': 'hide'});
			clearInterval(this.slideInterval);
			p_ThumbResizeBox.onDoing = false;
		}
		else {
			currHeight = eval(currHeight) - eval(p_ThumbResizeBox.vSlide);
			this.objSlide.setStyle({'height': currHeight+'px'});
		}
	},
	// 2008-04-22 1:07¿ÀÈÄ
	// haroc
	// ##############################################################################################
	// ¾Æ·¡ ¹Ú½º½½¶óÀÌµå¸¦ ÃÊ±âÈ­ÇÑ´Ù.
	initScrapBox:function (obj) {
		var vBodyHeight = getBodyHeight();
		// var objSlide = $("objSlide");
		this.objSlide	= obj;
		var opt = this.objSlide.getAttribute("switch")
		var pos_top;

		pos_top = 182;

		this.objSlide.setStyle({'top': eval(pos_top)+'px'});
	}
}

// 2008-07-15 1:34¿ÀÈÄ
// haroc
// ##############################################################################################
// ObjectÀÇ Height¸¦ ¼ýÀÚ·Î °¡Á®¿Â´Ù.
function getStyleWithNumber(obj_name, style_name) {
	return $(obj_name).getStyle(style_name).replace("px", "").replace("pt", "");
}

// 2008-04-29 11:29¿ÀÀü
// haroc
// ##############################################################################################
// objectÀÇ topÀ» °¡Á®¿Â´Ù.
function GetObjectTop(obj) {
	if (obj.offsetParent == document.body)
		return obj.offsetTop;
	else
		return obj.offsetTop + GetObjectTop(obj.offsetParent);
}

// 2008-04-29 11:29¿ÀÀü
// haroc
// ##############################################################################################
// ºê¶ó¿ìÀú»ó¿¡¼­ÀÇ objectÀÇ topÀ» °¡Á®¿Â´Ù.
function getTop(obj){
	var vTop = document.body.clientTop	+ GetObjectTop(obj) - document.body.scrollTop;
	var target = obj;

	return vTop + target.offsetHeight;
}

// 2008-04-29 11:29¿ÀÀü
// haroc
// ##############################################################################################
// objectÀÇ left°ªÀ» °¡Á®¿Â´Ù.
function GetObjectLeft(obj)
{
	if (obj.offsetParent == document.body)
		return obj.offsetLeft;
	else
		return obj.offsetLeft + GetObjectLeft(obj.offsetParent);
}

// 2008-04-29 11:29¿ÀÀü
// haroc
// ##############################################################################################
// ºê¶ó¿ìÀú »ó¿¡¼­ objectÀÇ left°ªÀ» °¡Á®¿Â´Ù.
function getLeft(obj){
	return document.body.clientLeft	+ GetObjectLeft(obj)	-  document.body.scrollLeft;
}

// 2008-04-29 11:29¿ÀÀü
// haroc
// ##############################################################################################
// ÁÖ¼Ò¸®½ºÆ®¸¦ °¡Á®¿À´Â Div¸¦ »ý¼ºÇÑ´Ù.
function createAddressElement(vTop, vLeft, vWdith, vHeight){
	var addrDiv = document.createElement("DIV");

	addrDiv.setAttribute("id", "AddrList");
	addrDiv.setAttribute("class", "AddrList");
	document.body.appendChild(addrDiv);
}

// 2008-04-29 11:29¿ÀÀü
// haroc
// ##############################################################################################
// ³Ñ°Ü¿Â ¿ÀºêÀÇ °ª¿¡¼­ ¾Èµé¾î¿Â°ªÀÌ ÀÖ´ÂÁö Ã³¸®ÇÏ´Â ÇÔ¼ö
function checkNullParam(param){
	// ³Ñ¾î¿Â ¹è¿­ÀÇ °¹¼ö¸¸Å­ ·çÇÁ¸¦ µ·´Ù.
	for ( var i = 0 ; i < param.length ; i++ ){
		if ( !$(param[i]).value ) {
			// ³»¿ëÀÌ ¾ø´Â°æ¿ì
			var paramTitle = 'ÀÔ·ÂÇ×¸ñ';

			// Å¸ÀÌÆ² Attribute°¡ ÀÖ´Â °æ¿ì
			if ( $(param[i]).getAttribute("title") ) {
				paramTitle = $(param[i]).getAttribute("title");
			}

			alert(paramTitle+" À»(¸¦) ÀÔ·ÂÇÏ½Ê½Ã¿À");
			if ( $(param[i]).getAttribute("type") == 'text' ) {
				$(param[i]).focus();
			}
			return false;
		}
	}
	return true;
}

// 2008-04-18 5:39¿ÀÈÄ
// haroc
// ##############################################################################################
// fckeditor¿¡ µ¥ÀÌÅÍ°¡ ÀÖ´ÂÁö Ã¼Å©ÇÏ´Â ÇÔ¼ö
function getHTML(instance_name){
	if ( !instance_name ) instance_name = 'FCKeditor1';
	if ( !$('FCKeditor1') ) {
		return false;
	}
	var oEditor = FCKeditorAPI.GetInstance(instance_name);
	var sHTML = oEditor.GetXHTML();

	return sHTML;
}

// 2008-04-23 10:17¿ÀÀü
// haroc
// ##############################################################################################
// ¸ðµç¹®ÀÚ¿­ Replace
String.prototype.replaceAll = function( searchStr, replaceStr ){
	var temp = this;

	while( temp.indexOf( searchStr ) != -1 ){
		temp = temp.replace( searchStr, replaceStr );
	}

	return temp;
}


// 2008-04-28 10:38¿ÀÀü
// haroc
// ##############################################################################################
// µ¥ÀÌÅÍ¸¦ °¡Á®¿Í¼­ ÇØ´ç object¿¡ innerHTML ÇØÁØ´Ù.
function contentUpdater(obj_name, ajax_url, pars){
	var myAjax = new Ajax.Updater (obj_name, ajax_url, {
							method: 'post',
							parameters:pars,
							onComplete:		completeUpdate,
							onLoading:		loadingUpdate
						});
}

// 2008-04-28 11:41¿ÀÀü
//haroc
// ##############################################################################################
// Updater¸¦ ¿Ï·áÇÑÈÄ¿¡ ½ÇÇàÇÏ´Â ÇÔ¼ö
function completeUpdate(){
}

// 2008-04-28 11:41¿ÀÀü
// haroc
// ##############################################################################################
// Updater¸¦ ÁøÇàÇÏ´Âµ¿¾È ½ÇÇàÇÏ´Â ÇÔ¼ö
function loadingUpdate(){
}


// MainMenu.asp¿¡¼­ »ç¿ëÇÏ´Â JavaScript
// 2008-04-25 5:09¿ÀÈÄ
// haroc
// ##############################################################################################
// °ü¸®ÀÚ¸®½ºÆ®¸¦ °¡Á®¿À´Â ÇÔ¼ö
function loadTrustList(){
	 var ajax_url 	= "/admin/common/trust_list.ajax.asp";
	 var pars 		= "?menuseqnum="+$("menuseqnum").value;

	 var myAjax = new Ajax.Updater ('trust_list', ajax_url, {
	 						method: 'post',
	 						parameters:pars
	 					});
}

// MainMenu.asp¿¡¼­ »ç¿ëÇÏ´Â JavaScript
// 2008-06-19 10:28¿ÀÀü
// haroc
// ##############################################################################################
// °Ô½ÃÆÇ ¼³Á¤À» °¡Á®¿À´Â ÇÔ¼ö
function loadBoardConfig(){
	if ( ! $("menuseqnum") ) {
		return false;
	}
	var ajax_url 	= "/admin/common/board_config.ajax.asp";
	var pars 		= "?menuseqnum="+$("menuseqnum").value;

	var		myAjax	= new Ajax.Request(ajax_url, {
		method: 		'post',
		parameters:		pars,
		onComplete:		loadBoardConfigComplete
		});
}

// 2008-06-19 11:29¿ÀÀü
// haroc
// ##############################################################################################
// loadBoardConfigComplete
function loadBoardConfigComplete(originalRequest){
	$("board_config").innerHTML = originalRequest.responseText;

	addUseYNClickEvent();

	var use_yn = document.getElementsByName("use_yn");
	for ( var i = 0 ; i < use_yn.length ; i++ ) {
		use_yn[i].onclick = addUseYNClickEvent;
	}
}

// 2008-06-19 11:44¿ÀÀü
// haroc
// ##############################################################################################
// addUseYNClickEvent()
function addUseYNClickEvent(){
	var use_yn = document.getElementsByName("use_yn");
	for ( var i = 0 ; i < use_yn.length ; i++ ) {
		if ( use_yn[i].checked ) {
			if ( use_yn[i].value == 'N' ) {
				$("board_config_tbody").hide();
			}
			else if ( use_yn[i].value == 'Y' ) {
				$("board_config_tbody").show();
			}
		}
	}
}

// 2008-04-28 11:17¿ÀÀü
// haroc
// ##############################################################################################
// ¸ÞÀÎ¸Þ´º ´ñ±Û ¸®½ºÆ®¸¦ °¡Á®¿Â´Ù.
function loadMenuMemoList(){
	var ajax_url 	= "/admin/common/menu_memo_list.ajax.asp";
	var pars 		= "?menuseqnum="+$("menuseqnum").value;

	contentUpdater("memo_div", ajax_url, pars);
}

// 2008-04-24 3:03¿ÀÈÄ
// haroc
// ##############################################################################################
// ¸Þ´º°¡ Á¤»óÀûÀ¸·Î ³¡³ª¸é ½ÇÇàÇÏ´Â ÇÔ¼ö.
function moveMenuFinish(){
	top.left_frame.location.href = "/admin/common/indexLeft.asp?admin_mnu=";
	$('move_menu_frame').hide();
	top.contents_frame.location.reload();
}


// 2008-04-16 9:52¿ÀÀü
// haroc
// ##############################################################################################
// ¸ÞÀÎ¸Þ´º °ü¸®ÀÚ¸¦ °ü¸®ÀÚ¸¦ Å×ÀÌºí ¸®½ºÆ®¿¡ Ãß°¡ÇÑ´Ù
function addTrust(){
	var param = ['trustid', 'trustname', 'buseo', 'trustemail', 'trusttel', 'trustfax'];
	if ( !checkNullParam(param) ){
		return false;
	}

	if ( checkTrustIDduplication() ) {
		alert("ÀÌ¹Ì»ç¿ëµÇ´Â °ü¸®ÀÚ ¾ÆÀÌµðÀÔ´Ï´Ù.");
		return false;
	}

	var vTr = "<tr id='tr_trustlist' name='tr_trustlist' onmouseover='Over(this);' onmouseout='Out(this);'>"
				+ "<td>"+$("trustid").value+"</td>"
				+ "<td>"+$("trustname").value+"</td>"
				+ "<td>"+$("buseo").value+"</td>"
				+ "<td>"+$("trustemail").value+"</td>"
				+ "<td>"+$("trusttel").value+"</td>"
				+ "<td>"+$("trustfax").value+"</td>"
				+ "<td><input type='button' id='' name='btnDelTrust' value='»èÁ¦' onclick='return deleteTrust(this);' /></td>"
				+ "</tr>";
	new Insertion.Bottom('TrustBody', vTr);

	$("trustid").value = "";
	$("trustname").value = "";
	$("buseo").value = "";
	$("trustemail").value = "";
	$("trusttel").value = "";
	$("trustfax").value = "";

}

// 2008-04-16 9:53¿ÀÀü
// haroc
// ##############################################################################################
// °ü¸®ÀÚ¸¦ ¸®½ºÆ®¿¡¼­ Á¦°ÅÇÑ´Ù
function deleteTrust(obj){
	// »èÁ¦È®ÀÎ ¹öÆ°
	if ( !confirm("»èÁ¦¸¦ ¿øÇÏ½Ã³ª¿ä?") ){
		return false;
	}
	var btnDelTrust = document.getElementsByName("btnDelTrust");
	var trustid = '';

	// ¹öÆ°ÀÌ ¸î°³ÀÖ´ÂÁö Ã¼Å©
	if ( btnDelTrust.length ) {
		if ( eval(btnDelTrust.length) > 1 ) {
			for ( var i = 0 ; i < eval(btnDelTrust.length) ; i++ ) {
				// ÇöÀç¹öÆ°ÀÌ ¸î¹øÂ° ¹öÆ°ÀÎÁö Ã£¾Æ³½´Ù.
				if ( obj == btnDelTrust[i] ) {
					var jj = document.getElementsByName("tr_trustlist")[i].firstChild;
					trustid = jj.innerText;
					document.getElementById("TrustBody").removeChild(document.getElementsByName("tr_trustlist")[i]);
				}
			}
		}
		// ¹öÆ°ÀÌ ÇÑ°³ÀÖ´Â °æ¿ì
		else {
			var jj = document.getElementById("tr_trustlist").firstChild;
			document.getElementById("TrustBody").removeChild(document.getElementById("tr_trustlist"));
			trustid = jj.innerText;
		}
	}

	// menuseqnumÀÌ ÀÖ´Â °æ¿ì µ¥ÀÌÅÍº£ÀÌ½º¿¡¼­ »èÁ¦¸¦ ÇÑ´Ù.
	if ( $("menuseqnum").value ) {
		var ajax_url 	= "/admin/common/Trust_d_ok.asp";
		var pars		= "?menuseqnum="+$("menuseqnum").value+"&trustid="+trustid
						+"&akey="+$("akey").value;

		var		myAjax	= new Ajax.Request(
			ajax_url, {
				method: 		'post',
				parameters:		pars
				// onComplete:		fname
			}
		);
	}

}

// 2008-04-16 10:01¿ÀÀü
// haroc
// ##############################################################################################
// ¸Þ´º°ü¸®ÀÚ Å×ÀÌºíÀÇ TR¿¡¼­ TD°ªÀ» °¡Á®¿Â´Ù.
function getTrust(obj){
	var vTrustList = '';
	for ( var j = 0 ; j < 6 ; j++ ){
		if ( 0 == j ) {
			vTrustList += obj.innerText
		}
		else {
			vTrustList += "##"+obj.innerText
		}
		obj = obj.nextSibling;
	}
	return vTrustList;
}

// 2008-04-16 10:19¿ÀÀü
// haroc
// ##############################################################################################
// ºóÇÔ¼ö
function blankFunction(originalRequest){
	alert(originalRequest.responseText);
	return true;
}

// 2008-04-16 1:35¿ÀÈÄ
// haroc
// ##############################################################################################
// ¸ÞÀÎ¸Þ´º¸¦ ÀúÀå
function submitMenu(){
	removeScripts('FCKeditor1');
	addTrustList();
	return true;
}

// 2008-06-10 10:18¿ÀÀü
// haroc
// ##############################################################################################
// fckeditor¿¡¼­ script¸¦ ¾ø¾Ú
function removeScripts(obj_name){
	var html = getHTML(obj_name).stripScripts();
	setFCKEditor(oFCKeditor, obj_name, html);
}

// 2008-06-10 10:20¿ÀÀü
// haroc
// ##############################################################################################
// FCK Editor¸¦ SetÇÑ´Ù.
function setFCKEditor(oFCKeditor, obj_name, originalRequest){
	oFCKeditor.Value	= originalRequest						//ÃÊ±â¿¡ º¸¿©Áú ³»¿ë
	oFCKeditor.Update(document.getElementById(obj_name));
}


// 2008-04-23 11:28¿ÀÀü
// haroc
// ##############################################################################################
// ¸Þ´ºÀÌµ¿
function moveMenuMst(obj){
	var ajax_url 	= "/admin/common/move_menu_mst.ajax.asp";
	//var pars 		= "?menuid=movemenu&menuseqnum="+$("menuseqnum").value+"&maincode="+$("maincode").value+"&subcode="+$("subcode").value;
	var pars 		= "?menuid=movemenu&menuseqnum="+$("menuseqnum").value+"&maincode="+$("maincode").value+"&subcode="+$("subcode").value+"&process=movemenu";

	/*$("move_menu_frame").show();
	$("move_menu_frame").setAttribute("left", getLeft(obj));
	$("move_menu_frame").style.left = eval(getLeft(obj));

	$("move_menu_frame").setAttribute("top", getTop(obj));
	$("move_menu_frame").style.top = eval(getTop(obj));
	document.move_menu_frame.location.href = ajax_url + pars;
	*/
	$("move_menu_frame").setStyle({'top':eval(getTop(obj))+30, 'left':eval(getLeft(obj))-150});
	$("move_menu_frame").appear({ duration: 1.0 });

	document.move_menu_frame.location.href = ajax_url + pars;
}

// 2008-04-21 11:35¿ÀÀü
// haroc
// ##############################################################################################
// ¸ÞÀÎÄÁÅÙÃ÷ ÅÛÇÃ¸´ ¸®½ºÆ® ÆË¾÷À» °¡Á®¿À´Â ÇÔ¼ö
var oTemplatePopup = window.createPopup() ;
function showTemplatePopup(){
	var ajax_url 	= "/admin/common/template_list.ajax.asp";
	var pars 		= "";

	var		myAjax	= new Ajax.Request(
		ajax_url, {
			method: 		'post',
			parameters:		pars,
			onComplete:		fillTemplateList
		}
	);
}

// 2008-04-21 2:34¿ÀÈÄ
// haroc
// ##############################################################################################
// ¸ÞÀÎÅÛÇÃ¸´¸®½ºÆ®¸¦ ajax·Î ¹Þ¾Æ¼­ ÆË¾÷À» ¶ç¿öÁÖ´Â ÇÔ¼ö
function fillTemplateList(originalRequest){
	var oPopBody		= oTemplatePopup.document.body;

	oPopBody.innerHTML 	= originalRequest.responseText;

	var TemplateHeight	= 200;
	oTemplatePopup.show(getLeft($("title")), getTop($("title")), 210, TemplateHeight, document.body);
}

// 2008-04-23 9:29¿ÀÀü
// haroc
// ##############################################################################################
// ÅÛÇÃ¸´À¸·Î ÀúÀåÇÑ´Ù.
function saveTemplate(){
	// ÄÁÅÙÃ÷°¡ ÀÖ´ÂÁö ¸ÕÀú È®ÀÎÇÑÈÄ¿¡ ÄÁÅÙÃ÷°¡ ÀÖ´Â°æ¿ì ÀúÀå¹öÆ°À» ¶ç¿öÁØ´Ù.
	var minLength = 100;

	//$("template_contents").value = getHTML('FCKeditor1');
	$("template_contents").value = tinyMCE.get('txtFCKcontentsClob').getContent();

	if ( eval($("template_contents").value.length) < minLength ) {
		alert("ÅÛÇÃ¸´À¸·Î ÀúÀåÇÏ±â¿¡ htmlÀÌ ³Ê¹« Âª½À´Ï´Ù.");
		return false;
	}

	// ÅÛÇÃ¸´ Å¸ÀÌÆ²À» °¡Á®¿À´Â ºÎºÐ
	var title = prompt("ÅÛÇÃ¸´ Å¸ÀÌÆ²À» ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À.\nÀÔ·ÂÇÏÁö ¾ÊÀ¸¸é ¸Þ´ºÅ¸ÀÌÆ²·Î ÀúÀåµË´Ï´Ù.");

	if ( !title ) {
		alert("½ºÅ©¸³Æ®µÈ Ã¢À» Çã¿ëÇÏ½Ê½Ã¿À.");
		return false;
	}
	if ( '' == title || 'undefined' == title ) {
		if ( !$("title").value ) {
			alert ("Å¸ÀÌÆ²À» ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À.");
			return false;
		}
		$("template_title").value = $("title").value;
	}
	else {
		$("template_title").value = title;
	}

	// ajax¸¦ »ç¿ëÇÏ·Á ÇÏ¿´À¸³ª. µ¥ÀÌÅÍ°¡ ajax¸¦ »ç¿ëÇÏ±â¿¡´Â Àû´çÇÏÁö ¾Ê¾Æ¼­..
	// iframeÀ¸·Î º¸³»ÁØ´Ù.
	document.frmTemplateSubmit.submit();
}

// 2008-04-23 10:44¿ÀÀü
// haroc
// ##############################################################################################
// ¼º°øÀûÀ¸·Î ÅÛÇÃ¸´À» ÀúÀåÇß´Ù°í..
function okSave(msg){
	alert(msg);
}

// 2008-04-16 4:28¿ÀÈÄ
// haroc
// ##############################################################################################
// ÁöÁ¤ÇÑ °ü¸®ÀÚ¸®½ºÆ® ÆË¾÷À» body¿¡¼­ »èÁ¦ÇÑ´Ù.
function removeTrustList(obj){
	if ( !obj ) return false;
	obj.hide();
}

// 2008-04-16 4:46¿ÀÈÄ
// haroc
// ##############################################################################################
// °ü¸®ÀÚ Á¤º¸¸¦ °¢°¢ ³Ö¾îÁØ´Ù.
function fillTrustInfo(trustid, trustname, trustemail, trusttel, trustfax){
	$("trustid").value = trustid;
	$("trustname").value = trustname;
	$("trustemail").value = trustemail;
	$("trusttel").value = trusttel;
	$("trustfax").value = trustfax;
}

// 2008-04-16 5:10¿ÀÈÄ
// haroc
// ##############################################################################################
// ¾ÆÀÌµð°¡ Áßº¹µÇ¾ú´ÂÁö Ã¼Å©
// ÇöÀç È­¸é¿¡¼­ Áßº¹µÇ¾ú´ÂÁö Ã¼Å©
function checkTrustIDduplication(){
	var tr_trustlist = document.getElementsByName("tr_trustlist");

	// ¸®½ºÆ® °¹¼ö
	if ( tr_trustlist.length ) {
		if ( eval(tr_trustlist.length) > 1 ) {
			for ( var i = 0 ; i < eval(tr_trustlist.length) ; i++ ) {
				var jj = document.getElementsByName("tr_trustlist")[i].firstChild;
				if ( jj.innerText == $("trustid").value ) {
					return true;
				}
			}
		}
		// ¸®½ºÆ®°¡ ÇÑ°³ÀÖ´Â °æ¿ì
		else {
			var jj = document.getElementById("tr_trustlist").firstChild;
			if ( jj.innerText == $("trustid").value ) {
				return true;
			}
		}
	}
	return false;
}

// 2008-04-16 5:30¿ÀÈÄ
// haroc
// ##############################################################################################
// °ü¸®ÀÚÁ¤º¸¸¦ ÃÊ±âÈ­ÇÑ´Ù.
function initTrust(){
	$("trustid").value = '';
	$("trustname").value = '';
	$("buseo").value = '';
	$("trustemail").value = '';
	$("trusttel").value = '';
	$("trustfax").value = '';
}

// 2008-04-17 5:44¿ÀÈÄ
// haroc
// unfinish
// ##############################################################################################
// ¸Þ´º»èÁ¦¹öÆ°
function delMenuMst(){
	// ¼­ºê¸Þ´º°¡ ÀÖ´ÂÁö Ã¼Å©ÇØ¼­ ¼­ºê¸Þ´º°¡ ÀÖ´Â°æ¿ì »èÁ¦¸¦ ¸ø½ÃÅ°µµ·Ï ¸·¾Æ³õ´Â´Ù.
	if ( eval($("havingsubmenu").value) > 0 ){
		alert("ÇÏÀ§¸Þ´º°¡ Á¸ÀçÇÏ´Â°æ¿ì´Â »èÁ¦°¡ ºÒ°¡´ÉÇÕ´Ï´Ù. \nÇÏÀ§¸Þ´ººÎÅÍ ´Ü°èÀûÀ¸·Î »èÁ¦ÇØÁÖ½Ã±â ¹Ù¶ø´Ï´Ù.");
		return false;
	}

	// »èÁ¦È®ÀÎ ¹öÆ°
	if ( !confirm("»èÁ¦¸¦ ¿øÇÏ½Ã³ª¿ä?") ){
		return false;
	}

	location.href = "/admin/common/mainmenu_d_ok.asp?menuseqnum="+$("menuseqnum").value+"&akey="+$("akey").value;
}

// 2008-04-21 6:22¿ÀÈÄ
// haroc
// ##############################################################################################
// ¸Þ´ºÆÄÀÏÀ» »èÁ¦ÇÑ´Ù.
function deleteMenuAttach(attach_gbn, attach_id){
	// »èÁ¦È®ÀÎ ¹öÆ°
	if ( !confirm("»èÁ¦¸¦ ¿øÇÏ½Ã³ª¿ä?") ){
		return false;
	}
	var ajax_url 	= "/admin/common/menu_attach_d_ok.ajax.asp";
	var pars 		= "?attach_id="+attach_id+"&akey="+$("akey").value;
	var attach_list = document.getElementById("attach_list_"+attach_gbn);
	var tr_name		= document.getElementById("tr_attach_list_"+attach_id);

	document.getElementById("attach_list_"+attach_gbn).removeChild(document.getElementById("tr_attach_list_"+attach_id));


	var		myAjax	= new Ajax.Request(
		ajax_url, {
			method: 		'post',
			parameters:		pars,
			onComplete:		blankFunction
		}
	);
}

var p_Button = {
	// 2008-06-05 11:00¿ÀÀü
	// haroc
	// ##############################################################################################
	// toggle adminWindowBox
	toggle : function (target_obj_name, compare_obj_name, obj) {
		var compare_obj = document.getElementsByName(compare_obj_name);

		for ( i = 0 ; i < compare_obj.length ; i++ ) {
			if ( compare_obj[i] == obj ) {
				p_Button.toggleBox(document.getElementsByName(target_obj_name)[i]);
			}
		}
		return false;
	},
	// 2008-06-05 10:25¿ÀÀü
	// haroc
	// ##############################################################################################
	// toggleBox
	toggleBox : function (target_obj) {
		if ( ! target_obj.getAttribute("status") ) {
			if ( !target_obj.style.Height ) {
				target_obj.setAttribute("status", 'maximize');
			}
		}

		if ( 'maximize' == target_obj.getAttribute("status") ) {
			return p_Button.doMin(target_obj);
		}

		if ( 'minimize' == target_obj.getAttribute("status") ) {
			return p_Button.doMax(target_obj);
		}
	},
	// 2008-04-22 3:34¿ÀÈÄ
	// haroc
	// ##############################################################################################
	// ÁöÁ¤ÇÑ objÀÇ ³ôÀÌ¸¦ min³ôÀÌ·Î ÁÙÀÎ´Ù.
	minimize : function (target_obj_name, compare_obj_name, obj){
		var compare_obj = document.getElementsByName(compare_obj_name);

		for ( i = 0 ; i < compare_obj.length ; i++ ) {
			if ( compare_obj[i] == obj ) {
				p_Button.doMin(document.getElementsByName(target_obj_name)[i]);
			}
		}
		return false;
	},
	// 2008-04-22 3:38¿ÀÈÄ
	// haroc
	// ##############################################################################################
	// ÁöÁ¤ÇÑ objÀÇ ³ôÀÌ¸¦ max³ôÀÌ·Î ´ÃÀÎ´Ù.
	maximize : function (target_obj_name, compare_obj_name, obj){
		var compare_obj = document.getElementsByName(compare_obj_name);

		for ( i = 0 ; i < compare_obj.length ; i++ ) {
			if ( compare_obj[i] == obj ) {
				p_Button.doMax(document.getElementsByName(target_obj_name)[i]);
			}
		}
		return false;
	},
	// 2008-06-05 10:23¿ÀÀü
	// haroc
	// ##############################################################################################
	// MinÇÑ´Ù.
	doMin : function (target_obj){
		if ( 'minimize' != target_obj.getAttribute("status") ) {
			// ÇöÀçÀÇ ³ôÀÌ¸¦ ÀúÀåÇÑ´Ù.
			target_obj.setAttribute("max_height", getClientHeight(target_obj));
			target_obj.setAttribute("status", 'minimize');
			target_obj.style.height = '30px';
			target_obj.style.overflow = 'hidden';
		}
	},
	// 2008-06-05 10:21¿ÀÀü
	// haroc
	// ##############################################################################################
	// max·Î ÇÑ´Ù.
	doMax : function (target_obj){
		if ( 'maximize' != target_obj.getAttribute("status") ) {
			// ÇöÀçÀÇ ³ôÀÌ¸¦ ÀúÀåÇÑ´Ù.
			setHeight(target_obj, target_obj.getAttribute("max_height"));
			target_obj.setAttribute("status", 'maximize');
			target_obj.style.height = '';
			target_obj.style.overflow = '';
		}
	}
}


// 2008-04-16 4:11¿ÀÈÄ
// haroc
// unfinish
// ##############################################################################################
// °ü¸®ÀÚ¸®½ºÆ® ÆË¾÷À» »ý¼ºÇÏ´Â ÇÔ¼ö
function showTrustListPopup() {
	var ajax_url 	= "/admin/common/find_user_list.ajax.asp";
	var pars 		= "";
	var posLeft		= getLeft($("find_trustid"));
	var posTop		= getTop($("find_trustid"));
	var iWidth 		= 210;
	var iHeight		= 200;

	p_AjaxPopup.call_popup(ajax_url, pars, posLeft, posTop, iWidth, iHeight);
}

// 2008-05-30 11:44¿ÀÀü
// haroc
// ##############################################################################################
// Ajax¸¦ ÀÌ¿ëÇØ¼­ PopupÀ» ¶ç¿öÁØ´Ù.

// »ç¿ë¹ý
// p_AjaxPopup.call_popup(ajax_url, pars, posLeft, posTop, iWidth, iHeight);
// Ajax¾È¿¡¼­ ÇÔ¼ö¸¦ È£ÃâÇÒ¶§ ´Ý¾ÆÁÖ´Â ÇÔ¼öÈ£Ãâ
// parent.p_AjaxPopup.remove();

var p_AjaxPopup = {
	vposLeft	: 0,
	vposTop		: 0,
	vWidth 		: 210,
	vHeight 	: 300,
	oPopup 		: window.createPopup(),
	call_popup : function(ajax_url, pars, posLeft, posTop, iWidth, iHeight){
		if ( iWidth )
			this.vWidth = iWidth;
		if ( iHeight )
			this.vHeight = iHeight;
		if ( posLeft )
			this.vposLeft = posLeft;
		if ( posTop )
			this.vposTop = posTop;
		var		myAjax	= new Ajax.Request( ajax_url, {
				method: 		'post',
				parameters:		pars,
				onComplete:		this.open_popup
			}
		);
	},
	open_popup : function (originalRequest) {
		var oPopBody		= p_AjaxPopup.oPopup.document.body;

		oPopBody.innerHTML = originalRequest.responseText;
		p_AjaxPopup.oPopup.show(p_AjaxPopup.vposLeft, p_AjaxPopup.vposTop, p_AjaxPopup.vWidth, p_AjaxPopup.vHeight, document.body);
	},
	remove : function () {
		p_AjaxPopup.oPopup.hide();
	}
}


// 2008-04-22 11:36¿ÀÀü
// haroc
// ##############################################################################################
// ½½¶óÀÌµå¸¦ Åä±ÛÇÑ´Ù.
// »ç¿ë¹ý : À©µµ onload, resize ÀÌº¥Æ®¿¡ p_Slide.initBottomBox($("objSlide1"));
var p_Slide = {
	slideInterval : "",
	vInterval : 10,
	vSlide : 5,
	objSlide : "",
	// 2008-04-22 11:36¿ÀÀü
	// haroc
	// ##############################################################################################
	// ½½¶óÀÌµå¸¦ Åä±ÛÇÑ´Ù.
	toggle:function () {
		if ( this.objSlide.getAttribute("switch") == 'OFF' ){
			this.onSlide();
			this.objSlide.setAttribute("switch", "ON");
			this.slideInterval = setInterval ("p_Slide.onSlide()", this.vInterval);
		}
		else {
			this.offSlide();
			this.objSlide.setAttribute("switch", "OFF");
			this.slideInterval = setInterval ("p_Slide.offSlide()", this.vInterval);
		}
	},
	// 2008-04-22 11:36¿ÀÀü
	// haroc
	// ##############################################################################################
	// ½½¶óÀÌµå¸¦ onÇÑ´Ù.
	onSlide:function () {
		// var objSlide = $("objSlide");
		var pos_top;
		var vMaxHeight = getBodyHeight() - 300;

		pos_top = this.objSlide.getStyle("top").replace("px", "");

		this.objSlide.setStyle({'top':eval(pos_top) - this.vSlide});

		pos_top = this.objSlide.getStyle("top").replace("px", "");

		if ( pos_top < vMaxHeight - 30 ){
			this.initBottomBox(this.objSlide);
			clearInterval(this.slideInterval);
		}
	},
	// 2008-04-22 11:37¿ÀÀü
	// haroc
	// ##############################################################################################
	// ½½¶óÀÌµå¸¦ offÇÑ´Ù.
	offSlide:function () {
		// var objSlide = $("objSlide");
		var pos_top;
		var vMinHeight = getBodyHeight() - 30;

		pos_top = this.objSlide.getStyle("top").replace("px", "");
		this.objSlide.setStyle({'top':eval(pos_top) + this.vSlide});

		pos_top = this.objSlide.getStyle("top").replace("px", "");

		if ( pos_top > vMinHeight + 30 ){
			this.initBottomBox(this.objSlide);
			clearInterval(this.slideInterval);
		}
	},
	// 2008-04-22 1:07¿ÀÈÄ
	// haroc
	// ##############################################################################################
	// ¾Æ·¡ ¹Ú½º½½¶óÀÌµå¸¦ ÃÊ±âÈ­ÇÑ´Ù.
	initBottomBox:function (obj) {
		var vBodyHeight = getBodyHeight();
		// var objSlide = $("objSlide");
		this.objSlide	= obj;
		var opt = this.objSlide.getAttribute("switch")
		var pos_top;

		if ( opt == 'OFF' ) {
			pos_top = eval(vBodyHeight) -  30;
		}
		else {
			pos_top = eval(vBodyHeight) -  300;
		}
		this.objSlide.setStyle({'top': eval(pos_top)});
	}
}

// 2008-04-30 10:49¿ÀÀü
// haroc
// ##############################################################################################
// ÄíÅ°°ª °¡Á®¿À±â
function getCookie( cookieName ) {
	var search = cookieName + "=";
	var cookie = document.cookie;

	// ÇöÀç ÄíÅ°°¡ Á¸ÀçÇÒ °æ¿ì
	if( cookie.length > 0 ) {
		// ÇØ´ç ÄíÅ°¸íÀÌ Á¸ÀçÇÏ´ÂÁö °Ë»öÇÑ ÈÄ Á¸ÀçÇÏ¸é À§Ä¡¸¦ ¸®ÅÏ.
		startIndex = cookie.indexOf( cookieName );

		// ¸¸¾à Á¸ÀçÇÑ´Ù¸é
		if( startIndex != -1 ) {
			// °ªÀ» ¾ò¾î³»±â À§ÇØ ½ÃÀÛ ÀÎµ¦½º Á¶Àý
			startIndex += cookieName.length;

			// °ªÀ» ¾ò¾î³»±â À§ÇØ Á¾·á ÀÎµ¦½º ÃßÃâ
			endIndex = cookie.indexOf( ";", startIndex );

			// ¸¸¾à Á¾·á ÀÎµ¦½º¸¦ ¸øÃ£°Ô µÇ¸é ÄíÅ° ÀüÃ¼±æÀÌ·Î ¼³Á¤
			if( endIndex == -1) endIndex = cookie.length;

			// ÄíÅ°°ªÀ» ÃßÃâÇÏ¿© ¸®ÅÏ
			return unescape( cookie.substring( startIndex + 1, endIndex ) );
		}
		else {
			// ÄíÅ° ³»¿¡ ÇØ´ç ÄíÅ°°¡ Á¸ÀçÇÏÁö ¾ÊÀ» °æ¿ì
			return false;
		}
	}
	else {
		// ÄíÅ° ÀÚÃ¼°¡ ¾øÀ» °æ¿ì
		return false;
	}
}

// 2008-04-30 10:50¿ÀÀü
// haroc
// ##############################################################################################
// ÄíÅ°°ª ¼³Á¤
function setCookie( cookieName, cookieValue, expireDate ) {
	var today = new Date();
	today.setDate( today.getDate() + parseInt( expireDate ) );
	document.cookie = cookieName + "=" + escape( cookieValue ) + "; path=/; expires=" + today.toGMTString() + ";";
}

// 2008-04-30 11:18¿ÀÀü
// haroc
// ##############################################################################################
// ÆË¾÷À» ¶ç¿öÁÖ´Â ÇÔ¼ö
var p_Popup = {
	vPopupLeftPosition : 0,
	openPopup : function (popupURI, popupName, popupConfig, vWidth){
		var cookieValue = getCookie(popupName);

		popupConfig += ", left="+this.vPopupLeftPosition;
		if ( cookieValue != 'N' ) {
			window.open(popupURI, popupName, popupConfig);
			this.vPopupLeftPosition += eval(vWidth);
		}
	}
}

// 2008-04-30 1:56¿ÀÈÄ
// haroc
// ##############################################################################################
// ÆË¾÷À» ´ÙÀ½¿¡ ¶ç¿ïÁö ¾È¶ç¿ïÁö ÄíÅ°¿¡ ÀúÀå
function nextPopupOpt(obj_name, cookieName, cookieValue, expireDate){
	if ( $(obj_name).checked ) {
		setCookie(cookieName, cookieValue, expireDate);
	}
	window.close();
}

// 2008-04-30 3:47¿ÀÈÄ
// haroc
// ##############################################################################################
// ºÎ¸ð ³ëµåÀÇ ¾ÆÀÌµð¸¦ °¡Á®¿Â´Ù.
function getParentNodeId(element_name){
	var parent = $(element_name).parentNode;

	return parent.id;
}

// 2008-04-30 3:54¿ÀÈÄ
// haroc
// ##############################################################################################
// Ajax ·ÎµùÀÌ¹ÌÁö¸¦ Áß¾Ó¿¡ À§Ä¡½ÃÅ²´Ù.
function setLoaderPos(element_name){
	var vLeft = $(getParentNodeId(element_name)).getWidth() - $(element_name).getWidth();
	var vTop = $(getParentNodeId(element_name)).getHeight() - $(element_name).getHeight();

	vLeft 	= vLeft / 2;
	vTop 	= vTop / 2;

	$(element_name).setStyle({'margin-left':vLeft});
	$(element_name).setStyle({'margin-top':vTop});
}

// 2008-05-06 3:32¿ÀÈÄ
// haroc
// ÃâÃ³ : http://www.dynamicdrive.com/dynamicindex16/emailvalidate.htm
// ##############################################################################################
// ÀÌ¸ÞÀÏ Ã¼Å©
var emailfilter=/^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i;
function checkmail(e){
	var returnval=emailfilter.test(e.value);
	if (returnval==false){
		alert("Please enter a valid email address.");
		e.select();
	}
	return returnval;
}

// 2008-05-09 11:25¿ÀÀü
// haroc
// ##############################################################################################
// ÇØ´ç ¿ÀºêÁ§Æ®ÀÇ clientHeight¸¦ °¡Á®¿Â´Ù.
function getClientHeight(obj){
	return obj.clientHeight;
}

// 2008-05-09 11:41¿ÀÀü
// haroc
// ##############################################################################################
// ³ôÀÌ¸¦ Àû¿ëÇÑ´Ù.
function setHeight(obj, obj_height){
	obj.style.height  = obj_height;
}


// 2008-05-09 11:34¿ÀÀü
// haroc
// ##############################################################################################
// document.getElementsByName ¿ÀºêÁ§Æ®¿¡ Class ¸¦ Àû¿ëÇÑ´Ù.
function setClassName(obj, class_name){
	obj.className = class_name;
}


// 2008-05-22 1:35¿ÀÈÄ
// haroc
// ##############################################################################################
// ÁÖ¹Î¹øÈ£ Ã¼Å©ÇÔ¼ö ½ÃÀÛ
function checkJumin( objJumin, szJumin ) {
	var objJumin = eval(objJumin) ;
	var nIDtot = 0;
	var szIDAdd = '234567892345';

	if (Number(szJumin)==0){
		alert('ÁÖ¹Îµî·Ï¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿ä...!!!');
		objJumin.focus() ;
		return false;
	}

	if ( eval(szJumin.length) < 13 ) {
		alert('Á¤»óÀûÀÎ ÁÖ¹Îµî·Ï¹øÈ£¸¦ ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿ä...!!!');
		objJumin.focus() ;
		return false;
	}
	// Å×½ºÆ®½Ã¿¡ Ç×»ó True¸¦ ¸®ÅÏ.
	// ÀÚ¸®¼ö ±îÁö¸¸ Ã¼Å© ³ª¸ÓÁö´Â ½Ç¸íÃ¼Å©°¡ ÇÏ¹Ç·Î.
	return true;

	for(var i=0; i < 12; i++) nIDtot = nIDtot + parseInt(szJumin.substring(i, i+1), 10) * parseInt(szIDAdd.substring(i, i+1), 10);
	nIDtot = 11 - ( nIDtot % 11);
	if ( nIDtot == 10) nIDtot = 0;
	else if ( nIDtot == 11) nIDtot = 1;

	if(parseInt(szJumin.substring(12, 13), 10) != nIDtot)
	{
		alert('Àß¸øµÈ ÁÖ¹Îµî·Ï¹øÈ£ÀÔ´Ï´Ù...!!!');
		objJumin.focus() ;
		return false;
	}

	else
	{
		return true;
	}
}

// 2008-05-09 2:19¿ÀÈÄ
// haroc
// ##############################################################################################
// ·çÆ®¿¡ ¸Þ´ºÃß°¡ÇÏ±â
function addRootMenu(){
	location.href = '/admin/common/MainMenu.asp?mode=I&menulocation=ROOT';
}


// 2008-06-05 9:56¿ÀÀü
// haroc
// ##############################################################################################
// tr over
function Over( tr ) {
	if ( !tr ) return false;
	tr.setAttribute("background-color", "#FCE1E1");
	// tr.style.background = "#FCE1E1";
}

// 2008-06-05 9:56¿ÀÀü
// haroc
// ##############################################################################################
// tr out
function Out( tr ) {
	if ( !tr ) return false;
	tr.setAttribute("background-color", "#FFFFFF");
	// tr.style.background = "#FFFFFF";
}

// 2008-06-05 5:31¿ÀÈÄ
// haroc
// ##############################################################################################
// tr_changer
function tr_changer(){
	var tr = document.getElementsByTagName("tr");

	for ( i = 0 ; i < tr.length ; i++ ) {
		if ( tr[i].getAttribute("mouseover") == 'on' ) {
	    	Event.observe(tr[i], 'mouseover', Over(this));
	    	Event.observe(tr[i], 'mouseout', Out(this));
	    }
	}
}


// 2008-06-02 11:25¿ÀÀü
// haroc
// ##############################################################################################
// window onload½Ã ÀÌº¥Æ® µî·Ï
function addLoadEvent(func) {
	var oldonload = window.onload;

	if ( typeof window.onload != 'function' ) {
		window.onload = func;
	}
	else {
		window.onload = function() {
			oldonload();
			func();
		}
	}
}

// 2008-07-01 6:14¿ÀÈÄ
// haroc
// ##############################################################################################
// ÆÄÀÏ ÀúÀå ÇÔ¼ö.
function file_upload(obj, action_form){
	if ( $("NewFile") ){
		if ( $("NewFile").value ) {
			action_form.submit();
			obj.value = "ÀúÀåÁß..."
			obj.disabled = true;
		}
		else {
			alert("¹è³Ê·Î »ç¿ëÇÒ ÀÌ¹ÌÁö¸¦ µî·ÏÇÏ¼¼¿ä.");
			return false;
		}
	}
	else {
		submit_pbmst();
	}


}

// 2008-07-04 10:18¿ÀÀü
// haroc
// ##############################################################################################
// FCKEditorÀÇ LayoutÀ» º¯°æÇÑ´Ù.
var Layout = new Array(8);
Layout[0]	= "";
Layout[1]	= "<table style=\"width: 100%; height: 350px\"><tbody><tr><td style=\"width:50%\" valign=\"top\">&nbsp;</td><td style=\"width:50%\" valign=\"top\">&nbsp;</td></tr></tbody></table>";
Layout[2]	= "<table style=\"width: 100%; height: 350px\"><tbody><tr><td style=\"width:50%\" valign=\"top\">&nbsp;</td><tr><td style=\"width:50%\" valign=\"top\">&nbsp;</td></tr></tbody></table>";
Layout[3]	= "<table style=\"width: 100%; height: 350px\"><tbody><tr><td style=\"width:50%\" valign=\"top\">&nbsp;</td><td style=\"width:50%\" valign=\"top\">&nbsp;</td></tr><tr><td style=\"width:50%\" valign=\"top\">&nbsp;</td><td style=\"width:50%\" valign=\"top\">&nbsp;</td></tr></tbody></table>";
Layout[4]	= "<table style=\"width: 100%; height: 350px\"><tbody><tr><td style=\"width:50%\" valign=\"top\">&nbsp;</td><td rowspan=\"2\" valign=\"top\">&nbsp;</td></tr><tr><td style=\"width:50%\" valign=\"top\">&nbsp;</td></tr></tbody></table>";
Layout[5]	= "<table style=\"width: 100%; height: 350px\"><tbody><tr><td rowspan=\"2\" valign=\"top\">&nbsp;</td><td style=\"width:50%\" valign=\"top\">&nbsp;</td></tr><tr><td style=\"width:50%\" valign=\"top\">&nbsp;</td></tr></tbody></table>";
Layout[6]	= "<table style=\"width: 100%; height: 350px\"><tbody><tr><td colspan=\"2\" valign=\"top\">&nbsp;</td></tr><tr><td style=\"width:50%\" valign=\"top\">&nbsp;</td><td style=\"width:50%\" valign=\"top\">&nbsp;</td></tr></tbody></table>";
Layout[7]	= "<table style=\"width: 100%; height: 350px\"><tbody><tr><td style=\"width:50%\" valign=\"top\">&nbsp;</td><td style=\"width:50%\" valign=\"top\">&nbsp;</td></tr><tr><td colspan=\"2\" valign=\"top\">&nbsp;</td></tr></tbody></table>";

function layout_update(opt_type){
	var oEditor = FCKeditorAPI.GetInstance('FCKeditor1');
	var sHTML = oEditor.GetXHTML();

	if ( sHTML ) {
		if ( !confirm("±âÁ¸µ¥ÀÌÅÍ°¡ »ç¶óÁý´Ï´Ù. ÁøÇàÇÏ½Ã°Ú½À´Ï±î?") ) {
			return false;
		}
	}
	oEditor.SetHTML(Layout[eval(opt_type) - 1]);
}

function setHTMLFckEditor(content){

	oFCKeditor.Value	= content	//ÃÊ±â¿¡ º¸¿©Áú ³»¿ë
	oFCKeditor.Update(document.getElementById("FCKeditor1")) ;
}

function getFCKEditorHTML(){
	var oEditor = FCKeditorAPI.GetInstance('FCKeditor1');
	var sHTML = oEditor.GetXHTML();

	return sHTML;
}

// 2008-04-22 11:23¿ÀÀü
// haroc
// ##############################################################################################
// bodyÀÇ ³ôÀÌ¸¦ °¡Á®¿Â´Ù.
function getBodyHeight(){
	var myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		myHeight = window.innerHeight;
	}
	else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		myHeight = document.body.clientHeight;
	}
	return myHeight;
}

// 2008-04-22 11:22¿ÀÀü
// haroc
// ##############################################################################################
// bodyÀÇ width¸¦ °¡Á®¿Â´Ù.
function getBodyWidth(){
	var myWidth = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		myWidth = window.innerWidth;
	}
	else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		myWidth = document.body.clientWidth;
	}
	return myWidth;
}



// 2008-04-22 11:28¿ÀÀü
// haroc
// ##############################################################################################
// ½ºÅ©·ÑµÈ °ªÀ» °¡Á®¿Â´Ù.
function getScrollXY() {
	var scrOfX = 0, scrOfY = 0;
	if( typeof( window.pageYOffset ) == 'number' ) {
		//Netscape compliant
		scrOfY = window.pageYOffset;
		scrOfX = window.pageXOffset;
	}
	else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
		//DOM compliant
		scrOfY = document.body.scrollTop;
		scrOfX = document.body.scrollLeft;
	} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
		//IE6 standards compliant mode
		scrOfY = document.documentElement.scrollTop;
		scrOfX = document.documentElement.scrollLeft;
	}
	return [ scrOfX, scrOfY ];
}

// 2008-08-01 11:57¿ÀÀü
// haroc
// ##############################################################################################
// °ªÀ» debugÇÑ´Ù.
function debug (str) {
	alert(str);
}

// 2008-08-05 10:33¿ÀÀü
// haroc
// ##############################################################################################
// ÀÌ¹ÌÁö Å©±âº¯°æ.
function resizeImg(obj, maxWidth, maxHeight){
	//ÆÄÀÌ¾îÆø½º¿¡¼­ ¹®Á¦¹ß»ýÇØ¼­ ÁÖ¼®Ã³¸® - 2008-12-19 10:00¿ÀÀü
	//var _img 	= document.createElement( 'IMG' ) ;	// new Image() ;
	//_img.setAttribute("src", obj.src);

	//var iWidth 	= eval(_img.getAttribute("width"));
	//var iHeight = eval(_img.getAttribute("height"));
	
	var _i 	= document.createElement( 'IMG' ) ;
	// var _i = new Image();
    // _i.src=obj.src;  //ÀÌ¹ÌÁöÁöÁ¤
    _i.setAttribute("src", obj.src);
    var iWidth = _i.width;
    var iHeight = _i.height;
    
	if ( eval(iWidth) > eval(maxWidth) ){
		obj.width = maxWidth;
	}
	return true;

	if ( eval( iWidth ) > eval( maxWidth ) ) {
		if ( eval ( iHeight ) >= eval ( maxHeight ) ) {
			if ( eval ( iWidth ) / eval ( iHeight ) >= eval ( maxWidth ) / eval (maxHeight) ) {
				obj.height = maxHeight;
			}
			else {
				obj.width = maxWidth;
			}
		}
		else {
			obj.height = maxHeight;
		}
	}
	return true;
}

// 2008-08-05 11:09¿ÀÀü
// haroc
// ##############################################################################################
// ÆÄÀÏ È®ÀåÀÚ¸¦ °¡Á®¿Â´Ù.
function getFileExtension (_filename) {
	var _filelist = _filename.split(".");
	if ( -1 == _filelist.length ) {
		return '';
	}
	return _filelist[_filelist.length - 1];
}

function replaceAll(str,orgStr,repStr)
{
	return str.split(orgStr).join(repStr);
}

// 2008-08-06 5:06¿ÀÈÄ
// haroc
// ##############################################################################################
// submitÇÔ¼ö¸¸ ¸ð¾Æ³õ´Â´Ù.
var p_MenuSubmit = {
	_formName 	: "frmMainMenu",
	_target		: "contents_frame",
	_action		: "/admin/common/MainMenu_w_ok.asp",
	_encoding	: "application/x-www-form-urlencoded",
	_selectName	: "BetaBoardFileList",
	ATTACH_FILE_PARTITION		: "^#####^",
	_uploadfilelist : "upload_file_list",
	submitMenuMst : function (vFrmName) {
		if ( '' == vFrmName+"" || null == vFrmName ) {
			vFrmName = this._formName;
		}
		p_MenuSubmit.addTrustList();

		document.forms[vFrmName].target			= this._target;
		document.forms[vFrmName].action 		= this._action;
		document.forms[vFrmName].encoding		= this._encoding;		
		document.forms[vFrmName].submit();
	},
	// 2008-04-16 9:59¿ÀÀü
	// haroc
	// ##############################################################################################
	// °ü¸®ÀÚ¸®½ºÆ®¸¦ hidden¿¡ ³Ö¾îÁØ´Ù.
	// submitÇÏ±âÀü¿¡ ½ÇÇàÇÏµµ·ÏÇÑ´Ù.
	addTrustList : function (){
		var tr_trustlist = document.getElementsByName("tr_trustlist");
		if ( !tr_trustlist.length ) {
			return false;
		}
		$("trustlist").value = '';
		if ( tr_trustlist.length > 1 ) {
			for ( var i = 0 ; i < eval(tr_trustlist.length) ; i++ ) {
				var jj = document.getElementsByName("tr_trustlist")[i].firstChild;

				if ( $("trustlist").value ) {
					$("trustlist").value += "$$";
				}
				$("trustlist").value += getTrust(jj);
			}
		}
		else {
			var jj = document.getElementById("tr_trustlist").firstChild;

			$("trustlist").value += getTrust(jj);
		}
		// alert($("trustlist").value);
	},
	// 2008-08-08 11:08¿ÀÀü
	// haroc
	// ##############################################################################################
	// uploadµÉ ÆÄÀÏ ¸®½ºÆ®¸¦ °¡Á®¿Â´Ù.
	addUploadFileList : function () {
		var vFileList = $(this._selectName);
		var vList = '';

		for ( var i = 0 ; i < vFileList.length ; i++ ) {
			if ( 0 == i ) {
				vList = vFileList[i].value;
			}
			else {
				vList += this.ATTACH_FILE_PARTITION + vFileList[i].value;
			}
		}

		$(this._uploadfilelist).value = vList;
	}
}

// 2008-09-24 11:25¿ÀÀü
// haroc
// ##############################################################################################
// toggleCheckBox
function toggleCheckBox(obj, check_name) {
	var chk = document.getElementsByName(check_name);
	for ( var i = 0 ; i < chk.length ; i++ ) {
		chk[i].checked = obj.checked;
	}
}

// 2008-07-02 4:58¿ÀÈÄ
// haroc
// ##############################################################################################
// ÆË¾÷ ¹è³Ê ¸¶½ºÅÍÆû submit
function submit_pbmst(file_name){
	$("file_name").value = file_name
	document.frmPBMst.submit();
}

// 2008-09-24 8:17¿ÀÈÄ
// haroc
// ##############################################################################################
// ÅÛÇÃ¸´ ¸®½ºÆ® º¸±â
function view_template_list() {
	var obj_name = "template_list";
	var ajax_url = "template_list.ajax.asp";
	var pars = "";
	var myAjax = new Ajax.Updater (obj_name, ajax_url, {
		method: 'post',
		parameters:		pars,
		onComplete:		completeUpdate,
		onLoading:		loadingUpdate
	});
	$(obj_name).show();
}

// 2008-09-24 8:37¿ÀÈÄ
// haroc
// ##############################################################################################
// ÅÛÇÃ¸´ ³»¿ëÀ» Àû¿ëÇÏ±â
function setHTMLTemplate(template_seqnum) {
	//var oEditor = FCKeditorAPI.GetInstance('FCKeditor1');
	//var sHTML = oEditor.GetXHTML();

	var sHTML = tinyMCE.get('txtFCKcontentsClob').getContent();

	if ( sHTML ) {
		if ( !confirm("±âÁ¸µ¥ÀÌÅÍ°¡ »ç¶óÁý´Ï´Ù. ÁøÇàÇÏ½Ã°Ú½À´Ï±î?") ) {
			return false;
		}
	}

	var ajax_url 	= "template_contents.ajax.asp";
	var pars 		= "?template_seqnum="+template_seqnum;
	var		myAjax	= new Ajax.Request(ajax_url, {
		method: 		'post',
		parameters:		pars,
		onComplete:		loadTemplateComplete
		});
}

// 2008-09-24 8:43¿ÀÈÄ
// haroc
// ##############################################################################################
// °¡Á®¿Â ÅÛÇÃ¸´ µ¥ÀÌÅÍ¸¦ FCKEditor¾ÈÀ¸·Î ³Ö¾îÁØ´Ù.
function loadTemplateComplete(originalRequest) {
	//var oEditor = FCKeditorAPI.GetInstance('FCKeditor1');

	//oEditor.SetHTML(originalRequest.responseText);

	tinyMCE.get('txtFCKcontentsClob').setContent(originalRequest.responseText);

	$("template_list").hide();
}

// 2008-09-24 11:12¿ÀÈÄ
// haroc
// ##############################################################################################
function view_backup_list(){
	var obj_name = "template_list";
	var ajax_url = "backup_list.ajax.asp";
	var pars = "?menuseqnum="+$("menuseqnum").value;
	var myAjax = new Ajax.Updater (obj_name, ajax_url, {
		method: 'post',
		parameters:		pars,
		onComplete:		completeUpdate,
		onLoading:		loadingUpdate
	});
	$(obj_name).show();
}

// 2008-09-24 11:20¿ÀÈÄ
// haroc
// ##############################################################################################
function backup_data_clipboard(backupseqnum) {
	var ajax_url 	= "backup_contents.ajax.asp";
	var pars 		= "?backupseqnum="+backupseqnum;
	var		myAjax	= new Ajax.Request(ajax_url, {
		method: 		'post',
		parameters:		pars,
		onComplete:		loadBackupClipboard
	});
}

// 2008-09-24 11:21¿ÀÈÄ
// haroc
// ##############################################################################################
function loadBackupClipboard(originalRequest){
	window.clipboardData.setData('Text',originalRequest.responseText);
	alert ( "³»¿ëÀÌ Å¬¸³º¸µå¿¡ º¹»çµÇ¾ú½À´Ï´Ù." );
}

// 2008-09-24 11:30¿ÀÈÄ
// haroc
// ##############################################################################################
function backup_data_input(backupseqnum){
	var ajax_url 	= "backup_contents.ajax.asp";
	var pars 		= "?backupseqnum="+backupseqnum;
	var		myAjax	= new Ajax.Request(ajax_url, {
		method: 		'post',
		parameters:		pars,
		onComplete:		loadBackupInput
	});
}

// 2008-09-24 11:31¿ÀÈÄ
// haroc
// ##############################################################################################
function loadBackupInput(originalRequest){
	var oEditor = FCKeditorAPI.GetInstance('FCKeditor1');

	oEditor.SetHTML(originalRequest.responseText);
}

// 2008-09-30 5:25¿ÀÈÄ
// haroc
// ##############################################################################################

function ChangImg(obj, image_src){
	obj.filters.blendTrans.apply();
	obj.src = image_src;
	obj.filters.blendTrans.play();
}

// ÇÃ·¡½Ã »ðÀÔ ÇÔ¼ö ½ÃÀÛ **************************************************************************************************************
function FlashInsert(FlashIDName, FlashFileName, FlashWidth, FlashHeight, DNSSetting, WMODESetting, FlashBGColor, QSetting, FlashAlign,Flashscale,Flashloc)
{
	document.write('<OBJECT CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
	document.write('CODEBASE="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab#version=8,0,22,0" ');
	document.write(' ID="'+FlashIDName+'" WIDTH="' + FlashWidth + '" HEIGHT="' + FlashHeight + '" ALIGN="'+FlashAlign+'">');
	document.write('<PARAM NAME="movie" VALUE="'+ FlashFileName +'">');
	document.write('<PARAM NAME="quality" VALUE="'+QSetting+'">');
	document.write('<PARAM NAME="bgcolor" VALUE="'+FlashBGColor+'">');
	document.write('<PARAM NAME="scale" VALUE="'+Flashscale+'">');
	document.write('<PARAM NAME="salign" VALUE="'+Flashloc+'">');
	document.write('<PARAM NAME="wmode" VALUE="'+WMODESetting+'">');
	document.write('<PARAM NAME="allowScriptAccess" VALUE="'+DNSSetting+'">');
	document.write('<EMBED SRC="'+ FlashFileName +'"  NAME="'+FlashIDName+'"');
	document.write(' WIDTH="' + FlashWidth + '" HEIGHT="' + FlashHeight + '" QUALITY="'+QSetting+'" BGCOLOR="'+FlashBGColor+'"scale="'+Flashscale+'"');
	document.write(' ALLOWSCRIPTACCESS="'+DNSSetting+'" ALIGN="'+FlashAlign+'" WMODE="'+WMODESetting+'" TYPE="application/x-shockwave-flash" ');
	document.write(' PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer" >');
	document.write('</EMBED>');
	document.write('</OBJECT>');
}
// ÇÃ·¡½Ã »ðÀÔ ÇÔ¼ö Á¾·á **************************************************************************************************************


// 2008-10-06 3:45¿ÀÈÄ
// haroc
// ##############################################################################################
function scrapList(maincode, nowPage, star){
	var obj_name = "scrapBox_Container";
	var ajax_url = "/common/scrap_list.ajax.asp";
	var pars = "?maincode="+maincode;
	pars += "&nowpage="+nowPage;
	pars += "&star="+star;
	var myAjax = new Ajax.Updater (obj_name, ajax_url, {
							method: 'post',
							parameters:pars,
							onComplete:		completeUpdate,
							onLoading:		loadingUpdate
						});
}

// 2008-10-07 2:12¿ÀÈÄ
// haroc
// ##############################################################################################
function thumbList(maincode, nowPage){
	var obj_name = "thumbBox_Container";
	var ajax_url = "/common/thumb_list.ajax.asp";
	var pars = "?maincode="+maincode;
	pars += "&nowpage="+nowPage;
	var myAjax = new Ajax.Updater (obj_name, ajax_url, {
							method: 'post',
							parameters:pars,
							onComplete:		completeUpdate,
							onLoading:		loadingUpdate
						});
}

// 2008-10-07 9:57¿ÀÀü
// haroc
// ##############################################################################################
function deleteScrap(scrap_idx, maincode, nowPage, star){
	var obj_name = "scrapBox_Container";
	var ajax_url = "/common/scrap_d_ok.ajax.asp";
	var pars = "?scrap_idx="+scrap_idx;
	pars += "&maincode="+maincode;
	pars += "&nowpage="+nowPage;
	pars += "&star="+star;
	var myAjax = new Ajax.Updater (obj_name, ajax_url, {
							method: 'post',
							parameters:pars,
							onComplete:		completeUpdate,
							onLoading:		loadingUpdate
						});
}

// 2008-10-06 11:49¿ÀÀü
// haroc
// ##############################################################################################
function toggleStar(obj, board_seqnum){

	if ( 'Y' == obj.getAttribute("stared") ) {
		obj.src = "/images/disko/mark_N.gif";
		obj.setAttribute("stared", "N");
	}
	else {
		obj.src = "/images/disko/mark_Y.gif";
		obj.setAttribute("stared", "Y");
	}

var ajax_url 	= "/common/toggleStar.ajax.asp";
var pars 		= "?boardseqnum="+board_seqnum+"&star="+obj.getAttribute("stared");

var		myAjax	= new Ajax.Request(ajax_url, {
	method: 		'post',
	parameters:		pars,
	onComplete:		debugAjax
	});
}

// 2008-10-06 11:49¿ÀÀü
// haroc
// ##############################################################################################
function debugAjax(originalRequest){
	// alert (originalRequest.responseText);
}






// 2008-10-07 4:56¿ÀÈÄ
// haroc
// ##############################################################################################
function viewYearCal(){
}

// 2008-10-07 4:57¿ÀÈÄ
// haroc
// ##############################################################################################
function viewMonthCal(){
}

// 2008-10-07 8:51¿ÀÈÄ
// haroc
// ##############################################################################################
function goURI(opt){
	
	if ( 'home' == opt ) {
		location.href = "/";
	}
	else if ( 'contactus' == opt ) {
		location.href = "/disko/list.asp?menuseqnum=20036";
	}
	else if ( 'sitemap' == opt ) {
		showPopWin('/disko/sitemap.html', 820, 510, null);
	}
	else if ( 'designdb' == opt ) {
		//location.href = "http://www.designdb.com/";
		window.open("http://www.designdb.com/", "" , "");
	}
	else if ( 'memberlogin' == opt ) {
	}
	else if ( 'join' == opt ) {
	}
	else {
	}
}

// 2008-10-01 8:18¿ÀÈÄ
// haroc
// ##############################################################################################
function contents_print(board_seqnum){
	var vLeft	= (screen.width - 640) / 2;
	var vTop	= (screen.height - 650) / 2;

	if ( board_seqnum == 'about' ) {
		window.open("print.asp?boardseqnum=" + board_seqnum, "print", "left="+vLeft+", top="+vTop+", width=900px, height=650px, scrollbars=yes");
	}
	else {
		window.open("print.asp?boardseqnum=" + board_seqnum, "print", "left="+vLeft+", top="+vTop+", width=640px, height=650px, scrollbars=yes");
	}

}

// 2008-10-01 8:52¿ÀÈÄ
// haroc
// ##############################################################################################
function scrapPost(board_seqnum) {
	// alert('Sorry, not serviced');
	if ( !board_seqnum ) {
		return false;
	}

	var ajax_url 	= "/common/scrap.ajax.asp";
	var pars 		= "?board_seqnum="+board_seqnum;

	var		myAjax	= new Ajax.Request(ajax_url, {
		method: 		'post',
		parameters:		pars,
		onComplete:		scrapComplete
		});
}

// 2008-10-01 8:53¿ÀÈÄ
// haroc
// ##############################################################################################
function scrapComplete(originalRequest) {
	alert (originalRequest.responseText);
}

// 2008-10-02 9:50¿ÀÀü
// haroc
// ##############################################################################################
function goTranslate(pvalue) {

	if ( pvalue == '' ) {
		return false;
	}

	//alert(location.href.toString().replaceAll("#none",""));

	var goUrl, repUrl

	repUrl = location.href.toString().replaceAll("#none","");


	if ( repUrl.indexOf("?") == -1 ) {
		goUrl = URLEncode(repUrl+"?trans=Y");
	}
	else {
		goUrl = URLEncode(repUrl+"&trans=Y");
	}

	var link_url = "http://translate.google.co.kr/translate?u="+goUrl+"&hl=ko&ie=UTF-8&sl=en&tl="+pvalue;

	window.open (link_url, 'translate');
	// $("translate_div").hide();
}

// 2008-10-02 9:54¿ÀÀü
// haroc
// ##############################################################################################
function toggleDisplay(div_name){
	if ( $(div_name).style.display == 'none' ) {
		$(div_name).show();
	}
	else {
		$(div_name).hide();
	}

}

// 2008-10-13 3:18¿ÀÈÄ
// haroc
// ##############################################################################################
function setBodyContentHeight() {
	if ( !$("body_content") ) {
		return false;
	}
	var divHeight = $("body_content").getStyle("height").replace('px', '');
	if ( eval(divHeight) < 1000 ) {
		$("body_content").style.height = '1000px';
	}
}

// 2008-10-13 8:39¿ÀÈÄ
// haroc
// ##############################################################################################
function go_detail(frm, id) {
	frm.i_applyseqnum.value = id;
	frm.cmd.value = "gallery_view";
	window.open ('', 'gd', '');
	frm.target = "gd";
	frm.submit ();
}

// 2008-10-15 11:09¿ÀÀü
// haroc
// ##############################################################################################

function toggleSchoolDiv (div_name){
	var div = document.getElementsByTagName("div");
	for ( var i = 0 ; i < div.length ; i++ ){
		if ( div[i].getAttribute("id").indexOf("source_school_") == 0 ) {
			if ( div[i].getAttribute("id") == div_name ) {
				div[i].style.display = 'block';
			}
			else {
				div[i].style.display = 'none';
			}

		}
	}
}

// 2008-10-15 2:05¿ÀÈÄ
// haroc
// ##############################################################################################

function DiskoSearch(search_title, search_content){
}

function imgResizeCode_1(){
}

// 2008-10-19 8:50¿ÀÈÄ
// haroc
// ##############################################################################################
function toggleSelectView(opt) {
	var vSelect = document.getElementsByTagName("select");

	for ( var i = 0 ; i < vSelect.length ; i ++ ) {
		vSelect[i].style.display = opt;
	}
}

// 2008-10-19 8:53¿ÀÈÄ
// haroc
// ##############################################################################################
function calendarView(opt){
	if ( opt == 'month' ) {
		showPopWin('/include/template/template_month_cal_popup.asp', 876, 624, null);
		toggleSelectView('none');
	}
	else if ( opt == 'year' ) {
		showPopWin('/include/template/template_calendar_popup.asp', 750, 624, null)
		toggleSelectView('none');
	}

}

// ====================================================================
//       URLEncode and URLDecode functions
//
// Copyright Albion Research Ltd. 2002
// http://www.albionresearch.com/
//
// You may copy these functions providing that
// (a) you leave this copyright notice intact, and
// (b) if you use these functions on a publicly accessible
//     web site you include a credit somewhere on the web site
//     with a link back to http://www.albionresearch.com/
//
// If you find or fix any bugs, please let us know at albionresearch.com
//
// SpecialThanks to Neelesh Thakur for being the first to
// report a bug in URLDecode() - now fixed 2003-02-19.
// And thanks to everyone else who has provided comments and suggestions.
// ====================================================================
function URLEncode( plaintext )
{
	// The Javascript escape and unescape functions do not correspond
	// with what browsers actually do...
	var SAFECHARS = "0123456789" +					// Numeric
					"ABCDEFGHIJKLMNOPQRSTUVWXYZ" +	// Alphabetic
					"abcdefghijklmnopqrstuvwxyz" +
					"-_.!~*'()";					// RFC2396 Mark characters
	var HEX = "0123456789ABCDEF";

	// var plaintext = document.URLForm.F1.value;
	var encoded = "";
	for (var i = 0; i < plaintext.length; i++ ) {
		var ch = plaintext.charAt(i);
	    if (ch == " ") {
		    encoded += "+";				// x-www-urlencoded, rather than %20
		} else if (SAFECHARS.indexOf(ch) != -1) {
		    encoded += ch;
		} else {
		    var charCode = ch.charCodeAt(0);
			if (charCode > 255) {
			    alert( "Unicode Character '"
                        + ch
                        + "' cannot be encoded using standard URL encoding.\n" +
				          "(URL encoding only supports 8-bit characters.)\n" +
						  "A space (+) will be substituted." );
				encoded += "+";
			} else {
				encoded += "%";
				encoded += HEX.charAt((charCode >> 4) & 0xF);
				encoded += HEX.charAt(charCode & 0xF);
			}
		}
	} // for

	// document.URLForm.F2.value = encoded;
  	// document.URLForm.F2.select();
	return encoded;
};

function URLDecode( )
{
   // Replace + with ' '
   // Replace %xx with equivalent character
   // Put [ERROR] in output if %xx is invalid.
   var HEXCHARS = "0123456789ABCDEFabcdef";
   var encoded = document.URLForm.F2.value;
   var plaintext = "";
   var i = 0;
   while (i < encoded.length) {
       var ch = encoded.charAt(i);
	   if (ch == "+") {
	       plaintext += " ";
		   i++;
	   } else if (ch == "%") {
			if (i < (encoded.length-2)
					&& HEXCHARS.indexOf(encoded.charAt(i+1)) != -1
					&& HEXCHARS.indexOf(encoded.charAt(i+2)) != -1 ) {
				plaintext += unescape( encoded.substr(i,3) );
				i += 3;
			} else {
				alert( 'Bad escape combination near ...' + encoded.substr(i) );
				plaintext += "%[ERROR]";
				i++;
			}
		} else {
		   plaintext += ch;
		   i++;
		}
	} // while
   document.URLForm.F1.value = plaintext;
   document.URLForm.F1.select();
   return false;
};


// 2008-11-19 8:20¿ÀÈÄ
// haroc
// ##############################################################################################
// ·Î±×ÀÎ È­¸é º¸¿©ÁÖ±â
function toggleDiskoLoginArea(){

	if ( $("disko_login_box").getStyle("display") == 'none') {
		var aaa = getClientSize();
		windowHeight = $("disko_body").getHeight();
		$("disko_body").setStyle({'height':aaa[1], 'overflow':'hidden'});
		$("disable_box").setStyle({'width':aaa[0], 'height':aaa[1]});
		
		// $("disko_login_box").setStyle({'top':eval(getTop($("main_center"))) + eval($("main_center").getHeight()), 'left':eval(getLeft($("main_center")))});
		$("disko_login_box").setStyle({'top':'180px', 'left':50});
		$('disko_login_box').appear({ duration: 1.0 });
	}
	else {
		$('disko_login_box').fade();
		$("disable_box").setStyle({'width':'0', 'height':'0'});
		$("disko_body").setStyle({'height':windowHeight});
	}
}


/**
* ºê¶ó¿ìÀú document ¿µ¿ªÀÇ
* clientWidth/clientHeight, scrollWidth/scrollHeight ±¸ÇÏ±â
*
* @author hooriza
*/
function getClientSize() {

  var oDoc = document[document.compatMode == 'CSS1Compat' ? 'documentElement' : 'body'];
  if (/Opera/.test(navigator.userAgent)) oDoc = document.body;

  return [
    oDoc.clientWidth,
    oDoc.clientHeight
  ];

}

function getScrollSize() {

  var oDoc = document[document.compatMode == 'CSS1Compat' ? 'documentElement' : 'body'];
  if (/Opera|Safari/.test(navigator.userAgent)) oDoc = document.body;

  // IE6 ¹Ì¸¸ÀÌ¸é
  if (/MSIE\s([0-9]+(\.[0-9]+)*)/.test(navigator.userAgent) && parseFloat(RegExp.$1) < 6) {

    var aOld = [ oDoc.scrollLeft, oDoc.scrollTop ];
    var aClient = getClientSize();

    oDoc.scrollLeft = 999999;
    oDoc.scrollTop = 999999;

    var aRet = [
      oDoc.scrollLeft + aClient[0],
      oDoc.scrollTop + aClient[1]
    ];

    oDoc.scrollLeft = aOld[0];
    oDoc.scrollTop = aOld[1];

    return aRet;

  }

  return [
    oDoc.scrollWidth,
    oDoc.scrollHeight
  ];

}


// 2008-12-05 5:59¿ÀÈÄ
// haroc
// ##############################################################################################
// »ç¿ëÀÚ ·Î±×ÀÎ
function AjaxDiskoLogin() {
	var ajax_url 	= "./login_ok.ajax.asp";
	var pars 		= "?id="+$("id").value;
	pars += "&passwd="+$("passwd").value;

	var		myAjax	= new Ajax.Request(ajax_url, {
		method: 		'post',
		parameters:		pars,
		onComplete:		DiskologinComplete
		});
}
// 2008-12-05 5:59¿ÀÈÄ
// haroc
// ##############################################################################################
// »ç¿ëÀÚ ·Î±×ÀÎ
function NewAjaxDiskoLogin() {
	if ( $("id").value == '' ) {
		alert ( "¾ÆÀÌµð¸¦ ÀÔ·ÂÇÏ¼¼¿ä." );
		$("id").focus();
		return false;
	}

	if ( $("passwd").value == '' ) {
		alert ( "ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇÏ¼¼¿ä." );
		$("passwd").focus();
		return false;
	}
	
	$("pUserid").value = $("id").value;
	$("pUserPass").value = $("passwd").value;
	
	document.forms["frmLogin"].action = ssoUrl;
	document.forms["frmLogin"].submit();
}


// 2008-12-05 6:01¿ÀÈÄ
// haroc
// ##############################################################################################
// »ç¿ëÀÚ ·Î±×ÀÎ¹öÆ° Å¬¸¯ÈÄ Ajax·Î ½ÇÇàÈÄ
function DiskologinComplete(originalRequest) {
	if ( 'Y' == originalRequest.responseText ) {
		location.reload();
	}
	else {
		alert ( "·Î±×ÀÎ¿¡ ½ÇÆÐÇÏ¿´½À´Ï´Ù.\n¾ÆÀÌµð¿Í ÆÐ½º¿öµå¸¦ È®ÀÎÈÄ ´Ù½Ã ½ÃµµÇØ ÁÖ½Ã±â ¹Ù¶ø´Ï´Ù." );
		return false;
	}
}

// 2008-12-05 6:17¿ÀÈÄ
// haroc
// ##############################################################################################
// »ç¿ëÀÚ ·Î±×¾Æ¿ô
function AjaxLogout() {
	var ajax_url 	= "./logout_ok.ajax.asp";
	var pars 		= "";

	var		myAjax	= new Ajax.Request(ajax_url, {
		method: 		'post',
		parameters:		pars,
		onComplete:		logoutComplete
		});
}

// 2008-12-05 6:17¿ÀÈÄ
// haroc
// ##############################################################################################
// »ç¿ëÀÚ ·Î±×¾Æ¿ô
function NewAjaxLogout() {
	document.forms["frmLogin"].action = ssoLogout;
	document.forms["frmLogin"].submit();
}


// 2008-12-05 6:19¿ÀÈÄ
// haroc
// ##############################################################################################
// ·Î±×¾Æ¿ôÈÄ
function logoutComplete(originalRequest) {
	location.reload();
}

// 2009-01-21 11:40¿ÀÀü
// haroc
// ##############################################################################################
// ¾ÆÀÌµð Ã£±â
function find_disko_id() {
	window.open('http://www.designdb.com/popup/popupForeignerIdSearch.asp', 'find_id', 'width=576, height=408, scrollbar=no');
}

// 2009-01-21 11:40¿ÀÀü
// haroc
// ##############################################################################################
// ÆÐ½º¿öµå Ã£±â
function find_disko_pwd() {
	window.open('http://www.designdb.com/popup/popupForeignerPwSearch.asp', 'find_pwd', 'width=566, height=570, scrollbar=no');
}

function createFCKEditor(area_name, ToolbarSet, _width, _height){
	if ( $( area_name ) ) {
		var oFCKeditor = new FCKeditor( area_name ) ;
		oFCKeditor.BasePath	= "/fckeditor/";
		oFCKeditor.ToolbarSet = ToolbarSet;
		if ( _width ) {
			oFCKeditor.Width = _width;
		}
		else {
			oFCKeditor.Width = '500px';
		}
		
		if ( _height ) {
			oFCKeditor.Height	= _height;
		}
		else {
			oFCKeditor.Height	= '400px';
		}
		
		
		oFCKeditor.ReplaceTextarea();
	}
}

/* ÆË¾÷ 
	ÀÌÁöÄÄ À¯Á¤ÈÆ 2010-04-23
*/
function popup(url, width, height) { 
	var width = width;
	var height = height;
	var windowproperties = "width="+ width +",height="+ height +",scrollbars=yes";
	window.open(url, "calendar_year", windowproperties); return false; 
}

function popup_noscroll(url, width, height) { 
	var width = width;
	var height = height;
	var windowproperties = "width="+ width +",height="+ height +",scrollbars=no";
	window.open(url, "calendar_month", windowproperties); return false; 
}

/* ¼¿·ºÆ® ·¹ÀÌ¾î ¼öÁ¤ 
2010-05-18
À¯Á¤ÈÆ*/
function initLayers(id,seq1) {
	nav1 = document.getElementById(id);
	nav1.menu1 = new Array();
	nav1.current = null;
	nav1.menuseq1 = 0;
	navLen1 = nav1.childNodes.length;
	
	allA = nav1.getElementsByTagName("a")
	for(k = 0; k < allA.length; k++) {
		allA.item(k).onmouseover = allA.item(k).onfocus = function () {
			nav1.isOver = true;
		}
		allA.item(k).onmouseout = allA.item(k).onblur = function () {
			nav1.isOver = false;
			setTimeout(function () {
				if (nav1.isOver == false) {
					if (nav1.menu1[seq1])
						nav1.menu1[seq1].onmouseover();
					else if(nav1.current) {
						if (nav1.current.submenu)
							nav1.current.submenu.style.display = "none";
						nav1.current = null;
					}
				}
			}, 500);
		}
	}

	for (i = 0; i < navLen1; i++) {
		navItem = nav1.childNodes.item(i);
		if (navItem.tagName != "LI")
			continue;

		navAnchor = navItem.getElementsByTagName("a").item(0);
		navAnchor.submenu = navItem.getElementsByTagName("ul").item(0);
		
		navAnchor.onmouseover = navAnchor.onfocus = function () {
			if (nav1.current) {
				if (nav1.current.submenu)
					nav1.current.submenu.style.display = "none";
				nav1.current = null;
			}
			if (nav1.current != this) {
				if (this.submenu)
					this.submenu.style.display = "block";
				nav1.current = this;
			}
			nav1.isOver = true;
		}
		nav1.menuseq1++;
		nav1.menu1[nav1.menuseq1] = navAnchor;
	}
	if (nav1.menu1[seq1])
		nav1.menu1[seq1].onmouseover();
}


function popup(url, width, height) { 
	var width = width;
	var height = height;
	var windowproperties = "width="+ width +",height="+ height +",scrollbars=0";
	window.open(url, "login", windowproperties); return false; 
}