/* jQuery Plugins */
 /**
 * jquery.scrollFollow.js
 * Copyright (c) 2008 Net Perspective (http://kitchen.net-perspective.com/)
 * Licensed under the MIT License (http://www.opensource.org/licenses/mit-license.php)
 * 
 * @author R.A. Ray
 *
 * @projectDescription	jQuery plugin for allowing an element to animate down as the user scrolls the page.
 * 
 * @version 0.4.0
 */
( function( $ ) {
	$.scrollFollow = function ( box, options )
	{ 
		// Convert box into a jQuery object
		box = $( box );
		// 'box' is the object to be animated
		var position = box.css( 'position' );
		function ani()
		{		
			// The script runs on every scroll which really means many times during a scroll.
			// We don't want multiple slides to queue up.
			box.queue( [ ] );
			// A bunch of values we need to determine where to animate to
			var viewportHeight = parseInt( $( window ).height() );	
			var pageScroll =  parseInt( $( document ).scrollTop() );
			var parentTop =  parseInt( box.cont.offset().top );
			var parentHeight = parseInt( box.cont.attr( 'offsetHeight' ) );
			var boxHeight = parseInt( box.attr( 'offsetHeight' ) + ( parseInt( box.css( 'marginTop' ) ) || 0 ) + ( parseInt( box.css( 'marginBottom' ) ) || 0 ) );
			var aniTop;
			// Make sure the user wants the animation to happen
			if ( isActive )
			{
				// If the box should animate relative to the top of the window
				if ( options.relativeTo == 'top' )
				{
					// Don't animate until the top of the window is close enough to the top of the box
					if ( box.initialOffsetTop >= ( pageScroll + options.offset ) )
					{
						aniTop = box.initialTop;
					}
					else
					{
						aniTop = Math.min( ( Math.max( ( -parentTop ), ( pageScroll - box.initialOffsetTop + box.initialTop ) ) + options.offset ), ( parentHeight - boxHeight - box.paddingAdjustment ) );
					}
				}
				// If the box should animate relative to the bottom of the window
				else if ( options.relativeTo == 'bottom' )
				{
					// Don't animate until the bottom of the window is close enough to the bottom of the box
					if ( ( box.initialOffsetTop + boxHeight ) >= ( pageScroll + options.offset + viewportHeight ) )
					{
						aniTop = box.initialTop;
					}
					else
					{
						aniTop = Math.min( ( pageScroll + viewportHeight - boxHeight - options.offset ), ( parentHeight - boxHeight ) );
					}
				}
				// Checks to see if the relevant scroll was the last one
				// "-20" is to account for inaccuracy in the timeout
				if ( ( new Date().getTime() - box.lastScroll ) >= ( options.delay - 20 ) )
				{
					box.animate(
						{
							top: aniTop
						}, options.speed, options.easing
					);
				}
			}
		};
		// For user-initiated stopping of the slide
		var isActive = true;
		if ( $.cookie != undefined )
		{
			if( $.cookie( 'scrollFollowSetting' + box.attr( 'id' ) ) == 'false' )
			{
				var isActive = false;
				
				$( '#' + options.killSwitch ).text( options.offText )
					.toggle( 
						function ()
						{
							isActive = true;
							$( this ).text( options.onText );
							$.cookie( 'scrollFollowSetting' + box.attr( 'id' ), true, { expires: 365, path: '/'} );
							ani();
						},
						function ()
						{
							isActive = false;
							$( this ).text( options.offText );
							box.animate(
								{
									top: box.initialTop
								}, options.speed, options.easing
							);	
							$.cookie( 'scrollFollowSetting' + box.attr( 'id' ), false, { expires: 365, path: '/'} );
						}
					);
			}
			else
			{
				$( '#' + options.killSwitch ).text( options.onText )
					.toggle( 
						function ()
						{
							isActive = false;
							$( this ).text( options.offText );
							box.animate(
								{
									top: box.initialTop
								}, 0
							);	
							$.cookie( 'scrollFollowSetting' + box.attr( 'id' ), false, { expires: 365, path: '/'} );
						},
						function ()
						{
							isActive = true;
							$( this ).text( options.onText );
							$.cookie( 'scrollFollowSetting' + box.attr( 'id' ), true, { expires: 365, path: '/'} );
							ani();
						}
					);
			}
		}
		// If no parent ID was specified, and the immediate parent does not have an ID
		// options.container will be undefined. So we need to figure out the parent element.
		if ( options.container == '')
		{
			box.cont = box.parent();
		}
		else
		{
			box.cont = $( '#' + options.container );
		}
		// Finds the default positioning of the box.
		box.initialOffsetTop =  parseInt( box.offset().top );
		box.initialTop = parseInt( box.css( 'top' ) ) || 0;
		// Hack to fix different treatment of boxes positioned 'absolute' and 'relative'
		if ( box.css( 'position' ) == 'relative' )
		{
			box.paddingAdjustment = parseInt( box.cont.css( 'paddingTop' ) ) + parseInt( box.cont.css( 'paddingBottom' ) );
		}
		else
		{
			box.paddingAdjustment = 0;
		}
		// Animate the box when the page is scrolled
		$( window ).scroll( function ()
			{
				// Sets up the delay of the animation
				$.fn.scrollFollow.interval = setTimeout( function(){ ani();} , options.delay );
				// To check against right before setting the animation
				box.lastScroll = new Date().getTime();
			}
		);
		// Animate the box when the page is resized
		$( window ).resize( function ()
			{
				// Sets up the delay of the animation
				$.fn.scrollFollow.interval = setTimeout( function(){ ani();} , options.delay );
				// To check against right before setting the animation
				box.lastScroll = new Date().getTime();
			}
		);
		// Run an initial animation on page load
		box.lastScroll = 0;
		ani();
	};
	$.fn.scrollFollow = function ( options )
	{
		options = options || {};
		options.relativeTo = options.relativeTo || 'top';
		options.speed = options.speed || 500;
		options.offset = options.offset || 0;
		options.easing = options.easing || 'swing';
		options.container = options.container || this.parent().attr( 'id' );
		options.killSwitch = options.killSwitch || 'killSwitch';
		options.onText = options.onText || 'Turn Slide Off';
		options.offText = options.offText || 'Turn Slide On';
		options.delay = options.delay || 0;
		this.each( function() 
			{
				new $.scrollFollow( this, options );
			}
		);
		return this;
	};
})( jQuery );
 /**
 * Cookie plugin
 *
 * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 */
jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }
        // CAUTION: Needed to parenthesize options.path and options.domain
        // in the following expressions, otherwise they evaluate to undefined
        // in the packed version for some reason...
        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};
/*
 * jQuery ifixpng plugin
 * (previously known as pngfix)
 * Version 2.1  (23/04/2008)
 * @requires jQuery v1.1.3 or above
 *
 * Examples at: http://jquery.khurshid.com
 * Copyright (c) 2007 Kush M.
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 */
 
 /**
  *
  * @example
  *
  * optional if location of pixel.gif if different to default which is images/pixel.gif
  * $.ifixpng('media/pixel.gif');
  *
  * $('img[@src$=.png], #panel').ifixpng();
  *
  * @apply hack to all png images and #panel which icluded png img in its css
  *
  * @name ifixpng
  * @type jQuery
  * @cat Plugins/Image
  * @return jQuery
  * @author jQuery Community
  */
 (function($) {
	/**
	 * helper variables and function
	 */
	$.ifixpng = function(customPixel) {
		$.ifixpng.pixel = customPixel;
	};
	$.ifixpng.getPixel = function() {
		return $.ifixpng.pixel || 'images/pixel.gif';
	};
	var hack = {
		ltie7  : $.browser.msie && $.browser.version < 7,
		filter : function(src) {
			return "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,sizingMethod=crop,src='"+src+"')";
		}
	};
	/**
	 * Applies ie png hack to selected dom elements
	 *
	 * $('img[@src$=.png]').ifixpng();
	 * @desc apply hack to all images with png extensions
	 *
	 * $('#panel, img[@src$=.png]').ifixpng();
	 * @desc apply hack to element #panel and all images with png extensions
	 *
	 * @name ifixpng
	 */
	$.fn.ifixpng = hack.ltie7 ? function() {
    	return this.each(function() {
			var $$ = $(this);
			// in case rewriting urls
			var base = $('base').attr('href');
			if (base) {
				// remove anything after the last '/'
				base = base.replace(/\/[^\/]+$/,'/');
			}
			if ($$.is('img') || $$.is('input')) { // hack image tags present in dom
				if ($$.attr('src')) {
					if ($$.attr('src').match(/.*\.png([?].*)?$/i)) { // make sure it is png image
						// use source tag value if set 
						var source = (base && $$.attr('src').search(/^(\/|http:)/i)) ? base + $$.attr('src') : $$.attr('src');
						// apply filter
						$$.css({filter:hack.filter(source), width:$$.width(), height:$$.height()})
						  .attr({src:$.ifixpng.getPixel()})
						  .positionFix();
					}
				}
			} else { // hack png css properties present inside css
				var image = $$.css('backgroundImage');
				if (image.match(/^url\(["']?(.*\.png([?].*)?)["']?\)$/i)) {
					image = RegExp.$1;
					image = (base && image.substring(0,1)!='/') ? base + image : image;
					$$.css({backgroundImage:'none', filter:hack.filter(image)})
					  .children().children().positionFix();
				}
			}
		});
	} : function() { return this; };
	/**
	 * positions selected item relatively
	 */
	 
	$.fn.positionFix = function() {
		return this.each(function() {
			var $$ = $(this);
			var position = $$.css('position');
			if (position != 'absolute' && position != 'relative') {
				$$.css({position:'relative'});
			}
		});
	};
})(jQuery);

/* DAPA global jQuery
 *           2009 by EZ1
 * jquery-ui 새버전 다운로드 시, dialog, sortable, accordion, tabs 체크 후 다운로드 할 것
 */
$("<link />", { type:"text/css", rel:"stylesheet", media:"screen" }).insertAfter("link:last").attr("href", "/common/ui-theme/main/jquery-ui.css");

/* IE 일 경우, 별도의 CSS 로딩 */
(function(){
if($.browser.msie){
	var msie = navigator.appVersion.indexOf("MSIE");
	var majorVersion = parseInt(navigator.appVersion.charAt(msie + 5), 10);
	$("<link />", {rel:'stylesheet', type:'text/css', media:'all' }).appendTo("head").attr("href", "/common/css/ie.css");
	if(majorVersion=="6"){
		$("<link />", { rel:'stylesheet', type:'text/css', media:'all' }).appendTo("head").attr("href", "/common/css/ie6.css");
		$(function(){
			$("#memberNavi > ul > li > a").css("backgroundImage","url(/common/images/common/sub_navi.gif)"); 
			$.ifixpng("/common/images/common/pixel.gif");
			$(".png24").ifixpng();
			if($("#view_download").length) { $("#view_download").addClass("clearfix").children("ul").css("width","80%"); }
		});
	}
}
})(jQuery);
 $(function(){ //jQuery DOM 로딩 후 시작하는 부분

/* 서브 페이지 검색 */
	$("#pagesearchform").submit(function(){
		var searchSite = $("#pageSearchField").val();
		var query = $("#pageSearchWord").val();
		var loc;
		if (searchSite == "google") {
				$("input[name=q]").val(query);
				$(this).attr("action", "/search_google.jsp");
				return true;
		} else if (searchSite == "daum") {
				loc = "http://search.daum.net/search?q=site:dapa.go.kr+" + query;
				window.open(loc);
				return false;
		} else if (searchSite == "yahoo") {
				loc = "http://kr.search.yahoo.com/search?p=site:dapa.go.kr+" + query;
				window.open(loc);
				return false;
		}else {
			return true;
		}
	});
	$("#contentsWrapper").addClass("clearfix");
/* 우측 상단 메뉴 */
	$("#memberNavi > ul > li").hover(function(){
		$(this).children("a").stop().animate({width:75}, 200);
	}, function(){
		$(this).children("a").stop().animate({width:23},200);
	});
/* 메인 내비게이션 */
	$("#globalNavi  > ul >  li").bind("mouseover keyup",function(e){
			$(this).siblings().find(".over").removeClass("over").end().find(".subMenu").children("ol").stop().animate({marginTop:"-25px"},200);
			$(this).children("a").addClass("over").end().find(".subMenu").children("ol").stop().animate({marginTop:0},200);
	});
	$("#globalNavi > ul > li > a.over").siblings("div").children("ol").animate({marginTop:0});
/* 서브 내비게이션 */
	(function(){
		var loc = window.location.href; 
		if(loc.indexOf("/internet/site/") > -1) { // 부서별 사이트일 경우 메뉴 열기
			$("#sidebarNavi > li > a").addClass("closed");
			$("#sidebarNavi > li >a").each(function(i){
			var thisPage = $(this).attr("href").replace("#","");
				if (loc.indexOf(thisPage) > -1) { $(this).removeClass("closed").addClass("opened").parent().addClass("current");
				$(this).next("ul").children("li").each(function(i){
					var subPage = $(this).children("a").attr("href");
					if(loc.indexOf(subPage) > -1) $(this).addClass("selected");
				});
				}
			});
		}
		$("#sidebarNavi > li:has(ul) > a").click(function(e){
			e.stopPropagation();
			$(this).toggleClass("closed").toggleClass("opened");
			if( $(this).is(".opened") ) $(this).next().slideDown(200, "easeInOutQuad");
			else $(this).next().slideUp(200, "easeInOutQuad");
			});
		$("a[href$=sidebarNavi]").focus(function(){	// 접근성 확보. tab으로 이동 시, 하위메뉴 바로가기에 포커스 맞춰지면 하위메뉴를 모두 열기
			$("#sidebarNavi > li > a.closed").trigger("click");
		});
	})();
/* 현재 위치 표시 - breadcrumb */
	(function(){
		$(".navy").empty();
		var $globalCurrent = $("#globalNavi > ul > li > a.over");
		var bread = {
			firstLevel : $globalCurrent.text(),
			secondLevel : $("#sidebarNavi li.current a:first").text(),
			thirdLevel : $("#sidebarNavi ul li.selected a").text(),
			breadcrumb : $(".navy")
			}
		$globalCurrent.next().children("ol").animate({marginTop:0});
		$('<a href="/index.jsp">Home</a>').appendTo(bread.breadcrumb);
		if (bread.firstLevel) {
			bread.breadcrumb.append(" &gt; ").append($globalCurrent.clone());
				if(bread.secondLevel) {
					bread.breadcrumb.append(" &gt; ").append(bread.secondLevel);
					if(bread.thirdLevel) {
						bread.breadcrumb.append(" &gt; ").append(bread.thirdLevel);
					}
				}
		} else {
			bread.breadcrumb.append(" &gt; ").append($("#sidebar > h3").text());
			if(bread.secondLevel) {
				bread.breadcrumb.append(" &gt; ").append(bread.secondLevel);
				if(bread.thirdLevel) {
					bread.breadcrumb.append(" &gt; ").append(bread.thirdLevel);
				}
			}
		}
	})();
	/* 전체 펼치기/닫기 */
	if ($("a.closed").length || $("a.opened").length) { 
		$("#sidebar").append("<a href='#openAll' id='openAll'>모두열기</a><a href='#closeAll' id='closeAll'>모두닫기</a>");
		$("#openAll").click(function(e){
			e.preventDefault();
			$("#sidebarNavi > li > a.closed").trigger("click");
		});
		$("#closeAll").click(function(e){
			e.preventDefault();
			$("#sidebarNavi > li > a.opened").trigger("click");
		});
	} else {
		$("#sidebarNavi").css("borderBottom","none");
	}
	// file 형식에 따라 클래스 지정
if(!$.browser.msie) {
	$("a[href$=.pdf]").addClass("pdfFile somefiles");
	$("a[href*=.hwp]").addClass("hwpFile somefiles");$("a[onclick*=hwp]").addClass("hwpFile somefiles");
	$("a[href*=.xls]").addClass("xlsFile hwpFile somefiles");
	$("a[href*=.ppt]").addClass("pptFile hwpFile somefiles");
	$("a[href*=.doc]").addClass("wordFile hwpFile somefiles");
} else {
// ie 일 경우... inline 요소가 2줄 이상이 되면 이상하게 렌더링하기 때문에 span을 덧붙여 처리.
	$("a[href$=.pdf], a[href$=.hwp], a[href$=.xls], a[href$=.ppt], a[href$=.doc]").each(function(){
		var text = $(this).text(), href = $(this).attr("href"), type;
		if(href.indexOf(".pdf") > -1) {
			type = "pdf";
		} else if(href.indexOf(".hwp") > -1) {
			type = "hwp";
		} else if(href.indexOf(".xls") > -1) {
			type = "xls";
		} else if(href.indexOf(".ppt") > -1) {
			type = "ppt";
		} else if(href.indexOf(".doc") > -1) {
			type = "doc";
		}
		$(this).append("<span class='"+type+"File somefiles ieFiles'>"+type+" 파일 다운로드</span>");
		//$(this).append(" <img src='/common/images/common/"+type+"Icon.gif' alt='"+type+" 파일 아이콘' width='16' height='16' />");
	});
}
	if($(".somefiles").length) {
		if($("#recomm").length){
			$("<div id='readerDown'><h5>이 페이지에 수록된 파일을 열 수 없는 경우, 아래의 프로그램으로 보실 수 있습니다.</h5><ul></ul></div>").insertBefore("#recomm"); 
		} else {
			$("#contents").append("<div id='readerDown'><h5>이 페이지에 수록된 파일을 보시려면 아래와 같은 뷰어가 필요합니다.</h5><ul></ul></div>");
		}
		if($(".pdfFile").length){
			$("#readerDown ul")
			.append("<li class='adobeReader'><a href='http://get.adobe.com/kr/reader/' rel='external'>Adobe Reader - Adobe 사에서 제공하는 <strong>PDF</strong> Reader입니다. <strong>PDF</strong> 파일을 열람할 경우 사용할 수 있습니다.</a></li>")
			.append("<li class='foxitReader'><a href='http://www.foxitsoftware.com/downloads/index.php' rel='external'>Foxit Reader - Foxit 사에서 제공하는 <strong>PDF</strong> Reader입니다. Adobe Reader보다 가볍고 빠른 장점이 있습니다.</a></li>");
		}
		if($(".hwpFile").length) {
			$("#readerDown ul").append("<li class='hwpViewer'><a href='http://www.hancom.co.kr/downLoad.downPU.do?mcd=002' rel='external'>한글과 컴퓨터 오피스 통합 뷰어 - <strong>hwp, xls, ppt, doc</strong> 파일을 열람할 경우 사용할 수 있습니다.</a></li>");
		}
		if($(".xlsFile").length) {
			$("#readerDown ul").append("<li class='excelViewer'><a href='http://www.microsoft.com/downloads/details.aspx?displaylang=ko&amp;FamilyID=1cd6acf9-ce06-4e1c-8dcf-f33f669dbc3a' rel='external'>MS Office Excel Viewer 2007 - 엑셀 스프레드 시트 파일(<strong>xls[x]</strong>)을 열람할 경우 사용할 수 있습니다.</a></li>");
		}
		if($(".pptFile").length) {
			$("#readerDown ul").append("<li class='pptViewer'><a href='http://office.microsoft.com/ko-kr/downloads/CD102070641042.aspx' rel='external'>MS Office Powerpoint Viewer 2007 - 파워포인트 슬라이드 파일(<strong>ppt[x], pps[x]</strong>)을 열람할 경우 사용할 수 있습니다.</a></li>");
		}
		if($(".wordFile").length) {
			$("#readerDown ul").append("<li class='wordViewer'><a href='http://office.microsoft.com/ko-kr/downloads/CD102258581042.aspx' rel='external'>MS Office Word Viewer 2007 - MS 워드 문서 파일(<strong>doc[x]</strong>)을 열람할 경우 사용할 수 있습니다.</a></li>");
		}
		if($(".xlsFile").length || $(".pptFile").length || $(".wordFile").length ) {
			$("#readerDown ul").append("<li class='openOffice'><a href='http://openoffice.or.kr/main/page.php?id=download' rel='external'>Open Office - Sun 에서 제공하는 무료 오피스인 오픈 오피스입니다. MS 오피스와 호환되며, 읽기 및 수정이 가능합니다.</a></li>");
		}
	}
/* 새창에서 열리는 링크에 '새창에서 열림' 타이틀 붙임
	a 태그에 rel="external" 속성이 있으면 적용. target="_blank"는 제거해야 하나, 레거시 페이지를 위해 적용함
*/
	$("a[rel='external'], a[target]").each(function(){
		var text = $(this).text();
		if($(this).is(":has('img')") && text == "") text = $(this).children("img").attr("alt");
		text += "(새창에서열림)";
		$(this).attr("title", text);
		if(!$(this).attr("onclick") && !$(this).attr("target") ) { $(this).bind("click", function(){ window.open(this.href);return false;; }); }
		});
/* 관련 사이트 셀렉트 박스 제어 */
$("#relatedSite li input").click(function(){
	var selectedVal = $(this).prev().val();
	if (selectedVal == "" || selectedVal =="#")
	{ return false;
	} else if (this.id) { location.href=selectedVal; }
	else { window.open(selectedVal); return false; }
});
/* 글씨 크기 조정 */
(function(){
	var textSize = $.cookie("contentsTextSize")?$.cookie("contentsTextSize"):1;
	$.cookie("contentsTextSize",textSize,{path: "/"});	// 설정을 쿠키에 저장함
	var defaultTextSize = 1;
	$("#contents").css("fontSize",textSize+"em"); //초기화
	$("#growText").click(function(e){
		e.preventDefault();
		textSize *= (textSize > 1.8) ? 1:1.2;	// 글자를 1.2배씩 크게하다가 1.8배를 넘으면 더이상 커지지 않게 함
		$.cookie("contentsTextSize",textSize);
		$("#contents").css("fontSize",textSize+"em");
	});
	$("#shrinkText").click(function(e){
		e.preventDefault();
		textSize /= (textSize < 0.7) ? 1:1.2;	// 글자를 1.2배씩 줄이다가 0.7배보다 작으면 더이상 작아지지 않음
		$.cookie("contentsTextSize",textSize);
		$("#contents").css("fontSize",textSize+"em");
	});
	$("#defaultText").click(function(e){
		e.preventDefault();
		textSize = defaultTextSize;
		$.cookie("contentsTextSize",textSize);
		$("#contents").css("fontSize",textSize+"em");
	});
	$("#textSizeControl a").hover(function(){
		$(this).stop().animate({paddingTop:8,paddingBottom:8},100);
		$(this).siblings().stop().animate({paddingTop:2,paddingBottom:2},100);
	}, function(){
		$("#textSizeControl a").stop().animate({paddingTop:4,paddingBottom:4},100);
	});
})();
/* 접근성 텍스트 설명 */
	$("#accessbilityDescription").addClass("textContents");
	$("#viewDescription a").click(function(e){
		e.preventDefault();
		$("#accessbilityDescription").toggle();
		if($("#accessbilityDescription").is(":visible")) {
			$(this).text("텍스트 설명 닫기");
		} else {
			$(this).text("텍스트 설명 보기");
		}
	});
/* 페이지 만족도 조사 */
	$("#recoStarForm").submit(function(){
		if($(".star input:checked").length ) {
			var star = $(".star input:checked").val();
			var text = $(".star input:checked").next().children("span").text();
			var answer = confirm(star+"점("+text+")을 선택하셨습니다.\n추천하시겠습니까?");
			if(answer) {
				var recommVar = $(this).serialize();
				$.post("/spage/page_proc_recomm_insert.jsp?"+recommVar, function(data){
					alert(data);
				});
				
				$(".star input:checked").removeAttr("checked");
			} else {}
			return false;
		} else { alert("만족도 별을 선택해 주세요."); return false; }
	});
	$("tbody tr", ".boardTable").hover(function(){
		$(this).stop().animate({backgroundColor:'#f0f0fa'},200);
	}, function(){
		$(this).stop().animate({backgroundColor:'#fff'},250);
	});

/* 게시판일 경우 게시판 스크립트 로드 */
	if($(".boardForms").length) {
		$.getScript("/adm_site/app/board/board_script.js");
		}

/* 게시물 제목을 브라우저 타이틀로... */
	if($(".view_t").length) {
		var title = $("h2.view_t").text(),
		breadcrumb=($.browser.msie)?document.title:$("title").text();
		document.title = title + " - " + breadcrumb;
	}
/* 즐겨찾기 등록 */
/*
	$("#addBookmark").click(function(e){
		e.preventDefault();
		var href=$(this).attr("href");
		$.post(href);
	});
*/
/* RSS 구독안내 */
	$("#subscribe").click(function(e){
		e.preventDefault();
		$("<div id='rssinfo' />").load("/rssSub.jsp").dialog({width:650,maxWidth:700,minWidth:500,height:500,maxHeight:600,minHeight:500,modal:true,title:"RSS 구독 안내"});
	});

/* 프린트 버튼 beta */
	$("#printThisPage").click(function(e){
		window.print();
	}).hover(function(){
		$(this).next().show();
	}, function(){
		$(this).next().hide();
	});
/* 동영상 대본 조정 */
	if($(".movieScript").length){
		$("<p class='buttons'></p>").insertBefore(".movieScript");
		$("<a class='peelScript ui-state-default ui-corner-all' href='#'>대본 넓게 보기</a>").appendTo(".buttons").click(function(e){
			e.preventDefault();
			$(".movieScript").removeClass("movieScript").addClass("script");
			$(this).remove();
		});
	}
/* 법령 조회 시에는 dialog로 띄우기 */
	if($("a[href*=www.law.go.kr/]").length){
		var $lawLink = $("a[href*=www.law.go.kr/]").not("[rel]"),
			dialogH = $(window).height()-20;
		$("body").append('<div id="lawFrame"><iframe id="modalIframeId" width="100%" height="100%" marginWidth="0" marginHeight="0" frameBorder="0" scrolling="auto" title="Dialog Title"><\/iframe><\/div>');
		$("#lawFrame").dialog({
			bgiframe: true,
			autoOpen: false,
			height: dialogH,
			width:900,
			modal: true,
			resizable:false,
			draggable:false,
			close: function() {
				$("#modalIframeId").attr("src", "");
			},
			buttons: {
				'닫기':function(){ $(this).dialog("close"); },
				'국가법령정보센터': function(){window.open($("#modalIframeId").attr("src"));}
				
			}
		});
		$lawLink.click(function(e){
			e.preventDefault();
			$("#lawFrame").append("<p class='preloading'>loading...</p>");
			$("#modalIframeId").hide().attr({src: $(this).attr("href"), title: $(this).text()}).load(function(){ 
				$(".preloading").remove();
				if($.browser.msie){
					$(this).animate({height:"100%"},1);	// animate는 IE8에서 높이가 변경되지 않는 문제를 해결하기 위한 것임.
				}
				$(this).show();	
			});
			$(".ui-dialog-title").text($(this).text());
			$("#lawFrame").dialog("open");
		});
	}
/* twitter 버튼 추가 2010. 4. 22. */
/*	if($(".boardForms").length && $("#news").length && window.location.search.indexOf("readForm") > -1) {	// 소식이고, 게시물을 읽는 경우 트위터 버튼 추가
		var boardTitle = encodeURIComponent($("h2.view_t").text()),
		articleNo = $("input[name=articleSeq]").val(),
		currentURI = "http://"+window.location.hostname+window.location.pathname+"/?mode=readForm";
		console.log(currentURI);
 		$.ajax({
			url:"/app/board/sns.jsp",
			data:"title="+boardTitle+"&articleSeq="+articleNo+"&currentURI="+currentURI,
			success:function(data){
				$(data).insertAfter("#viewDiv");
				$("a",".snsButtons").click(function(e){
					window.open(this.href);
					return false;
				});
			}
		});
	}*/
	$("#quickNavi, #staticbuttons").scrollFollow({container: 'contentsWrapper', offset:20, easing: 'easeOutQuint', speed:1000});	// 바로가기 스크롤
/* 맨위로 가는 효과 */
	  var moving;
	  if ($.browser.opera)
	  { moving = "html";
	  } else { moving = "html, body"; }

		$(".toTop").click(function(event) {
			event.preventDefault();
			$(moving).animate({scrollTop: 0}, 1000,"easeInOutCubic");
		});
/* 전자민원창구 메뉴 펼치기 */
	if($("#civil").length > 0) {
		var $mustOpen = $("a[href$=report]");
		if($mustOpen.is(".closed")){
			$mustOpen.trigger("click");
		}
	}
}); // end of jQuery