﻿/** left menu **/
var lm_height;
var lm_speed = 300;
var lm_type = "";
var lm_left_po =129;
var lm_setType = "N";
function j_lm(lm1,lm2){	
	//3차메뉴 기본 숨기기
	jQuery("#lm > li > ul").hide();
	jQuery("#lm > li > ul").animate({opacity:0});	
	for(i=0; i < jQuery("#lm > li").length; i++)
	{
		jQuery("#lm > li").eq(i).find(" > ul >li:last").css({"padding-bottom":"0px"});
	}
	//2차메뉴의 높이정의 및 기본높이저장
	//var li_normal_h = jQuery("#lm > li").eq(0).find(" > a").height();
	//jQuery("#lm > li").css({"height":li_normal_h+"px","overflow":"hidden"});
	lm_height = jQuery("#lm > li").height();
	
	
	lm2th_click();
	
	
	jQuery("#lm_con > a").click(function(){return false});


	jQuery(".lm_type1").click(function(){
	   lm_type = "right";
	   jQuery("#lm > li > ul").css({"position":"absolute"});	   
	   jQuery("#lm > li > ul").animate({opacity:1});
	   jQuery("#lm > li > ul").addClass("lmtype1");
	   lm_check_right(lm1,lm2);
	   lmtype_init(1);
	   
	   return false;
    });
	
	jQuery(".lm_type2").click(function(){
	   lm_type = "";	   
	   jQuery("#lm > li").css({"height":"auto"});
	   jQuery("#lm > li > ul").hide();
	   jQuery("#lm > li > ul").animate({opacity:0});
	   jQuery("#lm > li > ul").css({"position":"relative","left":"0","top":"0"});
	   jQuery("#lm > li > ul").removeClass("lmtype1");
	   lm_check(lm1,lm2);
	   lm2th_click();
	   lmtype_init(2);
	   lm_point_remove();
	   return false;
	});
	
	
	//메뉴 check
	lm_check(lm1,lm2);
	//메뉴type선택
	lmtype_init(2);
}
//클릭시 행위
function lm2th_click(){
	//2차메뉴 클릭시
	jQuery("#lm > li > a").click(function(){
		var lm_2th_check = jQuery(this).parent().height();
		if(jQuery(this).parent().find(">ul").length > 0){
			var hit_2th_url = jQuery(this).attr("href");
			if(lm_2th_check > 40 || hit_2th_url.indexOf("submain=Y") != -1){
			} else {
				return false
			}
		}
	});
	
	jQuery("#lm > li > a").click(function(){lm_3th_show(this)});	
}
//선택자 type버튼
function lmtype_init(cnt){
	if(cnt == 1){
		var oldcnt = 2;
		//초기화
		jQuery("#lm > li > a").unbind();
		//hover로 교체
		jQuery("#lm > li > a").hover(function(){lm_3th_show_right(this);},function(){lm_null();});
		jQuery("#lm > li > a").focus(function(){lm_3th_show_right(this);},function(){lm_null();})
		
		//높이 재정의
		var new_height = Number((lm_height * jQuery("#lm > li").size()) + jQuery("#lm > li:last > ul").height());
		jQuery("#lm").height(new_height);
		
		//스타일 재정의
		jQuery("#lm > li > ul").css({"border":"1px solid #2986c6"});
	} else {
		var oldcnt = 1;
		//초기화
		jQuery("#lm > li > a").unbind();
		//click로 교체
		lm2th_click();
		
		//높이 재정의
		jQuery("#lm").css({"height":"auto"});
		
		//스타일 재정의
		jQuery("#lm > li > ul").css({"border":"none"});
	}
	if(lm_setType == "Y"){
		var imgsrc = jQuery(".lm_type"+cnt).find(">img")[0];
		var set1imgsrc = jQuery(".lm_type1").find(">img")[0];
		var set2imgsrc = jQuery(".lm_type2").find(">img")[0];
		
		set1imgsrc.src = set1imgsrc.src.replace("_ov.gif",".gif");
		set2imgsrc.src = set2imgsrc.src.replace("_ov.gif",".gif");
		imgsrc.src = imgsrc.src.replace(".gif","_ov.gif");
	}
}
//right스타일
function lm_3th_show_right(data){
	var top_po = jQuery("#lm > li > a").index(jQuery(data));
	top_po = (top_po*lm_height)-6;
	
	//3차메뉴 높이줄이기
	jQuery("#lm > li > ul").hide();		
	jQuery("#lm > li").css({"height":lm_height+"px"});
	jQuery("#lm > li > ul").css({"position":"absolute","top":top_po+"px","left":lm_left_po+"px","z-index":"10"});
	
	if(jQuery(data).parent().find(">ul").size() != 0){
		//화살표 생성
		lm_point_init(top_po);
	} else {
		lm_point_remove();
	}
	
	//3차메뉴 높이늘이기	
	if(jQuery(data).parent().find(">ul").length > 0){
		jQuery(data).parent().find(" > ul").show();
	}
}

