$(document).ready(function() {
	var $mainMenu = $('#menu');
	var $sideMenu = $('#side-menu');
	var $sideMenuTopItems = $sideMenu.find('>ul>li');
	
	$sideMenuTopItems
		.filter('.current').addClass('expanded').end()
		.filter(':not(.current)').find('>ul').addClass('hidden');
	$sideMenuTopItems.find('>span')
		/*.wrapInner('<a href="#"></a>')*/
		.click(function() {
			$(this).parent().toggleClass('expanded').find('>ul').toggleClass('hidden');
			return false;
		});

/*인물시작*/
	$(".accordion h3:first").addClass("active");
	$(".accordion p:not(:first)").hide();

	$(".accordion h3").click(function(){
		$(this).next("p").slideToggle("slow")
		.siblings("p:visible").slideUp("slow");
		$(this).toggleClass("active");
		$(this).siblings("h3").removeClass("active");
	});
/*인물끝*/

	/*$('a[href^=http]:not(.open-local)')
		.add($('a.open-new'))
		.attr('title', '새창')
		.click(function() {
			window.open(this.href);
			return false;
		});
		*/

	$mainMenu.find('ul>li')
		.mouseenter(function() {
			var img = $(this).find('>a>img')[0];
			if (img)
				img.src = img.src.replace(/-off/, '-on');
		})
		.not('.current')
		.mouseleave(function() {
			var img = $(this).find('>a>img')[0];
			if (img)
				img.src = img.src.replace(/-on/, '-off');
		});

	$(document).bind('keydown','Ctrl+left',function(event){
		link=$("a.prev").attr("href");
		if (link) document.location=link;
	});

	$(document).bind('keydown','Ctrl+right',function(event){
		link=$("a.next").attr("href");
		if (link) document.location=link;
	});

	var $boardDivisions = $('#board-divisions');
	$boardDivisions.find('>li>span').click(function() {
		var $li = $(this).parent();
		if ($li.hasClass('expanded'))
			$li.removeClass('expanded');
		else {
			$li.siblings().removeClass('expanded');
			$li.addClass('expanded');
		}
	});

	var $filesDiv = $('#content-main div.record-files');
	$filesDiv.find('span.header').attr('style','line-height:'+$filesDiv.height()+'px;height:'+$filesDiv.height()+'px');
});

 function portal_popup_windowOpen_scroll(url, popupwidth, popupheight)
 {
  Top = (window.screen.height - popupheight) / 3;
  Left = (window.screen.width - popupwidth) / 2;
  if (Top < 0) Top = 0;
  if (Left < 0) Left = 0;
  Future = "fullscreen=no,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,left=" + Left + ",top=" + Top + ",width=" + popupwidth + ",height=" + popupheight;
  PopUpWindow = window.open(url, "PopUpWindow", Future)
  PopUpWindow.focus();
 }
//팝업창함수
function notice_getCookie( name ){
			var nameOfCookie = name + "=";
			var x = 0;
			while ( x <= document.cookie.length ){
				var y = (x+nameOfCookie.length);
				if ( document.cookie.substring( x, y ) == nameOfCookie ) {
					if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 )
						endOfCookie = document.cookie.length;
					return unescape( document.cookie.substring( y, endOfCookie ) );
				}
				x = document.cookie.indexOf( " ", x ) + 1;
				if ( x == 0 )
					break;
			}
			return "";
		}
		//Popup Close
function closeWin()     {    window.close();	}

