function imgCheck(obj) {
	check = true
	
	pathpoint = obj.lastIndexOf('.');
	filepoint = obj.substring(pathpoint+1,obj.length);
	filetype = filepoint.toLowerCase();

	if (filetype=='jpg' || filetype=='gif') {
		return true;
	} else {
		return false;
	}
}

function GetTextByte(text) {
   str = new String(text);
   var strLen = str.length;
   var strByte = 0;
   for (var i=0; i<strLen; i++) {
       tmp = new String(str.charCodeAt(i));
       strByte++;
       if (tmp.length > 3) {
           strByte++;
       }
   }
   return strByte;
}

function IsNull(nval) {
   for (var i = 0 ; i < nval.length ; i++){
       tst = nval.substring(i,i+1)
       if ((tst != ' ')&&(tst != '\r')&&(tst != '\n')&&(tst != '\t')&&(tst != '\b')&&(tst != '\v')&&(tst != '\f')) {
          return false;
       }
   }
   return true;
}

function chkNum(chk) {
   var comp="0123456789";
   var string = chk.value;
   var len = string.length;

   for (i=0;i<len;i++) {
      if (comp.indexOf(string.substring(i,i+1))<0) {
           alert("¼ýÀÚ·Î¸¸ ÀÔ·Â °¡´ÉÇÕ´Ï´Ù. ´Ù½Ã ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À");
           chk.value = "";
           chk.focus();
           return;
      }
   }
}

function isAllowStr(str, allowStr) {
   var i;
   var ch;

   for (i=0;i<str.length;i++) {
       ch = str.charAt(i);

       if (allowStr.indexOf(ch) < 0) {
          return false;
       }
   }

   return true;
}

function checkEmail(ctrl) {
   str = ctrl;

   if (isAllowStr(str, "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz@.-_") == false) {
       alert("À¯È¿ÇÑ EmailÀÌ ¾Æ´Õ´Ï´Ù!");
       //ctrl.value="";
       //ctrl.focus();
       //ctrl.select();
       return false;
   }

   var atCnt = 0;
   var dotCnt = 0;

   for (i = 0; i < str.length ; i++) { 
       ch = str.charAt(i);

       if (ch == "@") {
          atCnt++;
       }

       if (ch == ".") {
          dotCnt++;
       }
   }

   if (atCnt != 1 || dotCnt < 1) {
      alert("À¯È¿ÇÑ EmailÀÌ ¾Æ´Õ´Ï´Ù.");
      //ctrl.value="";
      //ctrl.focus();
     // ctrl.select();
      return false;
   }

   var atIndex = 0;
   atIndex = str.indexOf("@");

   if (atIndex <= 0) {
      alert("À¯È¿ÇÑ EmailÀÌ ¾Æ´Õ´Ï´Ù.");
     // ctrl.value="";
      //ctrl.focus();
      //ctrl.select();
      return false;
   }

   return true;
}

function CheckID(ctrl) {
	str = ctrl.value;	

    if (isAllowStr(str, "1234567890abcdefghijklmnopqrstuvwxyz") == false) {
        alert ("Çã°¡µÇÁö ¾ÊÀº ¹®ÀÚ¿­ÀÌ Æ÷ÇÔµÇ¾î ÀÖ½À´Ï´Ù!");
        ctrl.focus();
        ctrl.select();
        return false;
    }
   
	// Æ¯¼öÇÑ ÀÌ¸§Àº id·Î »ç¿ëÇÒ ¼ö ¾ø´Ù
	if (!checkSpecialID(str,"admin")) {
	    return false;
	} else if (!checkSpecialID(str,"admins")) {
	    return false;	
	} else if (!checkSpecialID(str,"master")) {
	    return false;	
	} else if (!checkSpecialID(str,"root")) {
	    return false;		
	} else if (!checkSpecialID(str,"webmaster")) {
	    return false;		
	} else {
        return true;
	}
}

function checkSpecialID(a,b) {	
	if (a.toUpperCase() == b.toUpperCase()) {
		alert("ID·Î " + b + "À»(¸¦) »ç¿ëÇÏ½Ç ¼ö ¾ø½À´Ï´Ù.");
		return false;
	}
	return true;
}

function CheckString(ctrl) {
	str = ctrl.value;	

    if (isAllowStr(str, "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz") == false) {
        ctrl.value="";
        ctrl.focus();
        ctrl.select();
        return false;
    }
   
    return true;
}