function lm_3th_show(data){
	//3차메뉴 높이줄이기
	jQuery("#lm > li > ul").hide();	
	jQuery("#lm > li > ul").animate({opacity:0});
	jQuery("#lm > li").animate({height:lm_height},lm_speed);
	
	jQuery(data).parent().height(jQuery("#lm > li > a").height());
	
	//3차메뉴 높이늘이기	
	if(jQuery(data).parent().find(">ul").length > 0){
		jQuery(data).parent().animate(
			{
				height:jQuery(data).parent().height()+jQuery(data).parent().find(">ul").innerHeight()
			},
			lm_speed
		);
		jQuery(data).parent().find(">ul").animate(
			{
				height:jQuery(data).parent().find(" > ul").height()},lm_speed,
				function(){
					jQuery(data).parent().find(" > ul").show();
					jQuery("#lm > li > ul").animate({opacity:1});
				}
		);
	} else {
		jQuery(data).parent().animate(
			{
				height:jQuery(data).parent().height()
			},
			lm_speed
		);
	}
	
}

function lm_open(){
	var li_count = jQuery("#lm > li").length;
	
	jQuery("#lm > li > ul").animate({opacity:1});	
	jQuery("#lm > li").height(jQuery("#lm > li > a").height());
	for(i=0; i < li_count; i++)
	{		
		if(jQuery("#lm > li").eq(i).find(">ul").length > 0)
		{
			jQuery("#lm > li").eq(i).animate(
				{
					height:jQuery("#lm > li").eq(i).height()+jQuery("#lm > li").eq(i).find(">ul").innerHeight()
				},
				lm_speed
			);
			jQuery("#lm > li").eq(i).find(">ul").animate(
				{
					height:jQuery("#lm > li").eq(i).find(">ul").height()},lm_speed,
					function(){
						jQuery("#lm > li > ul").show();					
					}
			);
		} else {
			jQuery("#lm > li").eq(i).animate(
				{
					height:jQuery("#lm > li").eq(i).height()
				},
				lm_speed
			);
		}
	}
}

function lm_close(){
	jQuery("#lm > li > ul").hide();		
	jQuery("#lm > li").animate({height:lm_height},lm_speed);
}

