// Flash Embed ½ºÅ©¸³Æ® -- »ç¿ë¿¹ : <script>embed_flash("/images/flash/a.swf", 100, 50) 
function swf(src, w, h) {
	html = '';
	html += '<object type="application/x-shockwave-flash" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" id="param" width="'+w+'" height="'+h+'">';
	html += '<param name="movie" value="'+src+'">';
	html += '<param name="quality" value="high">';
	html += '<param name="bgcolor" value="#ffffff">';
	html += '<param name="swliveconnect" value="true">';
	html += '<embed src="'+src+'" quality=high bgcolor="#ffffff" width="'+w+'" height="'+h+'" swliveconnect="true" id="param" name="param" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"><\/embed>';
	html += '<\/object>';
	document.write(html);
}


// °ø¹é check(space Ã³¸®)
// null => true
function chk_null(toCheck) 
{
    for (var i = 0; i < toCheck.length; i++)
        if (toCheck.substring(i, i+1) != " ") return false;
        
    return true;
}

// °ø¹é check (°ªÀÌ ¾øÀ»°æ¿ì true)
// null => true
function chk_null2(toCheck)
{
    var chkstr = toCheck + "";
        
    if ((chkstr == "") || (chkstr == null)) 
    {
        return true;
    }

    return false;
}

// ¼ýÀÚ check
function chk_num1(toCheck) 
{
   for (j = 0; j < toCheck.length ; j++)
   {
      if ( (toCheck.substring(j,j+1) < "0") || (toCheck.substring(j,j+1) > "9") ) return false;
   }
   return true;
}


// ¼ýÀÚ, ".", "-" ¸¸ Á¸ÀçÇÏ¸é true
function chk_num2(toCheck) 
{
   for (j = 0; j < toCheck.length ; j++) 
   {
      if ( (toCheck.substring(j,j+1) < "0") || (toCheck.substring(j,j+1) > "9") ) 
      {
         if ( (toCheck.substring(j,j+1) == ".") || (toCheck.substring(j,j+1) == "-") ) continue;
         return false;
      }
   }
   
   return true;
}

// ¼ýÀÚ, "-" ¸¸ Á¸ÀçÇÏ¸é true

function chk_num3(toCheck) 
{
   for (j = 0; j < toCheck.length ; j++) 
   {
      if ( (toCheck.substring(j,j+1) < "0") || (toCheck.substring(j,j+1) > "9") ) 
      {
         if (toCheck.substring(j,j+1) == "-") continue;
         return false;
      }
   }
   
   return true;
}

// ÇÑ±Û check
function chk_hangul(toCheck) 
{
    var str = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890`!@#$%^&*()-=_+~[]\{}|,./<>?";
    
    for (i=0; i< toCheck.length; i++)
    {
        idcheck = toCheck.charAt(i);
        
        for ( j = 0 ;  j < str.length ; j++)
        {
        
            if (idcheck == str.charAt(j)) break;
                
            if (j+1 == str.length)
            {
                return false;
            }
        }
    }
    return true;
}

//¿µ¾î,¼ýÀÚ, _ ¸¸ °¡´É
function chk_hangul2(toCheck) 
{
    var str = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890_";
    
    for (i=0; i< toCheck.length; i++)
    {
        idcheck = toCheck.charAt(i);
        
        for ( j = 0 ;  j < str.length ; j++)
        {
        
            if (idcheck == str.charAt(j)) break;
                
            if (j+1 == str.length)
            {
                return false;
            }
        }
    }
    return true;
}

// ÇÑ±Û, ¿µ¹®¸¸ ÀÔ·Â°¡´É
function chk_hangul3(toCheck) 
{
    var str = "1234567890`!@#$%^&*()-=_+~[]\{}|,./<>?";
    
    for (i=0; i< toCheck.length; i++)
    {
        idcheck = toCheck.charAt(i);
        
        for ( j = 0 ;  j < str.length ; j++)
        {
            if (idcheck == str.charAt(j)){
				return false;
			}                
            if (j+1 == str.length) break;
        }
    }
    return true;
}


