//----------------------------------------------------
// AGENT Ã³¸®
//----------------------------------------------------
if (typeof(nxAgent) == "undefined") {
	function nxAgent() {
		agent  = navigator.userAgent.toLowerCase();
		this.major	= parseInt(navigator.appVersion);
		this.minor	= parseFloat(navigator.appVersion);
		this.ns		= (agent.indexOf('mozilla') != -1 &&
					  agent.indexOf('spoofer') == -1 &&
					  agent.indexOf('compatible') == -1 &&
					  this.major >= 5);
		this.ie		= (agent.indexOf("msie") != -1 && this.major >= 4);
		this.ie7	= (agent.indexOf("msie 7") != -1);
		this.ie8	= (agent.indexOf("msie 8") != -1);
		this.iex	= (this.ie && (this.minor >= 5.5));
		this.moz	= (this.ns && (this.major >= 5));

		this.getinfo = function() {
			if (this.ns) {
				this.pagewidth	= window.innerWidth;
				this.pageheight	= window.innerHeight;
				this.pagetop	= window.pageYOffset;
				this.pageleft	= window.pageXOffset;
			}
			else {
				this.pagewidth	= document.body.clientWidth;
				this.pageheight	= document.body.clientHeight;
				this.pagetop	= document.body.scrollTop;
				this.pageleft	= document.body.scrollLeft;
			}
		}
	};
}
if (typeof(agent) == "undefined") { var agent = new nxAgent(); }

//----------------------------------------------------
// Document
//----------------------------------------------------
function get_elmid(str) {return document.getElementById(str)?document.getElementById(str):(parent.document.getElementById(str)?parent.document.getElementById(str):null);};
function get_tagnm(str) {return document.getElementsByTagName?document.getElementsByTagName(str):new Array();};

//----------------------------------------------------
// ¹®ÀÚ¿­ Ã³¸®
//----------------------------------------------------
function str_upper(str) {return str.toUpperCase();};
function str_trim(str) {return (typeof(str) != "undefined")?str.replace(/^\s*|\s*$/g,""):"";};
function str_escape(str) {return window.encodeURIComponent?encodeURIComponent(str):escape(str);};
function str_decode(str) {return window.decodeURIComponent?decodeURIComponent(str):unescape(str)};

