function trim(string){for(;string.indexOf(" ")!= -1;){string=string.replace(" ","");}return string;}

function Win(a, b, c) {
  window.open(a, b, c);
  return;
}

function CheckAuth(userauthname, siteauthname, login_type, return_type, return_url1, return_url2) {
  if(userauthname == 'ANONY') {
  	     if(login_type == 'POPUP_LOGIN' && confirm('·Î±×ÀÎÇÏ½Ã°Ú½À´Ï±î?')) { location.href = 'popup_login.asp?' + return_url1; }
  	else if(login_type == 'SUB_LOGIN' && confirm('·Î±×ÀÎÇÏ½Ã°Ú½À´Ï±î?')) { location.href = 'sub_login.asp?' + return_url1; }
  	else if(login_type == 'LOGIN' && confirm('·Î±×ÀÎÇÏ½Ã°Ú½À´Ï±î?')) { location.href = 'login.asp?' + return_url1; }
  	else {
  	  if(return_type == 'GO_TO') { location.href = return_url2; }
  	  else if(return_type == 'WINDOW_CLOSE') { alert('·Î±×ÀÎÇÏ¼¼¿ä.'); window.close(); }
  	  else if(return_type == 'HISTORY_BACK') { history.back(); }
  	  else { history.back(); }
  	}
  }
  else {
    if(GetAuthCode(userauthname) < GetAuthCode(siteauthname)) {
      alert(GetAuthMessage(siteauthname));
      
      if(return_type == 'GO_TO') { location.href = return_url2; }
      else if(return_type == 'WINDOW_CLOSE') { window.close(); }
  	  else if(return_type == 'HISTORY_BACK') { history.back(); }
  	  else { history.back(); }
    }
  }
}

function GetAuthName(authcode) {
       if(authcode == 90) { return 'MAINT'; }
  else if(authcode == 80) { return 'MASTR'; }
  else if(authcode == 70) { return 'ADMIN'; }
  else if(authcode == 60) { return 'SYSOP'; }
  else if(authcode == 52) { return 'LBL52'; }
  else if(authcode == 51) { return 'LBL51'; }
  else if(authcode == 50) { return 'MEMBR'; }
  else if(authcode == 40) { return 'CANDI'; }
  else if(authcode == 3) { return 'DENID'; }
  else if(authcode == 2) { return 'GUEST'; }
  else if(authcode == 1) { return 'ANONY'; }
}

function GetAuthCode(authname) {
       if(authname == 'MAINT') { return 90; }
  else if(authname == 'MASTR') { return 80; }
  else if(authname == 'ADMIN') { return 70; }
  else if(authname == 'SYSOP') { return 60; }
  else if(authname == 'LBL52') { return 52; }
  else if(authname == 'LBL51') { return 51; }
  else if(authname == 'MEMBR') { return 50; }
  else if(authname == 'CANDI') { return 40; }
  else if(authname == 'DENID') { return 3; }
  else if(authname == 'GUEST') { return 2; }
  else if(authname == 'ANONY') { return 1; }
}

function GetAuthMessage(authname) {
       if(authname == 'MAINT') { return ''; }
  else if(authname == 'MASTR') { return '°ü¸®ÀÚ¸¸ ÀÌ¿ëÇÒ ¼ö ÀÖ´Â ¸Þ´ºÀÔ´Ï´Ù.'; }
  else if(authname == 'ADMIN') { return '(ºÎ)°ü¸®ÀÚ¸¸ ÀÌ¿ëÇÒ ¼ö ÀÖ´Â ¸Þ´ºÀÔ´Ï´Ù.'; }
  else if(authname == 'SYSOP') { return '°Ô½ÃÆÇÁö±â¸¸ ÀÌ¿ëÇÒ ¼ö ÀÖ´Â ¸Þ´ºÀÔ´Ï´Ù.'; }
  else if(authname == 'LBL52') { return 'ÃÖ¿ì¼öÈ¸¿ø¸¸ ÀÌ¿ëÇÒ ¼ö ÀÖ´Â ¸Þ´ºÀÔ´Ï´Ù.'; }
  else if(authname == 'LBL51') { return '¿ì¼öÈ¸¿ø¸¸ ÀÌ¿ëÇÒ ¼ö ÀÖ´Â ¸Þ´ºÀÔ´Ï´Ù.'; }
  else if(authname == 'MEMBR') { return 'Á¤È¸¿ø¸¸ ÀÌ¿ëÇÒ ¼ö ÀÖ´Â ¸Þ´ºÀÔ´Ï´Ù.'; }
  else if(authname == 'CANDI') { return 'ÁØÈ¸¿ø¸¸ ÀÌ¿ëÇÒ ¼ö ÀÖ´Â ¸Þ´ºÀÔ´Ï´Ù.'; }
  else if(authname == 'DENID') { return 'Á¢±ÙÀÌ ±ÝÁöµÈ È¸¿øÀÔ´Ï´Ù.'; }
  else if(authname == 'GUEST') { return ''; }
  else if(authname == 'ANONY') { return '·Î±×ÀÎÇÏ½Ê½Ã¿À.'; }
}

