// 퀵메뉴 top
if(document.location.href.indexOf('index.jsp') > -1) {
	jwxe_scroll_quick_menu_top = 450;
} else {
	jwxe_scroll_quick_menu_top = 230;
}

$(
function() {
	$('#flashalt').parent().parent().parent().css('z-index',10000000);
}
)


$(
function() {
                     $("#banner_stop").click(
                                function() {
                                          $("ul[id=bannerID2] li a").attr("jwxe_isFocus", "true");
                                }
                     )
                     $("#banner_right").click(
                                function() {
                                          $("ul[id=bannerID2] li a").attr("jwxe_isFocus", "false");
                                          $("#bannerID2").attr("jwxe_dir", "-");
 
                                }
                     )
                     $("#banner_left").click(
                                function() {
                                          $("ul[id=bannerID2] li a").attr("jwxe_isFocus", "false");
                                          $("#bannerID2").attr("jwxe_dir", "+");
 
                                }
                     )
 
}
)

$(
function() {
 		$("#banner_stop2").click(
                                function() {
                                          $("ul[id=bannerID] li a").attr("jwxe_isFocus", "true");
                                }
                     )
                     $("#banner_right2").click(
                                function() {
                                          $("ul[id=bannerID] li a").attr("jwxe_isFocus", "false");
                                          $("#bannerID").attr("jwxe_dir", "-");
 
                                }
                     )
                     $("#banner_left2").click(
                                function() {
                                          $("ul[id=bannerID] li a").attr("jwxe_isFocus", "false");
                                          $("#bannerID").attr("jwxe_dir", "+");
 
                                }
                     )
 
}
)

//////////////////////////////////////////////////////////////////////////////// 배너 처리 /////////////////
var loop=1;
function bn_change(){

	loop = loop % 2;
	
	if(loop==1){	
		var tmpviewObj = document.getElementById("banner2");				
		tmpviewObj.style.display = 'none';
		loop=loop+1;
	} else {
		var tmpviewObj = document.getElementById("banner2");				
		tmpviewObj.style.display = '';
		loop=loop+1;
	}
 		
}


var left_banner_loop=1;
function left_bn_change(){
	
	left_banner_loop = left_banner_loop % 2;
	
	if(left_banner_loop==1){	
		var tmpviewObj1 = document.getElementById("leftBanner2");				
		tmpviewObj1.style.display = 'none';
		left_banner_loop=left_banner_loop+1;
	} else {
		var tmpviewObj1 = document.getElementById("leftBanner2");				
		tmpviewObj1.style.display = '';
		left_banner_loop=left_banner_loop+1;
	}

}




///////////////////////////////////////////////// 콘텐츠 높이에 따라 css 높이 설정 ////////////

var search_height = function(){
	var searchContent = $('#search_result'); 
	var searchMenu = $('#search_result2'); //검색결과

	var totalMenu =searchMenu.height()+120;

	searchContent.css('height',totalMenu);
};
$(function() {
	search_height();
});
$(window).resize( function() {
	search_height();
});

var leftHeight = function(){
	var itemContent = $('.lo_657_left'); //콘텐츠
	var itemMenu = $('#item_menu'); // 왼쪽, 서브메뉴
	var leftUnder = $('#item_left_under'); // 왼쪽, 서브메뉴 아래
	var boardLine = $('#item_bg'); // 맞춰줄 양쪽선
	var boardLine2 = $('#item_bg2'); // 맞춰줄 양쪽선

	var totalMenu = itemMenu.height() + leftUnder.height()-70;

	//두개의 왼쪽메뉴를 합친 값보다 콘텐츠값이 크면
	if(itemContent.height() > totalMenu){
		leftUnder.css('height', itemContent.height()-itemMenu.height()); 
	}else{ //왼쪽메뉴가 콘텐츠보다 크면
		itemContent.css('min-height', totalMenu);
	}

	if(itemContent.height() > boardLine .height()){
		boardLine.css('height', itemContent.height());
		boardLine2.css('height', itemContent.height());
	}

};
$(function() {
	leftHeight();
});

$(window).resize( function() {
	leftHeight();
});

var collapseHeight = function() {
	var boardLine = $('#item_bg'); // 맞춰줄 양쪽선
	var boardLine2 = $('#item_bg2'); // 맞춰줄 양쪽선
	var itemContent = $('.lo_657_left'); //콘텐츠
	boardLine.css('height', itemContent.height());
	boardLine2.css('height', itemContent.height());
}



//////////////////////////////////퀵메뉴스크립트
/*
var quickMenuReload = function() {
	var q = $('#quick_area');
	if(q) {
		var layout = $('.lo_680');
		if(layout.length > 0) {
			var left = layout.offset().left + layout.width() -0;
			q.css('left',left+'px');
		}
	}
};

$(function() {
	quickMenuReload();
});
$(window).resize( function() {
	quickMenuReload();
});

//서브 퀵메뉴스크립트
var quickMenuReload2 = function() {
	var q2 = $('#quick_area2');
	if(q2) {
		var layout = $('.lo_697_left');
		if(layout.length > 0) {
			var left = layout.offset().left + layout.width() -0;
			q2.css('left',left+'px');
		}
	}
};

$(function() {
	quickMenuReload2();
});
$(window).resize( function() {
	quickMenuReload2();
});
*/

// 메인 전체 메뉴 보기
function if_showhidden() {
        $('#allmenu-wrapper').parents(".lo_984").css("z-index", 100000);
	var obj = document.getElementById("allmenu-wrapper");
	if(obj.style.display == "none" || obj.style.display == "") {
		obj.style.display = "block";
	} else {
		obj.style.display = "none";		
	}
}



////////////////////////// 팝업존 /////

var rollingCount = 5;
var loopPop = 1;

function plusRolling(){
					
	var tmpPopObj;
	var tmpPopObj_num1 =$("#Pop01");
	var tmpPopObj_num2 = $("#Pop02");
	var tmpPopObj_num3 = $("#Pop03");
	var tmpPopObj_num4 = $("#Pop04");

			tmpPopObj_num1.find('img').attr("src", "/gongdan/_res/img/mainPopNo1.gif");
			tmpPopObj_num2.find('img').attr("src", "/gongdan/_res/img/mainPopNo2.gif");
			tmpPopObj_num3.find('img').attr("src", "/gongdan/_res/img/mainPopNo3.gif");
			tmpPopObj_num4.find('img').attr("src", "/gongdan/_res/img/mainPopNo4.gif");

	for(var i=1; i<rollingCount; i++){
		tmpPopObj = document.getElementById(i);

		if(!tmpPopObj) continue;


		if(i==loopPop){
			tmpPopObj.style.display = '';
			$("#Pop0"+i).find('img').attr("src", "/gongdan/_res/img/mainPopNo"+ i +"_on.gif");

		}else{
			tmpPopObj.style.display = 'none';

		}
	}

	if(loopPop == rollingCount-1){
		loopPop =1;
	}else{
		loopPop = loopPop+1;
	}


}

var popOnOff = true;

function popupOff(){
	popOnOff = false;
}
function popupOn(){
	popOnOff = true;
	change();
}

var change = function()
{
	if(popOnOff){
      	   day = new Date();
     	   second = day.getSeconds();

     	    //플러스쪽으로 이동
  	    plusRolling();
    	     
     	    //시간 3초로 설정 함
     	    setTimeout("change()",3000);
	}
};

$(function() {
	change();
});