function str_tagesc(str) {return (typeof(str) != "undefined")? str.replace(/</g,"&lt;").replace(/>/g,"&gt;"):"";};
function str_quoesc(str) {return (typeof(str) != "undefined")?str.replace(/"/g,'`').replace(/'/g,"`"):"";};
function str_urlesc(str) {return (typeof(str) != "undefined")? str.replace(/&/g,"%26").replace(/=/g,"%3D").replace(/\?/g,"%3F").replace(/\'/g,"%27"):"";};

// ['~`!@#$%^&*(){}-_=+\|<>?,./;:"] [1234567890]
function str_validate(pttn, pstr) {
	for (var i = 0; i < pstr.length; i++)  { if (pttn.indexOf(pstr.substring(i, i+1)) > 0) break; }
	if (i != pstr.length) return false;
	return true;
};
function str_len(pstr) {
	var cnt = 0;
	if (typeof(pstr) != "undefined") {
		for (var i = 0; i < pstr.length; i++) { cnt = (pstr.charCodeAt(i) < 127)? cnt+1 : cnt+2; }
	}
	return cnt;
};
function str_cut(pstr, pnum, pext) {
	if (pstr == null) return pstr;
	var res = ""; var tmp = ""; var cnt = 0;
	for (var i = 0; i < pstr.length; i++) {
		tmp	= pstr.substr(i, 1);
		cnt = (tmp.charCodeAt(0) < 127)? cnt+1 : cnt+2;
		if (cnt > pnum) return res.substr(0,res.length-2)+pext;
		res += tmp;
	}
	return pstr;
};
function str_onlykor(pstr) {
	for (var i = 0; i < pstr.length; i++) {
		if (pstr.charCodeAt(i) < 0xAC00 || pstr.charCodeAt(i) > 0xD7A3) {
			if (( pstr.charCodeAt(i) < 12593 || pstr.charCodeAt(i) > 12643) && (pstr.charCodeAt(i) != 32)) return true;
		}
	}
	return false;
};
function number_format(pnum) {
	pnum = (pnum == "" || !pnum)? 0 : pnum;
	var input = String(pnum);
	var pttn = /(\-?\d+)(\d{3})($|\.\d+)/;
	if (pttn.test(input)) {return input.replace(pttn,function(str,p1,p2,p3){return number_format(p1)+","+p2+""+p3;});}
	else return input;
};
function moneykey(frm) {
	if (frm.value == "") return;
	var curr = parseInt(frm.value.replace(/,/g,''));
	frm.value = number_format(curr);
};
function url_fixparam() {return document.location.search?document.location.search+"&":"?";};
var retry_framesize = 3;

function key_ignore(e) { if (e.keyCode == 13) { return false; } };
function key_active(e, next) { if (e.keyCode == 13) { next(); } };

function nxRollBox() {
	this.name		= "nxRollBox";
	this.item		= new Array();
	this.count		= 0;
	this.viewnum	= 0;
	this.currspeed	= 0;
	this.rollspeed	= 50;
	this.delaytime	= 1000;
	this.ispause	= false;
	this.stop		= false;
	this.type		= 1;
	this.height		= 100;
	this.width		= 100;
	this.wheight	= 0;
	this.wwidth		= 0;

	this.add = function () {
		var text = arguments[0];
		this.item[this.count] = text;
		this.count = this.count + 1;
	};
	this.startup = function () {
		this.type = 1;
		this.display();
		this.currspeed = this.rollspeed;
		this.viewnum++;
		setTimeout(this.name+'.scrollup()', this.currspeed);
	};
	this.startleft = function () {
		this.type = 2;
		this.display();
		this.currspeed = this.rollspeed;
		this.viewnum++;
		setTimeout(this.name+'.scrollleft()', this.currspeed);
	};
	this.startchange = function () {
		this.type = 3;
		this.display();
		this.currspeed = this.rollspeed;
		this.viewnum++;
		setTimeout(this.name+'.change()', this.currspeed);
	};
	this.display = function () {
		if (this.wheight == 0) this.wheight = this.height;
		if (this.wwidth == 0) this.wwidth = this.width;

		document.write('<div id="'+this.name+'" style="height:'+this.wheight+'px;width:'+this.wwidth+'px;position:relative;" onMouseOver="'+this.name+'.mouseover();" onMouseOut="'+this.name+'.mouseout();">');
		for (var i = 0; i < this.count; i++) {
			if (this.type == 1) {
				document.write('<div id="'+this.name+'item'+i+'"style="left:0;width:'+this.width+'px;position:absolute;top:'+(this.height*i+1)+'px;">');
				document.write(this.item[i]);
				document.write('</div>');
			}
			else if (this.type == 2) {
				document.write('<div id="'+this.name+'item'+i+'"style="left:'+(this.width*i+1)+'px;width:'+this.width+'px;position:absolute;top:0;">');
				document.write(this.item[i]);
				document.write('</div>');
			}
			else if (this.type == 3) {
				document.write('<div id="'+this.name+'item'+i+'"style="left:0;top:0;width:'+this.width+'px;position:absolute;display:none;">');
				document.write(this.item[i]);
				document.write('</div>');
			}
		}
		document.write('</div>');
	};
	this.scrollup = function() {
		this.currspeed = this.rollspeed;
		if (!this.stop) {
			for (i = 0; i < this.count; i++) {
				obj = document.getElementById(this.name+'item'+i).style;
				obj.top = (parseInt(obj.top) - 1) + "px";
				if (parseInt(obj.top) <= this.height*(-1)) obj.top = (this.height * (this.count-1)) + "px";
				if (parseInt(obj.top) == 0) this.currspeed = this.delaytime;
			}
		}
		window.setTimeout(this.name+".scrollup()", this.currspeed);
	};
	this.scrollleft = function() {
		this.currspeed = this.rollspeed;
		if (!this.stop) {
			for (i = 0; i < this.count; i++) {
				obj = document.getElementById(this.name+'item'+i).style;
				obj.left = parseInt(obj.left) - 1;
				if (parseInt(obj.left) <= this.left*(-1)) obj.left = (this.left * (this.count-1)) + "px";
				if (parseInt(obj.left) == 0) this.currspeed = this.delaytime;
			}
		}
		window.setTimeout(this.name+".scrollleft()", this.currspeed);
	};
	this.change = function() {
		this.currspeed = this.rollspeed;
		if (!this.stop) {
			for (i = 0; i < this.count; i++) {
				obj = document.getElementById(this.name+'item'+i).style;
				document.getElementById(this.name+'item'+i).style.display = (this.viewnum % this.count == i)?'block':'none';
			}
			this.viewnum++;
		}
		window.setTimeout(this.name+".change()", this.currspeed);
	};
	this.mouseover = function () { if (this.ispause) {this.stop = true;} };
	this.mouseout = function () { if (this.ispause) {this.stop = false;} };
};

function FormPattern() {
	function Validator (pttn, mesg) {
		this.pattern	= pttn;
		this.message	= mesg;
		this.validate	= function(str) {
			if (this.pattern == "nullcheck") return (str_trim(str)=="")?false:true;
			else return (str_trim(str)=="")?false:this.pattern.exec(str);
		}
	}

	this.email	= new Validator(/^[_0-9a-zA-Z-]+(.[_0-9a-zA-Z-]+)*@[0-9a-zA-Z-]+(.[0-9a-zA-Z]+)*$/, "ÀÌ¸ÞÀÏ Çü½ÄÀÌ Àß¸ø µÇ¾ú½À´Ï´Ù.");
	this.url	= new Validator(/^http:\/\/+[\.a-zA-Z0-9-]+\.[a-zA-Z]+/, "URL Çü½ÄÀÌ Àß¸ø µÇ¾ú½À´Ï´Ù.");
	this.number	= new Validator(/^[0-9\.\-]+$/, " Çü½ÄÀÌ Àß¸ø µÇ¾ú½À´Ï´Ù.");
	this.userid	= new Validator(/^[0-9a-z]+$/, " Çü½ÄÀÌ Àß¸ø µÇ¾ú½À´Ï´Ù.");
	this.memo	= new Validator("nullcheck", " ÀÔ·ÂÇÏ¿© ÁÖ¼¼¿ä.");
	this.combo	= new Validator("nullcheck", " ¼±ÅÃÇÏÁö ¾Ê¾Ò½À´Ï´Ù.");
};

var formchecker = new FormPattern();

function reg_checkform(thisform) {
	var forms	= thisform.elements;
	var errmsg	= null;
	for (var i = 0; i < forms.length; i++) {
		if (forms[i].getAttribute("validtype")) {
			//alert(forms[i].getAttribute("validtitle")+":"+forms[i].getAttribute("validtype"));
			var validator = formchecker[forms[i].getAttribute("validtype")];
			if (validator && !validator.validate(str_trim(forms[i].value))) {
				if (errmsg == null) errmsg = forms[i].getAttribute("validtitle") + validator.message;
				else errmsg += "\n\n" + forms[i].getAttribute("validtitle") + validator.message;
				break;
			}
			else if (forms[i].getAttribute("validmin") > str_len(str_trim(forms[i].value))) {
				errmsg = forms[i].getAttribute("validtitle") + " »çÀÌÁî°¡ ÀÛ½À´Ï´Ù\n\nÃÖ¼Ò »çÀÌÁî:" + forms[i].getAttribute("validmin");
				break;
			}
		}
	}
	if (errmsg != null) {
		alert(errmsg); forms[i].focus(); return false;
	}
	return true;
};
function reg_checkvalid(thisform) {
	var errmsg	= null;
	if (thisform.getAttribute("validtype")) {
		var validator = formchecker[thisform.getAttribute("validtype")];
		if (validator && !validator.validate(str_trim(thisform.value))) {
			if (errmsg == null) errmsg = thisform.getAttribute("validtitle") + validator.message;
			else errmsg += "\n\n" + thisform.getAttribute("validtitle") + validator.message;
		}
	}
	if (errmsg != null) { alert(errmsg); thisform.focus(); return false; }
	return true;
};
function reg_onlycheckform(thisform, target) {
	var forms	= thisform.elements;
	var errmsg	= null;
	for (var i = 0; i < forms.length; i++) {
		if (forms[i].getAttribute("validtype")) {
			var validator = formchecker[forms[i].getAttribute("validtype")];
			if (validator && !validator.validate(forms[i].value)) {
				if (errmsg == null) errmsg = forms[i].getAttribute("validtitle") + validator.message;
				else errmsg += "\n\n" + forms[i].getAttribute("validtitle") + validator.message;
				break;
			}
		}
	}
	if (errmsg != null) {alert(errmsg);target.focus();return false;}
	return true;
};

function isYYYYMMDD(y, m, d) {
	switch (m) {
		case 2:
			if (d > 29) return false;
			if (d == 29) { // À±³âÀÎÁö¸¦ È®ÀÎ
				if ((y % 4 != 0) || (y % 100 == 0) && (y % 400 != 0))
				return false;
			}
			break;
		case 4:
		case 6:
		case 9:
		case 11:
			if (d == 31) return false;
	}
	return true;
}

function isSSN(s1, s2) {
	n = 2; sum = 0;
	for (i = 0; i < s1.length; i++)
		sum += parseInt(s1.substr(i, 1)) * n++;
	for (i = 0; i < s2.length-1; i++) {
		sum += parseInt(s2.substr(i, 1)) * n++;
		if (n == 10) n = 2;
	}
	c = 11 - sum % 11;
	if (c == 11) c = 1;
	if (c == 10) c = 0;
	if (c != parseInt(s2.substr(6, 1))) return false;
	else return true;
}

// ¿Ü±¹ÀÎ ÁÖ¹Î¹øÈ£ Ã¼Å©
function isRegNo_fgnno(fgnno) { 
        var sum=0; 
        var odd=0; 
        buf = new Array(13); 
        for(i=0; i<13; i++) { buf[i]=parseInt(fgnno.charAt(i)); } 
        odd = buf[7]*10 + buf[8]; 
        if(odd%2 != 0) { return false; } 
        if( (buf[11]!=6) && (buf[11]!=7) && (buf[11]!=8) && (buf[11]!=9) ) { 
                return false; 
        } 
        multipliers = [2,3,4,5,6,7,8,9,2,3,4,5]; 
        for(i=0, sum=0; i<12; i++) { sum += (buf[i] *= multipliers[i]); } 
        sum = 11 - (sum%11); 
        if(sum >= 10) { sum -= 10; } 
        sum += 2; 
        if(sum >= 10) { sum -= 10; } 
        if(sum != buf[12]) { return false } 
        return true; 
} 

function nextform(currform, nextform, maxsize) {
	var len = currform.value.length;
	if (len == maxsize) { nextform.focus(); }
}

function send_ajax(purl, pfunc) {
	var req = req_xmlhttp();
	if (!req || agent && !pfunc) {(new Image()).src = purl;}
	else {
		req.open("GET", purl+((purl.indexOf('?') != -1)? "&": "?")+"nocache="+new Date().getTime(), true);
		req.setRequestHeader("Content-Type", "text/html; charset=euc-kr");
		req.setRequestHeader("Accept-Language", "ko");
		if (pfunc) {
			req.onreadystatechange = function() {
				if (req.readyState == 4) pfunc(req.responseText);
			}
		}
		req.send(null);
	}
};
function send_idajax(pid, purl, pfunc) {
	var obj = document.getElementById(pid);
	if (!obj || typeof(obj) == "undefined") return false;
	var req = req_xmlhttp();
	if (!req || agent && !pfunc) {(new Image()).src = purl;}
	else {
		req.open("GET", purl+((purl.indexOf('?') != -1)? "&": "?")+"nocache="+new Date().getTime(), true);
		req.setRequestHeader("Content-Type", "text/html;charset=euc-kr");
		req.setRequestHeader("Accept-Language", "ko");
		if (pfunc) {
			req.onreadystatechange = function() {
				if (req.readyState == 4) pfunc(obj, req.responseText);
			}
		}
		req.send(null);
	}
};
function send_postxmlajax(purl, pdata, pfunc) {
	var req = req_xmlhttp();
	if (!req || agent && !pfunc) {(new Image()).src = purl;}
	else {
		req.open("POST", purl+((purl.indexOf('?') != -1)? "&": "?")+"nocache="+new Date().getTime(), true);
		req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=EUC-KR');
		if (pfunc) {
			req.onreadystatechange = function() {
				if (req.readyState == 4) pfunc(req.responseXML);
			}
		}
		req.send(pdata);
	}
};
function send_postajax(purl, pdata, pfunc) {
	var req = req_xmlhttp();
	if (!req || agent && !pfunc) {(new Image()).src = purl;}
	else {
		req.open("POST", purl/*+((purl.indexOf('?') != -1)? "&": "?")+"nocache="+new Date().getTime()*/, true);
		req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=euc-kr');
		req.setRequestHeader("Accept-Language", "ko");
		if (pfunc) {
			req.onreadystatechange = function() { if (req.readyState == 4) pfunc(req.responseText); }
		}
		req.send(pdata);
	}
};
function send_xmlajax(purl, pfunc) {
	var req = req_xmlhttp();
	if (!req || agent && !pfunc) {(new Image()).src = purl;}
	else {
		req.open("GET", purl+((purl.indexOf('?') != -1)? "&": "?")+"nocache="+new Date().getTime(), true);
		req.setRequestHeader("Content-Type", "text/xml;charset=euc-kr");
		req.setRequestHeader("Accept-Language", "ko");
		if (pfunc) {
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					if (req.status == 200) pfunc(req.responseXML);
					else if (req.status == 404) alert("ÁË¼ÛÇÕ´Ï´Ù. µ¥ÀÌÅÍ°¡ Á¸ÀçÇÏÁö ¾Ê½À´Ï´Ù.");
				}
			}
			//if (req.readyState == 4) pfunc(req.responseXml);
		}
		req.send(null);
	}
};
function req_xmlhttp() {
	var obj = null;
	if (window.ActiveXObject) {
		obj = new ActiveXObject("Msxml2.XMLHTTP");
		if (!obj) obj = new ActiveXObject("Microsoft.XMLHTTP");
	}
	else if (window.XMLHttpRequest) obj = new XMLHttpRequest();
	return obj;
};
function set_cookie(pname,pvalue,expires,pdomain,path) {
	var expdate = new Date();
	expdate.setDate(expdate.getDate() + expires);
	var str = pname + "=" + escape(pvalue);
	str += ((expires == null || expires == 0)? "" : (" ; expires=" + expdate.toGMTString()));
	str += "; domain=" + (pdomain ? pdomain : GDOMAIN);
	str += "; " + (path? "path="+path+";" : "");
	document.cookie = str;
};
function get_cookie(pname) {
	var arg		= pname + "=";
	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) {
			var end = document.cookie.indexOf(";", j);
			if (end == -1) end = document.cookie.length;
			return unescape(document.cookie.substring(j, end));
		}
		i = document.cookie.indexOf(" ",i) + 1;
		if (i == 0) break;
	}
	return "";
};