// ÇÑÈ­ ±Ý¾×¿¡ ÄÞ¸¶ »ðÀÔ
function AddComma(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 
}

///////////YYY½ÃÀÛ 
var width1 = 640;
function ImageResize1() {
	width1 = 120;
}
function ImageResize() {
	//var width1 ="610";
	var bdclor="#cccccc";
  try {
	 // var iii = document.getElementById("image1"); xx
	var iii= document.all.item("image1");


	if(iii.length!=undefined){
		for(i = 0; i < iii.length; i++) {
		  if( iii[i].name == 'target_resize_image[]' &&  iii[i].width > width1 )  {
			iii[i].tmp_width  = iii[i].width;
			iii[i].tmp_height = iii[i].height;
			iii[i].width = width1;
			iii[i].style.cursor = 'pointer';
			// ½ºÅ¸ÀÏ¿¡ Àû¿ëµÈ ÀÌ¹ÌÁöÀÇ Æø°ú ³ôÀÌ¸¦ »èÁ¦ÇÑ´Ù
			iii[i].style.width = '';
			iii[i].style.height = '';
			iii[i].style.borderWidth = '1px';
			iii[i].style.borderStyle = 'solid';
			iii[i].style.borderColor = bdclor;
		  }
		}
	}else{
		if( iii.name == 'target_resize_image[]' &&  iii.width > width1 )  {
			iii.tmp_width  = iii.width;
			iii.tmp_height = iii.height;
			iii.width = width1;
			iii.style.borderWidth = '1px';
			iii.style.borderStyle = 'solid';
			iii.style.borderColor = bdclor;
		}
	}
  }
  catch(e) { } 
}
// ÀÌ¹ÌÁöÀÇ Å©±â¿¡ µû¶ó »õÃ¢ÀÇ Å©±â°¡ º¯°æµË´Ï´Ù.  

