$(function(){ // 좌측메뉴 selected $(".lnbm li").each(function(){ if( location.href.match( $(this).find("a").attr("href") ) ){ $(this).addClass("on"); } }); // contents 내용부분의 tab menu $(".w_tab_menu li a:first").addClass("on"); $(".w_tab_section").hide(); $(".w_tab_section:eq(0)").show(); $(".w_tab_menu li").css("cursor", "pointer").click(function(){ $(".w_tab_menu li a").removeClass("on"); $(this).find("a").addClass("on"); idx = $(this).index(); $(".w_tab_section").hide(); $(".w_tab_section:eq("+idx+")").show(); }); }); function getParameterByName(name) { var match = RegExp('[?&]' + name + '=([^&]*)').exec(window.location.search); return match && decodeURIComponent(match[1].replace(/\+/g, ' ')); } /* pagination 사용법 */ QueryString = function(str) { var str = str ? str : document.location.href; this.argv = new Array(); this.queryString = str.split('?')[1]; if (!this.queryString) this.queryString = ''; var _argv = this.queryString.split('&'); for(var i=0; i<_argv.length; i++) { pp=_argv[i].split('='); var _key = pp[0]; var _val = pp[1]; this.argv[_key] = pp[1]; } if (!this.argv) this.argv = new Array(); this.setVar = function(key,val) { if (typeof key == 'object') { for (var item in key) this.argv[item] = key[item]; } else { this.argv[key] = val; } return this.getVar(); } this.getVar = function(key) { if (key) { if (!this.argv[key]) return ''; else { return this.argv[key]; } } else { var cnt = 0; for(var c in this.argv) cnt++; // XXX: 키 이름을 가진 array 는 length 속성으로 항상 0 을 뱉어 낸다. if (cnt > 0) { var _item = new Array(); for (var x in this.argv) if (this.argv[x]) _item[_item.length] = x + '=' + this.argv[x]; else continue; return '?' + _item.join('&'); } else return '?'; } } } Paging = function(total, perPage, perView) { this.config = { thisPageStyle: 'font-weight: bold; text-decoration: none;', otherPageStyle: 'text-decoration: none;', // prevIcon: 'http://img2.surenet.co.kr/images/btn/list_prev.gif', // nextIcon: 'http://img2.surenet.co.kr/images/btn/list_next.gif', //itemPerPage: 10, // 리스트 목록수 //pagePerView: 10 // 페이지당 네비게이션 항목수 itemPerPage: perPage, pagePerView: perView } this.totalItem = total; this.qs = new QueryString; this.calculate = function() { this.totalPage = Math.ceil(this.totalItem / this.config.itemPerPage); this.currentPage = this.qs.getVar('page'); if (!this.currentPage) this.currentPage = 1; if (this.currentPage > this.totalPage) this.currentPage = this.totalPage; this.lastPageItems = this.totalPage % this.config.itemPerPage; this.prevPage = this.currentPage-1; this.nextPage = this.currentPage+1; this.seek = this.prevPage * this.config.itemPerPage; this.currentScale = parseInt(this.currentPage / this.config.pagePerView); if (this.currentPage % this.config.pagePerView < 1) this.currentScale--; this.totalScale = parseInt(this.totalPage / this.config.pagePerView); this.lastScalePages = this.totalPage % this.config.pagePerView; if (this.lastScalePages == 0) this.totalScale--; this.prevPage = this.currentScale * this.config.pagePerView; this.nextPage = this.prevPage + this.config.pagePerView + 1; } this.toString = function() { var ss, se; this.calculate(); var prevBtn = '
  • '; if (this.currentPage > this.config.pagePerView) { prevBtn = '
  • '; } ss = this.prevPage + 1; if ((this.currentScale >= this.totalScale) && (this.lastScalePages != 0)) se = ss + this.lastScalePages; else if (this.currentScale <= -1) se = ss; else se = ss + this.config.pagePerView; var navBtn = ''; for(var i = ss; i '; } else { _btn = '
  • '+i+'
  • '; } navBtn+=_btn; } var nextBtn = '
  • '; if (this.totalPage >= this.nextPage) { nextBtn = '
  • '; } return prevBtn+' '+navBtn+' '+nextBtn; } } function in_array(needle, haystack, argStrict) { // discuss at: http://phpjs.org/functions/in_array/ // original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) // improved by: vlado houba // improved by: Jonas Sciangula Street (Joni2Back) // input by: Billy // bugfixed by: Brett Zamir (http://brett-zamir.me) // example 1: in_array('van', ['Kevin', 'van', 'Zonneveld']); // returns 1: true // example 2: in_array('vlado', {0: 'Kevin', vlado: 'van', 1: 'Zonneveld'}); // returns 2: false // example 3: in_array(1, ['1', '2', '3']); // example 3: in_array(1, ['1', '2', '3'], false); // returns 3: true // returns 3: true // example 4: in_array(1, ['1', '2', '3'], true); // returns 4: false var key = '', strict = !! argStrict; //we prevent the double check (strict && arr[key] === ndl) || (!strict && arr[key] == ndl) //in just one for, in order to improve the performance //deciding wich type of comparation will do before walk array if (strict) { for (key in haystack) { if (haystack[key] === needle) { return true; } } } else { for (key in haystack) { if (haystack[key] == needle) { return true; } } } return false; }