function setCookie( name, value, expiredays ) {
		var todayDate = new Date();
		todayDate.setDate( todayDate.getDate() + expiredays );
		document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
		//alert(document.cookie);
}

function getCookie( name ) {
		var nameOfCookie = name + "=";
		var x = 0;
		while ( x <= document.cookie.length ) {
			var y = (x+nameOfCookie.length);
				if ( document.cookie.substring( x, y ) == nameOfCookie ) {
					if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 )
					endOfCookie = document.cookie.length;
					return unescape(document.cookie.substring(y,endOfCookie));
				}
			x = document.cookie.indexOf( " ", x ) + 1;
			if ( x == 0 ) break;
		}
		return "";
}

function resizeH(pwidth, retime) {
//	var ext = ((agent.ie7)? 70 : (agent.ie)?29:48);
//	var ext = ((agent.ie7)? 70 : 48);
	var ext = ((agent.ie)? 80 : 80);
	var _height = get_abspos(get_elmid("winbtnarea"), 0) + get_elmid("winbtnarea").offsetHeight + ext;
	self.resizeTo(pwidth, _height);
	if (retime != null && retime) {setTimeout("resizeH("+pwidth+")", retime);}
}
function closerewin() {
	try {opener.location.reload(); opener.focus();} catch(e){};
	self.close();
}
function set_homepage(thisform, url) {
	var browser = 0, version = 0;
	if (navigator.appName.indexOf('Explorer') != -1) browser = 1;
	else if (navigator.appName.indexOf('Netscape') != -1) browser = 2;
	version = navigator.appVersion.substr(0, 1) * 1;
	if (navigator.appVersion.indexOf('MSIE 3') != -1 || navigator.appVersion.indexOf('MSIE 4') != -1) {
		alert('½ÃÀÛ È¨ÆäÀÌÁö¸¦ "' + url + '" À¸·Î ¼³Á¤ÇÏ½Ã°Ú½À´Ï±î?\n¸¸¾à Ã¢ÀÌ ¶ß¸é [°è ¼Ó] ¹öÆ°À» ´­¸¥ ÈÄ [ÆÄÀÏ ¿­±â]¸¦ ¼±ÅÃÇÏ½Ã°í È®ÀÎ ¹öÆ°À» ´­·¯ÁÖ¼¼¿ä.');
		top.location = GHOME+'/zllog.reg';
	}
	else if (browser == 1) {
		thisform.style.behavior = 'url(#default#homepage)';
		thisform.setHomePage(url);
	}
	else {
		top.alert('ÁË¼ÛÇÕ´Ï´Ù.\n\n±ÍÇÏÀÇ ºê¶ó¿ìÀú¿¡¼­´Â ÀÚµ¿À¸·Î ½ÃÀÛÆäÀÌÁö¸¦ ¼³Á¤ÇÒ ¼ö ¾ø½À´Ï´Ù.\n¼öµ¿À¸·Î ½ÃÀÛÆäÀÌÁö ¼³Á¤À» ÇÏ½Ã±â ¹Ù¶ø´Ï´Ù.');
	}
};
function get_abspos(player, isxy) {
	var pos = 0;
	while(player != null && player.tagName != "BODY") {
		pos += player["offset"+(isxy?"Left":"Top")];
		pos -= (isxy?0:player["scrollTop"]);
		player = player.offsetParent;
	}
	return pos;
};