function image_window(img)
{ 

	var w = img.tmp_width; 
	var h = img.tmp_height; 
	var winl = (screen.width-w)/2; 
	var wint = (screen.height-h)/3; 

	if (w >= screen.width) { 
		winl = 0; 
		h = (parseInt)(w * (h / w)); 
	} 

	if (h >= screen.height) { 
		wint = 0; 
		w = (parseInt)(h * (w / h)); 
	} 

	var js_url = "<script language='JavaScript1.2'> \n"; 
		js_url += "<!-- \n"; 
		js_url += "var ie=document.all; \n"; 
		js_url += "var nn6=document.getElementById&&!document.all; \n"; 
		js_url += "var isdrag=false; \n"; 
		js_url += "var x,y; \n"; 
		js_url += "var dobj; \n"; 
		js_url += "function movemouse(e) \n"; 
		js_url += "{ \n"; 
		js_url += "  if (isdrag) \n"; 
		js_url += "  { \n"; 
		js_url += "    dobj.style.left = nn6 ? tx + e.clientX - x : tx + event.clientX - x; \n"; 
		js_url += "    dobj.style.top  = nn6 ? ty + e.clientY - y : ty + event.clientY - y; \n"; 
		js_url += "    return false; \n"; 
		js_url += "  } \n"; 
		js_url += "} \n"; 
		js_url += "function selectmouse(e) \n"; 
		js_url += "{ \n"; 
		js_url += "  var fobj      = nn6 ? e.target : event.srcElement; \n"; 
		js_url += "  var topelement = nn6 ? 'HTML' : 'BODY'; \n"; 
		js_url += "  while (fobj.tagName != topelement && fobj.className != 'dragme') \n"; 
		js_url += "  { \n"; 
		js_url += "    fobj = nn6 ? fobj.parentNode : fobj.parentElement; \n"; 
		js_url += "  } \n"; 
		js_url += "  if (fobj.className=='dragme') \n"; 
		js_url += "  { \n"; 
		js_url += "    isdrag = true; \n"; 
		js_url += "    dobj = fobj; \n"; 
		js_url += "    tx = parseInt(dobj.style.left+0); \n"; 
		js_url += "    ty = parseInt(dobj.style.top+0); \n"; 
		js_url += "    x = nn6 ? e.clientX : event.clientX; \n"; 
		js_url += "    y = nn6 ? e.clientY : event.clientY; \n"; 
		js_url += "    document.onmousemove=movemouse; \n"; 
		js_url += "    return false; \n"; 
		js_url += "  } \n"; 
		js_url += "} \n"; 
		js_url += "document.onmousedown=selectmouse; \n"; 
		js_url += "document.onmouseup=new Function('isdrag=false'); \n"; 		
		js_url += "//--> \n"; 
		js_url += "</"+"script> \n"; 
		
		var js_url2 = "<script language='JavaScript1.2'> \n"; 
		js_url2 += "<!-- \n"; 
		js_url2 += "// ·¹ÀÌ¾î Æ®·£Áö¼Ç..\n";
		js_url2 += "function doTrans(obj) {\n";
		js_url2 += "	if(document.all) {\n";
		js_url2 += "\n";
		js_url2 += "		f = new Array();\n";
		js_url2 += "		f[0] = 'Slide(slidestyle=HIDE,Bands=1)';                                // PUSH, SWAP\n";
		js_url2 += "		f[1] = 'Spiral(GridSizeX=8,GridSizeY=8)';\n";
		js_url2 += "		f[2] = 'Stretch(stretchstyle=SPIN)';                                    // HIDE, PUSH\n";
		js_url2 += "		f[3] = 'Strips(motion=leftdown)';                                       // leftup, rightdown, rightup\n";
		js_url2 += "		f[4] = 'Wheel(spokes=10)';                \n";
		js_url2 += "		f[5] = 'Zigzag(GridSizeX=8,GridSizeY=8)';\n";
		js_url2 += "		f[6] = 'Barn(motion=out,orientation=vertical)';                         // horizontal\n";
		js_url2 += "		f[7] = 'Blinds(Bands=10,direction=left)';                               // right, up, down\n";
		js_url2 += "		f[8] = 'Checkerboard(Direction=right,SquaresX=2,SquaresY=2)';           // up, down, left\n";
		js_url2 += "		f[9] = 'Fade(Overlap=1.00)';                                            // 0.75, 0.50\n";
		js_url2 += "		f[10]= 'GradientWipe(GradientSize=0.25,wipestyle=0,motion=forward)';    // style: 0, 1 motion : reverse\n";
		js_url2 += "		f[11]= 'Inset()';\n";
		js_url2 += "		f[12]= 'Iris(irisstyle=PLUS,motion=out)';                               // circle, diamond, cross, square, star\n";
		js_url2 += "		f[13]= 'Pixelate(MaxSquare=50)';\n";
		js_url2 += "		f[14]= 'RadialWipe(wipestyle=CLOCK)';                                   // wedge, radial\n";
		js_url2 += "		f[15]= 'RandomBars()';\n";
		js_url2 += "		f[16]= 'RandomDissolve()';\n";
		js_url2 += "		\n";
		js_url2 += "		date = new Date();\n";
		js_url2 += "		\n";
		js_url2 += "		effect = date.getSeconds() % f.length;\n";
		js_url2 += "		obj.style.filter = 'progid:DXImageTransform.Microsoft.' + f[effect];\n";
		js_url2 += "		obj.filters[0].apply();\n";
		js_url2 += "		obj.style.visibility = 'hidden';\n";
		js_url2 += "		obj.filters[0].play();\n";
		js_url2 += "		setTimeout('window.close();',1000); \n";
		js_url2 += " \n";
		js_url2 += "	} else {\n";
		js_url2 += "	\n";
		js_url2 += "		obj.style.visibility = 'hidden';\n";
		js_url2 += "		setTimeout('window.close();',1000); \n";
			
		js_url2 += "	}\n";
		js_url2 += "}\n";
		js_url2 += "//--> \n"; 
		js_url2 += "</"+"script> \n"; 


	var settings;
	if(w<600)w=600-20;
	if(h<450)h=450-20;
	settings  ='width='+(w+20)+','; 
	settings +='height='+(h+20)+',';
	settings +='top='+wint+','; 
	settings +='left='+winl+','; 
	settings +='scrollbars=1,'; 
	settings +='resizable=yes,'; 
	settings +='status=no'; 


	var win=window.open("","image_window",settings);  
	win.document.open(); 
	win.document.write ("<html><head> \n<meta http-equiv='imagetoolbar' CONTENT='no'> \n<meta http-equiv='content-type' content='text/html; charset=euc-kr'>\n"); 
	var size = "ÀÌ¹ÌÁö »çÀÌÁî : "+w+" x "+h;
	win.document.write ("<title>"+size+"</title> \n"); 
	win.document.write (js_url2); 
	if(w >= screen.width || h >= screen.height) { 
		win.document.write (js_url); 
		var click = "ondblclick='doTrans(this);'  title=' "+size+" ÀÌ¹ÌÁö »çÀÌÁî°¡ È­¸éº¸´Ù Å®´Ï´Ù.  ¿ÞÂÊ ¹öÆ°À» Å¬¸¯ÇÑ ÈÄ ¸¶¿ì½º¸¦ ¿òÁ÷¿©¼­ º¸¼¼¿ä.  ´õºí Å¬¸¯ÇÏ¸é ´Ý±â. '"; 
	} 
	else 
		var click = "onclick='doTrans(this);'  title=' "+size+"  Å¬¸¯ÇÏ¸é ´ÝÈû.. '";  

	win.document.write ("<style>.dragme{position:relative;}</style> \n"); 
	win.document.write ("</head> \n\n"); 
	win.document.write ("<body leftmargin=0 "+  js_cpx  + " topmargin=0 bgcolor=#dddddd style='cursor:arrow;'> \n"); 
	//win.document.write ("<table width=100% height=100% cellpadding=0 cellspacing=0><tr><td align=center valign=middle><img src='"+img.src+"' width='"+w+"' height='"+h+"' border=0 class='dragme' "+click+"></td></tr></table>");
	//ÀÌ¹ÌÁö°¡ Å©¸é height¼Ó¼º¾ø¾Ö¶ó.
	win.document.write ("<table width=100% height=100% cellpadding=0 cellspacing=0><tr><td align=center valign=middle><img src='"+img.src+"' width='"+w+"'  border=0 class='dragme'  "+click+" style='cursor:move; FILTER: progid:DXImageTransform.Microsoft.Spiral(GridSizeX=8,GridSizeY=8);' ></td></tr></table>");

	win.document.write ("</body></html>"); 
	win.document.close(); 

	if(parseInt(navigator.appVersion) >= 4){win.window.focus();} 
}


