
$(function(){
	$.extend({positions:[]});
	/*--------------------------------------------
		$.extend getColumnWrapPosition
	--------------------------------------------*/
	$.extend({getColumnWrapPosition:function(){
		var h =0;
		$(".columnWrap").each(function(i){
			h += $("#lnaviParent li").eq(i).height();
			$.positions.push(Math.floor($(this).position().top) - 210 -h);
		});	
	}}) //end $.getColumnWrapPosition
	
	/*--------------------------------------------
		$.extend setImgSlider
	--------------------------------------------*/	
	$.extend({setImgSlider:function(){
		$(".thumView li")
		.mouseover(function(){
			var cn = Number($(this).attr("class").split("thum")[1]);
			var $p = $(this).parent().parent().find(".picView");
			$p.dequeue().animate({
				marginTop: - 176 * cn
			},300, "easeInOutCirc")	
		});
	}}); //end $.extend setImgSlider
	
	/*--------------------------------------------
		$.extend check
	--------------------------------------------*/	
	$.extend({
		check:function()
			{
				var n =0;
				$.each($.positions,function(i){
					if(Number(this) >= Number($.aniTop)){
						n = i ==0 ? 0 : i -1;
						return false;
					}else{
						n = $.positions.length -1;
					}
				});
				if($("#lnaviParent .on") != $("#lnaviParent li").eq(n)){
					var $on =$("#lnaviParent .on").removeClass("on");
					$on = $("#lnaviParent li").eq(n);
					$on = $on.addClass("on");
					$arw.css({top: $on.attr("offsetTop") + $on.attr("offsetHeight") / 2 - 17/2});
				};
			}
	}) //end $.extend check
	
	/*--------------------------------------------
		$.extend setMenus
	--------------------------------------------*/
	$.extend({
		setMenus:function()
			{
				$('#menuLArea .menuCell')
				.biggerlink()
				.hover(
					function(){
						var h = $(this).height() +"px";
						$(this).prepend("<p class='overLayer'></p>")
						$(this).find(".overLayer")
						.css({backgroundColor:"#ffd4a8",position:"absolute",height:h,opacity:0,width:"279px"})
						.fadeTo("nomal",0.3);
					},
					function(){
						$(this).find(".overLayer")
						.fadeTo("slow",0,
							function(){
								$(this).remove();
							}
						);
					}		
				)
				$('#menuRArea .menuCell')
				.biggerlink()
				.hover(
					function(){
						var h = $(this).height() +"px";
						$(this).prepend("<p class='overLayer'></p>")
						$(this).find(".overLayer")
						.css({backgroundColor:"#aae40c",position:"absolute",height:h,opacity:0,width:"279px"})
						.fadeTo("nomal",0.3);
					},
					function(){
						$(this).find(".overLayer")
						.fadeTo("slowl",0,
							function(){
								$(this).remove();
							}
						);
					}		
				)
				/*
				$('#news1 .newsCell')
				.biggerlink()
				.hover(
					function(){
						var h = $(this).height()+17 +"px";
						$(this).prepend("<p class='overLayer'></p>")
						$(this).find(".overLayer")
						.css({backgroundColor:"#cc0003",position:"absolute",height:h,opacity:0,width:"309px"})
						.fadeTo("nomal",0.2);
					},
					function(){
						$(this).find(".overLayer")
						.fadeTo("slow",0,
							function(){
								$(this).remove();
							}
						);
					}		
				)
				*/
			}
	}) //end $.extend setMenus

	/*--------------------------------------------
		$.extend setTabMenu
	--------------------------------------------*/	
	$.extend({
		setTabMenu:function()
			{
				var tabCont = ["traNews0","traNews1","traNews2"];
				$('#tabWrap li').click(function(){
					$('#tabWrap li').removeClass("on");
					$(this).addClass("on");
					var cont = String($(this).attr('id').split("Tab").join(""));
					$.each(tabCont,function(){
						if(String(this) != String(cont)){
							if($("#"+this).css("display") == "block"){
								$("#"+this).slideUp("fast",function(){
									$("#"+cont).slideDown("fast");
								});
							
							}
						}
					});
				});
			}
	}) //end $.extend setTabMenu
	
	/*--------------------------------------------
		$.extend setLNavi
	--------------------------------------------*/	
	$.extend({
		setLNavi:function()
		{
			$("#lnavi .block").each(function(){
				var H =$(this).height();
				$.data($(this).get(0),"data",{h:H});
			})
			.css({overflow:"hidden"})
			.find(".plusMinus")
			.css({cursor:"pointer"})
			.click(function(){
				var img = $(this).attr("src");
				if(img.indexOf("plus") != -1){
					$(this).attr({src:"/common/images/lnavi/minus.gif"}).parent().parent().queue([]).stop().animate({height:$.data($(this).parent().parent().get(0),"data").h+"px"},300);
				}else{
					$(this).attr({src:"/common/images/lnavi/plus.gif"}).parent().parent().queue([]).stop().animate({height:"24px"},300);
				}
				
			});
		}
	}) //end $.extend setLNavi
	$.setLNavi();
	/*--------------------------------------------
		$.extend setGnavi
	--------------------------------------------*/	
	$.extend({
		setGnavi:function()
			{
				/*
				var isOut =true;
				var $gLi = $('#gnaviContent li').biggerlink();
				var $gback = $('#gnaviMove');
				var startX = $("#gnaviArea").position().left;
				$gLi.hover(function(){
					$gback.css({visibility:"visible"});
					$that =$(this);
					$gback.each(function() {
						 $(this).dequeue();
					});
					$gback.animate({
						left: startX + this.offsetLeft
					},300
					);
				});
				*/
			}
	}) //end $.extend setGnavi
	
});