function encode64(input) {
	var keystr64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789*@_";
	var output = "";
	var chr1, chr2, chr3;
	var enc1, enc2, enc3, enc4;
	var i = 0;
	do {
		chr1 = input.charCodeAt(i++);
		chr2 = input.charCodeAt(i++);
		chr3 = input.charCodeAt(i++);
		enc1 = chr1 >> 2;
		enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
		enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
		enc4 = chr3 & 63;
		if (isNaN(chr2)) enc3 = enc4 = 64;
		else if (isNaN(chr3)) enc4 = 64;
		output = output + keystr64.charAt(enc1) + keystr64.charAt(enc2) + keystr64.charAt(enc3) + keystr64.charAt(enc4);
	} while (i < input.length);
	return output;
}
function decode64(input) {
	var keystr64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789*@^";
	var output = "";
	var chr1, chr2, chr3;
	var enc1, enc2, enc3, enc4;
	var i = 0;
	input = input.replace(/[^A-Za-z0-9\*@\^]/g, "");
	do {
		enc1 = keystr64.indexOf(input.charAt(i++));
		enc2 = keystr64.indexOf(input.charAt(i++));
		enc3 = keystr64.indexOf(input.charAt(i++));
		enc4 = keystr64.indexOf(input.charAt(i++));
		chr1 = (enc1 << 2) | (enc2 >> 4);
		chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
		chr3 = ((enc3 & 3) << 6) | enc4;
		output = output + String.fromCharCode(chr1);
		if (enc3 != 64) output = output + String.fromCharCode(chr2);
		if (enc4 != 64) output = output + String.fromCharCode(chr3);
	} while (i < input.length);

	return output;
}
function encode64han(str) { return encode64(escape(str)); }
function decode64han(str) { return unescape(decode64(str)); }
function setradio(pradio, pval) {

	for (var i = 0; i < pradio.length; i++) {
		//alert(pradio[i].value);
		//alert(pval);
		if (pradio[i].value == pval) pradio[i].checked = true;
		else pradio[i].checked = false;
	}
}
function getradio(pradio) {
	for (var i = 0; i < pradio.length; i++) {
		if (pradio[i].checked == true) return pradio[i].value;
	}
	return "";
}
function dotoggle(thisform) {
	for (var i = 0; i < thisform.elements.length; i++) {
		if (thisform.elements[i].name == 'checkid[]') {
			if (thisform.elements[i].checked == true) thisform.elements[i].checked = false;
			else thisform.elements[i].checked = true;
		}
	}
}

