// ÀÚ¹Ù½ºÅ©¸³Æ® ¿À·ù¸Þ¼¼Áö °¨Ãß±â
window.onerror=function() {
	window.status="";
	return true;
}

var objFrame=null;

// ¾ÆÀÌÇÁ·¡ÀÓ »ý¼º ÇÔ¼ö
function MakeFrame(){
	objFrame=document.createElement("IFRAME");
	objFrame.id="idFrame";

	objFrame.style.left="0px";
	objFrame.style.top="0px";
	objFrame.style.visibility="hidden";
	objFrame.style.position="absolute";
	objFrame.style.width="1px";
	objFrame.style.height="1px";

	document.body.insertBefore(objFrame);
}

// ¾ÆÀÌÇÁ·¹ÀÓ Å©±â ÀÚµ¿Á¶Àý ÇÔ¼ö
function ResizeWindow(id){
	if(!id) id=idFrame;
	objBody=eval(id).document.body;

	intWidth=objBody.scrollWidth+(objBody.offsetWidth-objBody.clientWidth);
	intHeight=objBody.scrollHeight+(objBody.offsetHeight-objBody.clientHeight);

	eval(id).window.resizeTo(intWidth,intHeight);
}

// µµ¿ò¸» Ãâ·ÂÇÔ¼ö
function showHelp(str){
	if(!objFrame) MakeFrame();

	if(!str||window.event.button){
		objFrame.style.visibility="hidden";
	}
	else {
		objFrame.style.width="1px";
		objFrame.style.visibility="visible";

		objDiv=document.createElement("div");
		objDiv.innerHTML=str;
		objDiv.style.left="0px";
		objDiv.style.top="0px";
		objDiv.style.position="absolute";
		objDiv.style.visibility="hidden";

		document.body.insertBefore(objDiv); 

		var width=objDiv.offsetWidth+15;
		if(width>300) width=300;

		doc=idFrame.document;
		doc.open();

		tags='<html>'
		+'<head>'
		+'<style>'
		+' body,table{font-family:±¼¸²; font-size:12px; border:none; margin:0px; overflow:hidden; word-break: break-all;}'
		+'</style>'
		+'</head>'
		+'<body onload="parent.ResizeWindow();">'
		+'<table width="'+width+'" border="0" cellspacing="1" cellpadding="5" bgcolor="#71A2BE">'
		+'<tr>'
		+'<td bgcolor="#EEF5FF">'+str+'</td>'
		+'</tr>'
		+'</table>'
		+'</body>'
		+'</html>';

		doc.write(tags);
		doc.close();

		pixelTop=event.clientY+document.body.scrollTop+10;
		pixelLeft=event.clientX+document.body.scrollLeft+10;

		if(parseInt(document.body.clientWidth)-window.event.x<intWidth) pixelLeft-=intWidth;
		if(parseInt(document.body.clientHeight)-window.event.y<intHeight) pixelTop-=intHeight;

		objFrame.style.top=pixelTop;
		objFrame.style.left=pixelLeft;
	}
}

// ÀüÃ¼¼±ÅÃ1
function SelectAll(obj) {
	var el=eval(obj.form.name).elements;
	
	for(i=0; i<el.length; i++) {
		if(obj.checked==true) el[i].checked=true;
		else el[i].checked=false;
	}
}

// ÀüÃ¼¼±ÅÃ2
function checked_list(obj,el) {
	if(el!=null) {
		if(el.length) {
			for(i=0; i<el.length; i++) {
				if(obj.checked==true) el[i].checked=true;
				else el[i].checked=false;
			}
		}
		else {
			if(obj.checked==true) el.checked=true;
			else el.checked=false;
		}
	}
}

// ÆË¾÷Ã¢
function displayWindow(url,name,width,height,scrollbars,menubar,status,pos,intervalX,intervalY) {
	if(!intervalX) intervalX=0;
	if(!intervalY) intervalY=0;

	// ¿ÞÂÊ »ó´Ü
	if(pos==1) {
		var winX=eval(intervalX);
		var winY=eval(intervalY);
	}
	// ¿À¸¥ÂÊ »ó´Ü
	else if(pos==2) {
		var winX=screen.width-width-10-eval(intervalX);
		var winY=eval(intervalY);
	}
	// °¡¿îµ¥
	else {
		var winX=(screen.width-width)/2+eval(intervalX);
		var winY=(screen.height-height)/2+eval(intervalY);
	}

	var popWin=window.open(url,name,',width='+width+',height='+height+',top='+winY+',left='+winX+',scrollbars='+scrollbars+',menubar='+menubar+',status='+status+'');

	popWin.moveTo(winX,winY); // À§Ä¡Á¶Á¤
	popWin.focus(); // ÇØ´çÃ¢ È°¼ºÈ­
}

