function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
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) { //v4.01
  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);
  if(!x && d.getElementById) x=d.getElementById(n); 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_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
function MM_showHideLayers() { //v6.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; }
}
function showLayer(id) {
	document.all[id].style.visibility = "visible";
}
function hideLayer(id) {
	document.all[id].style.visibility = "hidden";
}

function setCookie( name, value, expiredays ) { 
	var todayDate = new Date(); 
	todayDate.setDate( todayDate.getDate() + expiredays ); 
	document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";" 
} 
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 autoResizePopup() {
	var winW, winH, sizeToW, sizeToH;
	if ( parseInt(navigator.appVersion) > 3 ) {
		 if ( navigator.appName=="Netscape" ) {
				winW = window.innerWidth;
				winH = window.innerHeight;
		 }
		 if ( navigator.appName.indexOf("Microsoft") != -1 ) {
				winW = document.body.scrollWidth;
				winH = document.body.scrollHeight;
		 }
	}
	sizeToW = 0;
	sizeToH = 0;
	if ( winW > 1000 ) {
		 sizeToW = 1000 - document.body.clientWidth;
	} else if ( Math.abs(document.body.clientWidth - winW ) > 3 ) {
		 sizeToW = winW - document.body.clientWidth;
	}
	if ( winH > 680 ) {
		 szeToH = 680 - document.body.clientHeight;
	} else if ( Math.abs(document.body.clientHeight - winH) > 4 ) {
		 sizeToH = winH - document.body.clientHeight;
	}
	if ( sizeToW != 0 || sizeToH != 0 )
		 window.resizeBy(sizeToW, sizeToH);
	//alert(winW + ":" + winH + ":"  +document.body.clientWidth);
}
function checkNumber()
{
	if ((event.keyCode < 46) || (event.keyCode > 57)) {
		alert('¼ýÀÚ¸¸ ÀÔ·Â °¡´É ÇÕ´Ï´Ù');
		event.returnValue = false;
	}
}

function beforePrint(){ 
	initBody = document.body.innerHTML; 
	document.body.innerHTML = document.all.printArea.innerHTML; 
} 
function afterPrint(){ 
		document.body.innerHTML = initBody; 
} 
function printArea() { 
		window.print(); 
} 
window.onbeforeprint = beforePrint;
window.onafterprint = afterPrint; 

function putComma(input) { 
	var num = input;

	if (num < 0) { 
		num *= -1; 
		var minus = true;
	} else {
		var minus = false;
	}

	var dotPos = (num+"").split(".");
	var dotU = dotPos[0];
	var dotD = dotPos[1];
	var commaFlag = dotU.length%3;

	if(commaFlag) {
	var out = dotU.substring(0, commaFlag);
	if (dotU.length > 3)
		out += ",";
	}	else {
		var out = "";
	}

	for (var i=commaFlag; i < dotU.length; i+=3) {
		out += dotU.substring(i, i+3);
		if( i < dotU.length-3) out += ",";
	}

	if(minus) out = "-" + out;
	if(dotD) return out + "." + dotD;
	else return out;
}
function jn_resizeFrame0(fr,w,h)
{
		var Frame_Body  = document.frames(fr).document.body;
		var Frame_name  = document.all(fr);

		Frame_name.style.width 
				= Frame_Body.scrollWidth
					+ (Frame_Body.offsetWidth-Frame_Body.clientWidth);
		Frame_name.style.height 
				= Frame_Body.scrollHeight 
					+ (Frame_Body.offsetHeight-Frame_Body.clientHeight);

		if (Frame_name.style.height == "0px" || Frame_name.style.width == "0px")
		{
			Frame_name.style.width = w+"px";       //±âº» iframe ³Êºñ
			Frame_name.style.height = h+"px";      //±âº» iframe ³ôÀÌ
			window.status = 'iframe resizing fail.';
		}
		else
		{
			window.status = '';
		}
}
function jn_resizeFrame(iframeObj){
		var innerBody = iframeObj.contentWindow.document.body;
		oldEvent = innerBody.onclick;

		innerBody.onclick = function()	{ resizeFrame(iframeObj, 1);oldEvent; };

		var innerHeight = innerBody.scrollHeight + (innerBody.offsetHeight - innerBody.clientHeight);s

		iframeObj.style.height = innerHeight;

		var innerWidth = innerBody.scrollWidth + (innerBody.offsetWidth - innerBody.clientWidth);

		iframeObj.style.width = innerWidth;     
		
		if( !arguments[1] )        /* just leave Scroll in case specific event. */
    this.scrollTo(1,1);
 }