function menuon(elm) { elm.src = elm.src.replace(".gif", "_on.gif"); }
function menuout(elm){ elm.src = elm.src.replace("_on.gif", ".gif"); }


function err_photo(pimg) { pimg.src = GIMGURL + "/photo/noimage.gif"; }
function reload_mesg(ptext) { document.location.reload(); }

function iamtop() {
	url = self.location.href;
	if (parent != self) {
		if (location.replace) top.location.replace(url);
		else top.location.href = url;
	}
}

function loadjscssfile(filename, filetype, container) {
	if (filetype == "js") {
		var fileref = document.createElement('script')
		fileref.setAttribute("type","text/javascript")
		fileref.setAttribute("src", filename)
	}
	else if (filetype == "css") { //if filename is an external CSS file
		var fileref = document.createElement("link")
		fileref.setAttribute("rel", "stylesheet")
		fileref.setAttribute("type", "text/css")
		fileref.setAttribute("href", filename)
	}
	if (typeof fileref != "undefined") {
		if (container == "") document.getElementsByTagName("head")[0].appendChild(fileref);
		else document.getElementById(container).appendChild(fileref);
	}
}

function show_flashplayer(pname, pval, pwidth, pheight) {
	var swf_src 		= GROOT+"/common/flash/"+pname+".swf";
	var swf_width 		= pwidth;
	var swf_height		= pheight;
	var swf_version		= "9.0.47.00";
	var swf_id 			= (tmp = swf_src.split("/"), tmp = tmp[tmp.length - 1], tmp.split(".swf").shift());
	var swf_fullscreen	= "true";
	var swf_script		= "always";
	var swf_wmode		= "transparent"; //"window";
	var swf_bgcolor		= "";
	var swf_vars 		= pval;
	var nocache 		= Math.random()*3600000;
	var source = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';
	source += 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+swf_version+'" ';
	source += 'name="'+swf_id+'" width="'+swf_width+'" height="'+swf_height+'" id="'+swf_id+'">\n';
	source += ' <param name="movie" value="'+swf_src+'" />\n';
//	source += ' <param name="movie" value="'+swf_src+'?nocache='+nocache+'" />\n';
	source += ' <param name="quality" value="high" />\n';
	source += ' <param name="allowFullScreen" value="'+swf_fullscreen+'" />\n';
	source += ' <param name="bgColor" value="' + swf_bgcolor + '" />\n';
	source += ' <param name="allowScriptAccess" value="'+swf_script+'" />\n';
	source += ' <param name="wmode" value="'+swf_wmode+'" />\n';
	source += ' <param name="FlashVars" value="'+swf_vars+'" />\n';
	source += ' <embed src="'+swf_src+'" allowFullScreen="'+swf_fullscreen+'"';
//	source += ' <embed src="'+swf_src+'?nocache='+nocache+'" allowFullScreen="'+swf_fullscreen+'"';
	source += '   FlashVars="'+swf_vars+'" allowScriptAccess="'+swf_script+'" width="'+swf_width+'" height="'+swf_height+'" quality="high"';
	source += '   pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" name="'+swf_id+'"></embed>\n</object>';
	document.write(source);
}

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.style.background = 'transparent';
	obj.src = 'about:blank;';
	return '';
}