//±æÀÌ Ã¼Å© ½ºÅ©¸³Æ®
function apg_length_chk(target, want_length)
{ 
   var len = 0; 
   if (target.value == null ) return 0; 
   for(var i=0;i<target.value.length;i++){ 
      var c = escape(target.value.charAt(i)); 
      if ( c.length == 1 ) len ++; 
      else if ( c.indexOf("%u") != -1 ) len += 2; 
      else if ( c.indexOf("%") != -1 ) len += c.length/3; 
   } 
   if (len > want_length)
  {
		kwant_length = want_length / 2
		alert("¿µ¹® "+want_length+"ÀÚ, ÇÑ±Û "+kwant_length+"ÀÚ ¾È¿¡¼­ ÀÔ·ÂÇÏ¿©ÁÖ¼¼¿ä.");
		target.value = "";
		target.focus();
		return false;
	}
	return true;
}
//¸®½ºÆ®¿¡¼­ ¸®ÇÃ±íÀÌ¿¡
function apg_title_length(title_content, title_step, title_len)
{ 
	var len = 0; 
	var title_result = ""
	if ( title_content == null ) return 0;
	if (title_step != 0)
		title_contentgth = (title_len -3) - title_step* 2;
	else
		title_contentgth = title_len;
	for(var i=0;i<title_content.length;i++)
	{ 
		if(len < title_contentgth)
		{
			var c = escape(title_content.charAt(i));
			title_result = title_result + title_content.charAt(i)
			if ( c.length == 1 ) len ++; 
			else if ( c.indexOf("%u") != -1 ) len += 2; 
			else if ( c.indexOf("%") != -1 ) len += c.length/3;
		}
		else
		{
			title_result = title_result + "...";
			break;
		}
	} 
	return title_result
} 
//¹®ÀÚ¿­¿¡¼­ ÇØ´çÇÏÁö ¾Ê´Â °ªÀÌ µé¾îÀÖ´ÂÁö Ã¼Å©ÇÏ±â
function apg_value_chk(contents, target)
{
	var i;
	var ch;   
	for (i=0;i<contents.length;i++) 
	{       
		ch = contents.charAt(i) ;       
		if (target.indexOf(ch) < 0) 
		{
			return false;
		}
	}
	return true;
}

//ÁÖ¹Îµî·Ï ¹øÈ£ Ã¼Å©
function CheckSSN(jumin1,jumin2) {
	var today = new Date();
	var chkYear1 = today.getYear();
	var chkYear2 = 0;

	if (chkYear1 < 2000) {
		chkYear1 += 1900;
	}

	var chk = 0;
	var chk2 = 0;
	var chk3 = 0;
	var yy = jumin1.substring(0,2);
	var mm = jumin1.substring(2,4);
	var dd = jumin1.substring(4,6);
    var chkSex = jumin2.substring(0,1);	

	if ((jumin1.length != 6) || (mm<1 || mm>12 || dd<1 || dd>31 )) {
		return false;
	}

	if ((chkSex != 1 && chkSex !=2 && chkSex !=3 && chkSex !=4) || (jumin2.length != 7)) {
		return false;
	}

	chkYear2 = parseInt(yy,10);

	if (chkSex <=2) {
		chkYear2 += 1900;
    } else {
		chkYear2 += 2000;
    }
	
	//if ((chkYear1 - chkYear2) < 12) { 
	//	return false;
	//} 

	// ÁÖ¹Îµî·Ï¹øÈ£ validation check
	for (var i = 0; i <=5 ; i++) { 
		chk = chk + ((i%8+2) * parseInt(jumin1.substring(i,i+1)))
	}

	for (var i = 6; i <=11 ; i++) { 
		chk = chk + ((i%8+2) * parseInt(jumin2.substring(i-6,i-5)))
	}

	chk = 11 - (chk %11)
	chk = chk % 10

	if (chk != jumin2.substring(6,7)) {
		return false;
	}  

	return true;
} 

function nextJumin(obj){
	if(obj.jumin1.value.length == 6){
		obj.jumin2.focus();
	}
}

function IsNumeric(oFrm){
	for(var i=0; i<oFrm.length;i++){
		if(oFrm.substring(i,i+1) < "0" || oFrm.substring(i,i+1) > "9"){
			return false;
		}
	 }
	return true;
}

