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 + 50;
        }
        else if ( bExplorer4plus ) {
                //yButtonFrom = parseInt (divLinkButton.style.top, 10);
                //yButtonTo   = document.body.scrollTop + document.body.clientHeight - 55;
                yMenuFrom   = parseInt (divMenu.style.top, 10);
                yMenuTo     = document.body.scrollTop + document.body.clientHeight - 70;
        }

        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;

        // we're not gonna be loaded in frames
//        if ( top.frames.length )
//                top.location.href = self.location.href;

        // setting initial UI elements positions
        if ( bNetscape4plus ) {
                document["divMenu"].top = top.pageYOffset + 50;
                document["divMenu"].visibility = "visible";
                //document["divLinkButton"].top = top.pageYOffset + top.innerHeight - 55;
                //document["divLinkButton"].visibility = "visible";
        }
        else if ( bExplorer4plus ) {
                divMenu.style.top = document.body.scrollTop + document.body.clientHeight - 90 ;
                divMenu.style.visibility = "visible";
                //divLinkButton.style.top = document.body.scrollTop + document.body.clientHeight - 55;
                //divLinkButton.style.visibility = "visible";
        }

        // initializing UI update timer
        CheckUIElements();
        //if ( bExplorer4plus )
        //        setTimeout ( "FlashTitleStepIt(255)", 10 );
        return true;
}


//*******************************************************************************************************************

function isnumeric(str){    // ¼ýÀÚ¸¸ ÀÖ´ÂÁö °Ë»ç
	for (i=0;  i<str.length; i++)
	{
		ch = str.charAt(i);
		if (ch < "0" || ch > "9")
      		return false; 
	}
	return true; 
  }

function isalnum(str)    // ¿µ¹®ÀÚ ¼ýÀÚ ÀÎÁö °Ë»ç
{
	var str0 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";

	for (i=0; i<str.length; i++)
	{
		ch = str.charAt(i);
		for (j=0;  j<str0.length; j++)
      		if (ch == str0.charAt(j))
       			 break;
    	if (j == str0.length)			// ¿µ¹®¼ýÀÚ°¡ ¾Æ´Ñ°ÍÀÌ ÀÖÀ½
      		return false;
  	}
  	return true;
}



  function isspace(str){  // °ø¹éÀÌ ÀÖ´ÂÁö °Ë»ç
   
    var max = str.length;
	var ct = 0;
	for (i=0; i<str.length; i++){
		ch = str.charAt(i);
		if (ch == " "){
      		  ct++;
         }
	}

	if(ct == 0){
		return true;
	}
	else{
		return false;
	}

  }

function checkEmail(checkString){ 
  
	  var at = false; 
      var dot = false; 
 
     for (var i = 0; i < checkString.length; i++) { 
        
 		ch = checkString.substring(i, i + 1) 

        if((ch >= "A" && ch <= "Z") || (ch >= "a" && ch <= "z") || (ch == "@") || (ch == ".") || (ch == "_") || (ch == "-") || (ch >= "0" && ch <= "9")){ 
                if( ch == "@" ){ 
                    at=true;                 
                }
		else if( at == true && ch == "." ) { 
		     dot=true; 
	        } 
        } 
     } 
 
    if( at == true && dot == true ){ 
          return true; 
    }
    else{
          return false; 
    }
} 

 function check_ID_Window(ref) {
	  var id = document.member.id.value;
		
	  if(id == "") {
		 alert('¾ÆÀÌµð¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä');
		 document.member.id.focus();
		 return;
	  }
	  else{
			
			 window.open(ref +"?id=" + id,"checkIDWin",'width=270,height=120,status=no,top=100,left=100');
	  }
  }


 //###################################################  ÁÖ¹Î ¹øÈ£ Ã¼Å©

 function jumin_no_chk(ju1, ju2){

	 var chk =0;
	 var yy = ju1.substring(0,2);
	 var mm = ju1.substring(2,4);
	 var dd = ju1.substring(4,6);
	 var sex = ju2.substring(0,1);		
	 
	 if( isnumeric(ju1) == false || isnumeric(ju2) == false ){             
	     return false;
	 }
	 else if(ju1.length != 6 || ju2.length != 7){	   
	   	     return false;
	 }
	 else if(mm < 1 || mm >12 || dd < 1 || dd > 31 ){	 	
	
	     return false;
	 }
	 else if(sex != 1 && sex != 2){
		    return false;
	 }
	 else{

	       for (var i = 0; i <=5 ; i++){
	             chk = chk + ((i%8+2) * parseInt(ju1.substring(i,i+1)))
	       }
	       
	       for (var i = 6; i <=11 ; i++){
	             chk = chk + ((i%8+2) * parseInt(ju2.substring(i-6,i-5)))
	       }
	       
	       chk = 11 - (chk %11)
	       chk = chk % 10
	       
	       if (chk != ju2.substring(6,7)){
			 return false;
	       }
	       else {	
	             return true;
	       }	
       }
 }

//#######################################################################################################################################
 function survey_win(url) {
		pol_win = open(url, "poll", "status=no, width=316, height=320, resizable=no, scrollbars=yes, top=50, left=150");
  }

// ¹è³Ê ·¹ÀÌ¾î Å¾ À§Ä¡
/*
 function scroll(){ 
		var a=document.body.scrollTop+0
		// 70 Àº ¹è³ÊÀÇ ±âÁØÀ§Ä¡°¡ À§ÂÊ¿¡¼­ 70 ÇÈ¼¿ ¶³¾îÁöµµ·Ï ¼³Á¤ÇÑ °ÍÀÔ´Ï´Ù 
		banner.style.top=a 
} 
*/


var old_menu = '';
function menuclick( submenu){
	if( old_menu != submenu ) {
		if( old_menu !='' ) {
			old_menu.style.display = 'none';
		}
		submenu.style.display = 'block';
		old_menu = submenu;
	} else {
	submenu.style.display = 'none';
	old_menu = '';
	}
}