// Email check
function chk_mail(toCheck) 
{
    // @Ç¥½Ã È®ÀÎ
    if (toCheck.indexOf('@') == -1 ) 
    { 
        return false; 
    }

    // .Ç¥½Ã È®ÀÎ
    if (toCheck.indexOf('.') == -1 ) 
    { 
        return false; 
    }
    
    // ÇÑ±Û È®ÀÎ
    if ( chk_hangul(toCheck) == false ) 
    { 
        return false; 
    }
    
    return true;
}


// ³¯ÀÚ check
function chk_date(toCheck) 
{
    var isDate = true;
   
    if (toCheck.length != 8) 
        return false;

    var year = toCheck.substring(0, 4);
    var month = toCheck.substring(4, 6);
    var day = toCheck.substring(6, 8);
    
    if (chk_yyyy(year) != true) 
    {
         isDate = false;
    }
    else if (chk_mm(month) != true) 
    {
         isDate = false;
    }
    else if (chk_dd(year, month, day) != true) 
    {
         isDate = false;
    }

    return isDate;
}


// ³â check
function chk_yyyy(toCheck) 
{
    return ( ( toCheck.length == 4 ) && ( chk_num(toCheck) ) && ( toCheck != "0000" ) );
}


// ¿ù check
function chk_mm(toCheck) 
{
    return ( ( toCheck.length > 0) && ( chk_num(toCheck) ) && ( 0 < eval(toCheck) ) && ( eval(toCheck) < 13) );
}


// ÀÏ check
function chk_dd(yyyy, mm, toCheck) 
{
    var isYMD = false;
    var monthDD = new montharr(31,28,31,30,31,30,31,31,30,31,30,31);
    var im = eval(mm) - 1;

    if ( toCheck.length == 0 )  return false;
    if ( !chk_num(toCheck)  )  return false;

    var dd = eval(toCheck);

    if ( ( (yyyy%4 == 0) && (yyyy%100 != 0) ) || (yyyy%400 == 0) ) 
    {
        monthDD[1] = 29;
    }

    if ( (0 < dd) && (dd <= monthDD[im]) ) 
        isYMD = true;

    return isYMD;
}


// ¿ùº°·Î ¸¶Áö¸· ³¯ÀÚ¸¦ Setting
// chk_dd¿¡¼­ »ç¿ëÇÔ
function montharr(m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11) 
{
    this[0] = m0;
    this[1] = m1;
    this[2] = m2;
    this[3] = m3;
    this[4] = m4;
    this[5] = m5;
    this[6] = m6;
    this[7] = m7;
    this[8] = m8;
    this[9] = m9;
    this[10] = m10;
    this[11] = m11;
}


// ¿ù,ÀÏÀÌ 1ÀÚ¸®¼öÀÏ°æ¿ì - ¾ÕÀÚ¸®¿¡ "0" setting. (°ªÀ» ºñ±³ÇÏ±â À§ÇØ)
function set_zero( num ) 
{
    if (num.length == 1)
        num = "0" + num;

    return num;
}

// ½ÃÀÛ³¯ÀÚ¿Í ¸¶Áö¸·³¯ÀÚ ¼ø¼­ check
function checkDate2( s_yy, s_mm, s_dd, e_yy, e_mm, e_dd ) 
{
    var isDate = true;

    s_mm = set_zero( s_mm );
    s_dd = set_zero( s_dd );
    e_mm = set_zero( e_mm );
    e_dd = set_zero( e_dd );

    var start_date  = s_yy + s_mm + s_dd;
    var end_date = e_yy + e_mm + e_dd;

    if ( start_date > end_date ) 
    {
         isDate = false;
    }  

    return isDate;
}


// ÁÖ¹Î¹øÈ£ check
function chk_juminno(obj) 
{
	if (obj.length == 14) {
        var calStr1 = "2345670892345", biVal = 0, tmpCal, restCal;

        for (i=0; i <= 12; i++) {
                if (obj.substring(i,i+1) == "-") {
                        tmpCal = 1;
                }
                else {
                        biVal = biVal + (parseFloat(obj.substring(i,i+1)) * parseFloat(calStr1.substring(i,i+1)));
                }
        }

        restCal = 11 - (biVal % 11);

        if (restCal == 11) {
                restCal = 1;
        }

        if (restCal == 10) {
                restCal = 0;
        }
        if (restCal == parseFloat(obj.substring(13,14))) {
                return true;
        }
        else {
                return false;
        }
	}
	else {
		return false;
	}
}


