$(document).ready(function() {
	
	//	글로벌 1차 메뉴 시작
  	$("._global").mouseover(function() {
      $("#golbal_list").removeClass("hidden")
  	})
 
  	$("._global").mouseleave(function() {
      $("#golbal_list").addClass("hidden")
  	})
	//	글로벌 1차 메뉴 종료
	
	//	글로벌 2차 1 메뉴 시작
	$("#_global1").mouseover(function() {
      $("#_global2_1").removeClass("hidden")
  	})
 
  	$("#_global1").mouseleave(function() {
      $("#_global2_1").addClass("hidden")
  	})
	//	글로벌 2차 1 메뉴 종료
	
	//	글로벌 2차 2 메뉴 시작
	$("#_global2").mouseover(function() {
      $("#_global2_2").removeClass("hidden")
  	})
 
  	$("#_global2").mouseleave(function() {
      $("#_global2_2").addClass("hidden")
  	})
	//	글로벌 2차 2 메뉴 종료
	
	
	$("#_global2_1").mouseover(function() {	
		$("#_global2_1").removeClass("hidden")
		$("#golbal_list").removeClass("hidden")
  	})
 
  	$("#_global2_1").mouseleave(function() {
		
		$("#_global2_1").addClass("hidden")
		$("#golbal_list").addClass("hidden")
  	})
	
	$("#_global2_2").mouseover(function() {	
		$("#_global2_2").removeClass("hidden")
		$("#golbal_list").removeClass("hidden")
  	})
 
  	$("#_global2_2").mouseleave(function() {
		$("#_global2_2").addClass("hidden")
		$("#golbal_list").addClass("hidden")
  	})
	
	
  });
  
  
  $(document).ready(function() {
	
	//	글로벌 1차 메뉴 시작
  	$("._global").mouseover(function() {
      $("#golbal_list02").removeClass("hidden")
  	})
 
  	$("._global").mouseleave(function() {
      $("#golbal_list02").addClass("hidden")
  	})
	//	글로벌 1차 메뉴 종료
	
	//	글로벌 2차 1 메뉴 시작
	$("#_global1").mouseover(function() {
      $("#_global2_1").removeClass("hidden")
  	})
 
  	$("#_global1").mouseleave(function() {
      $("#_global2_1").addClass("hidden")
  	})
	//	글로벌 2차 1 메뉴 종료
	
	//	글로벌 2차 2 메뉴 시작
	$("#_global2").mouseover(function() {
      $("#_global2_2").removeClass("hidden")
  	})
 
  	$("#_global2").mouseleave(function() {
      $("#_global2_2").addClass("hidden")
  	})
	//	글로벌 2차 2 메뉴 종료
	
	
	$("#_global2_1").mouseover(function() {	
		$("#_global2_1").removeClass("hidden")
		$("#golbal_list02").removeClass("hidden")
  	})
 
  	$("#_global2_1").mouseleave(function() {
		
		$("#_global2_1").addClass("hidden")
		$("#golbal_list02").addClass("hidden")
  	})
	
	$("#_global2_2").mouseover(function() {	
		$("#_global2_2").removeClass("hidden")
		$("#golbal_list02").removeClass("hidden")
  	})
 
  	$("#_global2_2").mouseleave(function() {
		$("#_global2_2").addClass("hidden")
		$("#golbal_list02").addClass("hidden")
  	})
	
	
  });


