<!--
/********************************************
* ÆÄ   ÀÏ   ¸í : common.js
* ÀÛ   ¼º   ÀÏ : 2004-09-22
* ¼ö   Á¤   ÀÏ :
* ÀÛ   ¼º   ÀÚ : KDI
* ÆÄ ÀÏ ¼³ ¸í : °øÅëÀûÀ¸·Î »ç¿ëÇÏ´Â ½ºÅ©¸³Æ®
*********************************************/

function openwindow (url,wtitle,xsize,ysize){

	var x,y, windowsize;
	x = Math.round ((screen.width - xsize)/2);
	y = Math.round ((screen.height - ysize)/2);

		windowsize = 'left='+x+',top='+y+',width=' + xsize + ', height=' + ysize + ',toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0';
		open_window = window.open(url, wtitle, windowsize );

		if(open_window != null) open_window.focus();
		if(open_window.opener == null ) open_window.opener = window;
}


/***********************************
¼³¸í : Æû¿¡¼­ °ø¹é Ã¼Å©ÇØ¼­ °ø¹éÀÌ¸é ¸Þ¼¼Áö º¸¿©Áö°í ÇØ´ç Æû°ª¿¡ Æ÷Ä¿½º
¿¹) checkSpace(frm,strMsg) checkSpace(Æû.ÀÌ¸§, ¸Þ¼¼Áö)
¸®ÅÏ) °ø¹éÀÌ¸é false °ø¹éÀÌ ¾Æ´Ï¸é true
 ****************************************/
function checkSpace(frm,strMsg){
	var str = frm.value
	if (str.search(/\S/)<0){			//\S °ø¹éÀÌ ¾Æ´Ñ ¹®ÀÚ¸¦ Ã£´Â´Ù.
		alert (strMsg);
		frm.value = "";
		frm.focus();
		return false;
	}
	var temp=str.replace(' ','');
	if (temp.length == 0){
		alert (strMsg);
		frm.value = "";
		frm.focus();
		return false;
	}
	return true;
}



/************************************************************
¼³¸í : ÀÔ·ÂÇÑ emailÀÌ ¿µ¹®ÀÚ¿Í @°ªÀÌ Á¤È®ÀÌ µé¾î°¡ ÀÖ´ÂÁö 
¿¹) checkEmail("test@test.co.kr")
°á°ú) true
¸®ÅÏ : ÀÌ¸ÞÀÏÀÌ ¸Â´Ù¸é  True , Æ²¸®´Ù¸é false
************************************************************/
function checkEmail(email){
	var str='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_';
	var flag=0;
	var comma=0;
	for(i=0; i<email.length; i++) {
		for(j=0; j<str.length; j++) {
			if(email.charAt(i)==str.charAt(j)){
				break;
			}
		}
		if(j==str.length) {
			if(email.charAt(i)=='@'){
				flag++;
			}else if(email.charAt(i)=='.'){
				comma++;
			}else{
				return false;
			}
		}
	}
	if(flag!=1){
		return false;
	}else if((comma<1)||(comma>3)){
		return false;
	}else{
		return true;
	}
}





/************************************************************
¼³¸í : ÀÔ·ÂÇÑ ¹ë·ù°ªÀÌ ¿øÇÏ´Â Ã¼Å©°ªÀÇ ´Ü¾î¶û ¸Â´ÂÄ¡ Ã¼Å©
¿¹)checkVal(Æû.ÀÌ¸§.¹ë·ù,"0123456789")  => ¹ë·ù °ªÀÌ 0~9 ±îÁö ÀÌ¸é true
°á°ú) ¹ë·ù °ªÀÌ Ã¼Å©°ª¿¡ ¼ÓÇÏ´Â ´Ü¾îÀÌ¸é true ¼ÓÇÏÁö ¾Ê´Â ´Ü¾î°¡ ÀÖÀ¸¸é false
¸®ÅÏ : ¸Â´Ù¸é  True , Æ²¸®´Ù¸é false
************************************************************/
function checkVal(val,val2,chkStr){
	for (var i=0; i <chkStr.length; i++){
		if(chkStr.indexOf(val.substring(i,i+1))<0) {
			alert('¼ýÀÚ¸¸ ÀÔ·ÂÇØÁÖ¼¼¿ä');
			eval("document."+val2+".value=''");
			//return false;
		}
	}
	return true;
}






/************************************************************
¼³¸í : Ã¼Å© ¹Ú½º, ¶óµð¿À ¹öÆ° ¼±ÅÃ Ã¼Å©
¿¹)checkRadio(Æû.ÀÌ¸§)
°á°ú) Ã¼Å© ÇÑ°Ô ÀÖ´Ù¸é true Ã¼Å©ÇÑ°Ô ¾ø´Ù¸é false
************************************************************/
function checkRadio(InputName){
	if(InputName){
		if(!InputName.length) {
			if(InputName.checked) {
				return true;
			}
		} else {
			for(i=0;i<InputName.length;i++) {
				if(InputName[i].checked) {
					return true;
				}
			}
		}
	}
	return false;
}