function lm_check(lm1,lm2){	
	lm1--;
	lm2--;
	if(jQuery("#lm > li").eq(lm1).find(">ul").length > 0){
		jQuery("#lm > li").eq(lm1).find(">ul").animate(
			{
				height:jQuery("#lm > li").eq(lm1).find(" > ul").height()},lm_speed,
				function(){
					jQuery("#lm > li").eq(lm1).find(" > ul").show();
					jQuery("#lm > li > ul").animate({opacity:1});
				}
		);
	}
	jQuery("#lm > li").eq(lm1).find(">a").addClass("link_2th_ov");
	jQuery("#lm > li").eq(lm1).find("ul>li").eq(lm2).find(">a").addClass("link_3th_ov");	
}
function lm_check_right(lm1,lm2){	
	lm1--;
	lm2--;
	top_po = (lm1*lm_height)-6;
	jQuery("#lm > li > ul").hide();		
	
	
	jQuery("#lm > li").css({"height":lm_height+"px"});
	jQuery("#lm > li > ul").css({"position":"absolute","top":top_po+"px","left":lm_left_po+"px","z-index":"10"});
	
	if(jQuery("#lm > li").eq(lm1).find(">ul").size() != 0){
		//화살표 생성	
		lm_point_init(top_po);
	} else {
		lm_point_remove();	
	}
	
	if(jQuery("#lm > li").eq(lm1).find(">ul").length > 0){
		jQuery("#lm > li").eq(lm1).find(" > ul").show();		
	}
	jQuery("#lm > li").eq(lm1).find(">a").addClass("link_2th_ov");
	jQuery("#lm > li").eq(lm1).find("ul>li").eq(lm2).find(">a").addClass("link_3th_ov");	
}
//화살표생성
function lm_point_init(pointTop){	
	lm_point_remove();
	jQuery('<div class="lm_point"></div>').appendTo(jQuery("#sub_left"));
	var point_tpo = jQuery(".lm_type").height() +  jQuery(".lt").height() + pointTop;
	var point_lpo = lm_left_po - jQuery(".lm_point").width()+1;
	jQuery(".lm_point").css({"top":point_tpo+"px","left":point_lpo+"px","z-index":"20"});	
}
function lm_point_remove(){
	jQuery(".lm_point").remove();
}
function lm_null(){
	return false;	
}

/** left menu end **/



//이미지 오버효과
//사용법 a링크에 rel="ov" 삽입
// 이미지의 ov이미지는 _ov.gif로 통일한다.
function img_ov(hit){
	var $j = jQuery;
	var imgSrc = $j(hit).children().attr("src");
	if(imgSrc.indexOf(".gif") != -1){
		if(imgSrc.indexOf("_ov.gif") == -1){
			imgSrc = imgSrc.replace(".gif","_ov.gif");		
		} else {
			imgSrc = imgSrc.replace("_ov.gif",".gif");
		}
	}
	else if(imgSrc.indexOf(".png") != -1){
		if(imgSrc.indexOf("_ov.png") == -1){
			imgSrc = imgSrc.replace(".png","_ov.png");
		} else {
			imgSrc = imgSrc.replace("_ov.png",".png");
		}
	}
	$j(hit).children()[0].src = imgSrc;
}
//퀵
var quickMove_save; //모션저장
var topPoint; //top고정값저장
var quickBottom = 320;//하단제어값
function quickMove_set(){
	var $j=jQuery;
	topPoint = $j(".sub_quick").position().top;
	$j(window).scroll(quickMove_moveSet);
}
function quickMove_moveSet(){
	var $j=jQuery;		
	clearInterval(quickMove_save);	
	$j(".sub_quick").stop();
	
	quickMove_save = setInterval(quickMove_move,10);	
}
function quickMove_move(){
	var $j=jQuery;
	var scroll_top = Number($(window).scrollTop())+topPoint;	
	var check = $j("body").height()-$j(".sub_quick").height()-topPoint-quickBottom;
	var footPoint = $j("body").height()-$j(".sub_quick").height()-quickBottom;
	
	clearInterval(quickMove_save);
	$j(".sub_quick").stop();
	if(check > Number($(window).scrollTop())){
		$j(".sub_quick").animate({top:scroll_top},400);	
	} else {
		$j(".sub_quick").animate({top:footPoint},400);	
	}
	//$j(".quickMove").animate({top:scroll_top},500);
}

