function leftLogin(pfrm) {
	var frm = pfrm;

	if (frm.id.value=="")
	{
		alert("ID¸¦ ÀÔ·ÂÇÏ¼¼¿ä.");
		frm.id.focus();
		return;
	}

	if (frm.pwd.value=="")
	{
		alert("ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇÏ¼¼¿ä.");
		frm.pwd.focus();
		return;
	}

	frm.target = "tsubmit";
	frm.submit();

}

function fncSearchPage(pfrm) {
	var frm = pfrm;
	
	if (frm.keyword.value=="")
	{
		alert("°Ë»ö¾î¸¦ ÀÔ·ÂÇÏ¼¼¿ä.");
		frm.keyword.focus();
		return;
	}

	if (!(checkWord2(frm.keyword)))
	{
		frm.pg.value = '';
		frm.target = "_self";
		frm.submit();
	}

}

function checkWord(frm) 
{
	var YesCheck="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_"; 
	var string=frm.value;
	var len=string.length;
	for(i=0;i<len;i++)
	{
			
		if(YesCheck.indexOf(string.substring(i,i+1))<0)
		{
			alert("ÀÔ·ÂÇÑ ¹®ÀÚ¿¡ ¹®Á¦°¡ ÀÖ½À´Ï´Ù.\n ´Ù½Ã ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À");
			frm.value="";
			frm.focus();
			return true;
		}
	}
}

function checkWord2(frm) 
{
	var badword="`~!@#$%^&*(),'<>"; 
	var string=frm.value;
	var len=string.length;
	for(i=0;i<len;i++)
	{
			
		if(badword.indexOf(string.substring(i,i+1))>0)
		{
			alert("Æ¯¼ö¹®ÀÚ´Â ÀÔ·ÂÇÏ½Ç¼ö ¾ø½À´Ï´Ù.\n ´Ù½Ã ÀÔ·ÂÇØ ÁÖ½Ê½Ã¿À");
			frm.value="";
			frm.focus();
			return true;
		}
	}
}