function chk_length(str,len) 
{ 
    char_cnt = 0;
    for(var i = 0; i < str.length; i++)
    {
        var chr = str.substr(i,1);
        chr = escape(chr);
        key_eg = chr.charAt(1);
        // key_eg °¡ u ÀÌ¸é ÇÑ±Û , °ø¹éÀÌ¸é ¿µ¹® , ¼ýÀÚ¸é Æ¯¼ö¹®ÀÚ

        switch (key_eg)
        {
            case "u":
            key_num = chr.substr(2,(chr.length-1));
            if((key_num < "AC00") || (key_num > "D7A3"))
            {
                alert("Àß¸øµÈ ÀÔ·ÂÀÔ´Ï´Ù");
                return false;
            }
            else
            {
                char_cnt = char_cnt + 2;
            }
            break;

            case "B":
            char_cnt = char_cnt + 2;
            break;

            case "A":
            alert("Àß¸øµÈ ÀÔ·ÂÀÔ´Ï´Ù");
            return false;
            break;

            default:
            char_cnt = char_cnt + 1;
        }
    }
    
    if( char_cnt >= len )
        return false;
    else
        return true;
}


function chk_length2(str,max_len,min_len) 
{ 
    char_cnt = 0;
    for(var i = 0; i < str.length; i++)
    {
        var chr = str.substr(i,1);
        chr = escape(chr);
        key_eg = chr.charAt(1);
        // key_eg °¡ u ÀÌ¸é ÇÑ±Û , °ø¹éÀÌ¸é ¿µ¹® , ¼ýÀÚ¸é Æ¯¼ö¹®ÀÚ

        switch (key_eg)
        {
            case "u":
            key_num = chr.substr(2,(chr.length-1));
            if((key_num < "AC00") || (key_num > "D7A3"))
            {
                alert("Àß¸øµÈ ÀÔ·ÂÀÔ´Ï´Ù");
                return false;
            }
            else
            {
                char_cnt = char_cnt + 2;
            }
            break;

            case "B":
            char_cnt = char_cnt + 2;
            break;

            case "A":
            alert("Àß¸øµÈ ÀÔ·ÂÀÔ´Ï´Ù");
            return false;
            break;

            default:
            char_cnt = char_cnt + 1;
        }
    }
    
    if( (char_cnt > max_len) || (char_cnt < min_len))
        return false;
    else
        return true;
}

// strÀÇ ±æÀÌ°¡ len°ú ´Ù¸£¸é false
function chk_length3(str,len) 
{ 
	if( str.length != len)
        return false;
    else
        return true;
}