/** selectbox Type **/
//하단 셀렉트박스 링크처리
function bt_link(data){
	var slink = jQuery("#"+data)[0].value;
	var chkStr = "http";
	var check = slink.indexOf(chkStr);
	if(check==0){
		window.open(slink);
	} else {
		location.href = slink;
	}
}
//셀렉트 변환
function selectbox_change(ch,int,bt,check){
	
	//하단 예외
	if(ch == "select_ch1"){
		jQuery(".select_ch1").css({"top":"25px"});	
	}
	
	var data = jQuery("."+ch);
	var count = jQuery(data).find(" > ul > li").length;
	var select_label = jQuery(data).find(" > ul > li").eq(0).text();
	var checks = check;
	var btn_alt="";
	
	jQuery('<label for="select_link_'+int+'" style="position:absolute; font-size:0; height:0px; width:0px; line-height:0px; visibility:hidden">'+select_label+'</label><select id="select_link_'+int+'"></select>').appendTo(jQuery(data));
	jQuery('#select_link_'+int+'').css({"margin-right":"5px"});
	if(checks == "Y") {btn_alt = "선택 사이트 새창열기";}
	else {btn_alt = "선택 사이트로 이동";}
	jQuery('<a href="#" onclick="bt_link(\'select_link_'+int+'\');return false;" onkeypress=""><img src="../images/common/'+bt+'.gif" alt="'+btn_alt+'" /></a>').appendTo(jQuery(data));
	jQuery(data).find(" > ul > li").each(
		function(n){			
			var selectLink = jQuery(this).find(">a").attr("href");
			var val = jQuery(this).find(">a").text();
			
			if(jQuery(this).find(">ul > li").size() == 0){ //기본
				jQuery('<option value="'+selectLink+'">'+val+'</option>').appendTo(jQuery(data).find(" > select"));
			} else if(jQuery(this).find(">ul > li").size() != 0){//그룹화 생성							
				jQuery('<optgroup label="'+val+'" class="optgroup_'+n+'"></optgroup>').appendTo(jQuery(data).find(" > select"));				for(i=0;i<jQuery(this).find(">ul > li").size();i++){					
					var selectLink2 = jQuery(this).find("ul>li:eq("+i+")>a").attr("href");
					var val2 = jQuery(this).find("ul>li:eq("+i+")>a").text();
					jQuery('<option value="'+selectLink2+'">'+val2+'</option>').appendTo(jQuery(data).find(" > select > optgroup.optgroup_"+n+""));	
				}				
			}
		}
	);
	jQuery(data).find(" > ul").remove();
}




/** 별표꽝꽝 **/
function star_ac_mul(){	
	jQuery(".star_mul").attr(
		"name",
		function(){
			return jQuery(this).text();
		}
	);
	jQuery(".star_mul").empty();
	jQuery(".star_mul").css({
		"position":"relative",
		"display":"inline-block",
		"width":"60px",
		"height":"12px",
		"line-height":"12px",
		"font-size":"10px",
		"background":"url(../images/common/star_ac.gif) no-repeat left top"
	});
	jQuery('<span class="star_mul_g"><img src="../images/common/star_ac_ov.gif" alt="" /></span>').appendTo(jQuery(".star_mul"));
	jQuery(".star_mul_g").css({
		"position":"absolute",
		"top":"0",
		"left":"0",
		"overflow":"hidden",
		"width":"0"
	});

	jQuery(".star_mul img").attr(
		"alt",
		function(){
			return jQuery(this).parent().parent().attr("name");
		}
	);

	//실행
	for(var i=0; i<jQuery(".star_mul").size(); i++){
		var txts = jQuery(".star_mul").eq(i).attr("name");
		var star_num = Number(txts*12);
		var star_speed = Number(txts*1000);
		
		jQuery(".star_mul_g").eq(i).animate(
			{width:star_num}
			,star_speed
		);
	}
	
}


