/* * »ç¿ëÀÚÃø °øÅëÀûÀ¸·Î ¾²´Â ÀÚ¹Ù½ºÅ©¸³Æ®ÀÔ´Ï´Ù. */ // firebug°¡ ¾ø´Â °æ¿ì¿¡ ¿¡·¯ ¹æÁö if (! window.console) { window.console = {}; window.console.debug = function() {}; window.console.error = function() {}; window.console.trace = function() {}; } /** * IE6 ¹é±×¶ó¿îµå À̹ÌÁö ²­¹÷ÀÓ ¹× ¸Þ¸ð¸® ¹®Á¦ ÇØ°á */ if(jQuery.browser.msie && parseInt(jQuery.browser.version, 10) == 6) { try { document.execCommand("BackgroundImageCache", false, true); } catch(err) {} } // Ÿ ÀÚ¹Ù½ºÅ©¸³Æ® ÇÁ·¹ÀÓ¿öÅ©($) ȣȯ¼ºÀ» À§ÇÏ¿© jq¸¦ »ç¿ëÇϱâ·Î ÇÔ. var jq = jQuery.noConflict(); jq(function(a) {a.datepicker.regional.ko={closeText:"´Ý±â",prevText:"ÀÌÀü´Þ",nextText:"´ÙÀ½ ´Þ",currentText:"¿À´Ã",monthNames:["1¿ù","2¿ù","3¿ù","4¿ù","5¿ù","6¿ù","7¿ù","8¿ù","9¿ù","10¿ù","11¿ù","12¿ù"],monthNamesShort:["1¿ù","2¿ù","3¿ù","4¿ù","5¿ù","6¿ù","7¿ù","8¿ù","9¿ù","10¿ù","11¿ù","12¿ù"],dayNames:["ÀÏ","¿ù","È­","¼ö","¸ñ","±Ý","Åä"],dayNamesShort: ["ÀÏ","¿ù","È­","¼ö","¸ñ","±Ý","Åä"],dayNamesMin:["ÀÏ","¿ù","È­","¼ö","¸ñ","±Ý"," Åä"],dateFormat:"yy-mm-dd",firstDay:0,isRTL:false};a.datepicker.setDefaults(a.datepicker.regional.ko)}); /** * validation À» ¼öÇàÇÏ´Â ÀÛÀº ÇÔ¼ö * class="required" ¿¡ µ¿ÀÛÇÕ´Ï´Ù. * formű׿¡ onsubmit="return chkRequired()" Ãß°¡ÇÏ¸é µË´Ï´Ù. * chkRequired(this)·Î È£ÃâÇÒ °æ¿ì ÇØ´ç Æû¸¸ °Ë»çÇÕ´Ï´Ù. */ function chkRequired(frm) { var chk = true; if(frm) var fields = jq(frm).find(':input.required'); else var fields = jq(':input.required'); fields.each(function() { if(!jq(this).val()) { jq(this).parent().find('label[class=required_error]').remove(); jq(this).addClass('error'); jq(this).parent().append(''); chk = false; var el = '
ÇʼöÇ׸ñÀ» ÀÔ·ÂÇÏ¼Å¾ß ÇÕ´Ï´Ù.
'; jq('#alert_form_required').remove(); jq(el).appendTo('#global_main'); } else { jq(this).parent().find('label[class=error]').remove(); jq(this).removeClass('error'); } }); return chk; } /** * Äü¸Þ´º ½ºÅ©·Ñ * »ç¿ë¹ý : jq(window).load(quick_menu_slide).resize(quick_menu_slide).scroll(quick_menu_slide); */ function quick_menu_slide() { var moveTop = 0; if(moveTop<0) moveTop=0; if(jq(document.body).scrollTop()==0) var scrollTop=jq(document.documentElement).scrollTop(); else var scrollTop=jq(document.body).scrollTop(); if(!document.compatMode||document.compatMode=="BackCompat") var scrollHeight=document.body.scrollHeight; else var scrollHeight=document.documentElement.scrollHeight; var moveHeight=scrollTop+moveTop; if(moveHeight+jq("#scroll").height() 13) return false; birthYear = (value.charAt(6) <= '2') ? '19' : '20'; birthYear += value.substr(0, 2); birthMonth = value.substr(2, 2) - 1; birthDate = value.substr(4, 2); birth = new Date(birthYear, birthMonth, birthDate); if ( birth.getYear()%100 != value.substr(0, 2) || birth.getMonth() != birthMonth || birth.getDate() != birthDate) { jq("input[name='birth']").val(''); return false; } buf = new Array(13); for (i = 0; i < 13; i++) buf[i] = parseInt(value.charAt(i)); multipliers = [2,3,4,5,6,7,8,9,2,3,4,5]; for (i = 0, sum = 0; i < 12; i++) sum += (buf[i] *= multipliers[i]); birthMonth = birthMonth + 1; if (("" + birthMonth).length == 1) {birthMonth = "0" + birthMonth;} if (("" + birthDate).length == 1) {birthDate = "0" + birthDate;} var client_birth = birthYear + birthMonth + birthDate; if ((11 - (sum % 11)) % 10 != buf[12]) { jq("input[name='birth']").val(''); return false; }else{ jq.post('/member/process.php', {'mode': 'regnoChk', 'regno': value}, function(response) { if(response == 'true') { jq("input[name='birth']").val(client_birth); } else { alert('°¡ÀÔµÈ Áֹεî·Ï¹øÈ£°¡ ÀÖ½À´Ï´Ù.'); jq("input[name='regno']").val(''); } }, 'html'); return true; } } else { jq("input[name='birth']").val(client_birth); return true; } }, 'À߸øµÈ Áֹεî·Ï¹øÈ£ÀÔ´Ï´Ù.'); } /** * »ç¾÷ÀÚµî·Ï¹øÈ£ üũ */ function validatorAddBusino() { jq.validator.addMethod("busiNo", function(value) { if(value) { return value.match( eval("/(\\d)(\\d)(\\d)(-)(\\d)(\\d)(-)(\\d)(\\d)(\\d)(\\d)(\\d)$/i") ) ? true : false; } else { return true; } }, '»ç¾÷ÀÚµî·Ï¹øÈ£ÀÇ Çü½ÄÀÌ À߸øµÇ¾ú½À´Ï´Ù.'); } /** * ÆÄÀÏŸÀÔ Ã¼Å© * @param string allow_file Çã¿ë°¡´ÉÇÑ È®ÀåÀÚ */ function validatorAdd(allow_file) { jq.validator.addMethod("fileTyepCheck", function(value) { if(value) { return value.match( eval("/\.(" + allow_file + ")$/i") ) ? true : false; } else { return true; } }, '÷ºÎ °¡´ÉÇÑ ÆÄÀÏÀÌ ¾Æ´Õ´Ï´Ù.'); } /** * ÇöÀç ½Ã°¢À» Time Çü½ÄÀ¸·Î ¸®ÅÏ */ function getCurrentTime(date) { return toTimeString(new Date(date)); } /** * ÀÚ¹Ù½ºÅ©¸³Æ® Date °´Ã¼¸¦ Time ½ºÆ®¸µÀ¸·Î º¯È¯ * parameter date: JavaScript Date Object */ function toTimeString(date) { var year = date.getFullYear(); var month = date.getMonth() + 1; // 1¿ù=0,12¿ù=11À̹ǷΠ1 ´õÇÔ var day = date.getDate(); if (("" + month).length == 1) {month = "0" + month;} if (("" + day).length == 1) {day = "0" + day;} return ("" + year + month + day) } /** * ÇöÀç Ò´À» YYYYÇü½ÄÀ¸·Î ¸®ÅÏ */ function getYear(date) { return getCurrentTime(date).substr(0,4); } /** * ÇöÀç êÅÀ» MMÇü½ÄÀ¸·Î ¸®ÅÏ */ function getMonth(date) { return getCurrentTime(date).substr(4,2); } /** * ÇöÀç ìíÀ» DDÇü½ÄÀ¸·Î ¸®ÅÏ */ function getDay(date) { return getCurrentTime(date).substr(6,2); } function getDate(day) { var d = new Date(); var dt = d - day*24*60*60*1000; return getYear(dt) + '-' + getMonth(dt) + '-' + getDay(dt); } /** * »õâÀ¸·Î ÆË¾÷À» ¶ç¿ó´Ï´Ù / ÆÛ½ºÆ®¸ô 2.0 js * popup('zoom.php?seq=7',750,550) */ function popup(src,width,height) { var scrollbars = "1"; var resizable = "no"; if (typeof(arguments[3])!="undefined") scrollbars = arguments[3]; if (arguments[4]) resizable = "yes"; window.open(src,'','width='+width+',height='+height+',scrollbars='+scrollbars+',toolbar=no,status=no,resizable='+resizable+',menubar=no'); } /** * ÄÞ¸¶ ºÙÀ̱â ÇÔ¼ö * @param value int */ function setComma(nStr) { nStr += ''; x = nStr.split('.'); x1 = x[0]; x2 = x.length > 1 ? '.' + x[1] : ''; var rgx = /(\d+)(\d{3})/; while (rgx.test(x1)) { x1 = x1.replace(rgx, '$1' + ',' + '$2'); } return x1 + x2; } /** * ½Å±Ô»ý¼º ´ÙÀ̾ó·Î±× âÀ» ¶ç¿î´Ù. *
 * 1. createElementContainer ÇÔ¼ö¸¦ ÀÌ¿ëÇÏ¿© ¸Å¹ø div ű׸¦ ÀÔ·ÂÇÏÁö ¾Ê°í ´ÙÀ̾ó·Î±× »ý¼º½Ã ÀÚµ¿À¸·Î »ý¼ºÇÑ´Ù.
 * 2. refreshTable ÇÔ¼ö¸¦ ÀÌ¿ëÇÏ¿© ´ÙÀ̾ó·Î±× ³»¿ë ºÎºÐÀ» ºÒ·¯¿Â´Ù.
 * 