// form check
// <input> tag¿¡ ¾Æ·¡»çÇ×À» check
// text : ÇØ´ç column ÀÌ¸§
// notnull : null check
// check
// - number : ¼ýÀÚ check
// - date : ³¯ÀÚ check
// - mail : ¸ÞÀÏ check
// - juminno : ÁÖ¹Î¹øÈ£ check
function chk_form(form) 
{
    var inx = 0; // À§Ä¡

    for ( ; inx < form.length; inx++)
    {
        //alert(inx);
        var column = form.elements[inx];
        
        var text = column.text;

        if ( (column.type == "text") || 
             (column.type == "password") || 
             (column.type == "textarea") ||
             (column.type == "file") )
        {
            // ÇÊ¼öÇ×¸ñ check
            if ( (column.notnull == "") && (chk_null(column.value)) ) 
            {
                alert (text + "Àº(´Â) ÇÊ¼öÇ×¸ñÀÔ´Ï´Ù");
                column.focus();
                return false;
            }
            
            // nullÀÌ ¾Æ´Ï¸é check
            if( !chk_null(column.value) )
            {
                // ÇüÅÂ check
                if ( (column.check == "number") && (!chk_num1(column.value)) )
                {
                    alert (text + "À»(¸¦) ¼ýÀÚ·Î ÀÔ·ÂÇÏ¼¼¿ä");
                    column.focus();
                    return false;
                }
				
                else if ( (column.check == "date") && (!chk_date(column.value)) )
                {
                    alert (text + "À»(¸¦) ³¯ÀÚ·Î ÀÔ·ÂÇÏ¼¼¿ä");
                    column.focus();
                    return false;
                }
                else if ( (column.check == "mail") && (!chk_mail(column.value)) )
                {
                    alert ("¿Ã¹Ù¸¥ ¸ÞÀÏÁÖ¼Ò°¡ ¾Æ´Õ´Ï´Ù.");
                    column.focus();
                    return false;
                }
                else if ( (column.check == "juminno") && (!chk_juminno(column.value)) )
                {
                    alert ("¿Ã¹Ù¸¥ ÁÖ¹Î¹øÈ£°¡ ¾Æ´Õ´Ï´Ù.");
                    column.focus();
                    return false;
                }
                else if ( (column.check == "length") && (!chk_length(column.value,column.hlength)) )
                {
                    alert (column.hlength+"ÀÚ±îÁö ÀÔ·Â°¡´ÉÇÕ´Ï´Ù.");
                    column.focus();
                    return false;
                }

                else if ( (column.check == "length3") && (!chk_length3(column.value,column.hlength) || !chk_num1(column.value)) )
                {
                    alert (text + "´Â(Àº) " + column.hlength + "±ÛÀÚÀÇ ¼ýÀÚ·Î ÀÔ·ÂÇÏ¼¼¿ä.");
                    column.focus();
                    return false;
                }

				else if ( (column.check == "hangul") && (!chk_hangul2(column.value)) )
                {
                    alert (text + " ´Â(Àº) ¿µ¹®,¼ýÀÚ,'_'¸¸ ÀÔ·Â°¡´ÉÇÕ´Ï´Ù.");
                    column.focus();
                    return false;
                }
				else if ( (column.check == "hangul2") && (!chk_hangul3(column.value)) )
                {
                    alert (text + " ´Â(Àº) ¿µ¹®,ÇÑ±Û¸¸ ÀÔ·Â°¡´ÉÇÕ´Ï´Ù.");
                    column.focus();
                    return false;
                }
				else if ( (column.check2 == "length2") && (!chk_length2(column.value,column.maxlen,column.minlen)) )
                {
                    alert (text + " ´Â(Àº) "+ column.minlen + " ~ " + column.maxlen +"ÀÚ±îÁö ÀÔ·Â°¡´ÉÇÕ´Ï´Ù");
                    column.focus();
                    return false;
                }
				else if ( (column.check == "number3") && (!chk_num3(column.value)) )
                {
                    alert (text + " ´Â(Àº) ¼ýÀÚ,'-'¸¸ ÀÔ·Â°¡´ÉÇÕ´Ï´Ù.");
                    column.focus();
                    return false;
                }

            }
        }
    }
  
    return true;
}

// object°¡ nullÀÎÁö check
function chk_null_obj(Obj) 
{
    var check = false;
    var Radio = Obj;

    if (!Radio) return check;

    if (Radio.length) 
    {
        for ( var i=0; i<Radio.length; i++ ) 
        {
            if ( Radio[i].checked == 1 ) 
            {
                check = true;
                break;
            }
        }
    }
    else
    {
        if ( Radio.checked == 1 ) 
        {
            check = true;
        }
    }

    return check
}


// ¸ðµç object¸¦ checkÇÔ
function CheckAll(Obj) 
{
    var Radio = Obj.form.file;

    if (!Radio) return;

    if (Radio.length) 
    {
        for ( var i=0; i<Radio.length; i++ )
            Obj.form.file[i].checked=1;
    }
    else 
    {
        Obj.form.file.checked=1;
    }
}


// ¸ðµç object¸¦ uncheckÇÔ 
function UnCheckAll(Obj) 
{
    var Radio = Obj.form.file;

    if (!Radio) return;

    if (Radio.length) 
    {
        for ( var i=0; i<Radio.length; i++ )
            Obj.form.file[i].checked=0;
    }
    else 
    {
        Obj.form.file.checked=0;
    }
}