function star_ac_set(){
	jQuery(".star_ov").css({
		"position":"relative",
		"display":"inline-block",
		"width":"60px",
		"height":"12px",
		"line-height":"12px",
		"font-size":"10px",
		"background":"url(../images/common/star_ac.gif) no-repeat left top"
	});
	jQuery('<span class="star_g"><img src="../images/common/star_ac_ov.gif" alt="" /></span>').appendTo(jQuery(".star_ov"));
	jQuery(".star_g").css({
		"position":"absolute",
		"top":"0",
		"left":"0",
		"overflow":"hidden",
		"width":"0"
	});

	//실행
	star_ac_tot(''+jQuery(".star_tot").text()+'','star_g');
	
}
function star_ac_tot(cnt,className){
	var star_num = Number(cnt*12);
	var star_speed = Number(cnt*1000);
	
	jQuery("."+className).animate(
		{width:star_num}
		,star_speed
	);
}


//포토겔러리
var photoTypeSave = 0;
var photoTypeClick = 0;
function photoType(type){
	var objList = jQuery(".photolistMove");
	var objListCC = objList.find(">ul>li");
	var maxHeight = objList.height();
	var listHeight = objList.find(">ul").height();
	
	//셋팅
	jQuery(".photolistMove, .photoViewImg").css("overflow","hidden");
	
	objListCC.find(" img").css("opacity","0.7");
	photoType_blind(0);	
	
	//실행
	jQuery(".photolist>a").eq(0).click(function(){photoType_up(maxHeight,listHeight);return false;});
	jQuery(".photolist>a").eq(1).click(function(){photoType_down(maxHeight,listHeight);return false;});
	
	objListCC.find(">a").click(function(){
		var cnt = objListCC.find(">a").index(jQuery(this));		
		photoType_blind(cnt);
		photoType_view(cnt);
		return false;
	});
}
function photoType_blind(cnt){
	var objList = jQuery(".photolistMove");
	var objListCC = objList.find(">ul>li");
	var hitImg = objListCC.eq(cnt).find(" img");
	var oldImg = objListCC.eq(photoTypeSave).find(" img");
	
	//과거
	oldImg
	.width(111)
	.height(76)
	.css({"border":"none","opacity":"0.7"});
	
	//현제
	hitImg
	.width(103)
	.height(68)
	.css({"border":"4px solid #fff","opacity":"1"});
	
	//저장
	photoTypeSave = cnt;
}
function photoType_view(cnt){
	var obj = jQuery(".photoViewImg > ul");
	var objC = obj.find(">li");
	var topPosition = objC.eq(cnt).position().top;
	
	obj.animate(
		{top:-topPosition}
		,500
	);
}
function photoType_up(maxHeight,listHeight){
	if(photoTypeClick == 0){
		photoTypeClick= 1;
		var obj = jQuery(".photolistMove>ul");
		var topPosition = (obj.position().top*-1)+95;
		var stopPosition = listHeight-maxHeight;
		
		if(topPosition >= stopPosition){
			alert("마지막페이지입니다.");
			photoTypeClick = 0;
		} else {
			obj.animate(
				{top:-topPosition}
				,500
				,function(){
					photoTypeClick = 0;
				}
			);
		}
	}
}
function photoType_down(){
	if(photoTypeClick == 0){
		photoTypeClick = 1;
		var obj = jQuery(".photolistMove>ul");
		var topPosition = (obj.position().top*-1)-95;
		var stopPosition = 0;
		
		if(topPosition < stopPosition){
			alert("처음페이지입니다.");
			photoTypeClick = 0;
		} else {
			obj.animate(
				{top:-topPosition}
				,500
				,function(){
					photoTypeClick = 0;
				}
			);
		}
	}
}

