(function($){
	var initLayout = function() {
		$('a.bwGal').zoomimage({
			border: 0,
			centered: true,
			hideSource: true
		});
		
		/*$('a.customGal').zoomimage({
			controlsTrigger: 'mouseover',
			className: 'custom',
			shadow: 40,
			controls: false,
			opacity: 1,
			beforeZoomIn: function(boxID) {
				$('#' + boxID)
					.find('img')
					.css('opacity', 0)
					.animate(
						{'opacity':1},
						{ duration: 500, queue: false }
					);
			},
			beforeZoomOut: function(boxID) {
				$('#' + boxID)
					.find('img')
					.css('opacity', 1)
					.animate(
						{'opacity':0},
						{ duration: 500, queue: false }
					);
			}
		});*/
	};
	EYE.register(initLayout, 'init');
})(jQuery)

$(function() {
	//레프트 메뉴가 mnu_type=='olink' 일 때 새창 이미지 뜨도록....
	/*var imgVar = "/img/common/newwin.gif";
	$('.subleftUL > li > a[href^=http://]').css({background: 'url('+imgVar+') no-repeat right 50%;'});
	$('.subleftUL > li > a[href^=https://]').css({background: 'url('+imgVar+') no-repeat right 50%;'});
	$('.subleftUL > li > ul > li > a[href^=http://]').css({background: 'url('+imgVar+') no-repeat right 50%;'});
	$('.subleftUL > li > ul > li > a[href^=https://]').css({background: 'url('+imgVar+') no-repeat right 50%;'});*/

	$('.customGaliMg').mouseover(function() {
		$(this).css("border","2px solid #bfde86");
	});

	$('.customGaliMg').focus(function() {
		this.mouseover();
	});

	$('.customGaliMg').mouseout(function() {
		$(this).css("border","2px solid #ffffff");
	});

	$('.customGaliMg').blur(function() {
		this.mouseout();
	});
	
	//프린트 플러그인 컨트롤 부분	
	//$('.link').click(function(){ $.jPrintArea('#cnt') });

	//탑메뉴 텝 전환 (마우스 오버시)
	$('#top_menu > li > a').mouseover(function(){
		$('#top_menu > li > div').css({visibility:'hidden'});
		$('#top_menu > li > a > img').each(function(index, value){
			$(this).attr('src',$(this).attr('src').replace('_on','_off'));
		});
		$('img:first',this).attr('src',$('img:first',this).attr('src').replace('_off','_on'));
		$(this).next('.sub_menuDiv').css({visibility:'visible'});
	});

	//탑메뉴 텝 전환 (온 포커스시)
	$('#top_menu > li > a').focus(function(){
		$('#top_menu > li > div').css({visibility:'hidden'});
		$('#top_menu > li > a > img').each(function(index, value){
			$(this).attr('src',$(this).attr('src').replace('_on','_off'));
		});
		$('img:first',this).attr('src',$('img:first',this).attr('src').replace('_off','_on'));
		$(this).next('.sub_menuDiv').css({visibility:'visible'});
	});

	//왼쪽메뉴 펼침부분
	$('.subleftULLI3 > a').click(function(){
		if ($(this).next('.3rd').css("display") == "none") {
			$(this).next('.3rd').show("nomal");
			$('img:first',this).attr('src',$('img:first',this).attr('src').replace('_plus','_minus'));
		}else{
			$(this).next('.3rd').hide("nomal");
			$('img:first',this).attr('src',$('img:first',this).attr('src').replace('_minus','_plus'));
		}
	});

	//왼쪽메뉴 펼침부분
	$('.subleftULLI3 > a').keyup(function(){
		//CountNum = CountNum + 1;
		if ($(this).next('.3rd').css("display") == "none") {
			$(this).next('.3rd').show();
			$('img:first',this).attr('src',$('img:first',this).attr('src').replace('_plus','_minus'));
			$(this).attr('title',$(this).attr('title').replace('펼치기','닫기'));
		}
	});

	//왼쪽메뉴 전체보기 / 전체닫기
	$('#OpenAll').click(function(){
		var BtnName = $('#OpenCloseBtn').attr('src');
		if ((BtnName).indexOf("left_view") > -1){
			$('.subleftUL > li > ul').show("nomal");
			$('.subleftUL > li > a > img').each(function(index, value){
				var imgName = $(this).attr('src');
				if ((imgName).indexOf("_plus")){
					imgName = imgName.replace('_plus','_minus');
					$(this).attr('src',imgName);
				}
			});
			$('#OpenCloseBtn').attr('src',$('#OpenCloseBtn').attr('src').replace('_view','_close'));
			$('#OpenCloseBtn').attr('alt',"왼쪽메뉴 전체닫기 버튼");
		}else{
			$('.subleftUL > li > ul').hide("nomal");
			$('.subleftUL > li > a > img').each(function(index, value){
				var imgName = $(this).attr('src');
				if ((imgName).indexOf("_minus")){
					imgName = imgName.replace('_minus','_plus');
					$(this).attr('src',imgName);
				}
			});
			$('#OpenCloseBtn').attr('src',$('#OpenCloseBtn').attr('src').replace('_close','_view'));
			$('#OpenCloseBtn').attr('alt',"왼쪽메뉴 전체펼침 버튼");
		}
	});

	$('#OpenAll').keypress(function(){
		$(this).click();
	});
});