//-------------------------------------------------------------
// ±âº»
//-------------------------------------------------------------
	var copenform, calsep;
	function popcalendar(pform, ptype) {
		var url = GROOT+"/common/html/calendar.htm";
		var xpos = 215; var ypos = 240;
		var tag = pform;
		var y = parseInt((window.screen.height - ypos) / 3);
		var x = parseInt((window.screen.width - xpos) / 2);
		if (y < 0) y = 0; if (x < 0) x = 0;
		copenform = pform; calsep = ptype;
		var win = window.open(url, "calendar2","width="+xpos+",height="+ypos+",top="+y+",left="+x);
		win.moveTo(x, y); win.focus();
	}
	var uopenform;

	function close_popdiv(pid) {
		var idx;
		if ((idx = pid.indexOf("__ajax_error__")) < 0) {
			//document.getElementById('loadingwrap').style.display = 'none';
			document.getElementById(pid).style.display = 'none';
		}
		else {
			var arr = pid.split("|");
			//document.getElementById('loadingwrap').style.display = 'none';
			document.getElementById(arr[1]).style.display = 'none';
			alert((arr[2] == "")? "¿À·ù°¡ ¹ß»ýÇÏ¿´½À´Ï´Ù":arr[2]);
		}
	}
	function confirm_popdiv(pid) {
		var idx;
		if ((idx = pid.indexOf("__ajax_error__")) >= 0 || pid == "") {
			var arr = pid.split("|");
			//document.getElementById('loadingwrap').style.display = 'none';
			document.getElementById(arr[1]).style.display = 'none';
			alert((arr[2] == "")? "¿À·ù°¡ ¹ß»ýÇÏ¿´½À´Ï´Ù":arr[2]);
			return false;
		}
		return true;
	}
	function open_popdiv(pid) { document.getElementById(pid).style.display = 'block'; }
	function open_visible(pid) { document.getElementById(pid).style.visibility = 'visible'; }
	function open_hidden(pid) { document.getElementById(pid).style.visibility = 'hidden'; }
	function toggle_div(pid) {
		if (!pid || pid == "") return;
		var elm = document.getElementById(pid);
		if (elm == null) return;
		elm.style.display = (elm.style.display == 'none')? 'block' : 'none';
		return;
	}


//-------------------------------------------------------------
// ¸ÞÀÎ
//-------------------------------------------------------------
	function set_menuajax(ptext) { try {document.getElementById("subtab").innerHTML = ptext;} catch(e) {} }

	function set_noticeajax(ptext) { try {document.getElementById("rnotice").innerHTML = ptext;} catch(e) {} }
	function get_noticeajax() { send_ajax("/petc/getnotice.php", set_noticeajax); }
	function set_mesgajax(ptext) { try {document.getElementById("rmesg").innerHTML = ptext;} catch(e) {} }
	function get_mesgajax() { send_ajax("/petc/getmesg.php", set_mesgajax); }

//-------------------------------------------------------------
// ·Î±×ÀÎ
//-------------------------------------------------------------
	function close_login() {
		document.getElementById('loadingwrap').style.display = 'none';
		document.getElementById('loginbox').style.display = 'none';
	}
	function open_login() {
		document.getElementById('loadingwrap').style.display = 'block';
		document.getElementById('loginbox').style.display = 'block';
	}
	function dologin(thisfrm) {
		if (nullcheck(thisfrm.userid, "¾ÆÀÌµð¸¦ ") == true) {
			return false;
		}
		if (nullcheck(thisfrm.userpw, "ºñ¹Ð¹øÈ£¸¦ ") == true) return false;
		if (document.getElementById('saveid')) {
			if (document.getElementById('saveid').checked) {
				set_cookie("saveid", thisfrm.userid.value, 60, GDOMAIN);
			}
		}
		return true;
	}
	function dologout() {
		document.location.href = GHOME+"/pmembship/logout.asp";
	}
	function nullcheck(pform, pstr) {
		if (pform.value == '') {
			alert(pstr + 'ÀÔ·ÂÇÏ¼¼¿ä.');
			pform.focus(); pform.select();
			return true;
		} else {
			for (var i = 0; i < pform.value.length; i++)
				if (pform.value.charAt(i) != " ") return false;
			alert(pstr + 'ÀÔ·ÂÇÏ¼¼¿ä.');
			pform.focus(); pform.select();
			return true;
		}
		return false;
	}
	function init_login() {
		var thisfrm = document.FLOGIN;
		if (thisfrm) {
			if (str_trim(get_cookie("saveid")) != "") {
				document.getElementById('saveid').checked = true;
				thisfrm.userid.value = get_cookie("saveid");
				thisfrm.userpw.focus();
			}
			else thisfrm.userid.focus();
		}
	}

