var _product = false;
var printInter;
$(document).ready(function (){
$("#cmTopScroll").click(function (){
// $("html, body").animate({scrollTop:0}, 500);
});
$(window).scroll(function (){
var top = $(document).scrollTop();
if(top > 50){
$("#cmTopScroll").stop().animate({"bottom":100}, 250);
}else{
$("#cmTopScroll").stop().animate({"bottom":-100}, 250);
}
});
//alert( $(window).width() );
if( $(window).width() == 1011){
//alert( $(window).width() );
//window.print();
}
addEvent();
resize();
$(window).keydown(function (e){
var key = e.keyCode;
if(key == "65"){
//printPage();
}
});
printInter = setInterval(function (){
if($("#external").length > 0){
$("#external").remove();
$(".location").remove();
$("#visual_bg").remove();
//$("#wrap").remove();
$("#footer").remove();
$("#cmTopScroll").remove();
$(".cmTopScroll").remove();
$("noscript").remove();
$("#skipNavi").remove();
$("#container").css({"min-height":"none", "background":"none", "overflow":"hidden"});
//$("#container").appendTo( $(document) );
$("body").show();
clearInterval(printInter);
}
}, 10);
});
var __loaded = false;
var _printChild;
var printpopup;
var parentBody;
function printPage($page){
var head = $("head").html();
parentBody = $("#container").html();
var height = $("#container").height() + 100;
height = 1000;
var style =
"";
var page = $page == "" ? "/print/printSub/" : "/print/printMain/"
if($page == "main") printpopup = window.open(window.location, "", "width=1024px height="+height+"px menubar=no status=no scrollbars=yes");
else printpopup = window.open("/print/printSub/", "", "width=1024px height="+height+"px menubar=no status=no scrollbars=yes");
var body = printpopup.document.getElementsByTagName("body");
var html = "
"+
"
"+
""+parentBody+"
"
var count = 0;
var inter = setInterval(function (){
if(printpopup.document.body != null){
count++;
printpopup.document.body.style.display = "none";
if(count > 10){
printpopup.document.body.innerHTML = html;
if($page == "main") {
printpopup.document.head.innerHTML = "";
} else printpopup.document.head.innerHTML = "";
clearInterval(inter);
}
}
}, 10);
}
/*
function printPage(){
//console.log("print");
var head = $("head").html();
parentBody = $("#container").html();
var height = $("#container").height();
var style =
"";
printpopup = window.open(window.location, "", "width=1024px height="+height+"px menubar=no status=no scrollbars=yes");
var body = printpopup.document.getElementsByTagName("body");
var html = "
"+
"
"+
""+parentBody+"
"
var count = 0;
var inter = setInterval(function (){
if(printpopup.document.body != null){
count++;
printpopup.document.body.style.display = "none";
if(count > 10){
///console.log(printpopup.document.body);
printpopup.document.body.innerHTML = html
clearInterval(inter);
}
}
}, 10);
}
*/
function printPage2(){
window.print();
}
var _open = false;
function addEvent(){
//document.onmousewheel = function(){ stopWheel(); } /* IE7, IE8 */
if(document.addEventListener){ /* Chrome, Safari, Firefox */
//document.addEventListener('DOMMouseScroll', stopWheel, false);
}
}
function stopWheel(e){
if(!e){ e = window.event; } /* IE7, IE8, Chrome, Safari */
if(e.preventDefault) {
if(_open)e.preventDefault();
} /* Chrome, Safari, Firefox */
if(_open) e.returnValue = false; /* IE7, IE8 */
}
function addWheelEvent(){
$('#layerPopup').mouseover(function (){
_open = true;
}).mouseout(function (){
_open = false;
});
}
function resize(){
var bg = $("#visual_bg>div").width();;
var sw = $(window).width();
$("#visual_bg").css({"margin-left":-bg/2 -10});
if($("#visual_bg").find("div").hasClass("company_bg08")){
$("#visual_bg").css({"margin-left":-bg/2 -100});
}
if($("#visual_bg").find("div").hasClass("company_bg11")){
$("#visual_bg").css({"margin-left":-bg/2 -50});
}
if($("#visual_bg").find("div").hasClass("company_bg13")){
$("#visual_bg").css({"margin-left":-bg/2 + 10});
}
}
//-------------------------- btnImage 활성화 --------------------------//
function onOverImg(obj){
try{
obj.getElementsByTagName('img')[0].src = obj.getElementsByTagName('img')[0].src.replace('.gif', '_on.gif')
}catch(e){}
}
function onOutImg(obj) {
try{
obj.getElementsByTagName('img')[0].src = obj.getElementsByTagName('img')[0].src.replace ('_on.gif', '.gif')
}catch(e){}
}
//-------------------------- floating --------------------------//
function floating(obj)
{
var $floating = $(obj);
var $floatingBox = $floating.find(".floating_box");
var $floatingWrap = $floating.find(".floating_wrap");
var $floatingConts = $floating.find(".floating_conts");
var $floatingImg = $floating.find(".floating_img");
var $floatingImgOn = $floatingImg.find(".on");
var $floatingBtn = $floating.find(".btn");
var flag = true;
function init()
{
if (!$floating.length) {
return false;
}
$floatingBtn.on("click", floatingEvent);
}
function floatingEvent()
{
var idx = $floatingBtn.index(this);
if ($floatingConts.eq(idx).is(":hidden")) {
// 클릭한 대상이 off일때 열려있는 대상 clear
$floatingConts.each(function(i){
if ($(this).is(":visible")) {
boxClear(i);
}
});
var index = parseInt($(this).attr("index")) ;
var tg = $(".floating_box[index|="+index+"]");
var no = 0;
if(index == 1) no = 0;
if(index == 3) no = 2;
if(index == 5) no = 4;
if(index == 0) no = 1;
if(index == 2) no = 3;
if(index == 4) no = 5;
tg.insertBefore( $(".floating_box[index|="+ no +"]"));
___index = index;
//var index = parseInt($(this).attr("index"));
//var tg = $(".envCont4[index|="+index+"]");
//tg.insertBefore( $(".envCont4[index|="+ parseInt(index/3)*3 +"]"));
//___index = index;
// off대상을 on으로 활성화 작업
$floatingConts.eq(idx).show();
$floatingBox.eq(idx).stop(true,true).animate({"width": "978px"}, 150, function(){
$floatingBtn.eq(idx).addClass("on");
});
$floatingImgOn.eq(idx).stop(true,true).fadeIn(300)
setTimeout(function(){
//$("html, body").delay(100).animate({scrollTop : ($floatingBox.eq(idx).offset().top - 200) + "px"}, 100);
}, 150);
// icon({selecter: $floatingBtn.eq(idx), turn : "on", size : 20, cut : 5});
} else {
for(var i = 0;i<6;i++){
var container = $("#floating");
var child = $(".floating_box[index|="+i+"]");
child.appendTo(container);
}
boxClear(idx);
// icon({selecter: $floatingBtn.eq(idx), turn : "off", size : 20, cut : 5});
}
function boxClear(idx)
{
//console.log("clear : " + idx);
$floatingBox.eq(idx).stop(true,true).animate({"width": "474px"}, 150, function(){
$floatingConts.eq(idx).hide();
$floatingImgOn.eq(idx).stop(true,true).fadeOut(100)
$floatingBtn.eq(idx).removeClass("on");
return;
var curTg = $(".floating_box[index|="+___index+"]");
___index--;
if(___index < 0 ) ___index = 0;
var prevTg = $(".floating_box[index|="+___index+"]");
curTg.insertAfter( prevTg );
});
}
return false;
}
init();
}
function floatingThree(obj)
{
// var rows = 3;
// $(".sec1").each(function(){
// $(this).find(".envCont4").each(function(i){
// $(this).attr("num", i);
// })
// })
// $(".btnOpen", obj).on("click", function(){
// var $envCont4 = $(".envCont4");
// var $envLeft = $envCont4.find(".envLeft");
// var $envBtn = $envCont4.find(".btnOpen");
// if (rows === 3) {
// var _idx = $envBtn.index(this);
// var _parentIdx = $(".sec1").index($(this).closest(".sec1"));
// var _appendIdx = null;
// var clone = $(".sec1").eq(_parentIdx).find($envCont4).eq(_idx).clone(true);
// var _self = $(this).closest(".sec1");
// _self.find($envCont4).eq(0).before(clone);
// var _$envCont4 = _self.find(".envCont4").eq(0);
// var _$envLeft = _$envCont4.find(".envLeft");
// $envCont4.eq(_idx).remove();
// if (_$envLeft.is(":hidden")) {
// _$envLeft.show();
// _$envCont4.animate({"width" : "978px"}, 150);
// } else {
// _$envLeft.hide();
// _$envCont4.animate({"width" : "304px"}, 150);
// }
// }
// });
var rows = 3;
var $envCont4 = $(obj);
var $envLeft = $envCont4.find(".envLeft");
var $envRight = $envCont4.find(".envRight");
var $envRightImgOn = $envRight.find(".thumbnail .on");
var $envBtn = $envCont4.find(".btn");
var saveDB = [];
var flag = true;
var ___index = 0;
// $.each($envCont4, function(i){
// saveDB.push(i);
// });
$(".btn", obj).on("click", function(e){
if (rows === 3) {
var _idx = $envBtn.index(this);
if ($envLeft.eq(_idx).is(":hidden")) {
$envLeft.each(function(i){
if ($(this).is(":visible")) {
boxClear(i);
}
});
var index = parseInt($(this).attr("index"));
var tg = $(".envCont4[index|="+index+"]");
var no = parseInt(index/3);
if(index%3 == 0){
}else{
if(index%3 == 1) no = index-1;
if(index%3 == 2) no = index-2;
tg.insertBefore( $(".envCont4[index|="+ no +"]"));
}
___index = index;
$envLeft.eq(_idx).show();
$envRightImgOn.eq(_idx).fadeIn(300);
$envBtn.eq(_idx).addClass("on");
$envCont4.eq(_idx).animate({"width" : "978px"}, 150);
/* setTimeout(function(){
//$("html, body").animate({scrollTop : ($envCont4.eq(_idx).offset().top - 200) + "px"}, 135);
}, 200);*/
$.each(saveDB, function(i, item){
if (item === _idx) {
return flag = false;
}
});
if (flag) {
saveDB.push(_idx);
disignScrollAdd({idx : _idx});
// ScrollLoad ("scrollholder"+parseInt(_idx +1), "scroll"+parseInt(_idx +1), true);
}
flag = true;
} else {
boxClear(_idx);
}
function disignScrollAdd(o) {
var _$scrollholder = $envCont4.eq(o.idx).find(".scrollholder");
if (!_$scrollholder.length) {
return false;
}
var _hoderId = _$scrollholder.attr("id")
var _crollId = _$scrollholder.find(".scroll").attr("id")
ScrollLoad (_hoderId, _crollId, true);
}
function boxClear(_idx)
{
// saveDB = endScroll;
$envBtn.eq(_idx).removeClass("on");
$envRightImgOn.eq(_idx).fadeOut(100);
$envLeft.eq(_idx).hide();
//console.log($envLeft.eq(_idx));
$envCont4.eq(_idx).animate({"width" : "304px"}, 150);
var curTg = $(".envCont4[index|="+___index+"]");
// console.log("boxClear : "+___index);
if(___index == 1){
curTg.insertAfter( $(".envCont4[index|="+0+"]") );
return false;
}
if(___index != 0){
___index--;
//console.log(___index);
var prevTg = $(".envCont4[index|="+___index+"]");
if(___index != 0) curTg.insertAfter( prevTg );
}
}
}
return false;
});
return false;
}
// Array.prototype.removeElement = function(index){
// this.splice(index,1);
// return this;
// }
//-------------------------- openSitemap --------------------------//
$(document).ready(function(){
var $openSitemap = $(".open_sitemap");
var $openFamily = $(".open_family .family_list");
var flag = true;
var open1 = false;
var open2 = false;
$("#sitemap1").click(function(){
if (!flag) return false;
flag = false;
if ($openSitemap.is(":hidden")) {
$openSitemap.slideDown(function(){flag = true;});
open1 = true;
// icon({selecter: $(this).find(".icon"), turn : "on", size : 16, cut : 13});
} else {
$openSitemap.slideUp(function(){flag = true;});
open1 = false;
// icon({selecter: $(this).find(".icon"), turn : "off", size : 16, cut : 13});
}
if ($openFamily.is(":visible")) {
$("#family").find(".icon").removeAttr("style");
$openFamily.hide();
open2 = false;
}
}).mouseenter(function (){
if (!open1) {
icon({selecter: $(this).find(".icon"), turn : "on", size : 16, cut : 13});
}
}).mouseleave(function (){
if (!open1) {
icon({selecter: $(this).find(".icon"), turn : "off", size : 16, cut : 13});
}
});
$("#family").click(function(){
if (!flag) return false;
flag = false;
if ($openFamily.is(":hidden")) {
$openFamily.slideDown(function(){flag = true;});
open2 = true;
// icon({selecter: $(this).find(".icon"), turn : "on", size : 16, cut : 13});
} else {
$openFamily.slideUp(function(){flag = true;});
open2 = false;
// icon({selecter: $(this).find(".icon"), turn : "off", size : 16, cut : 13});
}
if ($openSitemap.is(":visible")) {
$("#sitemap1").find(".icon").removeAttr("style");
$openSitemap.hide();
open1 = false;
}
}).mouseenter(function (){
if (!open2) {
icon({selecter: $(this).find(".icon"), turn : "on", size : 16, cut : 13});
}
}).mouseleave(function (){
if (!open2) {
icon({selecter: $(this).find(".icon"), turn : "off", size : 16, cut : 13});
}
});
$(".open_sitemap .open_sitemapWrap .view .icon").on({
"mouseenter": function(){
icon({selecter: $(this), turn : "on", size : 42, cut : 13});
},
"mouseleave": function(){
icon({selecter: $(this), turn : "off", size : 42, cut : 13});
}
});
/*$(".talentedCont .infoBox1 .tal_over .p_btn").on({
"mouseenter": function(){
icon({selecter: $(this).find(".icon"), turn : "on", size : 16, cut : 13});
},
"mouseleave": function(){
icon({selecter: $(this).find(".icon"), turn : "off", size : 16, cut : 13});
}
});*/
// $(".family .icon").on({
// "mouseenter": function(){
// icon({selecter: $(this), turn : "on", size : 20, cut : 5});
// },
// "mouseleave": function(){
// icon({selecter: $(this), turn : "off", size : 20, cut : 5});
// }
// });
$(".movie_viewDim .icon").on({
"mouseenter": function(){
icon({selecter: $(this), turn : "on", size : 67, cut : 3});
},
"mouseleave": function(){
icon({selecter: $(this), turn : "off", size : 67, cut : 3});
}
});
var $btn = $(".open_sitemap .btn");
var $overList = $(".over_list");
var $btnList = $btn.closest("li");
var idx = 0
$btn.css("z-index", 11);
$overList.hide();
$btnList.on("mouseenter", function(){
$overList.each(function(i){
if ($(this).is(":visible")) {
$(this).hide();
$btn.eq(i).removeClass("on").css("z-index", 11);
$btn.parent().removeClass("on");
}
});
idx = $btnList.index(this);
$btn.eq(idx).addClass("on");
$overList.eq(idx).show();
$btn.eq(idx).parent().addClass("on");
// $(this).css("z-index", -1);
});
$btnList.on("mouseleave", function(){
idx = $btnList.index(this);
$btn.eq(idx).removeClass("on").css("z-index", 11);
$overList.eq(idx).hide();
$btn.eq(idx).parent().removeClass("on");
})
// $overList.on("mouseleave", function(){
// idx = $overList.index(this);
// $btn.eq(idx).removeClass("on").css("z-index", 11);
// $(this).hide();
// })
});
//-------------------------- path --------------------------//
/**
* @param {obejct} o gnb함수에서 depth01, depth02, depth03를 받아옴
* @note : sub매뉴에 경로를 나타내는 리스트 gnb가 존재할때만 기능 작동
*/
function path(o)
{
var $gnbDepth01 = $("#headerWr .gnb > .depth01 > .gnb_lists");
var $gnbDepth02 = $gnbDepth01.eq(o.depth01).find("> .depth02 > li");
var $gnbDepth03 = $gnbDepth02.eq(o.depth02).find("> .depth03 > li");
var $gnbDepthChoice01 = $gnbDepth01.eq(o.depth01);
var $gnbDepthChoice02 = $gnbDepth02.eq(o.depth02);
var $gnbDepthChoice03 = $gnbDepth03.eq(o.depth03);
var depth01Txt = $gnbDepthChoice01.find("> a").text();
var depth02Txt = $gnbDepthChoice02.find("> a").text();
var depth03Txt = $gnbDepthChoice03.find("> a").text();
var $location = $("#content .location");
var $locationItem = $location.find(".path_item");
var $locationList = $location.find(".path_menu");
var $first = $location.find(".first_path");
var $second = $location.find(".second_path");
var $third = $location.find(".third_path");
var $border = null;
// gnb에 없는 단일 path
var hiddenDepth = null;
hiddenDepth = [
{
name : "사이트맵",
src : "/kor/util/sitemap/"
},
// {
// name : "개인정보취급방침",
// src : "/kor/util/privacyPolicy/"
// },
{
name : "문의하기",
src : "/kor/util/qnaWrite/"
},
{
name : "사업제안",
src : "/kor/util/proposalWrite/"
},
{
name : "법적고지",
src : "/kor/util/monition/"
},
{
name : "검색",
src : "/kor/util/searchGeneralList/"
},
{
name : "제품검색",
src : "/kor/util/searchProductList/"
}
];
function init()
{
// 제품소개
if (o.depth01 === 1) {
return false;
}
$location.find(".locationWrap").show();
pathAppend();
$first.on("mouseenter click", {selecter : "#first_path"}, pathOverOn);
$second.on("mouseenter click", {selecter : "#second_path"}, pathOverOn);
$third.on("mouseenter click", {selecter : "#third_path"}, pathOverOn);
$locationList.add(".locationWrap").on("mouseleave", pathOverOff);
$(".home").on("mouseenter", pathOverOff);
// 인재채용일경우 event 등록
// if (o.depth01 === 3) {
// $("#second_path").find("li a").click(function(){
// return false;
// })
// }
$border = $locationItem.filter(function(){
if ($(this).hasClass("border")) {
return $(this);
}
});
}
function pathOverOn(e) {
pathOverOff();
$border.removeClass("border");
var $selecter = $(e.data.selecter);
/* $selecter.show().css("width", 0).animate({"width" : 195}, 150); */ /* 왼쪽에서 오른쪽으로 펼쳐짐 */
$selecter.show();
icon({selecter: $(this).parent(), turn : "on", size : 18, cut : 13});
}
function pathOverOff()
{
$locationList.each(function(){
if($(this).is(":visible")) {
$(this).hide();
icon({selecter: $(this).parent(), turn : "off", size : 18, cut : 13});
}
})
$border.addClass("border");
}
function pathAppend() {
// depth01
if (o.depth01 != null) {
var _firstTxt = "";
$gnbDepth01.find("> a").each(function(i){
if (o.depth01 === i) {
_firstTxt += " " + $(this).text() + " ";
} else {
_firstTxt += " " + $(this).text() + " ";
}
});
_firstTxt = "";
$first.show().text(depth01Txt);
$("#first_path").html(_firstTxt);
}
// depth02
if (o.depth02 != null) {
var _secondTxt = "";
$gnbDepth02.find("> a").each(function(i){
if (o.depth02 === i) {
_secondTxt += " " + $(this).text() + " ";
} else {
_secondTxt += " " + $(this).text() + " ";
}
});
_secondTxt = "";
$second.show().text(depth02Txt);
$("#second_path").html(_secondTxt);
}
// depth03
if (o.depth03 != null) {
var _thirdTxt = "";
$gnbDepth03.find("> a").each(function(i){
if (o.depth03 === i) {
_thirdTxt += " " + $(this).text() + " ";
} else {
_thirdTxt += " " + $(this).text() + " ";
}
});
_thirdTxt = "";
$third.show().text(depth03Txt);
$("#third_path").html(_thirdTxt);
}
// 단일 path
if (o.singleDepth != null) {
var _firstTxt = "";
$.each(hiddenDepth, function(i){
if (o.singleDepth === i) {
_firstTxt += " " + this.name + " ";
} else {
_firstTxt += " " + this.name + " ";
}
});
_firstTxt = "";
$first.show().text(hiddenDepth[o.singleDepth].name);
$("#first_path").html(_firstTxt);
}
//존재여부 확인후 class 적용
if (o.depth03 == null) {
$locationItem.eq(2).hide();
if (o.depth02 == null) {
$locationItem.eq(1).hide();
if (o.depth01 == null || o.singleDepth == null) {
$locationItem.eq(0).addClass("on border");
}
} else {
$locationItem.eq(1).addClass("on border");
}
} else {
$locationItem.eq(2).addClass("on border");
}
}
init();
}
//-------------------------- visual --------------------------//
/**
* @note : main페이지 visual img rolling script
*/
function visual()
{
var $mainVisual = $("#main_visual");
var $visualWrap = null;
var $location = null;
var $locationA = null;
var $visualList = null;
var $visualImg = null;
var $visualBgList = null;
var leg = null;
var idx = 0;
var prevIdx = idx;
var timer = null;
var speed = 5000;
var size1024 = null;
var ie8under = ie8underBrowser();
function init() {
if (!$mainVisual.length) {
return false;
}
if (parseInt($(window).width()) <= 1024) {
size1024 = true;
} else {
size1024 = false;
}
size1024 = false;
visualSize();
$visualList = $visualWrap.find(".visual");
$visualList.hide().eq(idx).show();
$location = $visualWrap.find(".visual_location");
$locationA = $location.find("a");
$visualImg = $visualList.find(".img_visual");
$visualBgList = $mainVisual.find(".mainbg_wrap .mainbg");
leg = $visualList.length;
// console.log($visualBgList.length);
$locationA.on("click.location", visualNext);
$location.on({
"mouseenter.location": clearTimer,
"mouseleave.location": autoTimer
})
// $mainVisual.addClass("bg"+parseInt(idx+1));
$visualBgList.eq(idx).show().siblings().hide();
icon({selecter: $locationA.eq(idx), turn : "on", size : 20, cut : 5});
autoTimer();
$(window).resize(visualSize);
}
function reloadvisual()
{
//재호출전 저장시켜놓은 애들 지우기
$locationA.off("click.location");
$location.off("mouseenter.location");
$location.off("mouseleave.location");
$location.find(".icon").removeAttr("style");
$location.find("span").removeAttr("style");
idx = 0;
prevIdx = idx;
clearTimer();
// $mainVisual.addClass("bg1");
$visualBgList.eq(0).show().siblings().hide();
// 재호출
$visualList = $visualWrap.find(".visual");
$visualList.hide().eq(idx).show().find("span").show().removeAttr("style");
$visualList.eq(idx).find(".img_visual").removeAttr("style");
$location = $visualWrap.find(".visual_location");
$locationA = $location.find("a");
$visualImg = $visualList.find(".img_visual");
leg = $visualList.length;
$locationA.on("click.location", visualNext);
$location.on({
"mouseenter.location": clearTimer,
"mouseleave.location": autoTimer
})
icon({selecter: $locationA.eq(idx), turn : "on", size : 20, cut : 5});
autoTimer();
// init();
}
function visualSize()
{
var _winSize = parseInt($(window).width());
_winSize = 2000;
if (_winSize <= 1024 && size1024 === true) {
$mainVisual.removeClass();
$mainVisual.addClass("size1024");
$mainVisual.find(".size1024under").show();
$mainVisual.find(".size1024upper").hide();
$visualWrap = $mainVisual.find(".size1024under");
size1024 = false;
if ($visualList !== null) {
reloadvisual();
}
} else if(_winSize > 1024 && size1024 === false) {
$mainVisual.removeClass();
$mainVisual.removeClass("size1024");
$mainVisual.find(".size1024under").hide();
$mainVisual.find(".size1024upper").show();
$visualWrap = $mainVisual.find(".size1024upper");
size1024 = true;
if ($visualList !== null) {
reloadvisual();
}
}
}
function visualNext() {
var _idx = $locationA.index(this);
if (_idx === -1) {
_idx = idx + 1;
if (_idx >= leg) _idx = 0;
}
if (_idx === prevIdx) return false;
else idx = _idx;
icon({selecter: $locationA.eq(prevIdx), turn : "off", size : 20, cut : 5});
//$visualBgList.eq(prevIdx).fadeOut();
// $mainVisual.removeClass("bg"+parseInt(prevIdx+1));
if (ie8under === true) {
$visualList.eq(prevIdx).hide();
$visualBgList.eq(prevIdx).hide();
} else {
$visualBgList.eq(prevIdx).fadeOut();
var _$visualListPrev = $visualList.eq(prevIdx).find("span");
var _visualListPrevLeg = _$visualListPrev.length - 1;
$visualImg.eq(prevIdx).stop(true,true).fadeOut(700);
_$visualListPrev.each(function(i){
$(this).stop().animate({"margin-left" : -100, "opacity" : 0}, 150 + ((i + 5) * 30), function(){
$(this).hide()
});
});
}
icon({selecter: $locationA.eq(idx), turn : "on", size : 20, cut : 5});
//$visualBgList.eq(idx).fadeIn();
// $mainVisual.addClass("bg"+parseInt(idx+1));
if (ie8under === true) {
$visualList.eq(idx).show();
$visualBgList.eq(idx).show();
prevIdx = idx;
} else {
$visualBgList.eq(idx).fadeIn();
var _$visualList = $visualList.eq(idx).find("span");
var _visualListLeg = _$visualList.length - 1;
$visualImg.eq(idx).stop(true,true).fadeIn(700);
$visualList.eq(idx).show();
_$visualList.show();
_$visualList.css({"opacity": 0.3, "margin-left" : 400}).each(function(i){
$(this).stop().animate({"margin-left" : 0, "opacity" : 1}, 50 + ((i + 5) * 75));
});
prevIdx = idx;
}
return false;
}
function autoTimer() {
timer = setInterval(visualNext, 5000);
}
function clearTimer() {
clearInterval(timer);
timer = null;
}
init();
}
function headerSearch()
{
var $searchBar = $("#headerWr .search_bar");
var $searchHeader = $("#headerWr .header_search")
var $search_btn01 = $("#headerWr .search_btn01");
var $search_btn02 = $("#headerWr .search_btn02");
var $search_btn = $("#headerWr .search_btn_area")
if (!$searchBar.length) {
return false;
}
$searchHeader.attr("toggle", "true");
$searchBar.on({
"click": action,
"focusout": clear
});
// $searchHeader.on({"mouseleave": clear})
$search_btn.on({
"mouseenter": function(){
if ($searchHeader.attr("toggle") === "false") {
$search_btn01.show();
$search_btn02.hide();
}
},
"mouseleave": function(){
if ($searchHeader.attr("toggle") === "false") {
$search_btn01.hide();
$search_btn02.show();
}
}
})
function action () {
$searchHeader.attr("toggle", "false");
$searchBar
.stop().animate({"width" : 277}, 150)
// .parent().stop().animate({backgroundColor: '#000'}, 150);
$search_btn01.fadeOut(150);
$search_btn02.fadeIn(150);
}
function clear () {
$searchHeader.attr("toggle", "true");
$searchBar
.stop().animate({"width" : 126}, 500)
// .parent().stop().animate({backgroundColor: '#e8e8e8'}, 150);
$search_btn01.fadeIn(150);
$search_btn02.fadeOut(150);
}
}
/**
* 제품소개면 true
* 제품소개가 아니라면 false
*/
var gnbProduct = false;
/**
* gnb 제품소개 클로즈 버튼 클릭시 true
* mini gnb total btn클릭시 false
*/
var gnbProductClose = null;
//-------------------------- gnb --------------------------//
function gnb(opt)
{
var $headerWr = $("#headerWr");
var $header = $("#headerWr .header")
var $gnb = $header.find(".gnb");
var $gnbList = $gnb.find(".gnb_lists");
var $gnbListA = $gnbList.find("> a");
var $depth02 = $gnbList.find(".depth02");
var $depth02List = null;
var $depth02ListA = $depth02.find("> li > a");
var $depth03 = $depth02.find(".depth03");
var $gnbAnibar = null;
var $rollingWrap = $(".gnb_list02 .depth02");
var $rollingBtn = $(".gnb_list02 .btn_area");
var $rollingBg = $(".gnb_list02 .rolling_bg");
var $gnbLocation = $header.find(".gnb_location");
var rollingOverLeg = 1;
var rollingOverFlag = false;
var gnbIdx = 0;
function init()
{
if (!$header.length) {
return false;
}
// 이벤트 등록
$header.on("mouseleave", headerMouseOff);
$gnbListA.on({
"mouseenter": gnbListMouseOn,
"focusin": gnbListMouseOn
});
$depth02ListA.on({
"mouseenter": depth02ListMouseOn,
"focusin": depth02ListMouseOn
});
// depth01, dpeth02 바 추가
animationBarAppend({wrap: $header, name : "gnb_anibar"});
animationBarAppend({wrap: $gnb,name : "depth02_anibar"});
$gnbAnibar = $header.find('.gnb_anibar');
$depth02Anibar = $header.find('.depth02_anibar');
// 서브 일때 실행되는 것들
if (subCheck()) {
$("#wrap").addClass("sub");
subPage();
$rollingBtn.on("click", headerProductRolling);
var pathOptSet = {};
if (opt.depth01 != null) pathOptSet["depth01"] = opt.depth01;
if (opt.depth02 != null) pathOptSet["depth02"] = opt.depth02;
if (opt.depth03 != null) pathOptSet["depth03"] = opt.depth03;
path(pathOptSet);
if (opt.depth01 != null && opt.depth01 === 1) {
gnbProductClose = false;
gnbProduct = true;
$(".locationWrap").hide();
if ($(window).scrollTop() > 105) {
$("#product_close").show();
}
}
// 인재채용 scroll 등록
/* if (opt.depth01 != null && opt.depth01 === 3) {
// gnb depth02 event
$gnbList.eq(opt.depth01).find($depth02ListA).click(function(){
return false;
});
// gnb location event
$gnbLocation.find("#dep02 a").click(function(){
return false;
});
}*/
} else {
// 메인일때
$gnbLocation.find("#dep01 a").text("H").attr("href", "/");
// $gnbLocation.show();
}
// 단일 path일때 실행
if (opt !== undefined) {
if (opt.singleDepth !== undefined) {
var pathOptSet = {};
pathOptSet["singleDepth"] = opt.singleDepth;
path(pathOptSet);
}
}
}
// 서브 체크 -> gnb에 해당하지 않는 singledpeth추가 return false
function subCheck()
{
// true : sub, false : main , singleDepth
if (opt !== undefined && opt.singleDepth === undefined) {
return true;
} else {
return false;
}
}
// 서브일때만 실행
function subPage() {
var _$subGnbListA = $gnbListA.eq(opt.depth01);
var _gnbWit = _$subGnbListA.width();
var _gnbPosL = _$subGnbListA.position().left;
textOver($gnbList, $gnbList.eq(opt.depth01), "hover");
_animationBar({selecter: $gnbAnibar, wit: _gnbWit, posL: _gnbPosL});
_depth02ListClear();
gnbIdx = opt.depth01;
_$depth02 = $gnbList.eq(opt.depth01).find("> .depth02")
_$depth02.show();
$depth02List = _$depth02.find(" > li");
$depth02ListA = $depth02List.find(" > a");
var _$subDepth02ListA = $depth02ListA.eq(opt.depth02);
var _lnbWit = _$subDepth02ListA.width();
var _lnbPosL = null;
var _lnbPosT = null;
textOver($depth02List, _$subDepth02ListA.parent(), "hover");
if (_$subDepth02ListA.position() !== null) {
_lnbPosL = _$subDepth02ListA.position().left;
}
if (gnbIdx === 1 && subCheck() === true) {
_lnbPosL = parseInt(_$subDepth02ListA.parent().css("left"));
$("#wrap").addClass("type01");
$rollingBtn.show();
_lnbPosT = 139;
_animationBar({selecter: $depth02Anibar, wit: _lnbWit, posL: _lnbPosL, posT: _lnbPosT});
_gnbOn();
} else if (subCheck() === true) {
$("#wrap").removeClass("type01");
_lnbPosT = 87;
_animationBar({selecter: $depth02Anibar, wit: _lnbWit, posL: _lnbPosL, posT: _lnbPosT});
} else {
$("#wrap").removeClass("type01");
$rollingBtn.hide();
_lnbPosT = 87;
}
_depth03ListClear();
// sub일경우에만 실행
if (subCheck() === true){
$gnbLocation.find("#dep01 a").text(_$subGnbListA.text()).attr("href", _$subGnbListA.attr("href"));
$gnbLocation.find("#dep02 a").text(_$subDepth02ListA.text()).attr("href", _$subDepth02ListA.attr("href"));
// $gnbLocation.hide();
// depth03값이 들어 있을경우 실행
if (opt.depth03 != null) {
_$subDepth03List = _$subDepth02ListA.next().show().find("> li").eq(opt.depth03);
_$subDepth03List.addClass("on");
}
// 제품소개 일경우에만 실행
if (gnbIdx === 1) {
$gnbLocation.hide();
if (rollingOverFlag && opt.depth02 < 2) {
headerProductRolling();
_animationBar({selecter: $depth02Anibar, wit: _lnbWit, posL: _lnbPosL + 190, posT: _lnbPosT});
} else if(rollingOverFlag === false && opt.depth02 === 8) {
headerProductRolling();
_animationBar({selecter: $depth02Anibar, wit: _lnbWit, posL: _lnbPosL - 190, posT: _lnbPosT});
}
} else {
$gnbLocation.show();
}
}
}
function headerMouseOff() {
// 서브이면
if (subCheck() === true) {
$("#headerWr").removeClass("on");
// 제품소개 이면
if (opt.depth01 === 1) {
textOut($depth02List, "hover");
subPage();
if ($(window).scrollTop() > 105) {
$("#product_close").show();
} else {
$("#product_close").hide();
}
} else {
// textOver($gnbList, $gnbList.eq(opt.depth01), "hover");
// textOver($depth02List, $gnbList.eq(opt.depth01).find("> .depth02").show().find(" > li > a").eq(opt.depth02), "hover");
_depth03ListClear();
_depth02ListClear();
$gnb.stop(true,false).animate({"height": 37}, 150);
$headerWr.stop(true,false).animate({"height": 104}, 150);
var _$subGnbListA = $gnbListA.eq(opt.depth01);
var _gnbWit = _$subGnbListA.width();
var _gnbPosL = _$subGnbListA.position().left;
textOver($gnbList, $gnbList.eq(opt.depth01), "hover");
textOut($depth02List, "hover");
_animationClear({selecter: $depth02Anibar});
_animationBar({selecter: $gnbAnibar, wit: _gnbWit, posL: _gnbPosL});
}
} else {
// 메인이면
textOut($gnbList, "hover");
textOut($depth02List, "hover");
_depth03ListClear();
_depth02ListClear();
_gnbListClear();
$gnb.stop(true,false).animate({"height": 37}, 150);
$headerWr.removeClass("on").stop(true,false).animate({"height": 104}, 150);
}
}
function gnbListMouseOn() {
// gnb높이가 181작으면 크면 gnb열림
if (parseInt($gnb.css("height")) < 181) {
_gnbOn();
}
_depth02ListClear();
var _idx = $gnbListA.index(this);
var _wit = $gnbListA.eq(_idx).width();
var _posL = $gnbListA.eq(_idx).position().left;
$depth02.eq(_idx).show();
$depth02List = $depth02.eq(_idx).find("> li");
$depth02ListA = $depth02.eq(_idx).find("> li > a");
//class 추가부분
textOver($gnbList, $(this).parent(), "hover");
textOut($depth02List, "hover");
_animationBar({selecter:$gnbAnibar, wit:_wit, posL:_posL});
_depth03ListClear();
if (subCheck() === true) {
// 제자리가 아니라면 실행
if (_idx !== opt.depth01) {
// $gnbLocation.hide();
_animationClear({selecter:$depth02Anibar});
} else {
subPage();
}
// 제품소개라면 숨김
if (_idx === 1) {
$gnbLocation.hide();
} else {
$("#product_close").hide();
$gnbLocation.show();
}
// 제품소개 페이지만 실행
if (_idx === 1 && opt.depth01 === 1) {
if ($(window).scrollTop() > 105) {
$("#product_close").show();
}
}
} else {
// $gnbLocation.show();
// $gnbLocation.hide();
_animationClear({selecter:$depth02Anibar});
}
gnbIdx = _idx;
// textOver($depth02List, $depth02ListA.eq(opt.depth02), "hover");
// 제품소개만 type01추가
$("#headerWr").addClass("on");
if (gnbIdx === 1 && subCheck() === true) {
$("#wrap").addClass("type01");
$rollingBtn.show();
// $("#headerWr").addClass("on");
} else {
$("#wrap").removeClass("type01");
$rollingBtn.hide();
// $("#headerWr").addClass("on");
}
// 제품소개가 on일 경우에만 하단 그라데이션 제거
if (subCheck() === true) {
if (opt.depth01 === 1 && gnbIdx === 1) {
$("#headerWr").removeClass("on");
}
}
return false;
}
function depth02ListMouseOn() {
var _idx = $depth02ListA.index(this);
var _$depth02ListA = $depth02ListA.eq(_idx);
var _wit = _$depth02ListA.width();
var _posL = _$depth02ListA.position().left;
textOver(_$depth02ListA.parent().siblings(), _$depth02ListA.parent(), "hover");
if (gnbIdx === 1 && subCheck() === true) {
_posL = parseInt(_$depth02ListA.parent().css("left"));
$rollingBtn.show();
_animationBar({selecter: $depth02Anibar, wit: _wit, posL: _posL, posT: 139});
} else {
$rollingBtn.hide();
_animationBar({selecter: $depth02Anibar, wit: _wit, posL: _posL, posT: 87});
}
_depth03ListClear();
if (_$depth02ListA.next(".depth03").length) {
_$depth02ListA.next(".depth03").show();//.css("left", _posL);
}
return false;
}
function headerProductRolling() {
var _posL = $depth02Anibar.css("left");
if (!rollingOverFlag) {
$(".gnb_list02 .depth02 > li").each(function(i){
$(this).stop(false,true).animate({"left" : "-=190"}, 150 + ((i + 5) * 30));
})
icon({selecter: $rollingBtn, turn : "on", size : 16, cut : 5});
_animationBar({selecter: $depth02Anibar, wit: 108, posL: parseInt(_posL) - 190, posT: 137, speed: 400});
$rollingBg.show();
rollingOverFlag = true;
} else {
$(".gnb_list02 .depth02 > li").each(function(i){
$(this).stop(false,true).animate({"left" : "+=190"}, 150 + ((i + 5) * 30));
});
_animationBar({selecter: $depth02Anibar, wit: 108, posL: parseInt(_posL) + 190, posT: 137, speed: 400});
icon({selecter: $rollingBtn, turn : "off", size : 16, cut : 5});
$rollingBg.hide();
rollingOverFlag = false;
}
return false;
}
function textOver(item, self, cls) {
textOut(item, cls);
textOn(self, cls)
}
function textOn(self, cls) {
self.addClass(cls);
}
function textOut(item, cls) {
try{
$.each(item, function(){
if ($(this).hasClass(cls)) {
$(this).removeClass(cls);
}
});
}catch(e){}
}
function animationBarAppend(o) {
var _wrap = "";
o.wrap.append(_wrap);
}
function _gnbOn() {
$gnb.animate({"height": 181}, 150);
// if(_product == true){
// $headerWr.animate({"height": 245}, 150);
// }else{
$headerWr.animate({"height": 265}, 150);
// }
}
function _depth02ListClear() {
$depth02.each(function(){
if ($(this).is(":visible")) {
$(this).hide();
}
});
}
function _depth03ListClear() {
$depth03.each(function(i){
if ($(this).is(":visible")) {
$(this).hide();
}
});
}
function _gnbListClear() {
_animationClear({selecter:$gnbAnibar});
_animationClear({selecter:$depth02Anibar});
_depth02ListClear();
}
function _animationBar(o) {
var speed = o.speed || 220;
o.selecter.css({"top": o.posT}).stop().animate({"left": o.posL, "width": o.wit}, speed);
}
function _animationClear(o) {
o.selecter.stop(true,true).css({"left": 0, "width": 0});
}
init();
}
//-------------------------- 스크롤 이벤트 --------------------------//
function headerScroll()
{
var $miniWrap = $("#headerWr .mini_wrap");
var $header = $("#headerWr");
var $totalMenu = $miniWrap.find(".total_menu a");
var $location = $("#content .location");
var $visualBg = $("#visual_bg");
var $visualBg2 = $(".visual_bg2");
var $productClose = $("#product_close")
var flag = true;
var scrollEvent = null;
function init() {
if (!$miniWrap.length) {
return false;
}
$totalMenu.on("click", gnbEvent);
// $header.on("mouseleave", gnbOut);
windowScroll();
$(window).scroll(windowScroll);
$productClose.on("click", productCloseEvent);
}
// 제품소개 닫기 버튼 이벤트
function productCloseEvent() {
$("#headerWr").animate({"top": -265});
$("#headerWr .mini_wrap").show().stop().animate({"top": 0}, 150);
$("#container").stop().animate({"paddingTop": 0, "marginTop" : -90}, 150);
gnbProductClose = true;
return false;
}
function windowScroll(){
var topValue = $(this).scrollTop();
topValue > 90 ? $visualBg2.hide() : $visualBg2.show();
// 제품소개
if (gnbProduct) {
if ($(this).scrollTop() > 105) {
// 제품소개 버튼이 클릭되지 않은 상태라면
if (gnbProductClose === false) {
$productClose.show();
$miniWrap.show().stop().animate({"top": 0});
$header.css({"position":"fixed"}).stop(true,true).animate({"top": -75});
$("#wrap").find(".topWrap").css("borderBottom", "1px solid #e8e8e8");
}
} else {
// 제품소개 버튼이 클릭되지 않은 상태라면
if (gnbProductClose === false) {
$productClose.hide();
$miniWrap.stop().animate({"top": -30},function(){$miniWrap.hide()});
$header.stop(true,true).css({"position": "absolute", "top": 0});
$("#wrap").find(".topWrap").css("borderBottom", "none");
}
gnbEvent();
}
} else {
if ($(this).scrollTop() > 105) {
if (flag === false) return false;
// 제품소개가 아니라면
$miniWrap.show().stop().animate({"top": 0});
$header.css({"position":"fixed"}).stop(true,true).css({"top": -105}).stop().animate({"top": -75});
// $location.addClass("on").css({"position":"fixed"}).stop(true,true).css({"top": 0}).stop().animate({"top": 30});
$visualBg.find("div").fadeOut();
flag = false;
} else {
//console.log("scroll : "+flag );
if (flag === true) return false;
$miniWrap.stop().animate({"top": -30},function(){$miniWrap.hide()});
$header.stop(true,true).css({"position": "absolute", "top": 0});
// $location.removeClass("on").stop(true,true).css({"position":"relative", "top":0});
$visualBg.find("div").fadeIn();
flag = true;
}
}
}
function gnbEvent() {
// 제품소개
if (gnbProduct === true) {
gnbProductClose = false;
if($(window).scrollTop() > 105) {
$header.css("position", "fixed");
$productClose.show();
} else {
$productClose.hide();
}
$miniWrap.stop().animate({"top": -30},function(){$miniWrap.hide()});
$header.stop(true,true).animate({"top": 0}, 300);
$("#container").animate({"paddingTop" : 106, "marginTop" : 0}, 300);
$(window).on("scroll.one", function(){
gnbOut();
$(window).off("scroll.one");
});
} else {
// if (flag) return false;
$miniWrap.stop().animate({"top": -30},function(){$miniWrap.hide()});
// $location.stop(true,true).animate({"top": 103});
$header.stop(true,true).animate({"top": 0});
$(window).on("scroll.one", function(){
gnbOut();
$(window).off("scroll.one");
});
}
return false;
}
function gnbOut() {
// 제품소개
if (gnbProduct === true) {
if (gnbProductClose === false) {
} else {
}
} else {
if (flag) return false;
$miniWrap.show().stop().animate({"top": 0});
// $location.stop(true,true).animate({"top": 30});
$header.stop(true,true).animate({"top": -75});
}
}
init();
}
//-------------------------- 탭 --------------------------//
/**
* tab -
* @return {[type]} [description]
*/
function tab()
{
var $tab = $(".tab");
var $tabList = $tab.find(".tab_list li");
var $tabConts = $tab.find(".tab_conts .img_box");
var $tabTxt = $(".main_business .main_summ dd");
var saveIdx = 0;
function init() {
if (!$tab.length) {
return false;
}
stating();
$tabList.on({
"click": tabListOn
});
}
function stating() {
$tabList.eq(saveIdx).addClass("on");
$tabConts.eq(saveIdx).show();
$tabTxt.eq(saveIdx).show().siblings("dd").hide();
}
function tabListOn() {
var _idx = $tabList.index(this);
$tabList.eq(saveIdx).removeClass("on");
$tabList.eq(_idx).addClass("on");
$tabConts.eq(saveIdx).stop(true,true).fadeOut(500);
$tabConts.eq(_idx).stop(true,true).fadeIn(500);
$tabTxt.eq(saveIdx).hide()
$tabTxt.eq(_idx).show()
saveIdx = _idx;
return false;
}
init();
}
//-------------------------- designselect --------------------------//
function designselect()
{
var $designselect = $(".design_select");
var $txt = $designselect.find(".txt_val");
var $btn = $designselect.find(".btn");
var $listWrap = $designselect.find(".select_list");
var $list = $listWrap.find("li");
var $selectLocation = $designselect.attr("location")
var flag = true;
var storageScroll = [];
function init() {
if (!$designselect.length) {
return false;
}
$designselect.on("mouseleave", {ev : 0}, selectOn);
$btn.on("click", {ev : 1}, selectOn);
$txt.on("click", {ev : 2}, selectOn);
$list.on("click", txtVal);
$(".scrollholder").each(function(){
var _height = $(this).css("height");
$(this).attr("data-height", parseInt(_height));
});
}
function disignScrollAdd(o) {
var _$scrollholder = $listWrap.eq(o.idx).find(".scrollholder");
if (!_$scrollholder.length) {
return false;
}
var _hoderId = _$scrollholder.attr("id")
var _crollId = _$scrollholder.find(".scroll").attr("id")
var lsBrowser = navigator.userAgent;
var bool = false;
if (navigator.userAgent.indexOf("iPhone") >= 0){lsBrowser = "iPhone"; bool = true;}
if (navigator.userAgent.indexOf("iPad") >= 0){lsBrowser = "iPad";bool = true;}
if (navigator.userAgent.indexOf("Android") >= 0){lsBrowser = "Android";bool = true;}
if(bool == true){
//$(".scrollholder").width(180).css({"overflow":"scroll"});;
}
if(bool == false) SelectScrollLoad (_hoderId, _crollId, true);
}
function selectOn(e) {
if (e.data !== undefined) {
if (e.data.ev === 0) {
var _idx = $designselect.index(this);
if ($listWrap.eq(_idx).is(":hidden")) return false;
}
else if (e.data.ev === 1) var _idx = $btn.index(this);
else if (e.data.ev === 2) var _idx = $txt.index(this);
} else {
var _idx = e;
}
if (!flag) return false;
flag = false;
if ($listWrap.eq(_idx).is(":hidden")) {
$listWrap.eq(_idx).stop(true,true).slideDown(150);
icon({selecter: $designselect.eq(_idx), turn : "on", size : 36, cut : 4});
disignScrollAdd({idx : _idx});
flag = true;
} else if($listWrap.eq(_idx).is(":visible")) {
$listWrap.eq(_idx).stop(true,true).slideUp(150, function(){flag = true});
icon({selecter: $designselect.eq(_idx), turn : "off", size : 36, cut : 4});
}
return false;
}
function txtVal() {
var _txt = $(this).find("a").text();
var _idx = $designselect.index($(this).closest($designselect));
$txt.eq(_idx).text(_txt);
selectOn(_idx);
/**
* select 선택시 처리 로직 -(s)-
* > 유지석 / 2014.02.16 21:09
*/
try {
selectChangeProc();
} catch (e) {
// TODO: handle exception
}
/**
* select 선택시 처리 로직 -(e)-
*/
if (!$selectLocation) {
return false;
}
}
init();
}
//-------------------------- icon --------------------------//
function icon(o)
{
var leg = o.size * (o.cut - 1);
var val = 0;
var timer = _timerClear();
var $icon = o.selecter.find(".icon");
var mozO = mozOBrowser();
function init() {
if (!$icon.length) {
$icon = o.selecter;
}
if (o.turn === "on") {
timer = setInterval(iconOn, 20);
} else {
timer = setInterval(iconOff, 20);
}
}
function iconOn() {
if (val >= leg) {
_timerClear();
return false;
}
if (mozO) $icon.stop(false,false).css("background-position", "-=" + o.size + "px 0");
else $icon.stop(false,false).css("background-position-x", "-=" + o.size + "px");
val += o.size;
}
function iconOff() {
if (val >= leg) {
_timerClear();
return false;
}
if (mozO) $icon.stop(false,false).css("background-position", "+=" + o.size + "px 0");
else $icon.stop(false,false).css("background-position-x", "+=" + o.size + "px");
val += o.size;
}
function _timerClear() {
clearInterval(timer);
timer = null;
}
init();
}
//-------------------------- tblallBtn --------------------------//
// 전체열리는 버튼 클릭이벤트
var tblTotalBtn = null;
//-------------------------- tblSlider --------------------------//
function tblSlide()
{
var $tblSlide = $(".tbl_slide");
var $tblTotalBtn = null
var $tblChoiceBtn = null
var $tblList = null
var $tblConts = null
var idx = 0;
var prevIdx = 0;
var flag = true;
var mozO = mozOBrowser();
var bgCheck = false;
var open = false;
function init()
{
if (!$tblSlide.length) {
return false;
}
$tblTotalBtn = $tblSlide.find(".tbl_totalBtn");
$tblChoiceBtn = $tblSlide.find(".slideChoiceBtn");
$tblList = $tblSlide.find(".tbl_slide_list");
$tblConts = $tblSlide.find(".tbl_slide_conts");
// if ($tblList.length === 1) {
// flag = false
// }
$tblList.eq(idx).hide();
$tblConts.eq(idx).show();
$tblChoiceBtn.on("click", tblChoiceBtn);
$tblTotalBtn.on({
"click": tblTotalBtn
/*"mouseenter": function(){
if (!flag) {
return false;
}
icon({selecter: $(this), turn : "on", size : 13, cut : 1});
},
"mouseleave": function(){
if (!flag) {
return false;
}
if (bgCheck) {
icon({selecter: $(this), turn : "off", size : 13, cut : 8});
} else {
icon({selecter: $(this), turn : "off", size : 13, cut : 1});
}
bgCheck = false;
}*/
});
$tblTotalBtn.find(".icon").on({
"mouseenter": function(){
if (!open) {
icon({selecter: $(this), turn : "on", size : 13, cut : 8});
}
},
"mouseleave": function(){
if (!open) {
icon({selecter: $(this), turn : "off", size : 13, cut : 8});
}
},
"click": tblTotalBtn
});
$tblChoiceBtn.find(".icon").on({
"mouseenter": function(){
icon({selecter: $(this), turn : "on", size : 24, cut : 13});
},
"mouseleave": function(){
icon({selecter: $(this), turn : "off", size : 24, cut : 13});
},
"click": function(event){
event.preventDefault();
}
});
}
function tblChoiceBtn()
{
var _idx = $tblChoiceBtn.index(this);
$tblList.eq(prevIdx).show();
$tblList.eq(_idx).hide();
$tblConts.eq(prevIdx).stop(true,true).slideUp();
$tblConts.eq(_idx).stop(true,true).slideDown();
prevIdx = _idx;
setTimeout(function (){
$("html, body").stop().animate({"scrollTop":700 + (_idx*40) - 28 }, 500);
}, 100);
return false;
}
tblTotalBtn = function()
{
var _idx = $tblTotalBtn.index(this);
if (flag) {
$tblList.hide();
$tblConts.stop(true,true).slideDown();
$(".tbldiv01").find("th").addClass("th_color");
if (mozO) $tblTotalBtn.eq(_idx).find(".icon").stop(false,false).css("background-position", "-91px 0");
else $tblTotalBtn.eq(_idx).find(".icon").stop(false,false).css("background-position-x", "-91px");
// bgCheck = true;
flag = false;
open = true;
// setTimeout(function (){
// $("html, body").stop().animate({"scrollTop":500}, 500);
// }, 100);
} else {
$tblConts.stop(true,true).slideUp(function(){
$tblList.show();
});
$(".tbldiv01").find("th").removeClass("th_color");
if (!$(this).hasClass("icon")) {
if (mozO) $tblTotalBtn.eq(_idx).find(".icon").stop(false,false).css("background-position", "0 0");
else $tblTotalBtn.eq(_idx).find(".icon").stop(false,false).css("background-position-x", "0");
}
// bgCheck = true;
flag = true;
open = false;
}
return false;
}
init();
}
//-------------------------- common --------------------------//
function ie8underBrowser()
{
if ($.browser.msie && parseInt($.browser.version, 10) <= 8) {
return true;
} else {
return false;
}
}
function mozOBrowser()
{
if ($.browser.mozilla || $.browser.opera) {
return true;
} else {
return false;
}
}
/**
* 전페이지 디자인 스크롤 강제적으로 id 1번부터 부여 해주는 작업
*/
function disignScrollIdAdd()
{
if (!$(".scrollholder").length) {
return false;
}
var $scrollholder = $(".scrollholder");
var $scroll = $scrollholder.find(".scroll");
$scrollholder.each(function(i){
$(this).attr("id", "scrollholder"+(i+1));
$scroll.eq(i).attr("id", "scroll"+(i+1));
})
}
$(function(){
//-------------------------- controller --------------------------//
// visual();
designselect();
// tab();
headerScroll();
headerSearch();
disignScrollIdAdd();
// gnb();
// $("#scrollbar1").tinyscrollbar();
})