/*
 * Fucntion Name : trim()
 * Desc			: ¹®ÀÚ¿­ °ø¹éÁ¦°Å

 * Use			: strVariable.trim(); 
*/
String.prototype.trim = function() {
	return this.replace(/(^\s*)|(\s*$)/g, "");
}

/*
 * Function Name : onlyNumber
 * Desc				: ¼ýÀÚ¸¸ ÀÔ·Â¹Þ¾Æ¾ß ÇÏ´Â°÷¿¡¼­ È£Ãâ, 
 *						 ¼Ò¼öÁ¡ ÀÔ·Â°¡´ÉÇÏµµ·Ï Decimal Point(.)¸¦ ÀÔ·Â°¡´ÉÇÏµµ·ÏÇÔ
 *
*/   
 function onlyNumber(e){
	var objCode = (document.all)?event.keyCode:e.which; 

 //48~57 ¼ýÀÚ, 110 .
 	if (  (objCode < 48 || objCode > 57) &&  objCode != 46 )
 	{
		if (objCode != 13)	{
		  		alert('¼ýÀÚ¸¦ ÀÔ·ÂÇÏ¼¼¿ä');
		  		if (document.all) event.returnValue=false;
		  		else e.preventDefault();
		}

 	}
}

/*
 Äí±â°ª °¡Á®¿À±â
*/
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 email_chk(tempf)
{
	var t = tempf
	var ValidFlag = false
	var atCount = 0
	var SpecialFlag
	var atLoop
	var atChr
	var BadFlag
	var tAry1
	var UserName
	var DomainName

	if ( t.length > 0 && t.indexOf("@") > 0 && t.indexOf(".") > 0 ) {
		atCount = 0
		SpecialFlag = false

		for( atLoop=1; atLoop<=t.length; atLoop++ ) {
			atChr = t.substring( atLoop, atLoop+1 )
			if ( atChr == "@" ) atCount = atCount + 1

			if ( (atChr >= 32) && (atChr <= 44) ) SpecialFlag = true 
			if ( (atChr == 47) || (atChr == 96) || (atChr >= 123) ) SpecialFlag = true 
			if ( (atChr >= 58) && (atChr <= 63) ) SpecialFlag = true 
			if ( (atChr >= 91) && (atChr <= 94) ) SpecialFlag = true 
		}

		if ( ( atCount == 1 ) && (SpecialFlag == false ) ) {
			BadFlag = false
			tAry1 = t.split("@")
			UserName = tAry1[0]
			DomainName = tAry1[1]
			if ( (UserName.length <= 0 ) || (DomainName.length <= 0 ) ) BadFlag = true
			if ( DomainName.substring( 1, 2 ) == "." ) BadFlag = true
			if ( DomainName.substring( DomainName.length-1, DomainName.length) == "." ) BadFlag = true
			ValidFlag = true
		}
	}
	if ( BadFlag == true ) ValidFlag = false
	return ValidFlag
}


function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

//-------------------------------------------------------------------
// ÀÌ¹ÌÁö Å¬¸¯½Ã ÆË¾÷À¸·Î ¶ç¿ì±â
//-------------------------------------------------------------------
function showPicture(src,subject) {
  var imgObj = new Image();
  imgObj.src = src;
  var wopt = "scrollbars=no,status=no,resizable=no";
  wopt += ",width=" + imgObj.width;
  wopt += ",height=" + imgObj.height;
  var wbody = "<head><title>" + subject + "</title>";
  wbody += "<script language='javascript'>";
  wbody += "function finalResize(){";
  wbody += "  var oBody=document.body;";
  wbody += "  var oImg=document.images[0];";
  wbody += "  var xdiff=oImg.width-oBody.clientWidth;";
  wbody += "  var ydiff=oImg.height-oBody.clientHeight;";
  wbody += "  window.resizeBy(xdiff,ydiff);";
  wbody += "}";
  wbody += "</"+"script>";
  wbody += "</head>";
  wbody += "<body onLoad='finalResize()' style='margin:0'>";
  wbody += "<a href='javascript:window.close()'><img src='" + src + "' border=0></a>";
  wbody += "</body>";
  winResult = window.open("about:blank","",wopt);
  winResult.document.open("text/html", "replace");
  winResult.document.write(wbody);
  winResult.document.close();
  return;
}


