// È­¸é°¡¿îµ¥ Ã¢¶ì¿ì±â
function opwc(name, url, width, height, toolbar, menubar, statusbar, scrollbar, resizable) {
	var winl = (screen.width - width) / 2;
	var wint = (screen.height - height) / 2;
	opw(name, url, winl, wint, width, height, toolbar, menubar, statusbar, scrollbar, resizable);
}
// ÀÏ¹Ý Ã¢¶ì¿ì±â
function opw(name, url, left, top, width, height, toolbar, menubar, statusbar, scrollbar, resizable) {
    toolbar_str = toolbar ? 'yes' : 'no';
    menubar_str = menubar ? 'yes' : 'no';
    statusbar_str = statusbar ? 'yes' : 'no';
    scrollbar_str = scrollbar ? 'yes' : 'no';
    resizable_str = resizable ? 'yes' : 'no';
    window.open(url, name, 'left='+left+',top='+top+',width='+width+',height='+height+',toolbar='+toolbar_str+',menubar='+menubar_str+',status='+statusbar_str+',scrollbars='+scrollbar_str+',resizable='+resizable_str);
}

// ·¹ÀÌ¾î ¼û±èº¸ÀÓ
function show(iobject){
	iobject.style.visibility="visible";
}
function hide(iobject){
	iobject.style.visibility="hidden";
}

//
function previews(a, b) {
	var xx = eval(a);
	if(b == 1) {
		xx.style.left = event.clientX + 16;
		xx.style.top = event.clientY;
		xx.style.visibility = 'visible';
	} else {
		xx.style.visibility = 'hidden';
	}
}

// ÀÌ¹ÌÁö ¹Ì¸®º¸±â
function preview_img(frm, pre) {
	if(frm) {
		pre.src = frm;
	}
}

// textArea¿¡ ¿øÇÏ´Â °ª ³Ö±â
function saveCurrentPos(objTextArea) {
	if(objTextArea.createTextRange) objTextArea.currentPos = document.selection.createRange().duplicate();
}

function insertText(objTextArea, text) {
	if(objTextArea.createTextRange && objTextArea.currentPos) {
		var currentPos = objTextArea.currentPos;
		currentPos.text = currentPos.text.charAt(currentPos.text.length - 1) == ' ' ? text + ' ' : text;
   } else {
         objTextArea.value  = text;
   }
}

function imgView(src, name) {
	ti = new Image();
	ti.src = src;

	s = "";
	s += "<html><head><title>" + name + "</title>\n";
	s += "<sc"+"ript>\n";
	s += "function resize() {\n";
	s += "	pic = document.myimg;\n";
	s += "	if(eval(pic).height) {\n";
	s += "		var name = navigator.appName\n";
	s += "		if (name == 'Microsoft Internet Explorer') {\n";

	if(ti.width > screen.width || ti.height > screen.height) {
		var imgwin = window.open("",'name','scrollbars=yes,status=no,toolbar=no,resizable=1,location=no,menu=no,top=5000,left=5000,width=1,height=1');
		s += "			myHeight = screen.availHeight - 50; myWidth = screen.availWidth - 50;\n";
		s += "		} else {\n";
		s += "			myHeight = screen.availHeight - 50; myWidth = screen.availWidth - 50;\n";
	} else {
		var imgwin = window.open("",'name','scrollbars=no,status=no,toolbar=no,resizable=1,location=no,menu=no,top=5000,left=5000,width=1,height=1');
		s += "			myHeight = eval(pic).height + 30; myWidth = eval(pic).width + 12;\n";
		s += "		} else {\n";
		s += "			myWidth = eval(pic).height + 9; myWidth = eval(pic).width;\n";
	}
	imgwin.focus(); 
	imgwin.document.open(); 
	
	s += "		}\n";
	s += "		clearTimeout();\n";
	s += "		var height = screen.height;\n";
	s += "		var width = screen.width;\n";
	s += "		var leftpos = width / 2 - myWidth / 2;\n";
	s += "		var toppos = height / 2 - myHeight / 2; \n";
	s += "		self.moveTo(leftpos, toppos);\n";
	s += "		self.resizeTo(myWidth, myHeight);\n";
	s += "	} else {\n";
	s += "		setTimeOut(resize(), 100);\n";
	s += "	}\n";
	s += "}\n";
	s += "</sc"+"ript>\n";
	s += "</head>\n";
	s += "<body topmargin=0 leftmargin=0 marginheight=0 marginwidth=0>\n";
	s += "<img border=0 src='" + src + "' alt='Å¬¸¯ ´Ý±â' name=myimg onclick='self.close();' onload='resize();'>\n";
	s += "</body></html>\n";

	imgwin.document.write(s);
	imgwin.document.close();
}

// ÄíÅ° »ý¼º
function setCookie(name, value, expiredays) {
  var todayDate = new Date();
  todayDate.setDate( todayDate.getDate() + expiredays );
  document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}

// Äí±â °ª ¹Þ±â
function getCookieVal(offset) {
	var endstr = document.cookie.indexOf (";", offset);
	if(endstr == -1)
		endstr = document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
}

// ÄíÅ° Ã£±â
function getCookie(name) {
	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
	while (i < clen) {
		var j = i + alen;
		if (document.cookie.substring(i, j) == arg)
			return getCookieVal(j);
		i = document.cookie.indexOf(" ", i) + 1;
		if (i == 0) break;
	}
	return null;
}

// delete the cookie
function deleteCookie(name,path,domain) 
{
	if (getCookie(name)) 
	{
		document.cookie = name + "=" +
		((path) ? "; path=" + path : "") +
		((domain) ? "; domain=" + domain : "") +
		"; expires=Thu, 01-Jan-70 00:00:01 GMT";
	}
}