//-------------------------------------------------------------
// »ç¿ëÀÚ¹Ú½º
//-------------------------------------------------------------
//	document.onmouseover = movemouse;
	function resize_textarea(frm, min_height) {
		frm.style.wordWrap = 'break-word';
		frm.style.wordBreak= 'break-all';
		var width = frm.style.width;
		if (frm.scrollHeight < min_height) {
			frm.style.height = min_height + "px";
		}
		else if ((frm.scrollHeight+"px") != frm.style.height) {
			frm.style.height = frm.scrollHeight + "px";
		}
	}
	function checkfile(obj, prevobj) {
		if (!/(\.gif|\.jpg|\.jpeg|\.png)$/i.test(obj.value)) { alert("ÀÌ¹ÌÁö Çü½ÄÀÇ ÆÄÀÏ¸¸ ¾÷·Îµå ÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù."); return; }
		//var prevobj = document.getElementById('previewimg');
		//document.getElementById('fakefile').value = obj.value;
		if (obj.value.indexOf("fakepath") != -1) { // IE8¿¡¼­´Â ¹Ì¸®º¸±â Áö¿ø ¾ÈµÊ;
			prevobj.innerHTML = ""; return;
		}
		if (window.navigator.userAgent.indexOf("MSIE 7") != -1) {
			prevobj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='file://"+String(obj.value)+ "',sizingMethod='scale')"; return;
		} else {
			prevobj.innerHTML = "";
			var previmg = document.createElement('img');
			var w = prevobj.offsetWidth; var h = prevobj.offsetHeight;
			previmg.style.width = prevobj.style.width;
			previmg.style.height = prevobj.style.height;
			prevobj.appendChild(previmg);
			previmg.onerror = function() { return prevobj.innerHTML = ""; }
			previmg.onload = function() {
				if (this.width > w) { this.height = this.height/(this.width/w); this.width = w; }
				if (this.height > h) { this.width = this.width/(this.height/h); this.height = h; }
			}

			if (window.navigator.userAgent.indexOf("Firefox/3") == -1) previmg.src = "file://"+obj.value;
			else {
				var pic = obj.files.item(0).getAsDataURL();
				previmg.src = 'data:'+pic;
				previmg.writeAttribute("title", "ImageSize: "+ obj.files.item(0).fileSize +" byte");
			}
		}
	}


	function initswitchtxt(frm) {
		if (frm.value == "" && !frm.readOnly) {
			frm.value = frm.title;
			frm.style.color = "#ABAAAB";
		}
	}
	function onswitchtxt(frm) {
		if (frm.value == frm.title) {
			frm.value = "";
			frm.style.color = "#000000";
		}
	}
	function outswitchtxt(frm) {
		if (frm.value == "" && !frm.readOnly) {
			frm.style.color = "#ABAAAB";
			frm.value =  frm.title;
		}
	}


/////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////