function yreSize1(ifrName)
{
	var MF	=	eval(ifrName+'.document.body');
	var CF	=	eval('document.all["'+ifrName+'"]'); 
	CF.style.height = MF.scrollHeight + (MF.offsetHeight - MF.clientHeight)  ;
	//alert('CF.style.height='+CF.style.height);
	CF.style.width  = MF.scrollWidth + (MF.offsetWidth - MF.clientWidth);		
	
} 

//Áñ°ÜÃ£±âÃß°¡
function add_j () {
	var tit= document.title;
	var url = parent.document.location;
	if (document.all)
	window.external.AddFavorite(url,tit);
}

function swfLoad(sUrl,sWidth,sHeight,sName,sAlign,sColor,sTrans) {
	document.write('<EMBED src="' + sUrl + '" quality=high' + ' bgcolor=' + sColor + '  WIDTH="'+ sWidth + '" HEIGHT="'+ sHeight +'" NAME="' + sName + '" ALIGN="' + sAlign + '" invokeurls=false wmode=transparent');
	document.write(' TYPE="application/x-shockwave-flash"');
	document.write(' PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">');
	document.write('</EMBED>');
}


function allCK(chk,obj) {
	checked=false;
	if (obj.checked==true) {checked=true;}
	var chklen = document.getElementsByName(chk).length;
	if (chklen > 0) {
		for (i=0;i<chklen;i++) {document.getElementsByName(chk)[i].checked=checked;}
	}
}