// window ¶ç¿ì±â
function open_win(URL, name, width, height) 
{
    msgWindow=window.open(URL,name,'location=0,toolbar=no,width='+width+',height='+height+',directories=no,status=no,scrollbars=Yes,resizable=no,menubar=no,border=0');
    msgWindow.focus()
}

// window ¶ç¿ì±â, no scroll
function open_win1(URL, name, width, height) 
{
    msgWindow=window.open(URL,name,'location=0,toolbar=no,width='+width+',height='+height+',directories=no,status=no,scrollbars=No,resizable=no,menubar=no,border=0');
    msgWindow.focus()
}

// window ¶ç¿ì±â
function open_win_XY(URL, name, width, height) 
{
    msgWindow=window.open(URL,name,'location=0,toolbar=no,width='+width+',height='+height+',directories=no,status=no,scrollbars=Yes,resizable=Yes,menubar=no,border=0,screenX=0,screenY=0');
    msgWindow.focus()
}

// ±âº» ÆË¾÷Ã¢
function view_open(url,name,features) { 
    window.open(url,name,features);
}

/********************************************************************
    ¼³¸í : Ã¼Å©¹Ú½º ÀÏ°ý ¼±ÅÃÇÏ±â
    Input : ÀüÃ¼¼±ÅÃcheckbox, ´ë»ócheckbox, form name
    Output :
*********************************************************************/
// ´ë»ó checkbox¿¡ index°¡ ¾ø´Â °æ¿ì  
function check_all( source, target, form_name)
{
    var is_checked = true;
   
    q_check = form_name(target);

    if( q_check == null ) // ¾ø´Â °æ¿ì
    {
        alert('°Ë»öÈÄ ¼±ÅÃÇÏ¼¼¿ä.');
        return false;
    }

    if(source.checked)
        is_checked = false;
    
    // ¿©·¯°³ÀÏ °æ¿ì
    if( q_check.length > 0 )
    {    
        for(var i=0;i<q_check.length;i++)
        {
            if(is_checked)
                q_check[i].checked=false;
            else
                q_check[i].checked=true;
        }
    }
    else // ÇÑ°³ÀÏ°æ¿ì
    {
        if(is_checked)         
            q_check.checked=false;
        else
            q_check.checked=true;
    }
}
// ´ë»ó checkbox¿¡ index°¡ ÀÖ´Â °æ¿ì
// ins_estimateÀÇ CheckAll_defaultÂüÁ¶


//----¿À´ÃÀÌÀü ³¯Â¥ ¼±ÅÃºÒ°¡------
function check_today(y,m,d){
	var today = new Date();
	var year = today.getYear();
	var month = today.getMonth() + 1;
	var date = today.getDate();

	if( (y < year) || (m < month) || (d < date) ){
		alert ("¿À´ÃÀÌÀüÀÇ ³¯Â¥´Â ¼±ÅÃÇÒ ¼ö ¾ø½À´Ï´Ù.");
		return false;
	}
	return true;
}


// °è¿­ »çÀÌÆ® ¹Ù·Î°¡±â
function _jumpPage(url,target){ 
if (url != null && url != '') {       
	if (target=='_blank') {
		window.open(url,'_blank');     
	}else {
		window.location=url;
	}
}
}



// »çÁø È®´ë º¸±â
<!--


//ÀÌ¹ÌÁö°¡ Å¬°æ¿ì ¸µÅ©°¡ °É·ÁÀÖ¾î¼­ º» Å©±â·Î º¸¿©ÁØ´Ù.	
var imgObj = new Image();
function viewImg(imgName)
{
		imgObj.src = imgName;
		setTimeout("createImgWin(imgObj)", 100);
}
function createImgWin(imgObj)
{
		if(!imgObj.complete){
				setTimeout("createImgWin(imgObj)", 100);
				return;
}

imageWin = window.open("","imageWin", "width="+imgObj.width+",height="+imgObj.height);
imageWin.document.write("<html><body style='margin:0'>");
imageWin.document.write("<img src='"+imgObj.src+"' onclick='window.close()' style='cursor:hand' alt='´©¸£¸é ´ÝÈü´Ï´Ù.'>");
imageWin.document.write("</body></html>");
imageWin.document.title = "»çÁø È®´ë º¸±â";
}
//-->