function emailCheck(frm) {
	var temp = frm.value;
	if (temp.indexOf("@",0) < 1 || temp.indexOf(".",0) < 3 || temp.indexOf("'",0) != -1 || temp.indexOf("%",0) != -1 || temp.indexOf(" ",0) != -1)
	{
		alert("¹Ù¸¥ ÀÌ¸ÞÀÏÁÖ¼Ò¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
		frm.value="";
		frm.focus();
		return true;
	}
}

function popup(wid,hei,url){
	    var width = wid;
	    var height = hei;
		var x, y;
		var screen_width  = screen.width;
		var screen_height = screen.height;
		x = (screen_width  / 2) - (width  / 2);
		y = (screen_height / 2) - (height / 2);
		pop = window.open ( url,"friend","width=" + width + ", height=" + height + ", left=" + x + ", top=" + y + ", toolbar=no, status=no, menubar=no, scrollbars=no, resizable=no");
		pop.focus();
		return;
}

function textLengthLimit(theField, theLimit, message)
{
	if (theField.value.length > theLimit)
	{
		alert(message + " " + theLimit + "ÀÚ±îÁö¸¸ ¾µ ¼ö ÀÖ½À´Ï´Ù.");
		theField.value = theField.value.substring(0, theLimit);
		return;			
	}
} 

function fileExtCheck(param)
{
  var form			=	 param.value;
  var b_filename	=	 form.split(".");

  if(form.split(" ").join("") != "") {
	  if( b_filename[b_filename.length-1].toLowerCase() == "bak" || b_filename[b_filename.length-1].toLowerCase() == "exe" || b_filename[b_filename.length-1].toLowerCase() != "bat" || b_filename[b_filename.length-1].toLowerCase() != "vbs" || b_filename[b_filename.length-1].toLowerCase() != "asp" ) {
		alert("µî·ÏÇÏ½Ç¼ö ¾ø´Â ÆÄÀÏÀÔ´Ï´Ù.");
		param.value = "";
		param.focus();
		return false;
	  }
	  else
		  return true;
  }
  else
  {
	   return true;
  }
}

function windowClose() {
	window.close();
}

function login() {
	alert("·Î±×ÀÎÀÌ ÇÊ¿ä ÇÕ´Ï´Ù.");
	location.replace("login.asp");
}

function logOut() {
	location.replace("logOut.asp");
}

function fncModify() {
	document.pFrm.mode.value = "modify";
	pFrm.action = "regist.asp";
	pFrm.submit();		
}

function emailCheck(frm) {
	var temp = frm.value;
	if (temp.indexOf("@",0) < 1 || temp.indexOf(".",0) < 3 || temp.indexOf("'",0) != -1 || temp.indexOf("%",0) != -1 || temp.indexOf(" ",0) != -1)
	{
		alert("¹Ù¸¥ ÀÌ¸ÞÀÏÁÖ¼Ò¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä");
		frm.value="";
		frm.focus();
		return true;
	}
}

function onlyNumber(input){
  var code = window.event.keyCode;
  if ((code > 34 && code < 41) || (code > 47 && code < 58) || (code > 95 && code < 106) || code == 8 || code == 9 || code == 13 || code == 46) {
    window.event.returnValue = true;
    return;
  }
  alert('¼ýÀÚ¸¸ ÀÔ·ÂÀÌ °¡´ÉÇÕ´Ï´Ù');
input.value = "";
input.focus();
  window.event.returnValue = false;
}

function lenToTab(frm, src, len, dst){
    try{
        var source = document.getElementById(src);
        var target = document.getElementById(dst);

        if(source.value.length == len){
            target.focus();
            return;
        }
    }catch(e){
        alert('ÀÌµ¿ÇÒ ¿ä¼Ò¸¦ Ã£À» ¼ö ¾ø½À´Ï´Ù.');
        return;
    }
}

function valid_digit_dash(input) //¼ýÀÚ¿Í -¸¸ °¡´É ¾Æ¶ì
{ 
    if(!fTrim(input.value)) return false; 
	var error_c=0, i, val; 
    for(i=0;i<valid_byte(input);i++) { 
        val = input.charAt(i); 
        if(!((val>='0' && val<='9') || (val=='-'))) {
			input.value = "";
			input.focus();
			return false; 
		}
   } 
   return true; 
}

function valid_digit(input)  //ÀÌ°Íµµ ¼­ºñ½Á°¡ÀÔÆû ¶«¿¡ ¸¸µé¾ú´Ù.
{
    if(!fTrim(input.value)) return false; 
    var error_c=0, i, val; 
    for(i=0;i<valid_byte(input.value);i++) { 
        val = input.value.charAt(i); 
        if(!(val>='0' && val<='9')) {
			input.value = "";
			input.focus();
			return false; 
		}
   } 
   return true; 
}

function valid_byte(input) 
{ 
    var i, j=0; 
    for(i=0;i<input.length;i++) { 
        val=escape(input.charAt(i)).length; 
        if(val== 6) j++; 
        j++; 
    } 
    return j; 
}

function fTrim(string) 
{ 
    for(;string.indexOf(" ")!= -1;){ 
        string=string.replace(" ","");
		string=string.replace("\n","");
    } 
    return string; 
}

function isValidDate(fromObj , toObj) {
	if ( Date.parse(fromObj.value.replace('-','/')) <= Date.parse(toObj.value.replace('-','/')) ) return true;
	else return false;
}

/**
 * ÀÔ·Â°ªÀÌ ¼ýÀÚ,´ë½Ã(-)·Î µÇ¾îÀÖ´ÂÁö Ã¼Å©
 */
function isNumDash(input) {
    var chars = "-0123456789";
    for (var inx = 0; inx < input.value.length; inx++) {
       if (chars.indexOf(input.value.charAt(inx)) == -1)
           return false;
    }
    return true;
}

function handlerNum()
{

	e = window.event; //À©µµ¿ìÀÇ event¸¦ Àâ´Â°ÍÀÔ´Ï´Ù. ±×³É ½áÁÖ½ÉµË´Ï´ç.
	//¼ýÀÚ¿­ 0 ~ 9 : 48 ~ 57, Å°ÆÐµå 0 ~ 9 : 96 ~ 105 ,8 : backspace, 46 : delete -->Å°ÄÚµå°ªÀ» ±¸ºÐÇÕ´Ï´Ù. Àú°ÍµéÀÌ ¼ýÀÚ¶ø´Ï´Ù.
	if(e.keyCode >= 48 && e.keyCode <= 57 || e.keyCode >= 96 && e.keyCode <= 105 || e.keyCode == 8 || e.keyCode == 46 || e.keyCode == 9)
	{
		if(e.keyCode == 48 || e.keyCode == 96)//0À» ´­·¶À»°æ¿ì
		{
		   // if(txtMileage.value == "" ) //¾Æ¹«°Íµµ ¾ø´Â»óÅÂ¿¡¼­ 0À» ´­·¶À»°æ¿ì
			//    e.returnValue=false; //-->ÀÔ·ÂµÇÁö¾Ê´Â´Ù.
		  //  else //´Ù¸¥¼ýÀÚµÚ¿¡¿À´Â 0Àº
			 //   return; //-->ÀÔ·Â½ÃÅ²´Ù.
		}
		else //0ÀÌ ¾Æ´Ñ¼ýÀÚ
			return; //-->ÀÔ·Â½ÃÅ²´Ù.
	}
	else //¼ýÀÚ°¡ ¾Æ´Ï¸é ³ÖÀ»¼ö ¾ø´Ù.
		e.returnValue=false;
}

//2009-10-30 ¼¿·ºÆ®¹Ú½ºÀÇ ¼±ÅÃµÈ °ªÀ» °¡Áö°í ¿Â´Ù.

function getISelectBoxValue(arg)  {
	var x= arg;
	return x.options[x.selectedIndex].value;
}



function payForm() {
		StartSmartUpdate();
        if( document.Payplus.object == null )
        {
			location.replace("/comm/pay.asp");
		}else {
			location.replace("/comm/payForm.asp");
		}

}
