 $(document).ready(function() {
	stageResize();

	// 타이틀 변환
	var homeTile = jQuery('title').text();
	var replaceTitle = jQuery('.sub-title h2').text();
	arrTitle = jQuery('.sub-title h2').text();
	if(replaceTitle==''){
	}else{
		document.title=arrTitle + " | " + homeTile;
	};

	// 텝
	jQuery(".tab-content").hide();
	jQuery("ul.tabs>li:first").addClass("active");
	jQuery(".tab-content:first").show();

	jQuery("ul.tabs>li").click(function(e) {
		e.preventDefault();
		jQuery("ul.tabs>li").removeClass("active");
		jQuery(this).addClass("active");
		jQuery(".tab-content").hide();

		jQuery("ul.tabs>li").find('img').attr("src" ,function(iIndex,sSrc){
			return sSrc.replace('_on.gif', '_off.gif');
		});

		jQuery("ul.tabs>li.active").find('img').attr("src",function(iIndex,sSrc){
			return sSrc.replace('_off.gif', '_on.gif');
		});

		var activeTab = jQuery(this).find("a").attr("href");
		jQuery(activeTab).fadeIn();
		return false;
	});

	// slide
	$(".mainSlide").slick({
		//fade: true,
		autoplay: true,
		pauseOnHover: false,
		autoplaySpeed: 4000,
		speed: 800,
		arrows:true,
		dots:true
	});

	$(".ptnSlide").slick({
		infinite: true,
		pauseOnHover: false,
		autoplaySpeed: 2000,
		speed: 700,
		slidesToShow: 5,
		slidesToScroll: 1,
		arrows:true,
		dots:false
	});

	// fancybox
	jQuery(".pop_privacy").fancybox({
		padding     : 0,
		margin      : 50,
		fitToView	: false,
		maxWidth	: "100%",
		maxHeight	: "90%",
		width		: 700,
		height		: 600,
		autoSize	: true,
		closeClick	: false,
		openEffect	: 'none',
		closeEffect	: 'none',
		type		: 'iframe',
		helpers:  {
			overlay: {
				locked: false
			}
		}
	});

	jQuery(".pop_email").fancybox({
		padding     : 0,
		margin      : 50,
		fitToView	: false,
		maxWidth	: "100%",
		maxHeight	: "90%",
		width		: 700,
		height		: 600,
		autoSize	: true,
		closeClick	: false,
		openEffect	: 'none',
		closeEffect	: 'none',
		type		: 'iframe',
		helpers:  {
			overlay: {
				locked: false
			}
		}
	});

	// path
	jQuery(".path-wrap .path>a").bind("click", function(){
		var t = $(this).parent("div");
		if(!t.hasClass("active")){
			jQuery(".path-wrap .path").removeClass("active").find("ul").slideUp(100);
			t.addClass("active").find("ul").slideDown(200);
		}else{
			t.removeClass("active").find("ul").slideUp(100);
		}
		return false
	});

	$(".path-wrap .path").each(function(){
		$(this).find(".page-name").text($(this).find("li.active").text());
	});

	/*jQuery(".path-wrap .page-name").text(jQuery(".sub-title h2").text());
	jQuery(".path-wrap .page-name2").text(jQuery(".lnb .active a").text());*/

	// 높이동일적용
	$(".auto-height").each(function(){
		var heightArray = $(this).find(".box").map(function(){
			return $(this).outerHeight();
		}).get();
		var maxHeight = Math.max.apply(Math, heightArray);
		$(this).find(".box").css("min-height",maxHeight);
	});
	$(".line-service").each(function(){
		var heightArray = $(this).find(".txt").map(function(){
			return $(this).outerHeight();
		}).get();
		var maxHeight = Math.max.apply(Math, heightArray);
		$(this).find(".txt").css("min-height",maxHeight);
	});

});//END


$(window).bind("load resize", function(){
	stageResize();
});
function stageResize(){
	var winH = $(window).height(),
		headH = $("#header").outerHeight(),
		subvH = $(".sub-visual").outerHeight(),
		pathH = $(".path-wrap").outerHeight(),
		footH = $("#footer").outerHeight();

	$("#container").css("min-height",winH-headH-subvH-pathH-footH);
}