// ÀÌ¹ÌÁö ¹Ì¸®º¸±â
function viewImg(elVal,viewId) {
	if(!objFrame) MakeFrame();

	if(event.srcElement.value.match(/(.jpg|.jpeg|.gif|.png|.bmp)/i)) {
		objFrame.style.visibility="visible";

		doc=idFrame.document;
		doc.open();

		view=new Image();
		view.src=elVal;

		tags='<html>'
		+'<head>'
		+'<style>'
		+' body,table{font-family:±¼¸²; font-size:12px; border:none; margin:0px; overflow:hidden;}'
		+' table{border-width:1px; border-style:solid;}'
		+' a:link,a:visited,a:active,a:hover {color:black; text-decoration:none;}'
		+'</style>'
		+'</head>'
		+'<body onload="parent.ResizeWindow();">'
		+'<div style="position:absolute; z-index:1">'
		+'<img src="../../images/closed.gif" width="15" height="15" border="0" align="right" style="cursor:hand" onClick="javascript:parent.objFrame.style.visibility=\'hidden\'">'
		+'</div>'
		+'<table border="0" cellspacing="0" cellpadding="0">'
		+'<tr>'
		+'<td><img src="'+view.src+'" width="150"></td>'
		+'</tr>'
		+'</table>'
		+'</body>'
		+'</html>';

		doc.write(tags);
		doc.close();

		objFrame.style.top="";
		objFrame.style.left="";
		viewId.insertBefore(objFrame);
	}
	else objFrame.style.visibility="hidden";
}

// ÄíÅ° »ý¼º
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 setCookie(name,value,expiredays) {
	var todayDate=new Date();
	todayDate.setDate(todayDate.getDate()+expiredays);
	document.cookie=name+"="+escape(value)+"; path=/; expires="+todayDate.toGMTString()+";"
}

// ÀÚµ¿ Æ÷Ä¿½º
function getFocus(obj) {
	var num=0;
	if(document.forms.length) {
		if(obj) num=obj.split(".").length;
		if(num==2) eval(obj).focus();
		else {
			if(num==1) el=eval(obj).elements;
			else if(num==0) el=document.forms[0].elements;
			for(i=0; i<el.length; i++) {
				if(!el[i].disabled&&!el[i].readOnly&&(el[i].type=="text"||el[i].type=="password"||el[i].type=="textarea")) {
//				if((el[i].type=="text")||(el[i].type=="textarea")||(el[i].type.toString().charAt(0)=="s")) {
					el[i].focus();
					break;
				}
			}
		}
	}
}

// radio¹öÆ° Ã¼Å©
function checkRadio(obj,val) {
	if(obj!=null) {
		for(var i=0; i<obj.length; i++){
			if(obj[i].value==val) obj[i].checked=true;
			else obj[i].checked=false;
		}
	}
}

// select »óÀÚ Ã¼Å©
function selectIt(obj,val) {
	if(obj!=null) {
		var el=val.split("|");
		for(var i=0; i<obj.length; i++){
			for(var j=0; j<el.length; j++){
				if(obj[i].value==el[j]) obj[i].selected=true;
			}
		}
	}
}

// checkbox Ã¼Å©
function checkboxIt(obj,val){
	if(obj!=null) {
		if(obj.value==val) obj.checked=true;
		else obj.checked=false;
	}
}

// ÅØ½ºÆ®Á¦°Å
function clear_text(el,str) {
	if(!str||el.value==str) el.value="";
}

// ¼ýÀÚ¿¡ ÄÞ¸¶ ³Ö±â
function number_format(el) {
	var rtn="";
	var val="";
	var j=0;
	x=el.value.length;

	for(i=x; i>0; i--) {
		if(el.value.substring(i,i-1)!=",") val=el.value.substring(i,i-1)+val;
	}
	x=val.length;
	for(i=x; i>0; i--) {
		if(j%3==0&&j!=0) rtn=val.substring(i,i-1)+","+rtn;
		else rtn=val.substring(i,i-1)+rtn;
		j++;
	}
	el.value=rtn;
}

function JS_viewObj(objhtml) {
	document.write(objhtml);
}

function swf(src,width,height){
	object='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+width+'" height="'+height+'">'
	+'<param name="movie" value="'+src+'">'
	+'<param name="menu" value="false">'
	+'<param name="wmode" value="transparent">'
	+'<param name="quality" value="high">'
	+'<embed src="'+src+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'"></embed>'
	+'</object>';
	document.write(object);
}

function showDiv(obj){
	if(obj.style.display=="none") obj.style.display="block";
	else obj.style.display="none";
}

function window.yesno(str) {
	execScript('n=msgbox("'+str+'","4132")', "vbscript");
	return(n == 6);
}

function swf(src,width,height){
    object = '';
    object += '<object type="application/x-shockwave-flash" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" id="param" width="'+width+'" height="'+height+'">';
    object += '<param name="movie" value="'+src+'">';
    object += '<param name=menu value=false>';
    object += '<param name=wmode value=transparent>';
    object += '<embed src="'+src+'" quality="high" bgcolor="#ffffff" menu="false" width="'+width+'" height="'+height+'" swliveconnect="true" id="param" name="param" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"><\/embed>';
    object += '<\/object>';
    document.write(object);
}

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_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;
}