$(function(){ initAll(); // 롤 오버 $('#gnb li li img, #vmode img, #cmode img, #target img, .visual-nav a.target img').each(function() { $(this).mouseover(function() { if ($(this).attr('src').match('_off')) { $(this).css('cursor', 'pointer'); $(this).attr('src', $(this).attr('src').replace('_off', '_on')); $(this).mouseout(function() { $(this).attr('src', $(this).attr('src').replace('_on', '_off')); }); } }); }); // 로드맵 $('table.roadmap td div').wrapInner(''); // GNB $('#gnb .gnbsub').wrapInner('
'); $('#gnb .all-menu .wrapper').wrapInner(''); // GNB sub if ($('#gnb ul').attr('class').match('season')){ $('#gnb li:nth-child(3)').addClass('entrance'); $('#gnb li li').removeClass('entrance'); $('#gnb li.entrance a.d1 img').attr('src', $('#gnb li.entrance a.d1 img').attr('src').replace('gnb3_', 'gnb3_1_')); } $('.gnbsub .inner').animate({opacity: 0.0}, 100); $('.gnbsub .section:last-child').addClass('last-child'); $('div#gnb li').hover(function() { gnbOpen($(this)); } , function() { gnblCose($(this)); }); // GNB hover function gnbOpen(obj) { // IE width 100% if(navigator.userAgent.match('MSIE')) { // eng, chn if(navigator.userAgent.match('MSIE 8') || navigator.userAgent.match('MSIE 6')) { var winw = document.documentElement.offsetWidth -21; } else { var winw = document.documentElement.offsetWidth; } obj.find('.gnbsub').css('width',winw); } obj.find('.gnbsub').show(); obj.find('.gnbsub .inner').animate({opacity: 1.0}, 300); // 다른메뉴 오버시 current 효과 없애기 if($('div#gnb li').is('.current')) { $('div#gnb ul').addClass('out'); } obj.find('a.d1 img').each(function() { $(this).attr('src', $(this).attr('src').replace('_off.', '_on.')); }); obj.find('.section').hover(function () { $(this).find('strong').addClass('on'); $(this).find('strong img').each(function() { $(this).attr('src', $(this).attr('src').replace('_off.', '_on.')); }); } ,function() { $(this).find('strong').removeClass('on'); $(this).find('strong img').each(function() { $(this).attr('src', $(this).attr('src').replace('_on.', '_off.')); }); }); } // GNB out function gnblCose(obj) { $('div#gnb ul').removeClass('out'); obj.find('.inner').animate({opacity: 0.0}, 300); setTimeout(function(){ obj.find('.gnbsub').hide(); },200); obj.find('a.d1 img').each(function() { if(obj.attr('class').match('current')) { } else { $(this).attr('src',$(this).attr('src').replace('_on.', '_off.')); } }); } // 메인에만 적용 if($('body').attr('class').match('main')) { // 뷰모드 슬라이드 $('#slider1').bxSlider({ auto: true, speed: 700, pause: 5000, displaySlideQty: 1, moveSlideQty: 1 }); // 모드선택 토글 $('div.visual-nav li a').bind('click', function(event){ event.preventDefault(); var obj = $(this).attr('href').replace('#',''); var img = $(this).children(); $('div.visual-nav li a img').attr('src', $('div.visual-nav li a img').attr('src').replace('_on.', '_off.')); $(this).addClass('current'); $('div.toggle').each(function(){ if($(this).attr('id').match(obj)){ $(this).fadeIn(); img.attr('src', img.attr('src').replace('_on.', '_off.')); } else { $(this).fadeOut(); img.attr('src', img.attr('src').replace('_off.', '_on.')); } }); }); // 타겟 서비스 $('#visual a.target').click(function(event){ event.preventDefault(); $('#target').fadeIn(); }); $('#target a.close').click(function(event){ event.preventDefault(); $('#target').fadeOut(); }); } }); function unfold(todo){ if(todo == true){ $('#gnb').removeClass(); $('#gnb').addClass('gnb-unfold'); } else { $('#gnb').removeClass(); $('#gnb').addClass('gnb-fold'); } } // URL 변수 받아오기 // getUrlVars()[doc]; function getUrlVars() { var vars = [], hash; var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&'); hashes[0] = hashes[0].substring(0,9); // 9자 까지 자르기 for(var i = 0; i < hashes.length; i++) { hash = hashes[i].split('='); vars.push(hash[0]); vars[hash[0]] = hash[1]; } return vars; } function getUrlVarShort(name) { name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); var regexS = "[\\?&]"+name+"=([^]*)"; var regex = new RegExp( regexS ); var results = regex.exec( window.location.href ); if( results == null ) return "0"; // 0을 돌려주기 else return results[1]; } // png 24 알파채널 처리 function setPng24(obj) { obj.width=obj.height=1; obj.className=obj.className.replace(/\bpng24\b/i,''); obj.style.filter ="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ obj.src +"',sizingMethod='image');" obj.src='../img/common/spacer.gif'; return ''; } // 메인 페이지 처리 function initMain(){ // 탭 토글링 $('div.tab-view h4 a').click(function(){ var grpimg = $(this).parent().parent().parent().find('h4 a img'); var grpthumb = $(this).parent().parent().parent().find('div.thumb'); var thumb = $(this).parent().next('div.thumb'); var img = $(this).children('img'); // more 처리 $(this).parent().parent().parent().find('a.more').hide(); $(this).parent().parent().find('a.more').show(); // 비활성화 grpthumb.each(function(){ $(this).removeClass('show'); }); grpimg.each(function(){ $(this).attr('src',$(this).attr('src').replace('_on','_off')); }); $(this).parent().parent().parent().find('table').addClass('hide'); // 활성화 thumb.addClass('show'); img.attr('src',img.attr('src').replace('_off','_on')); $(this).parent().parent().children('table').removeClass('hide'); return false; }); // 서비스탭 $('p.btn-service-tab a').click(function(){ $(this).parent().next().show(); $('div.section-login h3 img').css('visibility','hidden'); return false; }); $('div.help-service a.close').click(function(){ $(this).parent().hide(); $('div.section-login h3 img').css('visibility','visible'); return false; }); // 로그인 필드 처리 $('table.form-login input.num').val(''); $('table.form-login input.num').focus(function(){ $(this).removeClass('num'); }); $('table.form-login input.num').focusout(function(){ if($(this).val()==''){ $(this).addClass('num'); } }); $('table.form-login input.pw').focus(function(){ $(this).removeClass('pw'); }); $('table.form-login input.pw').focusout(function(){ if($(this).val()==''){ $(this).addClass('pw'); } }); $('table.form-login input.idnum').val(''); $('table.form-login input.idnum').focus(function(){ $(this).removeClass('idnum'); }); $('table.form-login input.idnum').focusout(function(){ if($(this).val()==''){ $(this).addClass('idnum'); } }); } // 공통 function initAll(){ // Allmenu 스크롤 if($('body').is(".scrollarea")) { $('.scrollarea').tinyscrollbar(); } // 라벨 이미지 처리 $('label img').click(function(){ $(this).css('cursor','pointer'); $(this).parent().click(); }); // GNB /* $('#gnb').hover(function(){ $(this).removeClass(); $(this).addClass('gnb-unfold'); $('#allmenu').hide(); }, function() { $(this).removeClass(); $(this).addClass('gnb-fold'); }); */ // 전체메뉴 $('a.btn-allopen').click(function(){ $(this).next().css('top','-362px'); $(this).next().show(); $(this).next().animate({ 'top': '87px', 'opacity': '100' }, { duration: 'slow', easing: 'easeOutCirc' } ); return false; }); $('#allmenu div.btn-close a').click(function(){ $(this).parent().parent().hide(); //$(this).parent().parent().animate({ 'top': '-362px', 'opacity': '100' }, { duration: 'slow', easing: 'easeOutCirc' } ); return false; }); // 인쇄 $('a.print').click(function(){ window.print(); return false; }); // 점프메뉴 $('select.jumpmenu').change(function(){ alert('2011.12월 중순 오픈예정입니다.'); /* if($(this).val() == '#'){ alert('서비스 준비중입니다'); } else if($(this).val() != ''){ window.open($(this).val(),'newwin','top=0, left=0, width=906, height=578, toolbar=no, status=yes, menubar=no, scrollbars=no, resizable=yes'); } */ return false; }); // 점프메뉴2 $('select.jumpmenu_1').change(function(){ if($(this).val() == '#'){ alert('서비스 준비중입니다'); } else if($(this).val() != ''){ //userwidth = (screen.width - 200); //userheight = (screen.height - 200); //window.open($(this).val(),'newwin','top=0, left=0, width='+userwidth+', height='+userheight+', toolbar=no, status=yes, menubar=no, scrollbars=yes, resizable=yes '); var scrumb1 = ''; } return false; }); // scroll to top $('a[href=#top]').click(function(){ $('html, body').animate({scrollTop:0}, 'slow'); return false; }); // 롤 오버 $('img.rollover').each(function(){ $(this).mouseover(function(){ if ($(this).attr('src').match('_off')){ $(this).css('cursor','pointer'); $(this).attr('src',$(this).attr('src').replace('_off','_on')); $(this).mouseout(function(){ $(this).attr('src',$(this).attr('src').replace('_on','_off')); }); } }); }); // skyscraper initSkyscraper("true"); $('#skyscraperOff img.button').click(function(){ $('#skyscraperOff').hide(); $('#skyscraperOn').show(); return false; }); $('#skyscraperOn img.button').click(function(){ $('#skyscraperOn').hide(); $('#skyscraperOff').show(); return false; }); } // 네비게이션 처리 function initNav(doc){ $('#lnb ul').hide(); if(!doc || doc=='home') doc = '1_1_1_1_1'; if(doc){ page = doc.split('_'); var sub1 = page[0]; var sub2 = page[1]; var sub3 = page[2]; var sub4 = page[3]; // 0부터 첫번째 sub1 = sub1 - 1; sub2 = sub2 - 1; sub3 = sub3 - 1; sub4 = sub4 - 1; var lnkimg1 = $('#lnb > li:eq('+sub1+') > H4 > a > img'); var lnkimg2 = $('#lnb > li:eq('+sub1+') > ul > li:eq('+sub2+') > a > img'); var lnkimg3 = $('#lnb > li:eq('+sub1+') > ul > li:eq('+sub2+') > ul > li:eq('+sub3+') > a > img'); var scrumb = "Home"; if(lnkimg1.val()!= null) { lnkimg1.addClass('current'); lnkimg1.attr('src',lnkimg1.attr('src').replace('_off','_on')); var scrumb1 = '' + lnkimg1.attr('alt') + ''; scrumb = scrumb + ' > '+ scrumb1; } if(sub3!=-2 && lnkimg2.val()!= null) { $('#lnb > li:eq('+sub1+')').show(); $('#lnb > li:eq('+sub1+') > ul').slideDown(); lnkimg2.addClass('current'); lnkimg2.parent().parent().addClass('current'); if(sub3!=-1){ // 서브메인일때 lnkimg2.attr('src',lnkimg2.attr('src').replace('_off','_on')); } var scrumb2 = '' + lnkimg2.attr('alt') + ''; scrumb = scrumb + ' > '+ scrumb2; } if(sub3>-1 && lnkimg3.val()!= null) { $('#lnb > li:eq('+sub1+') > ul > li:eq('+sub2+') > ul').show(); lnkimg3.addClass('current'); lnkimg3.attr('src',lnkimg3.attr('src').replace('_off','_on')); var scrumb3 = '' + lnkimg3.attr('alt') + ''; scrumb = scrumb + ' > '+ scrumb3; } $('#scrumb').html(scrumb); } } // 기존 스크립트 function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i