(function($){$.browserTest=function(a,z){var u='unknown',x='X',m=function(r,h){for(var i=0;i400){r.version='2.0';}if(r.name==='presto'){r.version=($.browser.version>9.27)?'futhark':'linear_b';}r.versionNumber=parseFloat(r.version,10)||0;r.versionX=(r.version!==x)?(r.version+'').substr(0,1):x;r.className=r.name+r.versionX;return r;};a=(a.match(/Opera|Navigator|Minefield|KHTML|Chrome/)?m(a,[[/(Firefox|MSIE|KHTML,\slike\sGecko|Konqueror)/,''],['Chrome Safari','Chrome'],['KHTML','Konqueror'],['Minefield','Firefox'],['Navigator','Netscape']]):a).toLowerCase();$.browser=$.extend((!z)?$.browser:{},c(a,/(camino|chrome|firefox|netscape|konqueror|lynx|msie|opera|safari)/,[],/(camino|chrome|firefox|netscape|netscape6|opera|version|konqueror|lynx|msie|safari)(\/|\s)([a-z0-9\.\+]*?)(\;|dev|rel|\s|$)/));$.layout=c(a,/(gecko|konqueror|msie|opera|webkit)/,[['konqueror','khtml'],['msie','trident'],['opera','presto']],/(applewebkit|rv|konqueror|msie)(\:|\/|\s)([a-z0-9\.]*?)(\;|\)|\s)/);$.os={name:(/(win|mac|linux|sunos|solaris|iphone)/.exec(navigator.platform.toLowerCase())||[u])[0].replace('sunos','solaris')};if(!z){$('html').addClass([$.os.name,$.browser.name,$.browser.className,$.layout.name,$.layout.className].join(' '));}};$.browserTest(navigator.userAgent);})(jQuery); /* alert($.browser.name); // this will alert 'chrome' alert($.browser.version); // this will alert '3.0.195.33' alert($.browser.versionNumber); // this will alert '3' alert($.browser.versionX); // this will alert '3' alert($.browser.className); // this will alert 'chrome3' alert($.layout.name); // this will alert 'webkit' alert($.layout.version); // this will alert '532.0' alert($.layout.versionNumber); // this will alert '532' alert($.layout.versionX); // this will alert '5' alert($.layout.className); // this will alert 'webkit5' alert($.os.name); // this will alert 'win' */ $(function() { if($.browser.name == 'msie') { //$('
'+ $.browser.className + '
').appendTo(document.body); $('body').addClass($.browser.className); } else { //$('
'+ $.browser.name + '
').appendTo(document.body); $('body').addClass($.browser.name); } //select box $('.ui_select').selectbox({ //셀렉터 class 지정 //onChangeCallback:myFunction, //콜백함수 inputClass:'select_basic', //input 클래스 지정 containerClass:'select_basic_wrapper', //div 클래스 지정 hoverClass:'current', // 오버 클래스 지정 currentClass:'selected', // 선택 클래스 지정 maxHeight:120, // // 최대 높이값(보다크면 스크롤 생성) debug:false // debug mode on/off }); /* callback function */ function myFunction(args) { /* var $els = $(args); alert($els.attr('id')); */ } }); function addLoadEvent(func) { var oldonload = window.onload; if(typeof window.onload != 'function') { window.onload = func; } else { window.onload = function() { oldonload(); func(); } } } $(function() { /* img tab */ $.fn.imgTab = function(options) { return this.each(function() { options = options || {}; var $cont = $(this); var opts = $.extend({}, $.fn.imgTab.defaults, options || {}); var $eventEls = $cont.find(opts.eventEls); $eventEls.bind('click focus', function(ev) { tabActive($(this), ev); }) function tabActive(obj, ev) { var self = obj; var current = $eventEls.index($(self)[0]); ev.preventDefault(); $eventEls.each(function(n) { var href = $(this).attr('href'); // URL 을 표준 링크로 만든다 if (!$.support.herfNormalized) { var loc = window.location; href = href.replace(loc.protocol + '//' + loc.host + loc.pathname, ''); } //alert(href.substr(0, 1) == '#'); if(current == n) { $(this).addClass(opts.tabOnClass); $(this).children('img').attr('src', function() {return this.src.replace(opts.offimg, opts.onimg);}); $cont.find(href).removeClass(opts.hiddenClass); } else { $(this).removeClass(opts.tabOnClass); $(this).children('img').attr('src', function() {return this.src.replace(opts.onimg, opts.offimg);}); $cont.find(href).addClass(opts.hiddenClass); } }); if(opts.clickCallback) opts.clickCallback($eventEls); } }); }; $.fn.imgTab.defaults = { eventEls: 'a', tabOnClass: 'on', onimg: '_on.gif', offimg: '_off.gif', hiddenClass: 'hidden_obj', clickCallback: false //testTabFunction } /*// img tab */ /* widget tab shadow img add */ //widgetTabShadow($('#widgetA a')); //widgetTabShadow($('#widgetB a')); }); function testTabFunction() { alert('testTabFunction'); } /* 위젯탭 쉐도우 효과 */ function widgetTabShadow(els) { var tabs = $(els); var tmp_wrap = document.createElement('span'); var $tmp_wrap = $(tmp_wrap); var tab_size = $(tabs).size(); $(tabs).each(function(n) { if($(this).hasClass('on')) { if((tab_size - 1) == n) { $tmp_wrap.append(''); } else if (n == 0) { $tmp_wrap.append(''); } else { $tmp_wrap.append(''); } $(this).append($tmp_wrap); } else { $(this).find('span').remove(); } }); } /* 우측 보더 삭제 */ function tableBorderRight(cssName) { var els = $('table[class*='+cssName+']'); var index; var row_count; $(els).find('tr').children(':last-child').each(function(n) { if($(this).attr('rowspan') > 1) { row_count = $(this).attr('rowspan') + n; index = n; }; if((n > index) && (n < row_count)) return; $(this).css('border-right', 'none'); }); } /* ie6 탑 보더 삭제 */ function tableBorderTop(cssName) { if($.browser.className == 'msie6') { var els = $('table[class*='+cssName+']'); $(els).find('tr:first-child th').each(function() { $(this).css('border-top', 'none'); }); $(els).find('tr:first-child td').each(function() { $(this).css('border-top', 'none'); }); } } /* dialog 테이블 리사이징 */ function resizeTable(obj) { var self = $(obj); var width = $(self).find('.overflow_area').width() -27; var els = $(self).find('.overflow_area'); $(els).find('table').width(width); $(els).css({'overflow': 'auto','padding-right': 20}); $(els).parent().css('padding-right', 20); } /* ap dialog call */ $(function() { $('.call_link').click(function(ev) { //$('head').append(''); $('#wrapper').append('
'); $.get(this.href, loadDialogCallback); return false; ev.preventDefault(); }); $('.position_call_link').click(function(ev) { var self = $(this); $('#wrapper').append('
'); $.get(this.href, function(data) { loadDialogCallback(data); dialogPosition(self); }); return false; ev.preventDefault(); }); }); function loadDialogPost(path, parameter) { $('#wrapper').append('
'); $.post(path, parameter, loadDialogCallback); } function loadDialogCallback(data) { var source = data; data = data.replace(/.*<\/script>/ig,""); // Remove script tags data = data.replace(/<\/?meta.*>/ig,""); //Remove link tags data = data.replace(/<\/?link.*>/ig,""); //Remove link tags data = data.replace(/<\/?html.*>/ig,""); //Remove html tag data = data.replace(/<\/?body.*>/ig,""); //Remove body tag data = data.replace(/<\/?head.*>/ig,""); //Remove head tag data = data.replace(/<\/?!doctype.*>/ig,""); //Remove doctype data = data.replace(/.*<\/title>/ig,""); // Remove title tags $('.dialog_frame').empty().html(data); $('.dialog_frame style').clone().appendTo('head').attr('id','dialog_frame'); $('.dialog_frame').remove(); } function dialogPosition(self) { var $dialog = $('.ui-dialog'), viewport_x = $('body').outerWidth(), viewport_y = $('body').outerHeight(), $elemOffset = $(self).offset(), elem_y = $elemOffset.top, elem_x = $elemOffset.left, elemHeight = $(self).outerHeight(), dialog_x = $dialog.outerWidth(), dialog_y = $dialog.outerHeight(); $dialog.css({ top : elem_y + dialog_y > viewport_y ? elem_y - dialog_y : elem_y + elemHeight, left : elem_x + dialog_x > viewport_x ? elem_x - (elem_x + dialog_x - viewport_x) - 20 : elem_x + 20 }); } /* alert */ function dialogAlert(msg, callbackfunc) { var data = '
'; $('body').append(data); $('#alertWindow').find('.dialog_content').html(msg); $('#alertWindow').dialog({ dialogClass: 'alert_window', width: 312, beforeclose: callbackfunc, modal: true }); } function dialogAlert2(msg, callbackfunc) { var data = '
'; $('body').append(data); $('#alertWindow').find('.dialog_content').html(msg); $('#alertWindow').dialog({ dialogClass: 'alert_window', width: 312, modal: true }) .find('button.btn_ok').click(function() { $('#alertWindow').bind('dialogbeforeclose', callbackfunc); $('#alertWindow').dialog('close'); }); } // png alpha channels 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=''; return ''; } function borderColor(style, obj) { var style; var obj; } addLoadEvent(function(){ tableBorderRight('tbl_type2'); $('.tbl_type1 tr:last td').css('border-bottom-color', '#B2B3D8'); $('.tbl_type2 tr:last th').css('border-bottom-color', '#B2B3D8'); $('.tbl_type2 tr:last td').css('border-bottom-color', '#B2B3D8'); $('.tbl_type4 tr:last td').css('border-bottom-color', '#B2B3D8'); }); /* * jQuery selectbox plugin * * Copyright (c) 2007 Sadri Sahraoui (brainfault.com) * Licensed under the GPL license and MIT: * http://www.opensource.org/licenses/GPL-license.php * http://www.opensource.org/licenses/mit-license.php * * The code is inspired from Autocomplete plugin (http://www.dyve.net/jquery/?autocomplete) * * Revision: $Id: common.js,v 1.2 2010/12/15 05:22:20 lcs Exp $ * Version: 0.6 * * Changelog : * Version 0.6 * - Fix IE scrolling problem * Version 0.5 * - separate css style for current selected element and hover element which solve the highlight issue * Version 0.4 * - Fix width when the select is in a hidden div @Pawel Maziarz * - Add a unique id for generated li to avoid conflict with other selects and empty values @Pawel Maziarz */ jQuery.fn.extend({ selectbox: function(options) { return this.each(function() { new jQuery.SelectBox(this, options); }); } }); /* pawel maziarz: work around for ie logging */ if (!window.console) { var console = { log: function(msg) { } } } /* */ jQuery.SelectBox = function(selectobj, options) { var opt = options || {}; opt.inputClass = opt.inputClass || "select_basic"; opt.containerClass = opt.containerClass || "select_basic_wrapper"; opt.hoverClass = opt.hoverClass || "current"; opt.currentClass = opt.selectedClass || "selected"; opt.maxHeight = opt.maxHeight || 120; opt.onChangeCallbak = opt.onChangeCallback || false; opt.onChangeParams = opt.onChangeParams || false; opt.debug = opt.debug || false; var elm_id = selectobj.id; var active = 0; var inFocus = false; var hasfocus = 0; //jquery object for select element var $select = $(selectobj); // jquery container object var $container = setupContainer(opt); //jquery input object var $input = setupInput(opt); // hide select and append newly created elements $select.hide().before($input).before($container); init(); $input .click(function(){ $container.parent().css('z-index','100'); if (!inFocus) { $container.toggle(); } }) .focus(function(){ $container.parent().css('z-index','100'); if ($container.not(':visible')) { inFocus = true; $container.show(); } }) .keydown(function(event) { switch(event.keyCode) { case 38: // up event.preventDefault(); moveSelect(-1); break; case 40: // down event.preventDefault(); moveSelect(1); break; //case 9: // tab case 13: // return event.preventDefault(); // seems not working in mac ! $('li.'+opt.hoverClass).trigger('click'); break; case 27: //escape hideMe(); break; } }) .blur(function() { if ($container.is(':visible') && hasfocus > 0 ) { if(opt.debug) console.log('container visible and has focus') } else { // Workaround for ie scroll - thanks to Bernd Matzner if($.browser.msie || $.browser.safari){ // check for safari too - workaround for webkit // IE8 getAttribute('id') error {.getAttribute('id') => .id} if(document.activeElement.id.indexOf('_container')==-1){ hideMe(); } else { $input.focus(); } } else { hideMe(); } } }); function hideMe() { hasfocus = 0; $container.hide(); $container.parent().css('z-index','0'); } function init() { $container.append(getSelectOptions($input.attr('id'))) setHeight(); setPosition(); $container.hide(); } function setupContainer(options) { var container = document.createElement("div"); $container = $(container); $container.attr('id', elm_id+'_container'); $container.addClass(options.containerClass); $container.width($select.width()); return $container; } function setupInput(options) { var input = document.createElement("input"); var $input = $(input); $input.attr("id", elm_id+"_input"); $input.attr("type", "text"); $input.addClass(options.inputClass); $input.attr("autocomplete", "off"); $input.attr("readonly", "readonly"); $input.width($select.width()); return $input; } function moveSelect(step) { var lis = $("li", $container); if (!lis || lis.length == 0) return false; active += step; //loop through list if (active < 0) { active = lis.size(); } else if (active > lis.size()) { active = 0; } scroll(lis, active); lis.removeClass(opt.hoverClass); $(lis[active]).addClass(opt.hoverClass); } function scroll(list, active) { var el = $(list[active]).get(0); var list = $container.get(0); if (el.offsetTop + el.offsetHeight > list.scrollTop + list.clientHeight) { list.scrollTop = el.offsetTop + el.offsetHeight - list.clientHeight; } else if(el.offsetTop < list.scrollTop) { list.scrollTop = el.offsetTop; } } function setCurrent() { var li = $("li."+opt.currentClass, $container).get(0); var ar = (''+li.id).split('_'); var el = ar[ar.length-1]; // $select.val(el); $select.get(0).selectedIndex = $('li', $container).index(li); $input.val($(li).text()); // opt.onChangeParams = { selectedVal : $select.val() }; if (opt.onChangeCallback) opt.onChangeCallback($select); return true; } // select value function getCurrentSelected() { return $select.val(); } // input value function getCurrentValue() { return $input.val(); } function getSelectOptions(parentid) { var select_options = new Array(); var ul = document.createElement('ul'); $select.children('option').each(function() { var li = document.createElement('li'); li.setAttribute('id', parentid + '_' + $(this).val()); li.innerHTML = $(this).text(); if ($(this).is(':selected')) { $input.val($(this).text()); $(li).addClass(opt.currentClass); } ul.appendChild(li); $(li) .mouseover(function(event) { hasfocus = 1; if (opt.debug) console.log('over on : '+this.id); jQuery(event.target, $container).addClass(opt.hoverClass); }) .mouseout(function(event) { hasfocus = -1; if (opt.debug) console.log('out on : '+this.id); jQuery(event.target, $container).removeClass(opt.hoverClass); }) .click(function(event) { var fl = $('li.'+opt.hoverClass, $container).get(0); if (opt.debug) console.log('click on :'+this.id); $('li.'+opt.currentClass).removeClass(opt.currentClass); $(this).addClass(opt.currentClass); setCurrent(); //$select.change(); $select.get(0).blur(); hideMe(); }); }); return ul; } function setPosition() { var document_height = $(document).height(); var input_offset = $input.offset(); var select_height = input_offset.top + $container.height(); if(document_height >= select_height) { $container.css({'top': function() { return ($input.outerHeight() - 1) + 'px'; } }) } else { $container.css({'top': function() { return '-' + $container.height() + 'px'; } }) } } function setHeight() { if($container.height() > options.maxHeight) { $container.height(options.maxHeight); } } }; function onoff(ID, Class, Action){ var onoff = document.getElementById(ID); var onoffel = onoff.getElementsByTagName(Class); if (Action== 'click'){ for (var i = 0;i option[value='" + selectContent + "']").attr("selected","true"); $(selectId).selectbox({ onChangeCallback : callback, inputClass:'select_basic', containerClass:'select_basic_wrapper', hoverClass:'current', currentClass:'selected', maxHeight:120, debug:false }); } /* view_clickE */ function view_clickE(obj, targetId) { var targetDiv=document.getElementById(targetId); targetDiv.style.display=(targetDiv.style.display=='none')? 'block' : 'none'; obj.parentNode.className=(targetDiv.style.display=='none')? 'close' : 'open'; } // 구글 Analytics var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-8800594-3']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })();