// Flash Embed ½ºÅ©¸³Æ® -- »ç¿ë¿¹ : <script>swf("/images/flash/a.swf", 100, 50) 
function swf(src, w, h) {
	var src_arr = src.split("/");
	var src_file = src_arr[src_arr.length -1]
	var src_id = src_file.substr(0,src_file.length-4);
	//alert(src_id);

	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=8,0,0,0" id="'+src_id+'" 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="wmode" value="transparent">';
	html += '<param name="swliveconnect" value="true">';
	html += '<embed src="'+src+'" quality=high bgcolor="#ffffff" width="'+w+'" height="'+h+'" swliveconnect="true" id="'+src_id+'" name="'+src_id+'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"><\/embed>';
	html += '<\/object>';
	document.write(html);
}

// BASIC SCRIPT
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_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

// onmouseover effect
function bt(id,after) 
{ 
eval(id+'.filters.blendTrans.stop();'); 

eval(id+'.filters.blendTrans.Apply();'); 

eval(id+'.src="'+after+'";'); 

eval(id+'.filters.blendTrans.Play();'); 
}

// LAYER SHOW HIDE
function news(stat){
	if (stat == 1){ 
		document.all.news1.style.display = "block"; 
		document.all.news2.style.display = "none"; 
		document.all.news3.style.display = "none"; 
	} else if (stat == 2){  
		document.all.news1.style.display = "none"; 
		document.all.news2.style.display = "block"; 
		document.all.news3.style.display = "none"; 
	} else if (stat == 3){  
		document.all.news1.style.display = "none"; 
		document.all.news2.style.display = "none"; 
		document.all.news3.style.display = "block"; 
	} 
}

function webzin(stat){
	if (stat == 1){ 
		document.all.webzin1.style.display = "block"; 
		document.all.webzin2.style.display = "none"; 
	} else if (stat == 2){  
		document.all.webzin1.style.display = "none"; 
		document.all.webzin2.style.display = "block"; 
	}
}

function info(stat){
	if (stat == 1){ 
		document.all.info1.style.display = "block"; 
		document.all.info2.style.display = "none"; 
		document.all.info3.style.display = "none"; 
		document.all.info4.style.display = "none"; 
		document.all.info5.style.display = "none"; 
		document.all.info6.style.display = "none"; 
	} else if (stat == 2){  
		document.all.info1.style.display = "none"; 
		document.all.info2.style.display = "block"; 
		document.all.info3.style.display = "none"; 
		document.all.info4.style.display = "none"; 
		document.all.info5.style.display = "none"; 
		document.all.info6.style.display = "none";
	} else if (stat == 3){  
		document.all.info1.style.display = "none"; 
		document.all.info2.style.display = "none"; 
		document.all.info3.style.display = "block"; 
		document.all.info4.style.display = "none"; 
		document.all.info5.style.display = "none"; 
		document.all.info6.style.display = "none";
	}  else if (stat == 4){  
		document.all.info1.style.display = "none"; 
		document.all.info2.style.display = "none"; 
		document.all.info3.style.display = "none"; 
		document.all.info4.style.display = "block"; 
		document.all.info5.style.display = "none"; 
		document.all.info6.style.display = "none";
	}  else if (stat == 5){  
		document.all.info1.style.display = "none"; 
		document.all.info2.style.display = "none"; 
		document.all.info3.style.display = "none"; 
		document.all.info4.style.display = "none"; 
		document.all.info5.style.display = "block"; 
		document.all.info6.style.display = "none";
	} else if (stat == 6){  
		document.all.info1.style.display = "none"; 
		document.all.info2.style.display = "none"; 
		document.all.info3.style.display = "none"; 
		document.all.info4.style.display = "none"; 
		document.all.info5.style.display = "none"; 
		document.all.info6.style.display = "block";
	}
}

// ±âº» ÆË¾÷Ã¢
function view_open(url,name,features) { 
    window.open(url,name,features);
}


// 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()
}


// °ø¹é 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_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;
	}
}



// 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;
    }
}

function notice(){
	alert("¸ÕÀú Ä¿¹Â´ÏÆ¼¸¦ ¼±ÅÃÇÏ¿© ÁÖ¼¼¿ä");
}


//¼¼ºÎÆäÀÌÁö ½ºÅ©·Ñ Á¦°Å
function ReSizeIframe() 
{ 
	td_iframe.height = boardframe.document.body.scrollHeight; 
	td_iframe.width = boardframe.document.body.scrollWidth; 
} 


// ¹è³Ê½ºÅ©·Ñ

var bNetscape4plus = (navigator.appName == "Netscape" && navigator.appVersion.substring(0,1) >= "4");
var bExplorer4plus = (navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.substring(0,1) >= "4");

function CheckUIElements()
{
        var yMenuFrom, yMenuTo, yButtonFrom, yButtonTo, yOffset, timeoutNextCheck;

        if ( bNetscape4plus ) { // ³×Ã÷ÄÉÀÌÇÁ ¿ë ¼³Á¤
                //yButtonFrom = document["divLinkButton"].top;
                //yButtonTo   = top.pageYOffset + top.innerHeight - 55;
                yMenuFrom   = document["divMenu"].top;
                yMenuTo     = top.pageYOffset + 5;   // À§ÂÊ À§Ä¡
        }
       else if ( bExplorer4plus ) {  // IE ¿ë ¼³Á¤
                //yButtonFrom = parseInt (divLinkButton.style.top, 10);
                //yButtonTo   = document.body.scrollTop + document.body.clientHeight - 55;
                yMenuFrom   = parseInt (divMenu.style.top, 10);
                yMenuTo     = document.body.scrollTop + 190; // À§ÂÊ À§Ä¡
        }

        timeoutNextCheck = 500;

        if ( Math.abs (yButtonFrom - (yMenuTo + 152)) < 6 && yButtonTo < yButtonFrom ) {
                setTimeout ("CheckUIElements()", timeoutNextCheck);
                return;
        }


        if ( yButtonFrom != yButtonTo ) {
                yOffset = Math.ceil( Math.abs( yButtonTo - yButtonFrom ) / 10 );
                if ( yButtonTo < yButtonFrom )
                        yOffset = -yOffset;

                if ( bNetscape4plus )
                        document["divLinkButton"].top += yOffset;
                else if ( bExplorer4plus )
                        divLinkButton.style.top = parseInt (divLinkButton.style.top, 10) + yOffset;

                timeoutNextCheck = 10;
        }
        if ( yMenuFrom != yMenuTo ) {
                yOffset = Math.ceil( Math.abs( yMenuTo - yMenuFrom ) / 20 );
                if ( yMenuTo < yMenuFrom )
                        yOffset = -yOffset;

                if ( bNetscape4plus )
                        document["divMenu"].top += yOffset;
                else if ( bExplorer4plus )
                        divMenu.style.top = parseInt (divMenu.style.top, 10) + yOffset;

                timeoutNextCheck = 10;
        }

        setTimeout ("CheckUIElements()", timeoutNextCheck);
}

function OnLoad()
{
        var y;


        // ÆäÀÌÁö ·Îµù½Ã Æ÷Áö¼Ç
        if ( bNetscape4plus ) {
                document["divMenu"].top = top.pageYOffset + 135;
                document["divMenu"].visibility = "visible";
        }
        else if ( bExplorer4plus ) {
                divMenu.style.top = document.body.scrollTop + 135;
                divMenu.style.visibility = "visible";
        }

        // initializing UI update timer
        CheckUIElements();
        return true;
}

/* ÆäÀÌÁö ÀÌµ¿ */

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

/* ÆÐ¹Ð¸®»çÀÌÆ® ¹Ù·Î°¡±â */

function MM_jumpMenu(targ,selObj,restore){ //v3.0
	window.open(selObj.options[selObj.selectedIndex].value);
}

function pagego(ob) {
	document.frm.Page.value=ob;
	document.frm.submit();

}


/* »çÀÌÆ® °Ë»ö */
function search_list(){
	location.href='/search_list.asp?search='+ document.all.search.value;
}

function search_key(){
	if(window.event.keyCode ==13)
		search_list();
}