function fComm_GoImg(argURL,argSUBJECT,argWIDTH,argHEIGHT){

	var sORG_WIDTH
	var sORG_HEIGHT
	var sWIDTH
	var sHEIGHT
	var sIS_SCROLL
	
	sWIDTH = 0;
	sHEIGHT = 0;
	sORG_WIDTH = argWIDTH * 1;
	sORG_HEIGHT = argHEIGHT * 1;
	sIS_SCROLL = "no";
	
	if (window.screen.width * 1 < sORG_WIDTH + 40) {
		sWIDTH = window.screen.width - 90
		sIS_SCROLL = "yes";
	}else{
		sWIDTH = sORG_WIDTH //+ 40
	}
	
	if (window.screen.height * 1 < sORG_HEIGHT + 144) {
		sHEIGHT = window.screen.height - 150
		sIS_SCROLL = "yes";
	}else{
		sHEIGHT = sORG_HEIGHT // + 144
	}
	
	// ½ºÅ©·Ñ ¿©ºÎ¿¡ µû¶ó width °ª ´Ù½Ã Á¶Àý
	/*
	if (sIS_SCROLL=="no")
	{
		sWIDTH = sORG_WIDTH + 40
	}
	else
	{
		sWIDTH = sORG_WIDTH + 54
	}

	
	if (sORG_WIDTH > 1000) {
		sWIDTH = 1000
		sIS_SCROLL = "yes";
	}else{
		sWIDTH = sORG_WIDTH + 40
	}
	
	if (sORG_HEIGHT > 800) {
		sHEIGHT = 800
		sIS_SCROLL = "yes";
	}else{
		sHEIGHT = sORG_HEIGHT + 144
	}
	
	// ½ºÅ©·Ñ ¿©ºÎ¿¡ µû¶ó width °ª ´Ù½Ã Á¶Àý
	if (sIS_SCROLL=="no")
	{
		sWIDTH = sORG_WIDTH + 40
	}
	else
	{
		sWIDTH = sORG_WIDTH + 54
	}
	*/

	var win = window.open('/include/image_popup.asp?hIMG_URL=' + argURL + '&hTITLE=' + argSUBJECT + '&hWIDTH=' + argWIDTH + '&hHEIGHT=' + argHEIGHT, 'viewpict', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=' + sIS_SCROLL + ',resizable=no,left=0,top=0,width=' + sWIDTH + ',height=' + sHEIGHT);
	if (win !=null)	{ win.focus();	}
}


//-------------------------------------------------------------------
// ¸ðÁý°ø°í¹® Ç®Ã¢ ÆË¾÷
//-------------------------------------------------------------------
<!-- 
function full_window(url) 
{

   var ls_url 

   if(window.name == "win_full")
   {
      window.opener=self;
     // window.close();
      window.open(ls_url); 

   }
   else
   {      
      window.opener=self;
 //     window.close();

      //
      var li_width  = window.screen.width - 10;
      var li_height = window.screen.height - 60;
      window.open(ls_url,"win_full","width=" + li_width + ",height=" + li_height+",top=0,left=0,scrollbars=yes,resizable=yes");
   }
}



// ÀÌ¸ÞÀÏ ¹«´Ü¼öÁý°ÅºÎ
function fGoEmail()
{
	var win = window.open('/pop_email.asp', 'pop_01', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,left=100,top=100,width=440,height=285');
	if (win !=null)	{ win.focus();	}

}


// °³ÀÎÁ¤º¸º¸È£Á¤Ã¥
function fGoPrivacy()
{
	var win = window.open('/pop_privacy.asp', 'pop_02', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,left=100,top=100,width=750,height=700');
	if (win !=null)	{ win.focus();	}

}


// ÆòÇü°è»ê±â
function fGoPOP()
{
	var win = window.open('/subscription/pop.asp', 'pop_03', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,left=100,top=100,width=362,height=200');
	if (win !=null)	{ win.focus();	}

}


//-------------------------------------------------------------------
// ÅØ½ºÆ® ÀÔ·Â½Ã ÄÞ¸¶ Âï±â.
//-------------------------------------------------------------------

String.prototype.trim = function() 
{
	return this.replace(/(^\s*)|(\s*$)/g, "");
}  

//¼ýÀÚ¸¸ ÀÔ·Â°¡´É (ÄÞ¸¶ °¡´É)
function onlyNumber() 
{
	var e1 = event.srcElement;
	var num ="-0123456789";
	var f = document.theForm;
	event.returnValue = true;

	for (var i=0;i<e1.value.length;i++) 
	{
		if (-1 == num.indexOf(e1.value.charAt(i)) && ","!=e1.value.charAt(i)) 
		{
		event.returnValue = false;
		}
	}

	if (!event.returnValue) 
	{
		e1.value="";
		e1.focus();
	}    
	fncCal(); 
}

// ÄÄ¸¶(,) Âï±â
function cfComma1000(obj1) 
{ 
	var sOrg = eval(obj1).value.trim(); 
	if(isNaN(sOrg) || sOrg.length==0) return "";

	var sRetVal     = "";
	var sTmpVal     = "";
	var sFractionVal  = "";

	sOrg = sOrg.toString();
	sOrg = sOrg.replace(/,/g,"");

	var lLengh = sOrg.search(/\./);

	if (lLengh<0) 
	{
		lLengh = sOrg.length;
	}
	else
		sFractionVal = sOrg.substr(lLengh);

	lLengh    = lLengh;
	var lRemainder  = lLengh % 3;

	if (lRemainder == 0 && lLengh > 0)
	lRemainder  = 3;

	sRetVal = sOrg.substr(0,lRemainder);

	while(lRemainder < lLengh) {
		sTmpVal = sTmpVal + "," + sOrg.substr(lRemainder,3);
		lRemainder  += 3;
	}

	if(sRetVal == "-") sTmpVal = sTmpVal.substr(1,sTmpVal.length);
	sRetVal = sRetVal + sTmpVal + sFractionVal;

	eval(obj1).value = sRetVal ;
}

// ÀÔ·Â°ª ÄÞ¸¶ Á¦°ÅÇÏ±â
function fncDelComma() {   
var f = document.theForm;
f.hMONEY.value = f.hMONEY.value.replace(/,/g,"");;
}

// ÀÔ·Â°ªÄÞ¸¶ ºÙÀÌ±â
function fncIncComma() {
var f = document.theForm;    
cfComma1000(f.hMONEY);
}

// ÄÄ¸¶(,)¸¦ ¾ø¾Ø ¼ýÀÚ¸¦ ¹ÝÈ¯
function cfNumeric(sOrg) {
var nm;
sOrg = sOrg.replace(/,/g,""); 
nm = parseFloat(sOrg).toString();
return (isNaN(nm)?0:nm);
}

// ÀÚµ¿°è»ê (ÄÞ¸¶ º¸ÀÌ±â)
function fncCal() {
 fncDelComma();
var f = document.theForm;
 f.hMONEY.value = f.hMONEY.value.split(",");  
fncIncComma();
}

//°ø¹éÃ¼Å©
function isEmpty( data ){
	for ( var i = 0 ; i < data.length ; i++ ){
		if ( data.substring( i, i+1 ) != " " ){
			return true;
		}
	}
	return false;
}

function CheckNumeric(Data) 
{
	var nochk='01234567890,.'
	for (i=0; i<Data.length; i++){
		if(nochk.indexOf(Data.substring(i,i+1)) < 0) 		
		{
			return true;
		}
	}//for Á¾·á
	return false;
}
// ¼ýÀÚ¸¸ ÀÔ·ÂÇÏ±â.
function NumNock(){
	if ((event.keyCode<48)||(event.keyCode>57)){ 
		event.returnValue = false;
	}
	return true;
}

// ¹Ìµð¾î ÇÃ·¹ÀÌ¾î 
function fPlayer_Activate(argWIDTH, argHEIGHT, argBASE_WORK_URL, argATT_PLAYER_NAME) {

	var contents = "<OBJECT id='mediaPlayer' type='application/x-oleobject' standby='Loading Microsoft?Windows?Media Player components...'"
		contents += " width= " + argWIDTH + " height= " + argHEIGHT + " classid='CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95'>" 
		contents += " <PARAM NAME='FileName' VALUE=" + argBASE_WORK_URL + "/" + argATT_PLAYER_NAME + "> "
		contents += " <PARAM NAME='AnimationAtStart' VALUE='false'> "
		contents += " <PARAM NAME='TransparentAtStart' VALUE='true'> "
		contents += " <PARAM NAME='AutoStart' VALUE='true'> "
		contents += " <PARAM NAME='Autosize' VALUE='false'> "
		contents += " <PARAM NAME='AutoRewind' VALUE='false'> "
		contents += " <PARAM NAME='ShowDisplay' VALUE='false'> "
		contents += " <PARAM NAME='ShowStatusBar' VALUE='false'> "
		contents += " <PARAM NAME='ShowControls' VALUE='false'> "
		contents += " <PARAM NAME='ShowAudioControls' VALUE='false'> "
		contents += " <PARAM NAME='ShowTracker' VALUE='false'> "
		contents += " <PARAM NAME='ShowPositionControls' VALUE='0'> "
		contents += " <PARAM NAME='EnableContextMenu' VALUE='false'> "
		contents += " </object> ";
		document.write(contents);
}

function fGoEnglish()
{
	var win = window.open("/english/")
	win.focus();
}

	
	function fGoMapOpen(e, top, gubun)
	{
		var POPUP = eval("POPUP1_" + e)
		var POPUP1 = eval("POPUP_" + e)
		

		fFixLayer(e, top, gubun);

		POPUP.style.display = ''
		POPUP1.style.display = ''

	}

	function fGoMapClose(e)
	{
		var POPUP = eval("POPUP1_" + e)
		var POPUP1 = eval("POPUP_" + e)

		POPUP.style.display = 'none'
		POPUP1.style.display = 'none'


	}

	function fFixLayer(e, top, gubun) {

		var xMax = document.body.clientWidth;
		var yMax = document.body.clientHeight;

		var xOffset;
		if (gubun=="1")
		{
			xOffset= (xMax)/2-490;
		} else {
			xOffset= (xMax)/2-250;
		}
		
		var yOffset = (yMax)/2+10; 
		var divMenu = eval("document.all.POPUP1_" + e).style;
		var divMenu2 = eval("document.all.POPUP_" + e).style;
		
		divMenu.left = xOffset;
		divMenu.top = top;

		divMenu2.left = xOffset;
		divMenu2.top = top;

	}


//»ó´Ü Top¸Þ´º ·¹ÀÌ¾î ¿­±â
function glTopLayerOpen()
{
	document.all.main_top_flash.height = 600
	document.getElementById('divTopMenu').style.height="600"
	document.getElementById('divTopMenu').style.zIndex="1001"
}
//»ó´Ü Top¸Þ´º ·¹ÀÌ¾î ´Ý±â
function glTopLayerClose()
{
	document.all.main_top_flash.height = 240
	document.getElementById('divTopMenu').style.height="240"
	document.getElementById('divTopMenu').style.zIndex="999"
}

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_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();
}
MM_reloadPage(true);

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_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; }
}

//png ÀÌ¹ÌÁö
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.src='';  
  return ''; 
}