//메인 베스트사진
var mainTab_save=0;
function mainTab_init(){
	var obj = jQuery(".mainTab");
	var objC = obj.find(">li");
	var objCC = objC.find(">div");
	
	//settting
	obj.css({"overflow":"hidden"});
	objC.css({"float":"left"});
	objCC.css({"position":"absolute","left":"20px","top":(objC.find(">a>img").height()+19)+"px"});
	objCC.hide();
	
	//초기실행
	mainTab_AC(0);
	
	//오버
	objC.find(">a").bind(
		"mouseover",
		function(){
			var cnt = objC.find(">a").index(jQuery(this));
			mainTab_AC(cnt);
		}
	);
}
function mainTab_AC(cnt){
	var obj = jQuery(".mainTab");
	var objC = obj.find(">li");
	var objCC = objC.find(">div");
	
	objC.eq(mainTab_save).find("div").hide();
	var oldImg = objC.eq(mainTab_save).find(">a>img").get(0);
	oldImg.src = oldImg.src.replace("_ov.gif",".gif");
	
	objC.eq(cnt).find("div").show();
	var newImg = objC.eq(cnt).find(">a>img").get(0);
	newImg.src = newImg.src.replace(".gif","_ov.gif");
	
	
	
	//저장
	mainTab_save = cnt;
}



//사진올리기
var photoAddAC_save;
function photoAddAC(){
	var obj = jQuery(".photoADD");	
	var ListVal = jQuery(".photoADDList");
	photoAddAC_save = ListVal.html();//리스트복사
	
	obj.css("position","relative");
	
	
	jQuery('<span class="button photoADDBt"><input type="button" value="사진추가하기" /></span>').appendTo(obj);
	
	jQuery(".photoADDBt").css({"position":"absolute","right":"20px","top":"10px","z-index":"101"});
	
	//클릭
	var objBt = jQuery(".photoADDBt > input:button");
	objBt.bind("click",function(){photoAdd_plus();return false;});
	
}

function photoAdd_plus(){
	var ListVal = jQuery(".photoADDList");
	
	jQuery(photoAddAC_save).appendTo(ListVal);
}


//비밀번호 효과
function passAC(){
	jQuery('<div class="blind"></div>').prependTo(jQuery("body"));
	jQuery('<div class="passBox"><strong>비밀번호를 입력하세요</strong><input type="text" style="width:90px" class="inputLine" /><span class="button"><a href="#link">확인</a></span><p class="passBoxClose"><a href="#link"><img src="../images/common/pass_close.gif" alt="닫기" /></a></p></div>').prependTo(jQuery("body"));
	
	jQuery(".blind").css({
		"position":"absolute",
		"left":"0",
		"top":"0",
		"z-index":"99999",
		"width":"100%",
		"height":jQuery("#wrap").height()+"px",
		"background":"#000",
		"opacity":"0"
	});
	
	jQuery(".passBox").css({
		"position":"absolute",
		"left":(jQuery(window).width()/2)-70+"px",
		"top":(jQuery(window).height()/2)+jQuery(window).scrollTop()-50+"px",
		"z-index":"999999",
		"width":"140px",
		"height":"40px",
		"padding":"10px 10px 15px 15px",
		"color":"#000",
		"background":"#fff",
		"border":"1px solid #666",
		"display":"none"
	});
	jQuery(".passBoxClose").css({
		"position":"absolute",
		"left":"119px",
		"top":"-16px",
		"margin":"0px"
	});
	jQuery(".passBox>strong").css({"display":"block","margin-bottom":"5px"});
	
	//실행
	jQuery(".blind").animate({opacity:0.7},500,function(){jQuery(".passBox").show()});
	
	jQuery(".passBoxClose").click(function(){
		jQuery(".passBox").remove();
		jQuery(".blind").animate({opacity:0},500,function(){jQuery(".blind").remove();});
		return false;
	});
}


/** 메인 블라인드 **/
function mblindAC(){
	jQuery(".mblind").css("opacity","0.4");
	jQuery(".mblind2").css("opacity","0.65");
}

