function numCheck(target)
{  
	var Digit = '1234567890';
   for (i=0 ;i<=target.length ;i++)
   {  if(Digit.indexOf(target.substring(i,i+1)) < 0) 
      {  
		 return false;
      }
   }
}

function commaNum(num) {  

        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 number_chk(obj,chk)
{
	if(numCheck(obj.value) == false)
	{
		alert('¼ýÀÚ¸¸ ±âÀÔÇØÁÖ¼¼¿ä');
		obj.value =chk ;		 
		obj.focus();	 
	}
}

function logout()
{
	if(confirm("·Î±×¾Æ¿ô ÇÏ½Ã°Ú½À´Ï±î?"))
	{	
		location.href="/regist/logout.asp";
	}
}

function  swapPicture(pic_url,width,height) { 

	document.obj_PicPath.src = pic_url;
	document.obj_PicPath.src.width=width ;
	document.obj_PicPath.src.width=height ;
}

//»çÁøÅ©±â¸¦ ½ÇÁ¦ »çÀÌÁî·Î º¸´Â(»ç½ÇÀº »õÃ¢À¸·Î ¶ç¿ì±â)
function view(img_url) {
var imgwin = window.open("",'WIN','scrollbars=yes,status=no,toolbar=no,resizable=no,location=no,width=10,height=10');
imgwin.focus();
imgwin.document.open();
imgwin.document.write("<html>\n");
imgwin.document.write("<head>\n");
imgwin.document.write("<title>»ó¼¼º¸±â</title>\n");
imgwin.document.write("<sc"+"ript>\n");
imgwin.document.write("function resize() {\n");
imgwin.document.write("pic = document.il;\n");
imgwin.document.write("if (eval(pic).height) { var name = navigator.appName\n");
imgwin.document.write("  if (name == 'Microsoft Internet Explorer') { myHeight = eval(pic).height + 100; myWidth = eval(pic).width + 100;\n");
imgwin.document.write("  } else { myHeight = eval(pic).height + 100; myWidth = eval(pic).width + 100; }\n");
imgwin.document.write("  clearTimeout();\n");
imgwin.document.write("  var height = screen.height;\n");
imgwin.document.write("  var width = screen.width;\n");
imgwin.document.write("  var leftpos = width / 2 - myWidth / 2;\n");
imgwin.document.write("  var toppos = height / 2 - myHeight / 2; \n");
imgwin.document.write("  self.resizeTo(myWidth, myHeight);\n");
imgwin.document.write("}else setTimeOut(resize(), 100);}\n");
imgwin.document.write("</script>\n");
imgwin.document.write("</head>\n");
imgwin.document.write('<body topmargin="5" leftmargin="5" marginheight="5" marginwidth="5" bgcolor="#FFFFFF" oncontextmenu="return false">\n');
imgwin.document.write("<a href='javascript:self.close();'><p align=center><img border=0 src="+img_url+" name=il onload='resize();'></p></a>\n");
imgwin.document.write("</body>\n");
imgwin.document.close();
}
 
  

function imgRsize(img, rW, rH){
	var iW = img.width;
	var iH = img.height;
	var g = new Array;
	if(iW < rW && iH < rH) { // °¡·Î¼¼·Î°¡ Ãà¼ÒÇÒ °ªº¸´Ù ÀÛÀ» °æ¿ì
			g[0] =  iW; 
			g[1] =  iH; 
	} else {
			if(img.width > img.height) { // ¿øÅ©±â °¡·Î°¡ ¼¼·Îº¸´Ù Å©¸é
					g[0] = rW;
					g[1] = Math.ceil(img.height * rW / img.width);
			} else if(img.width < img.height) { //¿øÅ©±âÀÇ ¼¼·Î°¡ °¡·Îº¸´Ù Å©¸é
					g[0] = Math.ceil(img.width * rH / img.height);
					g[1] = rH;
			} else {
					g[0] = rW;
					g[1] = rH;
			}
			if(g[0] > rW) { // ±¸ÇØÁø °¡·Î°ªÀÌ Ãà¼Ò °¡·Îº¸´Ù Å©¸é
					g[0] = rW;
					g[1] = Math.ceil(img.height * rW / img.width);
			}
			if(g[1] > rH) { // ±¸ÇØÁø ¼¼·Î°ªÀÌ Ãà¼Ò ¼¼·Î°ª°¡·Îº¸´Ù Å©¸é
					g[0] = Math.ceil(img.width * rH / img.height);
					g[1] = rH;
			}
	}
	  img.width =g[0]; // ¿ø»çÀÌÁî °¡·Î
	  img.height =g[1]; // ¿ø»çÀÌÁî ¼¼·Î
 }


function email_chk(frm)
{
    var t = frm.value
	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 Jumin_chk(it) {
	IDtot = 0;
	IDAdd = "234567892345";

	for(i=0; i<12; i++) IDtot = IDtot + parseInt(it.substring(i, i+1)) * parseInt(IDAdd.substring(i, i+1));
	IDtot = 11 - (IDtot%11);
	if (IDtot == 10) IDtot = 0;
	else if (IDtot == 11) IDtot = 1;
	if(parseInt(it.substring(12, 13)) != IDtot) return true;
	else return false
} 


function search_post(frm,post1,post2,addr1,addr2)
{
window.open("/post_find.asp?frm="+frm+"&zip1="+post1+"&zip2="+post2+"&addr1="+addr1+"&addr2="+addr2,"","scrollbars=no,toolbar=no,width=460,height=430")
}

function nullchk(frm,txt)
{
	if(frm.value =="")
	{
		alert(txt);
		frm.focus();
		return false;
	}
	else
	{
		return true;
	}

}

 function AllCheck(frm){

	var a = frm.allchk.checked;
	var X = frm.chk;
                if (!X.length){
                   X.checked = true
                }else{
	   for (i = 0;i<X.length;i++){
		X[i].checked=a;
	   }

	}
}


function check_gubn(obj)
{
    //Ã¼Å©³»¿ª¾øÀ¸¸é false ,ÀÖÀ¸¸é true 
    var X = obj;
    var gubn; 
    gubn =false
    if (!X.length){
        if(X.checked == true) {gubn=true};
    }
    else
    {
	   for (i = 0;i<X.length;i++)
       {
		if(X[i].checked== true) {gubn=true};
	   }
    }

    return gubn;

}

function file_chk(form_v)
{
	if(form_v.value != "") {                                  //ÆÄÀÏÀÌ  ¼±ÅÃµÈ °æ¿ì 
		 var strFile = form_v.value;              //ÆÄÀÏ¸í
		 var strLen  = strFile.length;                   //ÆÄÀÏ¸í ÀüÃ¼±æÀÌ  
		 var strExt  = strFile.substring(strLen-3); //ÆÄÀÏ È®ÀåÀÚ 


	//  ÀÌ¹ÌÁö¸¸ ¾÷·Îµå 
	 if ((strExt.toLowerCase() != "gif") &&
		 (strExt.toLowerCase() != "jpg") && 
		 (strExt.toLowerCase() != "bmp")) {
		 alert( strExt + "Çü½ÄÀº ¾÷·Îµå°¡ Çã¿ëµÇÁö ¾Ê´Â ÆÄÀÏÇü½ÄÀÔ´Ï´Ù.\n");
		 return false;
		 }   //End If strExt
	}

}

function nullchk(frm,txt)
{
	if(frm.value =="")
	{
		alert(txt +"±âÀÔÇØÁÖ¼¼¿ä");
		frm.focus();
		return false;
	}
	else
	{
		return true;
	}

}

String.prototype.trim = function() {
    return this.replace(/(^ *)|( *$)/g, "");
}
String.prototype.ltrim = function() {
    return this.replace(/(^ *)/g, "");
}
String.prototype.rtrim = function() {
    return this.replace(/( *$)/g, "");
}

// »õ·Î¿î À©µµ¿ì¸¦ È­¸éÁß¾Ó¿¡ ¿­±â
function openWinCenter(url, wname, wopt) {
	var newopt = "", wHeight = 0, wWidth = 0;
	if (wopt != undefined) {
		var woptlist = wopt.replace(/ /g, "").split(",");
		for (var i in woptlist) {
			if (woptlist[i].match(/^height=/i)) {
				wHeight = parseInt(woptlist[i].substr(7),10);
				if (!isNaN(wHeight)) newopt += "top=" + Math.floor((screen.availHeight - wHeight) / 2) + ",";
			}
			if (woptlist[i].match(/^width=/i)) {
				wWidth = parseInt(woptlist[i].substr(6),10);
				if (!isNaN(wWidth)) newopt += "left=" + Math.floor((screen.availWidth - wWidth) / 2) + ",";
			}
		}
	}
	return window.open(url, wname, newopt + wopt);
}

// »èÁ¦ÇÏ±â Àü¿¡ È®ÀÎÇÏ±â
function deleteData(url, idx, return_board){
	if(confirm("»èÁ¦ÇÏ½Ã°Ú½À´Ï±î?") == true) {
		location.href(url + "?idx=" + idx + "&return_board=" + return_board);
	}
	return;
}

function minlength(frm, len) {
	if(frm.value != "" && frm.value.length < len) {
		frm.value = "";
		alert(len + "ÀÚ ÀÌ»ó ÀÔ·ÂÇÏ¼¼¿ä.");
		frm.focus();
	}
}

function dataintComma(formnum) {
  
    
    num1 = formnum.length;        

        FirstNum = formnum.substr(0,1);
        FirstNum2 = formnum.substr(1,num1);
   
        if(FirstNum == "0"){
                alert("ÀÔ·Â¼ýÀÚ´Â 0 À¸·Î ½ÃÀÛÇÒ ¼ö ¾ø½À´Ï´Ù.");
        return FirstNum2;
                formnum = FirstNum2;
        }

        loop = /^\$|,/g; 
	    formnum = formnum.replace(loop, ""); 

		var fieldnum = '' + formnum;    

        if (isNaN(fieldnum)) {
        alert("¼ýÀÚ¸¸ ÀÔ·ÂÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù.");        
        return "";
        }
        else {
        var comma = new RegExp('([0-9])([0-9][0-9][0-9][,.])');
        var data = fieldnum.split('.');
        data[0] += '.';
           do {
             data[0] = data[0].replace(comma, '$1,$2');
            } while (comma.test(data[0]));

           if (data.length > 1) {
           return data.join('');
           }
           else {
           return data[0].split('.')[0];
                }
        }
}

function replaceComma(str) { // ÄÞ¸¶ ¾ø¾Ö±â 
 while(str.indexOf(",") > -1) { 
  str = str.replace(",", ""); 
 } 
 return str; 
 } 

function valid(form) {
	var filter = /[\d]{4}[-][\d]{2}[-][\d]{2}/
	var arrdate
	if (form.value == ""){
		return;
	}
	if (filter.test(form.value) == false) {
	    alert("Àß¸øµÈ Çü½ÄÀÔ´Ï´Ù.\n¿¹)2005-07-07");
		form.focus();
    }
	else {
		arrdate = form.value.split("-");
		if(chkDate(arrdate[0], arrdate[1], arrdate[2]) == false) {
			alert("Àß¸øµÈ ³¯Â¥ ÀÔ´Ï´Ù");
			form.focus();
		}
	}
}

function chkDate(y, m, d) {
	var er = 0; // ¿¡·¯ º¯¼ö
	var daa = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
	
	if (y%1000 != 0 && y%4 == 0) daa[1] = 29; // À±³â
	if (d > daa[m-1] || d < 1) er = 1; // ³¯Â¥ Ã¼Å©
	if (m < 1 || m > 12) er = 1; // ¿ù Ã¼Å©
	if (m%1 != 0 || y%1 != 0 || d%1 != 0) er = 1; // Á¤¼ö Ã¼Å©
	if (er == 1) return false;
	else return true;
}





































































