//½ÃÀÛ yPro
//ÀÛ¼º    : À±Àç¸¸
//ÀÏÀÚ    : 2009-06-05
//»ç¿ë¹ý
// @param  : ¾ÆÀÌµð
// @parmm  : widthÅ©±â
// <div id="test1"> ÇÁ·Î¼¼½ºÇ¥½ÃµÇ´Â°÷ </div>
// var aa = new yPro('test1',400);
// aa.pro(1,10);
// aa.pro(2,10);
// aa.pro(3,10);
// aa.pro(4,10);
// aa.pro(5,10);
// aa.pro(6,10);
// aa.pro(7,10);
// aa.pro(8,10);
// aa.pro(9,10);
// aa.pro(10,10);  

var yPro = function  (sid,w) {
	this.id=sid;
	this.ido=document.getElementById(sid); 
	this.w=w;
	this.Write();
}

yPro.prototype={
	Write : function  () {
		var s='';
		s=s+'<div id="pro_bx0_this_id_" style="border: 0px solid #000; text-align:left;width: '+this.w+'px;">';
		s=s+'	<div id="pro_bx_this_id_" style="border: 1px solid #000; text-align:left;width: '+this.w+'px;">';
		s=s+'		<table border=0  cellspacing=0 cellpadding=0   >';
		s=s+'		<tr>';
		s=s+'			<td  height=10 id="pro1_this_id_"></td>';
		s=s+'		</tr>';
		s=s+'		</table>';
		s=s+'	</div>';
		s=s+'	<table border=0  cellspacing=0 cellpadding=0 width="100%">';
		s=s+'	<tr>';
		s=s+'		<td>';
		s=s+'		<div id="dbg_this_id_" style="text-align:center;"></div>';
		s=s+'		</td>';
		s=s+'		</tr>';
		s=s+'		</table>';
		s=s+'</div>';		
		this.ido.innerHTML=s;
	},

	pro : function (cur,tot) {
		var p;
		if (tot==0) {
			p=0;
		}else{
			p = Math.round(cur/tot * 100);
		}
		//FF x eval("dbg"+this.id).innerHTML= p +'%' + ' <br> <font color=magenta>'+cur+' / '+tot+'</font>';
		document.getElementById("dbg_this_id_").innerHTML= p +'%' + '<br> <font color=magenta>'+cur+' / '+tot+'</font>';

		//FFx document.getElementById('pro1'+this.id).style.width= p *  this.w / 100 +'px';
		document.getElementById("pro1_this_id_").style.width= p *  this.w / 100 +'px';
		
		if (cur==tot) {
		//FFx setTimeout("document.getElementById('pro_bx0"+this.id+"').style.display='none';", 600);
			setTimeout("document.getElementById('pro_bx0_this_id_').style.display='none';", 600);
		}
	}

}
// yPro³¡

//»ç¿ë¹ý onkeyup='chksize1(this,20);'  onblur='chksize1(this,20);'  
function chksize1(t,s){
	var bytesLimit =s;
	var tempi1=0;
	var tempi2=0;
	byteIs=0; var brk_i=0;
	for (i=0;i<t.value.length;i++) {
		tmp = t.value.charAt(i);
		escChar = escape(tmp);
		if (escChar.length > 4) {byteIs += 2;} else {byteIs += 1;}
		if (byteIs> bytesLimit) {brk_i=i;break; }
		if (byteIs==bytesLimit-1) {tempi1 = i+1;}
		if (byteIs==bytesLimit) {tempi2 = i+1;}
		 
	}
	if (byteIs>bytesLimit) {
		
		if ( byteIs > bytesLimit  )
		{		
				if (byteIs > s) {
					alert(bytesLimit + "bytes ±îÁö¸¸ °¡´ÉÇÕ´Ï´Ù."+byteIs+" Byte");	 
					 t.value = t.value.substr(0, brk_i);
					 byteIs=bytesLimit;
				}else{		
				} 
		
		}			
	} 		
}
///////////YYY³¡