function bank_find(bank, bankname) {
  window.open('/common/bankcode.asp?bank='+bank+'&bankname='+bankname,'bankcode','resizable=no,scrollbars=yes, width=366,height=232'); 
}

function post_find(seq, zip1, zip2, addr1, addr2) {
  window.open('/common/postcode.asp?seq='+seq+'&zip1='+zip1+'&zip2='+zip2+'&addr1='+addr1+'&addr2='+addr2,'postcode','resizable=no,scrollbars=yes, width=366,height=274'); 
}

function winPop(url, name ,sWidth, sHight, isScroll, isResize, isTool, isMenu) {
  window.open(url,name,'scrollbars='+isScroll+',resizable='+isResize+',toolbar='+isTool+',menubar='+isMenu+',location=no, width='+sWidth+',height='+sHight);
}

//¼ýÀÚ¸¸ ÀÔ·Â ¹Þ´Â ½ºÅ©¸³Æ®
function checkNum(obj){
	for(var i=0; i<obj.value.length;i++){
		if(obj.value.substring(i,i+1) < "0" || obj.value.substring(i,i+1) > "9"){
			alert("ÀÌ ÇÊµå´Â ¼ýÀÚ¸¸ ÀÔ·Â °¡´ÉÇÕ´Ï´Ù.");
			obj.value = "";
			obj.focus();
		return false;
		}
	 }
	return true;
}

function FormatPrice(Price) {
	Price = new String(Price)
	Price = Price.replace(/,/gi,"")
	
	fl=""
	if(isNaN(Price)) 
	{ 
		alert("¹®ÀÚ´Â »ç¿ëÇÒ ¼ö ¾ø½À´Ï´Ù.");
		return 0;
	}
	if(Price == 0) 
	{
		return Price;
	}
	
	if (Price < 0)
	{ 
		Price = Price * (-1);
		fl = "-";
	}
	else
	{
		Price = Price * 1 //Ã³À½ ÀÔ·Â°ªÀÌ 0ºÎÅÍ ½ÃÀÛÇÒ¶§ ÀÌ°ÍÀ» Á¦°ÅÇÑ´Ù.
	}
	Price = new String(Price);
	temp = "";
	co = 3;
	Price_len = Price.length;
	while (Price_len>0)
	{
		Price_len = Price_len - co;
		if(Price_len<0)
		{
			co = Price_len + co;
			Price_len = 0;
		}
		temp = "," + Price.substr(Price_len,co) + temp
	}

	return fl + temp.substr(1)
}



// ÁÖ¹Îµî·Ï¹øÈ£ Ã¼Å© ·ÎÁ÷
    function check_ResidentNO(str_f_num,str_l_num){  
        var i3=0
        for (var i=0;i<str_f_num.length;i++){
         var ch1 = str_f_num.substring(i,i+1);
            if (ch1<'0' || ch1>'9') i3=i3+1;
        }
        if ((str_f_num == '') || ( i3 != 0 )) return false;
        var i4=0;
        for (var i=0;i<str_l_num.length;i++){
            var ch1 = str_l_num.substring(i,i+1);
            if (ch1<'0' || ch1>'9') i4=i4+1; 
        }
        if ((str_l_num == '') || ( i4 != 0 )) return false;
        if(str_f_num.substring(0,1) < 4) return false;
        if(str_l_num.substring(0,1) > 2) return false;
        if((str_f_num.length > 7) || (str_l_num.length > 8)) return false;
        if ((str_f_num == '72') || ( str_l_num == '18'))  return false;
                
        var f1=str_f_num.substring(0,1)
        var f2=str_f_num.substring(1,2)
        var f3=str_f_num.substring(2,3)
        var f4=str_f_num.substring(3,4)
        var f5=str_f_num.substring(4,5)
        var f6=str_f_num.substring(5,6)
        var hap=f1*2+f2*3+f3*4+f4*5+f5*6+f6*7
        var l1=str_l_num.substring(0,1)
        var l2=str_l_num.substring(1,2)
        var l3=str_l_num.substring(2,3)
        var l4=str_l_num.substring(3,4)
        var l5=str_l_num.substring(4,5)
        var l6=str_l_num.substring(5,6)
        var l7=str_l_num.substring(6,7)
        hap=hap+l1*8+l2*9+l3*2+l4*3+l5*4+l6*5
        hap=hap%11
        hap=11-hap
        hap=hap%10
        if (hap != l7) return false;
        return true; 
    }


	function hanCheck(x) {
		for(i=0;i<x.value.length;i++) {
		var a=x.value.charCodeAt(i);
			if (a > 128) {
			
			}else{
				alert('ÇÑ±Û ÀÌ¿Ü¿¡ ÀÔ·Â ±ÝÁö');
				x.value="";
				x.focus();
				return;
			}
		}
	}

	