/** 메인 배너 **/
var mban_click=0;
var Tabobj,TabobjC,TabobjCC,TabobjTab,TabobjSave;
(function(jQuery){
	jQuery.mbanAC = {
		set : function(){
		var leftBt = jQuery(".mban_left");
		var rightBt = jQuery(".mban_right");
		
			leftBt.click(jQuery.mbanAC.before_bn);
			rightBt.click(jQuery.mbanAC.after_bn);
		},
		
		before_bn : function(){
			if(mban_click == 0){
				mban_click = 1;
				var moveObj = jQuery(".mban_move");
				var moveObj_last = moveObj.find(">li:last")
				var moveObj_left = moveObj_last.width();
				
				moveObj_last.clone().prependTo(moveObj);
				moveObj.css("left","-"+moveObj_left+"px");
				
				moveObj.animate(
					{left:0}
					,300
					,function(){
						moveObj_last.remove();
						mban_click = 0;
					}
				);
				return false;
			}
		},
		
		after_bn : function(){
			if(mban_click == 0){
				mban_click = 1;
				var moveObj = jQuery(".mban_move");
				var moveObj_first = moveObj.find(">li:eq(0)")
				var moveObj_left = moveObj_first.width();
				
				moveObj.animate(
					{left:-moveObj_left}
					,300
					,function(){
						moveObj_first.clone().appendTo(moveObj);
						moveObj_first.remove();
						moveObj.css("left","0px");
						mban_click = 0;
					}
				);
				return false;
			}
		}
	}
	jQuery.mTab = {
		set : function(){
			Tabobj = jQuery(".mTab");
			TabobjC = Tabobj.find(">li");
			TabobjCC = TabobjC.find(">ul");
			TabobjTab = TabobjC.find(">strong>a");
			
			//css
			Tabobj.css({"overflow":"hidden"});
			TabobjC.css({"float":"left"});
			TabobjCC.css({"position":"absolute","left":"5px","top":"31px","margin":"0px"});
			
			//초기값
			TabobjSave = 0;
			TabobjCC.hide().eq(0).show();
			
			//효과
			TabobjTab.mouseover(function(){
				var cnt = TabobjTab.index(jQuery(this));
				jQuery.mTab.view(cnt);
				return false;
			});
		},
		
		view : function(cnt){
			//old
			var oldImg = TabobjC.eq(TabobjSave).find(">strong>a>img").get(0);
			TabobjCC.eq(TabobjSave).hide();
			oldImg.src = oldImg.src.replace("_ov.png",".png");
				
			//new			
			var newImg = TabobjC.eq(cnt).find(">strong>a>img").get(0);
			TabobjCC.eq(cnt).show();
			newImg.src = newImg.src.replace(".png","_ov.png");	
			
			//save
			TabobjSave = cnt;
		}
	}
})(jQuery);

//png ov효과
function pngOvAC(){
	var obj = jQuery("a[rel^=pngOv]");
	obj.mouseover(function(){
		var chImg = jQuery(this).find(">img").get(0);
		chImg.src = chImg.src.replace(".png","_ov.png");
	});
	obj.mouseout(function(){
		var chImg = jQuery(this).find(">img").get(0);
		chImg.src = chImg.src.replace("_ov.png",".png");
	});
}


// 메인 배너 2번째
function mban2AC(){
	var obj = jQuery(".mban2 > ul")	;
	var obj_first = obj.find(">li:eq(0)");
	var obj_firstWidth = obj_first.width()+6;
	obj.animate(
		{left:-obj_firstWidth}
		,2000
		,function(){
			obj_first.clone().appendTo(obj);
			obj_first.remove();
			obj.css("left","0px");
			mban2AC();
		}
	).delay(800);
}

