/** * Ä«Å×°í¸® È°¼ºÈ­ */ $(document).ready(function(){ // Ä«Å×°í¸® È°¼ºÈ­ var currentLocation = location.href; //¼Ò¼È(addthis¿µ¿ª Ãâ·Â) socialControll(); $('#subnav a').each(function(){ var tmp = $(this).attr('href').split('?'); var uri = tmp[0].replace(/[a-zA-Z]+\.do/g , ''); var tmpQueryString = tmp[1].split('&'); // make queryString var loopCnt = tmpQueryString.length; var queryArray = []; for(var i = 0 ; i < loopCnt ; i++) { if(tmpQueryString[i].indexOf('gnb') == -1 && tmpQueryString[i].indexOf('lnb') == -1) queryArray.push(tmpQueryString[i]); } var queryString = queryArray.join('&'); // location check if( currentLocation.indexOf(uri) > 1 ) { if(queryString != '') { if(currentLocation.indexOf(queryString) > 1) $(this).addClass('on'); } else { $(this).addClass('on'); } } else { $(this).removeClass('on'); } }); // datepicker È°¼ºÈ­ $(function(){ $('.datepicker').datepicker({ dateFormat : "yy.mm.dd" , monthNames : ["1¿ù","2¿ù","3¿ù","4¿ù","5¿ù","6¿ù","7¿ù","8¿ù","9¿ù","10¿ù","11¿ù","12¿ù"] , dayNamesMin : ["ÀÏ","¿ù","È­","¼ö","¸ñ","±Ý","Åä"] }); $('.datepicker2').datepicker({ dateFormat : "yymmdd" , monthNames : ["1¿ù","2¿ù","3¿ù","4¿ù","5¿ù","6¿ù","7¿ù","8¿ù","9¿ù","10¿ù","11¿ù","12¿ù"] , dayNamesMin : ["ÀÏ","¿ù","È­","¼ö","¸ñ","±Ý","Åä"] }); $('.datepicker3').datepicker({ dateFormat : "yy-mm-dd" , monthNames : ["1¿ù","2¿ù","3¿ù","4¿ù","5¿ù","6¿ù","7¿ù","8¿ù","9¿ù","10¿ù","11¿ù","12¿ù"] , dayNamesMin : ["ÀÏ","¿ù","È­","¼ö","¸ñ","±Ý","Åä"] }); }); // add overlay $('#overlay').css('position' , 'absolute'); $('#overlay').css('background-color' , '#000'); $('#overlay').css('opacity' , '0.5'); $('#overlay').css('left' , '0px'); $('#overlay').css('top' , '0px'); $('#overlay').css('width' , $(window).width()); $('#overlay').css('height' , $(document).height()); $('#overlay').css('z-index' , '99'); $(window).resize(function(){ $('#overlay').css('width' , $(window).width()); $('#overlay').css('height' , $(document).height()); }); setSearch(); }); /** * javascriptÀÇ ¿¡·¯ ó¸® * @param str * @param fos * @param frm */ function doError(str , fos , frm) { alert(str); eval("document.forms." + frm + "." + fos + ".focus();"); return; } /** * javascriptÀÇ ¿¡·¯ ó¸® - alert ¸»°í text·Î * @param str * @param fos * @param frm */ /** * * @param obj * @param len * @param target */ function checkLength(obj , len , target) { if(obj.value.length >= len) $('input[name=' + target + ']').focus(); } /** * üũ¹Ú½º¿¡ ¼±ÅÃÀÌ µÇ¾îÀÖ´ÂÁö üũÇÑ´Ù. */ function isChecked(name) { var checked = false; $("input[name='" + name + "']").each(function(){ if(typeof($(this)) != 'undefined') { if($(this).is(':checked')) checked = true; } }); return checked; } /** * ¼ýÀÚÇüÀÎÁö È®ÀÎ * @param value */ function checkNumeric(value) { return !isNaN(value); } //ÆòÇü°è»ê±â Çڵ鷯 function pytCalHandle(mode) { if( mode == 'sp') { var square = parseFloat($('input[name=spSquare]').val()); var result = (square * 0.3025).toFixed(2); $('input[name=spPyung]').val(result); } else if(mode == 'ps') { var pyung = parseFloat($('input[name=psPyung]').val()); var result = (pyung * 3.3058).toFixed(2); $('input[name=psSquare]').val(result); } } /* ¼Ò¼È¿µ¿ªÁ¦¾î */ function socialControll() { var html = '' + '' + 'ÆäÀ̽ººÏ' + 'Æ®À§ÅÍ' + 'ÀμâÇϱâ' + '¸ÞÀÏ' + 'ÁÁ¾Æ¿ä' + '' + '' + ''; $('.social').html(html); } function socialCallback() { //alert("111"); //closePopup('socialRegist'); window.close(); document.location.reload(); } /* ¼Ò¼È´ñ±Û °¡Á®¿À±â */ function getSocicalComment(refer, target, page, len) { var smartlogin_seq = "382"; var consumer_seq = "343"; var livere_seq = "9020"; refer = refer.replace('http://', ''); var url = 'http://dev.livere.co.kr/API_Livere?calltype=refer&command=getArticle&sort=new&smartlogin_seq=' + smartlogin_seq + '&consumer_seq=' + consumer_seq + '&refer=' + refer + '&livere_seq=' + livere_seq + '&viewpage=' + page; $.ajax({ url : url + "&liverecallback=?", type : 'post', dataType : 'jsonp', jsonp : 'callback', cache : true, success : function(data) { if(data.resultData != null) { var html = ''; $(target).append(html); } }, error: function(request, status, error) { $(target).html('error: ' + error); } }); } //°Ë»öÇϱâ var serchCon = {}; var isOpen = false; var serchTimerNum = 0; var communitySerchCon = {}; var communityIsOpen = false; var communitySerchTimerNum = 0; function setSearch(){ serchCon = $("#aside").find(".service"); serchCon.find(".searchbtn").bind('focusin', function(event){ //console.log("btn1ON"); stopTimer(); }); serchCon.find(".searchbtn").bind('focusout', function(event){ //console.log("btn1OUT"); startTimer(); }); serchCon.find(".schBtn").bind('focusin', function(event){ stopTimer(); }); serchCon.find(".schBtn").bind('focusout', function(event){ startTimer(); }); serchCon.find(".itext").bind('focusin', function(event){ stopTimer(); }); serchCon.find(".itext").bind('focusout', function(event){ startTimer(); }); /////////////// ·¡¹Ì¾È ŸÀÓÁî °Ë»ö Æ÷Ä¿½º ////////////////////////////////////////////// communitySerchCon = $("#contents"); communitySerchCon.find(".search").find("a").bind('focusin', function(event){ //startCommunityTimer(); stopCommunityTimer(); }); communitySerchCon.find(".search").find("a").bind('focusout', function(event){ startCommunityTimer(); }); communitySerchCon.find(".searchArea").find(".itext").bind('focusin', function(event){ stopCommunityTimer(); }); communitySerchCon.find(".searchArea").find(".itext").bind('focusout', function(event){ startCommunityTimer(); }); communitySerchCon.find(".searchArea").find(".schBtn").bind('focusin', function(event){ stopCommunityTimer(); }); communitySerchCon.find(".searchArea").find(".schBtn").bind('focusout', function(event){ startCommunityTimer(); }); } function startTimer(){ serchTimerNum = setInterval(closeSearch , 300 ); } function closeSearch(){ if(isOpen == true)totalSearch(); stopTimer(); } function stopTimer(){ clearInterval( serchTimerNum ); } function totalSearch() { if(isOpen == true)isOpen = false; else isOpen = true; $('.searchAreaT').toggle("slide"); } function startCommunityTimer(){ communitySerchTimerNum = setInterval(closeCommunitySearch , 300 ); } function closeCommunitySearch(){ if(communityIsOpen == true)communitySearch(); stopCommunityTimer(); } function stopCommunityTimer(){ clearInterval( communitySerchTimerNum ); } function communitySearch() { if(communityIsOpen == true)communityIsOpen = false; else communityIsOpen = true; $('.searchArea').toggle('slide'); } function imgPop(imgPath) { if(imgPath != '') { showPopup('imgPop', '?imgPath=' + imgPath); } } /* get cookie */ function getCookie( name ){ var nameOfCookie = name + "="; var x = 0; while ( x <= document.cookie.length ) { var y = (x+nameOfCookie.length); if ( document.cookie.substring( x, y ) == nameOfCookie ) { if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 ) endOfCookie = document.cookie.length; return unescape( document.cookie.substring( y, endOfCookie ) ); } x = document.cookie.indexOf( " ", x ) + 1; if ( x == 0 ) break; } return ""; } /* set cookie */ function setCookie(name, value, expiredays){ var todayDate = new Date(); todayDate.setDate(todayDate.getDate() + expiredays); document.cookie = name + "=" + escape(value) + "; path=/; expires=" + todayDate.toGMTString() + ";"; } // cookie plugin (function($){ $.cookie = function(key, value, options) { if(arguments.length > 1) { var o = $.extend({}, $.cookie.defaults, options); if (value === null || value === undefined) { value = ''; o.expires = -1; } if (o.expires.constructor != Date) { var today = new Date(); today.setDate(today.getDate() + o.expires); o.expires = today; } // Create the cookie string document.cookie = key + '=' + value + '; expires=' + o.expires.toUTCString() + (o.path? '; path=' + (o.path) : '') + (o.domain? '; domain=' + (o.domain) : '') + (o.secure? '; secure' : ''); } else { if(result = new RegExp(key+"=(.*?)(?:;|$)").exec(document.cookie)) return decodeURIComponent(result[1]); return false; } }; $.cookie.defaults = { expires: 365, path: '/' } })(jQuery);