//**************************************
// µå¸²À§¹ö¿¡¼­ Á¦°øÇÏ´Â ÇÔ¼ö¶óÀÌºê·¯¸®
//**************************************

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_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_findObj(n, d) { //v4.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);
  if(!x && document.getElementById) x=document.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();
}

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; }
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
alert(11);
  window.open(theURL,winName,features);
}

MM_reloadPage(true);


//À¯µ¿ ¾ÆÀÌÇÁ·¹ÀÓ1
function doResize() 
{ 
reservation.height = ticket.document.body.scrollHeight; 
reservation.width = ticket.document.body.scrollWidth; 
} 

//À¯µ¿ ¾ÆÀÌÇÁ·¹ÀÓ2
function doResize2() 
{ 
pap.height = ppp.document.body.scrollHeight; 
pap.width = ppp.document.body.scrollWidth; 
} 

// µ¿¿µ»ó
function MovieWrite(file) {

	document.write('<object classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" id="MMPlayer1" standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject" width="259" height="197" VIEWASTEXT>');
	document.write('<PARAM NAME="AudioStream" VALUE="1">');
	document.write('	<PARAM NAME="AutoPlay" VALUE="1">');
	document.write('	<PARAM NAME="AutoSize" VALUE="0">');
	document.write('	<PARAM NAME="AutoStart" VALUE="1">');
	document.write('	<PARAM NAME="AnimationAtStart" VALUE="0">');
	document.write('	<PARAM NAME="AutoRewind" VALUE="1">');
	document.write('	<PARAM NAME="Balance" VALUE="0">');
	document.write('	<PARAM NAME="BufferingTime" VALUE="1000">');
	document.write('	<PARAM NAME="CaptioningID" VALUE="">');
	document.write('	<PARAM NAME="ClickToPlay" VALUE="0">');
	document.write('	<PARAM NAME="CursorType" VALUE="32512">');
	document.write('	<PARAM NAME="CurrentPosition" VALUE="-1">');
	document.write('	<PARAM NAME="CurrentMarker" VALUE="0">');
	document.write('	<PARAM NAME="DefaultFrame" VALUE="">');
	document.write('	<PARAM NAME="DisplayBackColor" VALUE="16777215">');
	document.write('	<PARAM NAME="DisplayForeColor" VALUE="16777215">');
	document.write('	<PARAM NAME="DisplaySize" VALUE="4">');
	document.write('	<PARAM NAME="uiMode" VALUE="none">');
	document.write('	<PARAM NAME="stretchToFit" VALUE="0">');
	document.write('	<PARAM NAME="Enabled" VALUE="-1">');
	document.write('	<PARAM NAME="EnableContextMenu" VALUE="0">');
	document.write('	<PARAM NAME="EnablePositionControls" VALUE="-1">');
	document.write('	<PARAM NAME="EnableFullScreenControls" VALUE="1">');
	document.write('	<PARAM NAME="EnableTracker" VALUE="-1">');
	document.write('	<PARAM NAME="InvokeURLs" VALUE="-1">');
	document.write('	<PARAM NAME="Language" VALUE="0">');
	document.write('	<PARAM NAME="Mute" VALUE="0">');
	document.write('	<PARAM NAME="PlayCount" VALUE="1">');
	document.write('	<PARAM NAME="PreviewMode" VALUE="0">');
	document.write('	<PARAM NAME="Rate" VALUE="1">');
	document.write('	<PARAM NAME="SAMILang" VALUE="">');
	document.write('	<PARAM NAME="SAMIStyle" VALUE="">');
	document.write('	<PARAM NAME="SAMIFileName" VALUE="">');
	document.write('	<PARAM NAME="SelectionStart" VALUE="0">');
	document.write('	<PARAM NAME="SelectionEnd" VALUE="0">');
	document.write('	<PARAM NAME="SendOpenStateChangeEvents" VALUE="-1">');
	document.write('	<PARAM NAME="SendWarningEvents" VALUE="-1">');
	document.write('	<PARAM NAME="SendErrorEvents" VALUE="-1">');
	document.write('	<PARAM NAME="SendKeyboardEvents" VALUE="0">');
	document.write('	<PARAM NAME="SendMouseClickEvents" VALUE="0">');
	document.write('	<PARAM NAME="SendMouseMoveEvents" VALUE="0">');
	document.write('	<PARAM NAME="SendPlayStateChangeEvents" VALUE="1">');
	document.write('	<PARAM NAME="ShowCaptioning" VALUE="0">');
	document.write('	<PARAM NAME="ShowControls" VALUE="0">');
	document.write('	<PARAM NAME="ShowAudioControls" VALUE="0">');
	document.write('	<PARAM NAME="ShowDisplay" VALUE="0">');
	document.write('	<PARAM NAME="ShowGotoBar" VALUE="0">');
	document.write('	<PARAM NAME="ShowPositionControls" VALUE="0">');
	document.write('	<PARAM NAME="ShowTracker" VALUE="0">');
	document.write('	<PARAM NAME="TransparentAtStart" VALUE="0">');
	document.write('	<PARAM NAME="VideoBorderWidth" VALUE="0">');
	document.write('	<PARAM NAME="VideoBorderColor" VALUE="0">');
	document.write('	<PARAM NAME="VideoBorder3D" VALUE="0">');
	document.write('	<PARAM NAME="Volume" VALUE="600">');
	document.write('	<PARAM NAME="WindowlessVideo" VALUE="0">');
	document.write('    <param name="Filename" value="' + file + '">');
	document.write('</object>');

}