function MM_preloadImages() { //v3.0
	var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
		var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
		if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_swapImgRestore() { //v3.0
	var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_findObj(n, d) { //v3.0
	var p,i,x;	if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}
function MM_swapImage() { //v3.0
	var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
	 if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_showHideLayers() { //v3.0
	var i,p,v,obj,args=MM_showHideLayers.arguments;
	for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
		if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
		obj.visibility=v; }
}
// flashWrite(ÆÄÀÏ°æ·Î, °¡·Î, ¼¼·Î, ¾ÆÀÌµð, ¹è°æ»ö, À©µµ¿ì¸ðµå)
function flashWrite(url,w,h,id,bg,win){

	// ÇÃ·¡½Ã ÄÚµå Á¤ÀÇ
	var flashStr=
	"<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='"+w+"' height='"+h+"' id='"+id+"' align='middle'>"+
	"<param name='movie' value='"+url+"' />"+
	"<param name='wmode' value='"+win+"' />"+
	"<param name='menu' value='false' />"+
	"<param name='quality' value='high' />"+
	"<param name='bgcolor' value='"+bg+"' />"+
	"<embed src='"+url+"' wmode='"+win+"' menu='false' quality='high' bgcolor='"+bg+"' width='"+w+"' height='"+h+"' name='"+id+"' align='middle' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />"+
	"</object>";

	// ÇÃ·¡½Ã ÄÚµå Ãâ·Â
	document.write(flashStr);
}
//main-map
function flashObj(fileName, width, height, id, mode, flashValue){
        document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+width+'" height="'+height+'" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" id="'+id+'">'
        +'<param name="movie" value="'+fileName+'">'
        +'<param name="quality" value="high">'
        +'<param name="wmode" value="'+mode+'">'
        +'<param name="allowScriptAccess" value="always" />'
        +'<param name="FlashVars" value="'+flashValue+'" />'
        +'<embed src="'+fileName+'" FlashVars="'+flashValue+'" quality="high" wmode="'+mode+'" pluginspage="http://www.macromedia.com/go/getflashplayer" width="'+width+'" height="'+height+'" type="application/x-shockwave-flash" showLiveConnect="true" name="'+id+'" allowScriptAccess="always"></embed>'
        +'</object>');
}
// ÇÃ·ÎÅÍ - ¹üÀ§Á¦ÇÑ
//ex) initMoving("idname",884,500);
function initMoving(id,xleft,ytop) {
	target = document.getElementById(id);
	if (!target) return false;
	var obj = target;
	obj.initLeft = xleft;//Àý´ëÁÂÇ¥x
	obj.initTop = ytop;//Àý´ëÁÂÇ¥y
	obj.bottomLimit = document.documentElement.scrollHeight - 100;
	obj.topLimit = 70;

	obj.style.position = "absolute";
	obj.top = obj.initTop;
	obj.left = obj.initLeft;
	obj.style.top = obj.top + "px";
	obj.style.left = obj.left + "px";

	obj.getTop = function() {
		if (document.documentElement.scrollTop) {
			return document.documentElement.scrollTop;
		} else if (window.pageYOffset) {
			return window.pageYOffset;
		} else {
			return 270;
		}
	}
	obj.getHeight = function() {
		if (self.innerHeight) {
			return self.innerHeight;
		} else if(document.documentElement.clientHeight) {
			return document.documentElement.clientHeight;
		} else {
			return 270;
		}
	}
	obj.move = setInterval(function() {
		pos = obj.getTop() + obj.getHeight() / 70 ;

		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";
	}, 10)
}

//°ü·Ã »çÀÌÆ® ¿­±â
function my_site_on(){

//document.getElementById("my_site_off").style.display="none" ; //
document.getElementById("my_site_on").style.display="block" ; //
}

function my_site_off(){
//document.getElementById("my_site_off").style.display="block" ; //
document.getElementById("my_site_on").style.display="none" ; //

}

// Tab Content
function initTabMenu(tabContainerID) {
	var tabContainer = document.getElementById(tabContainerID);
	var tabAnchor = tabContainer.getElementsByTagName("a");
	var i = 0;

	for(i=0; i<tabAnchor.length; i++) {
		if (tabAnchor.item(i).className == "tab")
			thismenu = tabAnchor.item(i);
		else
			continue;

		thismenu.container = tabContainer;
		thismenu.targetEl = document.getElementById(tabAnchor.item(i).href.split("#")[1]);
		thismenu.targetEl.style.display = "none";
		thismenu.imgEl = thismenu.getElementsByTagName("img").item(0);
		//¿ù·¡´ÂÅ¬¸¯ÇØ¾ßº¸ÀÌ´Âµ¥¿À¹öÇÏ¸éº¸ÀÌ°Ô¼öÁ¤
        //thismenu.onclick = function tabMenuClick() {
		thismenu.onmouseover = function tabMenuClick() {
			currentmenu = this.container.current;
			if (currentmenu == this)
				return false;

			if (currentmenu) {
				currentmenu.targetEl.style.display = "none";
				if (currentmenu.imgEl) {
					currentmenu.imgEl.src = currentmenu.imgEl.src.replace("_on.gif", ".gif");
				} else {
					currentmenu.className = currentmenu.className.replace(" on", "");
				}
			}
			this.targetEl.style.display = "";
			if (this.imgEl) {
				this.imgEl.src = this.imgEl.src.replace(".gif", "_on.gif");
			} else {
				this.className += " on";
			}
			this.container.current = this;

			return false;
		};

		if (!thismenu.container.first)
			thismenu.container.first = thismenu;
	}
	if (tabContainer.first)
//¿ù·¡´ÂÅ¬¸¯ÇØ¾ßº¸ÀÌ´Âµ¥¿À¹öÇÏ¸éº¸ÀÌ°Ô¼öÁ¤
//tabContainer.first.onclick();
		tabContainer.first.onmouseover();

}
// Tab Content
function initTabMenu(tabContainerID) {
	var tabContainer2 = document.getElementById(tabContainerID);
	var tabAnchor = tabContainer2.getElementsByTagName("a");
	var i = 0;

	for(i=0; i<tabAnchor.length; i++) {
		if (tabAnchor.item(i).className == "tab")
			thismenu = tabAnchor.item(i);
		else
			continue;

		thismenu.container = tabContainer2;
		thismenu.targetEl = document.getElementById(tabAnchor.item(i).href.split("#")[1]);
		thismenu.targetEl.style.display = "none";
		thismenu.imgEl = thismenu.getElementsByTagName("img").item(0);
		//¿ù·¡´ÂÅ¬¸¯ÇØ¾ßº¸ÀÌ´Âµ¥¿À¹öÇÏ¸éº¸ÀÌ°Ô¼öÁ¤
        //thismenu.onclick = function tabMenuClick() {
		thismenu.onmouseover = function tabMenuClick() {
			currentmenu = this.container.current;
			if (currentmenu == this)
				return false;

			if (currentmenu) {
				currentmenu.targetEl.style.display = "none";
				if (currentmenu.imgEl) {
					currentmenu.imgEl.src = currentmenu.imgEl.src.replace("_on.gif", ".gif");
				} else {
					currentmenu.className = currentmenu.className.replace(" on", "");
				}
			}
			this.targetEl.style.display = "";
			if (this.imgEl) {
				this.imgEl.src = this.imgEl.src.replace(".gif", "_on.gif");
			} else {
				this.className += " on";
			}
			this.container.current = this;

			return false;
		};

		if (!thismenu.container.first)
			thismenu.container.first = thismenu;
	}
	if (tabContainer2.first)
//¿ù·¡´ÂÅ¬¸¯ÇØ¾ßº¸ÀÌ´Âµ¥¿À¹öÇÏ¸éº¸ÀÌ°Ô¼öÁ¤aa
//tabContainer.first.onclick();
		tabContainer2.first.onmouseover();

}

function rollover(id){
	for(i = 1; i <= 8; i++){
		j = document.getElementById("img"+i);
		k = document.getElementById("menu"+i);
		if(i == id){
			j.src = "/images/karmain/topmenu_0"+ i +"_on.gif";
			k.style.display = "";
		} else {
			j.src = "/images/karmain/topmenu_0"+ i +".gif";
			k.style.display = "none";
		}
	}
}


function t_rollover(id){
	var rollid = ["", "1", "3", "4", "6", "7", "8"];
	for(i = 1; i <= 6; i++){
		j = document.getElementById("img"+i);
		k = document.getElementById("menu"+i);
		if(i == id){
			j.src = "/images/karmain/t_topmenu_0"+ rollid[i] +"_on.gif";
			k.style.display = "";
		} else {
			j.src = "/images/karmain/t_topmenu_0"+ rollid[i] +".gif";
			k.style.display = "none";
		}
	}
}