$(function() {

	 /*----------------------------------------------------------------------------
    게시판 패스워드 확인 레이아웃 창
  -----------------------------------------------------------------------------*/
	
  $(" a[href*=MODE=MO], a[href*=SMODE=SECRET]").click(function() {

		//	2010-08-17 인트라넷게시판 부분의 공동 모듈로 쓰고 있기 때문에 따로 때놓았음
		//	일반 사이트들은 비번 기능의 다수들이 있기때문에 따로 관리.			
	if ($(this).attr("isCustom")) return false;

	var pParam = this.href.split("?")[1]

  if (gLanguageIdx && pParam.indexOf("LT") < 0) pParam += "&LT=" + gLanguageIdx;

  $.ajax({
	type:"post",
	url:"/common/confirm/index.asp?" + pParam,
	complete:function(XMLHttpRequest, statusText) {
	  try {
		if (statusText == "success" || (XMLHttpRequest.statusText == "OK" && XMLHttpRequest.status == "200")) {
		  fnLayerInit( XMLHttpRequest.responseText, false )

		  // 타이틀 초기화
		  var pCaption = "패스워드 확인"
		  if (gLanguageID)
			if (gLanguageID != "KOR") pCaption = "PASSWORD"

		  $("#popup_wrap #DragCaption h4").html( pCaption )

		  fnAutoSizeLayerWindow()
		}

	  } catch(e) {
		alert(e);
	  }
	},
	error:function(XMLHttpRequest, textStatus, errorThrown) {
	  alert("fnLayerWindow : " + textStatus + '--------------' + errorThrown);
	}
  })

	return false;

  })

  $(".pad10f a").click(function(){

   if($("#passwordV").hasClass("hidden")){
    $("#passwordV").removeClass("hidden");
    $("#passwordV").addClass("data01_wrap");
   }else{
    $("#passwordV").removeClass("data01_wrap");
    $("#passwordV").addClass("hidden");
   }
   return false;
  })

  if ($("*[name=frmPassword]").size()) {
    $("*[name=frmPassword] a").click(function() {
      var $this = $(this);
      var pURL = $this.attr("_title");
      var pValue = $("form[name=frmPassword]").find("input:text").val();

      location.href='/common/board/PasswordSave.asp?pURL='+pURL+'&passwd='+pValue;

      return false;
    });
  }

  if ($("form[name=frmSelectSearch]").size()) {
    $("form[name=frmSelectSearch]").submit(function() {
      return true;
    });
  };

  /// 왼쪽 메뉴 폴링 기능
  $("li.newWindow a[_folding='true']").live("click", function() {
    var _self = this;

	  if( $($(_self).parents(":first").children(".depth3").get(0)).hasClass("hidden") ){
	    $($(_self).parents(":first").children(".depth3").get(0)).removeClass("hidden");
	  }else{
	    $($(_self).parents(":first").children(".depth3").get(0)).addClass("hidden");
	  }
  });
  
    $("select[_other=globalmenu]").each(function() {
      var $this = $(this);
 
      $this.cssDropDown({
        callback : {
          onSelect : function(Ele, $Ele) {
 
            var pBcIdx = $("select[name=bcIdx02] option:selected").val();
			if(pBcIdx.indexOf("http")>-1){	location.href=pBcIdx;	}
          }
        }
      })
    });
	
  if ($("select").size()) {
    $("select").not("select[_other=true]").each(function() {
      var $this = $(this);

      $this.cssDropDown({
        callback : {
          onSelect : function(Ele, $Ele) {
            $Ele.parents("form:first").submit()
          }
        }
      });
    });
  };

  /*----------------------------------------------------------------------------
    한글 Encode
    encodeURLComponent
    decodeURLComponent
  ----------------------------------------------------------------------------*/
  if ($("*[name=nmeSearchCount]").size()) {
    $("*[name=nmeSearchCount]").each(function() {
      var $this = $(this);
      var pTitle = $this.attr("title");
      var pValue = $("form[name=frmSearch]").find("input:text").val();

      if (pValue == "") pValue = "축제"

      $.post("/common/search/searchCount.asp", {LT:gLanguageIdx,bcName:pTitle,searchKeyword:pValue}, function(data, textStatus, XMLHttpRequest) {
        var pJson = eval(data);

        if (pJson.success) {
          $this.html( $this.html().replace(/#Count/g, pJson.Count) );
        }

        return false;
      })
    });
  }

  if ($("div[_mainNotice=true]").size()) {
    fnMainTabPage();
  }
})

function fnMainTabPage() {
  $("div[_mainNotice=true]").each(function() {
    var $this = $(this);

    $this.children("div").find("A").not("A[_Init=true]").each(function() {
      var $Athis = $(this);

      $Athis.attr("_Init", "true");
      $Athis.click(function() {
        var $Athis = $(this);
        var pHref = $Athis.attr("href").split("?")[1];

        $.get("/html/kor/test.asp?" + pHref, function(data, textStatus, XMLHttpRequest) {
          $this.html(data);
          fnMainTabPage();
        });

        return false;
      });

    });
  });
}



//경로
function link(){

	var url = "";
	var target = "";
	var depth = arguments.length;

	var arr_key ="link_arr";
//    alert(arguments[0]);
	try {
		if(depth==0) return;
		else {
			for (i=1;i<=depth;i++ )		{
				arr_key = arr_key + "['"+arguments[(i-1)] + "']";
			}
		}

		

		url = eval(arr_key + "['0']");
		target = eval(arr_key + "['1']");
		
		if(url=="") alert("경로가 지정되지 않았습니다.");
		else {
			if (target!="_self")			{
				window.open(url)
			}else{
				location.href = url;
			}

		}
		
	}catch(e) { alert(url + "컨텐츠 준비중입니다."); }

}



//플래쉬링크
link_arr = new Array();
link_arr['f01'] =Array("http://www.busanbiennale.org","_blank");
link_arr['f02'] =Array("http://www.busan.go.kr/00_main/","_blank");
link_arr['f03'] =Array("http://www.mcst.go.kr/main.jsp","_blank");
link_arr['f04'] =Array("http://www.visitkoreayear.com/korea/main/main.asp","_blank");
link_arr['f05'] =Array("http://www.c1soju.co.kr/main/main.asp","_blank");
link_arr['f06'] =Array("http://www.busan.com/","_blank");
link_arr['f07'] =Array("http://www.taewoong.com/","_blank");