//¼¿·ºÆ®¹Ú½º
function goto_new(form) {
	var windowprops = "";
	var URL = form.go.options[form.go.selectedIndex].value;
		if (URL != "" && URL != null){
	popup = window.open(URL,'',windowprops);
	}
}

// flashWrite(ÆÄÀÏ°æ·Î, °¡·Î, ¼¼·Î, ¾ÆÀÌµð, ¹è°æ»ö, º¯¼ö, À©µµ¿ì¸ðµå)
function flashWrite(url,w,h,id,bg,vars,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='allowScriptAccess' value='always' />"+
	"<param name='movie' value='"+url+"' />"+
	"<param name='FlashVars' value='"+vars+"' />"+
	"<param name='wmode' value='"+win+"' />"+
	"<param name='menu' value='false' />"+
	"<param name='quality' value='high' />"+
	"<param name='bgcolor' value='"+bg+"' />"+
	"<embed src='"+url+"' FlashVars='"+vars+"' wmode='"+win+"' menu='false' quality='high' bgcolor='"+bg+"' width='"+w+"' height='"+h+"' name='"+id+"' align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />"+
	"</object>";

	document.write(flashStr);
}


//FAQ
var old_obj = null;

function showSubmenu(obj) {
  if (!old_obj) {
    obj.style.display = "block";
	old_obj = obj;
	return;
  }

  if (old_obj == obj) {
	if (obj.style.display == "block") {
	  obj.style.display = "none";
	  old_obj = null;
	  return;
	}
  } else {
    old_obj.style.display = "none";
    obj.style.display = "block";
	old_obj = obj;
  }

}

//·¹ÀÌ¾î
function open_layer(number) {
	var mainL = document.getElementById(number);
	mainL.style.display = "block";
}

function closing(number) {
	var mainL = document.getElementById(number);
	mainL.style.display = "none";
}


// ÀÌ¹ÌÁö Å©°Ôº¸±â
String.prototype.popupView = function () { 
	var img_view = this; 
	var x = x + 20 ; 
	var y = y + 30 ; 
	htmlz = "<html><head><title>´ë¿ì°Ç¼³</title><style>body{margin:0;cursor:hand;}</style></head><body scroll=auto onload='width1=document.all.Timage.width;if(width1>1024)width1=1024;height1=document.all.Timage.height;if(height1>768)height1=768;top.window.resizeTo(width1+30,height1+54);' onclick='top.window.close();'><img src='"+img_view+"'  title='Å¬¸¯ÇÏ½Ã¸é ´ÝÈü´Ï´Ù.' name='Timage' id='Timage'></body></html>" 
	imagez = window.open('', "image", "width="+ 100 +", height="+ 100 +", top=0,left=0,scrollbars=auto,resizable=1,toolbar=0,menubar=0,location=0,directories=0,status=1"); 
	imagez.document.open(); 
	imagez.document.write(htmlz) 
	imagez.document.close(); 
} 