//-------------------------------------------------------------------------------------------------------------------------Äü¸Þ´º¿ë
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 ) { 
                yMenuFrom   = document["divMenu"].top;
                yMenuTo     = top.pageYOffset + 62; 
        }
        else if ( bExplorer4plus ) {
                yMenuFrom   = parseInt (divMenu.style.top, 10);
                yMenuTo     = document.body.scrollTop + 150;//ÀÌ ¼ýÀÚ¸¦ ¼öÁ¤ÇÏ¸é À§ÂÊ¿©¹éÀ» Á¶Àý ÇÒ ¼ö ÀÖ½À´Ï´Ù(ÀÍ½ºÇÃ·Î·¯)
        }

        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 ( top.frames.length )
        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";
        }
        CheckUIElements();
        return true;
}

//-------------------------------------------------------------------------------------------------------------------------over img
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);
}

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 MM_showHideLayers() { //v6.0
	var i,p,v,obj,args=MM_showHideLayers.arguments;
	for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
	if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
//-------------------------------------------------------------------------------------------------------------------------menu over
    var nscp = (navigator.appName == "Netscape")
    var ismc = (navigator.appVersion.indexOf("Mac") != -1)
    var vers = parseFloat(navigator.appVersion.substring(22,25))
	var tab_cnt = 6;
    
    function getObj(obj) {
       if (nscp) {
           compLayr = document.layers[obj]
       }else{
           compLayr = eval("document.all." + obj + ".style")
       }
       return compLayr
    }

    function show(layr){
       obj = getObj(layr)
       obj.visibility = "visible"
    }

    function hide(layr){
       obj = getObj(layr)
       obj.visibility = "hidden"
    }

    function menuRoll(which,status,total){
       if (status){
           currentMenuChoice = which
           show("info" + currentMenuChoice)
           checkinfo(total)
       }
    }

    function fontRoll(which,status,total){
       if (status){
           currentMenuChoice = which
           obj = getObj("font"+currentMenuChoice)
           obj.color = "blue"
           checkfont(total)
       }
    }
 
    function checkinfo(total){
       for(r=1;r<= total ;r++){
           if(r != currentMenuChoice){
               hide("info" + r)
           }
       }
       setTimeout("checkinfo()",50)
    }

    function checkfont(total){
       for(r=1;r<= total ;r++){
           if(r != currentMenuChoice){
               obj = getObj("font"+r)
               obj.color = "#757575"
           }
       }
       setTimeout("checkfont()",50)
    }


	function changetab (no) {
	for (i=1; i<= tab_cnt;i++){
		obj = eval("document.images.tab"+i);
		if (i == no){
			obj.src = img_ov_url[i-1].src;
		}else{
			obj.src = img_url[i-1].src;
		}
	}
	}

//-------------------------------------------------------------------------------------------------------------------------ÀÏ¹Ý ½ºÅ©¸³Æ®

	function logout() {
		var url = "/member/top_logout.asp";
		if(confirm("ÀÌ¿ëÇØ ÁÖ¼Å¼­ °¨»çÇÕ´Ï´Ù.\n\n·Î±×¾Æ¿ô ÇÏ½Ã°Ú½À´Ï±î?")) {
			window.location = url;
		}
		else{return;}
	}



function message(){
	alert("ÁØºñÁßÀÔ´Ï´Ù");
	return false;
}

function topgoboard(board,navi){
		var url = "/job/board/list.asp?tb=" + board + "&navi="+navi
		location.href= url	
}

function topgoboard2(board,navi){
		var url = "/trade/board/list.asp?tb=" + board + "&navi="+navi
		location.href= url	
}

function OpenWindow2(url,name,intWidth,intHeight,intscroll)
{ 
	var w_openoption = "width="+intWidth +",height="+ intHeight +",left=0,top=0,scrollbars="+intscroll
   window.open(url, name, w_openoption) ;
}


function OpenWindow(url,name,intWidth,intHeight,intscroll)
{ 
	var w_openoption = "width="+intWidth +",height="+ intHeight +",left=0,top=0,scrollbars="+intscroll
   window.open(url, name, w_openoption) ;
}


function OpenModal(url,name,intWidth,intHeight,intscroll)
{
    window.showModalDialog(url,name,"dialogWidth:"+intWidth+"px; dialogHeight:"+intHeight+"px; center:yes; status:no; resizeable:yes; scroll:"+intscroll+"; help:no;");
}

function go_page_change()
{	
	var form = document.infosearch;

	var gubun = form.gubun.value; //»ç¿ëÀÚºÐ·ù
	var keyword = form.key.value; // °Ë»öÅ°¿öµå
	
	url = "/search/index.asp?key=" +keyword;
	url = url +"&gubun="+gubun;

	location.href = url;
	return;
}

function sendit()
{	
	document.infosearch.key.style.background = "";
	document.infosearch.key.style.backgroundColor="white";
}

function chkChar(objItem, length_limit, msgkind) {
	var length = calculate_msglen(objItem.value);
	if(objItem.value.split(" ").join("")==""){
		alert(msgkind + "¿¡´Â °ø¹é¿ÜÀÇ ³»¿ëÀÌ ÇÊ¿äÇÕ´Ï´Ù.");	
		return true;
	}else if (length_limit!="0"){
		if (length > length_limit) {
			alert(msgkind + "Àº ÃÖ´ë " + length_limit + "ÀÚ±îÁö ÀÔ·ÂÇÒ ¼ö ÀÖ½À´Ï´Ù.\n\n" + length_limit + "Byte´Â [ " + assert_msglen(objItem.value, length_limit) + " ] ±îÁö ÀÔ´Ï´Ù.");		
			return true;
		}
		
	}else if (length == 0) {
		alert(msgkind + "À» Á¤È®È÷ ÀÔ·Â(" + length_limit + "Byte)ÇØ ÁÖ¼¼¿ä.");
		return true;
	}
}

//ÀÔ·ÂÇÑ ±ÛÀÚ ¼ö Ã¼Å© ÇÔ¼ö
function calculate_msglen(message) {
	var nbytes = 0;
	for (i = 0; i < message.length; i++) {
		var ch = message.charAt(i);
		if(escape(ch).length > 4) {
			nbytes += 2;
		} else if (ch == '\n') {
			if (message.charAt(i-1) != '\r') {
				nbytes += 1;
			}
		} else if (ch == '<' || ch == '>') {
			nbytes += 4;
		} else {
			nbytes += 1;
		}
	}
	return nbytes;
}

function calcHeight()
{
//find the height of the internal page
var the_height=
document.getElementById('the_iframe').contentWindow.
document.body.scrollHeight;

//change the height of the iframe
document.getElementById('the_iframe').height=
the_height;
}
function calcHeighta()
{
//find the height of the internal page
var the_height=
document.getElementById('the_iframea').contentWindow.
document.body.scrollHeight;

//change the height of the iframe
document.getElementById('the_iframea').height=
the_height;
}
