$(window).ready(function(){
	$scrollpos	= 0;

	$("#organ_prev").click(function(){
		if($scrollpos-$(".list_link").width() >= 0){
			$scrollpos = $scrollpos-$(".list_link ul li").width();
			$(".list_link").scrollLeft($scrollpos);
		}
	});
	$("#organ_next").click(function(){
		if($scrollpos+$(".list_link").width() < $scrollpos+$(".list_link ul").width()){
			$scrollpos = $scrollpos+$(".list_link ul li").width();
			$(".list_link").scrollLeft($scrollpos);
		}
	});
	setInterval(function(){
		if($scrollpos+$(".list_link").width() < $(".list_link ul").width()){
			$scrollpos = $scrollpos+$(".list_link ul li").width();
			$(".list_link").scrollLeft($scrollpos);
		}else if($scrollpos+$(".list_link").width() == $(".list_link ul").width()){
			$scrollpos = 0;
			$(".list_link").scrollLeft($scrollpos);
		}
	}, 2500);

	$("#popupzone_silding").jCarouselLite({
		btnNext: ".btn_popupzone2",
		btnPrev: ".btn_popupzone1",
		pauseOnHover : true,
		auto: 3000,
		speed: 1200,
		visible: 1
	});

	$("#list_company ul li:eq("+Math.round(Math.random()*2)+")").show();

	$(".tablink h3 a").click(function(){
		$(this).parent().siblings().each(function(){
			$(this).find("img").attr("src", $(this).find("img").attr("src").replace("_on", "_off"));
			$($(this).find("a").attr("href")).hide();
		});

		$(this).find("img").attr("src", $(this).find("img").attr("src").replace("_off", "_on"));
		$($(this).attr("href")).show();

		if($(this).attr("href") == "#picture_board"){
			$(".tab_title2 .paging a").attr("href", "/notice/picture.do");
		}else{
			$(".tab_title2 .paging a").attr("href", "/notice/picture.do?page=&amp;cmd=&amp;search_word=&amp;board_code=BO05&amp;category_id=CA07&amp;mode=list");
		}

		return false;
	});
});

//110726 팝업
function getCookie(Name) {
	var search = Name + "="
		offset = document.cookie.indexOf(search)
		if (document.cookie.length > 0) { // 쿠키가 설정되어 있다면    
			if (offset != -1) { // 쿠키가 존재하면
			offset += search.length
			// set index of beginning of value
			end = document.cookie.indexOf(";", offset)
			// 쿠키 값의 마지막 위치 인덱스 번호 설정
			if (end == -1)
			end = document.cookie.length
			return unescape(document.cookie.substring(offset, end))
		}
	}
}

function openNotice() {
	 if (getCookie("popup01") != "p01") {   
		//요청에 의한 팝업 중지 2011-09-02
		//window.open('popup_110726.do','popup',"width=470,height=590,top=0,left=0,status=no,scrollbars=no,resizable=no");
	}
}

openNotice();