/** Tab **/
var moveTab_animate = "N"; // 애니메이션 사용여부 ( Y, N )
var moveTab_Time1,moveTab_Time2;
function moveTab_init(cnt){
	//기본
	moveTab_set(cnt);
	moveTab_repoint(cnt);
	
	jQuery("#moveTab > ul > li > a").hover(function(){moveTab_ov(this)},function(){return false});
		
	jQuery("#moveTab > ul > li > a").focus(function(){moveTab_ov(this)});
	
	jQuery("div[id^=moveTabView]").hide().eq(0).show(cnt-1);
}
function moveTab_repoint(cnt){
	//마우스 이벤트
	jQuery("#moveTab").mouseout(
		function(){
			moveTab_Time1 = setTimeout(function(){moveTab_set(cnt)},2000);
		}
	);
	jQuery("#moveTab").mouseover(
		function(){
			clearTimeout(moveTab_Time1);
		}
	);
	//키보드 이벤트
	jQuery("#moveTab").blur(
		function(){
			moveTab_Time2 = setTimeout(function(){moveTab_set(cnt)},2000);
		}
	);
	jQuery("#moveTab").focus(
		function(){
			clearTimeout(moveTab_Time2);
		}
	);
}
function moveTab_set(cnt){
	jQuery("#moveTab_ov").stop();
	cnt--;
	var point_href = jQuery("#moveTab > ul > li").eq(cnt).find(" > a").attr("href");
	var point_text = jQuery("#moveTab > ul > li").eq(cnt).find(" > a").text();
	var point_width = jQuery("#moveTab > ul > li").eq(cnt).width();
	var point_left = jQuery("#moveTab > ul > li").eq(cnt).position().left;
	
	if(navigator.appVersion.indexOf("MSIE 6")!=-1){
		//IE6.0용 코드
		var point_top = jQuery("#moveTab > ul > li").eq(cnt).position().top;	
	} else {	
		//그외 코드
		var point_top = jQuery("#moveTab > ul > li").eq(cnt).position().top;	
	}

	
	
	jQuery("#moveTab_ov").html('<strong><a href="'+point_href+'">'+point_text+'</a></strong>');
	jQuery("#moveTab_ov").width(point_width);
	if(moveTab_animate == "Y"){
		jQuery("#moveTab_ov").animate(
			{top:point_top}
			,5
			,function(){
				jQuery("#moveTab_ov").animate(
					{left:point_left}
					,300
				);	
			}
		);
	} else {
		jQuery("#moveTab_ov").css({"left":point_left+"px","top":point_top+"px"});
	}
	
	jQuery("#moveTab_ov a").click(function(){moveTab_click(cnt);return false;});
}
function moveTab_ov(hit){
	var hitCount = jQuery("#moveTab > ul > li > a").index(jQuery(hit))+1;
	//실행
	moveTab_set(hitCount);
}
function moveTab_click(cnt){
	jQuery("div[id^=moveTabView]").hide().eq(cnt).show();
	moveTab_set(cnt+1);
	jQuery("#moveTab").unbind("mouseover mouseout blur");
	//alert(cnt);
	clearTimeout(moveTab_Time1);
	clearTimeout(moveTab_Time2);
	moveTab_repoint(cnt+1);
}


// 맵핑
var map_view_objA,map_view_objB;
var map_view_save=0;
function map_view_init(){
	map_view_objA = jQuery(".mapsJs").find(">ul>li");
	map_view_objB = jQuery(".map_view_content");
	
	map_view_AC(0);
	
	map_view_objA.find(">a").click(function(){
		var cnt = map_view_objA.find(">a").index(jQuery(this));
		map_view_AC(cnt);
		return false;
	});
}
function map_view_AC(cnt){
	map_view_objB.hide().eq(cnt).show();
	
	var oldimg = map_view_objA.eq(map_view_save).find(">a>img").get(0);
	oldimg.src = oldimg.src.replace("_ov.gif",".gif");
	
	var newimg = map_view_objA.eq(cnt).find(">a>img").get(0);
	newimg.src = newimg.src.replace(".gif","_ov.gif");
	
	map_view_save = cnt;
}


//전체메뉴
function allMenu_AC(){
	var obj = jQuery(".allMenu");
	var openBt = jQuery(".allMenuOn");
	var closeBt = jQuery(".allMenuOff");
	
	openBt.click(function(){
		obj.show()
		.css("opacity","0")
		.animate(
			{top:0,opacity:1}
			,500
			,function(){
				jQuery(".allMenu a").eq(0).focus();
			}
		);		
	});
	
	closeBt.click(function(){
		obj.animate(
			{top:-320,opacity:0}
			,500
			,function(){
				obj.hide();
				openBt.find(" a").eq(0).focus();
			}
		);		
	});
}