* @param string url ÆûÈ­¸é ÁÖ¼Ò * @param int width °¡·Î »çÀÌÁî * @param int height ¼¼·Î »çÀÌÁî * @param string title Á¦¸ñ */ function addFormDialog(url, width, height, title) { createElementContainer(title); refreshTable(url); jq('#dlg').dialog({ bgiframe: true, autoOpen: false, width: width, height: height, resizable: false, modal: true, overlay: { backgroundColor: '#000000', opacity: 0.8 }, buttons: { '´Ý±â': function() { jq(this).dialog('close'); }, 'ÀúÀåÇϱâ': function() { jq('#form-image').submit(); } } }).dialog('open'); return false; } function createElementContainer(title) { var dlg_title = title ? title : 'µî·ÏÆû'; var el = '
'; jq('#dlg').remove(); jq(el).appendTo('body'); } function refreshTable(url) { jq.get(url, {}, function(data, textStatus) { jq('#dlg_content').html(data); }); } /** * °ü¸®ÀÚ À̹ÌÁö °ü¸® ±â´É * @param int mode 0~1 : 0 ÀÌ¸é ¼öÁ¤¸ðµå, 1 ÀÌ¸é ¿ø·¡¸ðµå·Î º¹±ÍÇÑ´Ù. */ function image_manager(mode) { if(mode != 1) { //jq('a').removeAttr('href'); // ¸ðµç À̹ÌÁö¿¡ Ä¿¼­ Æ÷ÀÎÆ®¸¦ ÁØ´Ù. jq('img, td[background]').css('cursor', 'pointer'); // ¸ðµç À̹ÌÁö¿¡ Ŭ¸¯À̺¥Æ®¸¦ ºñȰ¼ºÈ­ ½ÃŲ´Ù. jq('img').unbind('click'); // ¸ðµç À̹ÌÁö Ŭ¸¯½Ã ÆË¾÷âÀ» ¶ç¿î´Ù. jq('img, input[type=image], td[background]').click(function(e, data) { e.preventDefault(); e.stopPropagation(); if(jq(this).attr('background')) { img_path = jq(this).attr('background'); img_target = 'background'; } else { img_path = jq(this).attr('src'); img_target = 'img'; } // »óǰÀ̹ÌÁö´Â Á¦¿Ü¸¦ ½ÃŲ´Ù. if(img_path.match( eval("/^(\\/admin\\/images)/i") ) || img_path.match( eval("/^(\\/skin\\/goods)/i") )) { //alert('»óǰÀ̹ÌÁö´Â º¯°æÇϽǼö ¾ø½À´Ï´Ù.'); return false; } img_width = jq(this).width(); img_height = jq(this).height(); img_link = jq(this).parent().attr('href'); temp_link = jq(this).parent().attr('opt'); if(img_target == 'background') { addFormDialog('/manager/image_manager.php', 500, 300, 'À̹ÌÁö °ü¸®'); } else { addFormDialog('/manager/image_manager.php', img_width + 500, img_height + 300, 'À̹ÌÁö °ü¸®'); } }); // ¼±Åà ´ë»ó ¿Ü°û¼±À» Åä±Û½ÃŲ´Ù. jq('img, input[type=image], td[background]').hover( function() { // »óǰÀ̹ÌÁö´Â Á¦¿Ü¸¦ ½ÃŲ´Ù. img_path = jq(this).attr('background') ? jq(this).attr('background') : jq(this).attr('src'); if(img_path.match( eval("/^(\\/admin\\/images)/i") ) || img_path.match( eval("/^(\\/skin\\/goods)/i") )) { jq(this).css('cursor', 'default'); return false; } else { jq(this).css('border', '3px solid #E872B6'); } }, function() { jq(this).css('border', ''); } ); } else { location.reload(); } } /** * À̹ÌÁö °ü¸® Ȱ¼º / ºñȰ¼º üũ */ function image_edit_check() { if(jq('#image_edit_btn').attr('opt') == 'Y') { jq('#image_edit_btn').attr('opt', 'N'); jq('#image_edit_btn').css('background-image', "url('/admin/images/denine/btn_wil_gray.gif')"); jq('#image_edit_btn').attr('value', ' '); image_manager(0); } else { jq('#image_edit_btn').attr('opt', 'Y'); jq('#image_edit_btn').css('background-image', "url('/admin/images/denine/btn_wil_blue.gif')"); jq('#image_edit_btn').attr('value', ' '); image_manager(1); } } /** * À̹ÌÁö ¸µÅ©¸¦ µðºñ¿¡¼­ °¡Á®¿Í¼­ ¼ÂÆÃÇÑ´Ù. */ //function settingImageUrl() { // jq.post('/manager/process.php', {'mode': 'find_image_url'}, function(response) { // if(response) { // jq(response).each(function(e, data) { // var pattern = "img[src*='" + data.image_path + "']"; // // if(jq(pattern).parent('a').length > 0) { // jq(pattern).parent().attr('href', data.url); // } else { // var link = ""; // jq(pattern).wrap(link); // } // // }); // } // }, 'json'); //} function isNumber(s) { s += ''; // ¹®ÀÚ¿­·Î º¯È¯ s = s.replace(/^\s*|\s*$/g, ''); // ÁÂ¿ì °ø¹é Á¦°Å if (s == '' || isNaN(s)) return false; return true; } /** * Áñ°Üã±â ±â´É Ãß°¡ */ function addfavorites(url, title){ if(window.opera && window.print){ // opera var elem = document.createElement('a'); elem.setAttribute('href',url); elem.setAttribute('title',title); elem.setAttribute('rel','sidebar'); elem.click(); } else if(document.all)// ie window.external.AddFavorite(url, title); else if (window.sidebar) // firefox window.sidebar.addPanel(title, url, ""); } //¿À´Ãº» »óǰ ÀÌÀüÀ¸·Î function todayViewPre(){ hideCnt = 0; jq("#todayGoodsView").children().children().each(function (e, el){ displayStyle = jq(el).css("display"); if(displayStyle == "none"){ hideCnt++; } console.debug(jq(el)); if(displayStyle == "none" && jq(this).next().css("display") == "block" && hideCnt > 0) { jq(this).css("display", "block"); } else if(displayStyle == "block" && (jq(this).next().css("display") == "none" || !jq(this).next().css("display")) && hideCnt > 0) { jq(this).css("display", "none"); } }); } //¿À´Ãº» »óǰ ´ÙÀ½À¸·Î function todayViewNext(totalCnt, perCnt){ cnt = 0; todayGoodsChange = 0; hideCnt = 0; maxBehavior = totalCnt - perCnt; jq.each(jq("#todayGoodsView").children().children(), function (i, n){ displayStyle = jq(this).css("display"); if(displayStyle == "none"){ hideCnt++; } if(displayStyle == "block" && todayGoodsChange == 0 && hideCnt < maxBehavior) { jq(this).css("display", "none"); todayGoodsChange = 1; } else if(displayStyle == "none" && todayGoodsChange == 1 && hideCnt <= maxBehavior) { jq(this).css("display", "block"); todayGoodsChange = 0; } cnt++; }); } function quickViewDialog(url, width, height, title) { createElementContainer(title); refreshTable(url); jq('#dlg').dialog({ bgiframe: true, autoOpen: false, width: width, height: height, resizable: false, modal: true, overlay: { backgroundColor: '#000000', opacity: 0.8 }, buttons: { '´Ý±â': function() { jq(this).dialog('close'); } } }).dialog('open'); return false; } jq(document).ready(function() { jq('.quick_view').click(function() { var goods_seq = jq(this).attr('opt'); quickViewDialog('/goods/quick_view.php?seq=' + goods_seq, 700, 480, 'Quick View'); }); });