/************************************************************
¼³¸í : Æû Ã¼Å© ÇÔ¼ö
¿¹)checkFrm(Æû.ÀÌ¸§, "ÀÔ·Â¶õ", "", ÀÛÀº°ª, Å«°ª)
°ªÀÌ Àß¸øµÈ°Ô ÀÖ´Ù¸é false
°ªÀÌ ¿Ã¹Ù¸£´Ù¸é true
ex ) if(!checkFrm(frm.mem_name, "ÀÌ¸§", "", 1, 5)) return;
************************************************************/
function checkFrm(target, cmt, astr, lmin, lmax){
	var i;
	var t = target.value;
	
	if(t.search(/\S/)<0){
		alert(cmt + ' ÀÔ·Â¶õ¿¡ °ø¹éÀÌ ÀÖ½À´Ï´Ù. °ªÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä.');
		target.focus();
		return false;
	}

	var temp = t.replace(' ','');
	if (temp.length == 0){
		alert(cmt + ' ÀÔ·Â¶õ¿¡ °ø¹éÀÌ ÀÖ½À´Ï´Ù. °ªÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä.');
		target.focus();
		return false;
	}
	
	if(t.length < lmin || t.length > lmax){
		if (lmin == lmax) alert(cmt + ' ÀÔ·Â¶õÀº ' + lmin + ' ÀÚ ÀÌ³»·Î ÀÔ·ÂÇÏ¼Å¾ß ÇÕ´Ï´Ù');
		else alert(cmt + ' ÀÔ·Â¶õÀº ' + lmin + ' ~ ' + lmax + ' ÀÚ ÀÌ³»·Î ÀÔ·ÂÇÏ¼Å¾ß ÇÕ´Ï´Ù');
		target.focus();
		return false;
	}

	if (astr.length > 1) {
		for (i=0; i < t.length; i++){
			if(astr.indexOf(t.substring(i,i+1))<0){
				alert(cmt + ' ÀÔ·Â¶õ¿¡ Çã¿ëÇÒ ¼ö ¾ø´Â ¹®ÀÚ°¡ ÀÔ·ÂµÇ¾ú½À´Ï´Ù');
				target.focus();
				return false;
			}
		}
	}
	return true;
}







/************************************************************
¼³¸í : ÁÖ¹Î¹øÈ£ Ã¼Å© ÇÔ¼ö
¿¹)checkJumin(ÁÖ¹Î¹øÈ£)
°ªÀÌ Àß¸øµÈ°Ô ÀÖ´Ù¸é false
°ªÀÌ ¿Ã¹Ù¸£´Ù¸é true
************************************************************/
function checkJumin(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 false;
	else return true;
}



/************************************************************
¼³¸í : »õÃ¢ ¶ç¿ö¼­ Æ÷Ä¿½º ÁÖ±â
¿¹)windowOpen(url,winName,width,height,scrollbars,resizable,left,top)
windowOpen('ÁÖ¼Ò','À©µµ¿ìÀÌ¸§',500,400,'yes','no',100,100)
************************************************************/
function windowOpen(url,winName,width,height,scrollbars,resizable,left,top){
	var newWin=window.open(url,winName,"width="+width+",height="+height+",scrollbars="+scrollbars+",resizable="+resizable+",left=" + left + ",top=" + top+",directories=no,status=no,menubar=no");
	newWin.focus(); 
}



/************************************************************
¼³¸í : Æ÷Ä¿½º ÀÌµ¿ÇÏ±â
¿¹)nextFocus(thisitem,cnt,nextitem)
nextFocus('ÇØ´çitem','ÃÖ´ë±æÀÌ','¿È°Ü°¥item')
************************************************************/
function nextFocus(thisitem,cnt,nextitem) { 
   if(thisitem.value.length  == cnt) 
   nextitem.focus(); 
}



function CheckSpaces(strValue){
		var flag=true;
		
		if (strValue!="") {
			for (var i=0; i < strValue.length; i++) {
				if (strValue.charAt(i) != " ") {
					flag=false;
					break;
				}
			}
		}
		return flag;
	}

///////¹®ÀÚ¿­±æÀÌÃ¼Å©/////////////
function GetStrLen(strInput){
	var nStrLen, nStrRealLen, nPos, chTmp;

	nStrLen     = strInput.length;
	nStrRealLen = 0;

	for(nPos = 0; nPos < nStrLen; nPos++)
		{
		var nASCII = strInput.charCodeAt(nPos)
		if (nASCII > 0 && nASCII < 255)
			nStrRealLen += 1; 
		else
			nStrRealLen += 2; 
		}
	return nStrRealLen;
}

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.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 sendlogin(formname) {	
	formname.action = "/member/login.asp";
	formname.submit();
}

function send_re(Obj){
	Obj.submit();
}
//-->