(function ($) {
$(document).ready(function() {
$('.numberC').blur(function(){
$(this).numberFormat();
})
$("ul.navi li.gnb").hover(function(e){
$(this).find("img").filter(function(){this.src = this.src.replace("_off", "_over");});
},function(e){
$(this).find("img").filter(function(){this.src = this.src.replace("_over", "_off");});
});
if($(".date").hasClass('date')){
$(".date").datepicker({
dateFormat: 'yy-mm-dd',
monthNamesShort: ['1¿ù','2¿ù','3¿ù','4¿ù','5¿ù','6¿ù','7¿ù','8¿ù','9¿ù','10¿ù','11¿ù','12¿ù'],
dayNamesMin: ['ÀÏ','¿ù','È','¼ö','¸ñ','±Ý','Åä'],
weekHeader: 'Wk',
changeMonth: true, //¿ùº¯°æ°¡´É
changeYear: true, //³âº¯°æ°¡´É
yearRange:'1990:+2', // ¿¬µµ ¼¿·ºÆ® ¹Ú½º ¹üÀ§(ÇöÀç¿Í °°À¸¸é 1988~ÇöÀç³â)
showMonthAfterYear: true, //³â µÚ¿¡ ¿ù Ç¥½Ã
buttonImageOnly: true, //À̹ÌÁöÇ¥½Ã
buttonText: '³¯Â¥¸¦ ¼±ÅÃÇϼ¼¿ä',
autoSize: false, //¿ÀÅ丮»çÀÌÁî(bodyµî »óÀ§Å±×ÀÇ ¼³Á¤¿¡ µû¸¥´Ù)
buttonImage: '/images/common/calendar_icon.gif', //À̹ÌÁöÁÖ¼Ò /wtm/images/egovframework/wtm2/sub/bull_calendar.gif
showOn: "both", //¿¤¸®¸ÕÆ®¿Í À̹ÌÁö µ¿½Ã »ç¿ë
showButtonPanel:true,
currentText:'¿À´Ã',
onSelect: function(dateText , inst){ if(($(this).attr('func'))){ eval($(this).attr('func'))(dateText)} }
});
//$(".date").attr('readonly','readonly')
$(".date").change(function(){
var over_obj = $(this).attr('notover')
if(over_obj || $(this).val()){
if($(over_obj).val()>$(this).val()){
$(this).val('')
alert('±â°£ ¼³Á¤ÀÌ À߸øµÇ¾ú½À´Ï´Ù.');
$(this).focus();
}
}
})
}
$("input.all").click(function(){
var chk = $("input.all").is(':checked');
$('input[name="chk"]').each(function(){
this.checked = chk;
});
$('input[name^="num"]').each(function(){
this.checked = chk;
});
})
$('input[name="chk"]').click(function(){
$("input.all").each(function(){
this.checked = $('input[name="chk"]').length == $('input[name="chk"]:checked').length;
});
})
if($('div.buttonSelect').hasClass('buttonSelect')){
//$('div.buttonSelect').parent().css({position: 'relative',height: 50});
$('div.buttonSelect').prepend("¡å")
$('div.buttonSelect').css({width:'180px',overflow: 'hidden','text-align': 'right',position: 'absolute'});
$('div.buttonSelect').find('input[type=button]').css('width','160px');
var temp_height = $('div.buttonSelect').height();
$('div.buttonSelect').css({height:27});
$('span.list','div.buttonSelect').click(function(){
if($('div.buttonSelect').height() != '27'){
$('div.buttonSelect').animate({height:27,queue: true,opacity:1}, {duration:300}, "easeInOutBack");
}else{
$('div.buttonSelect').animate({height:temp_height,queue: true,opacity:1}, {duration:300}, "easeInOutBack");
};
})
$('div.buttonSelect').find('input[type=button]').click(function(){
$('div.buttonSelect').animate({height:25,queue: true,opacity:1}, {duration:300}, "easeInOutBack");
$('.list','div.buttonSelect').after($(this));
});
}
//¹ÚÀοø ȸ¿ø °¡ÀÔüũ Ãß°¡... 2013³â 03¿ù 27ÀÏ
$('.MemberSubmit').click(function(){
if($('#userID').val() == "" & $('#userID').val().length == 0){
alert('»ç¿ëÀÚ ¾ÆÀ̵𸦠ÀÔ·ÂÇØÁÖ¼¼¿ä!!');
}else if($('#userID').val().length < 4)
{
alert('»ç¿ëÀÚ ¾ÆÀ̵ð´Â 4ÀÚ ÀÌ»ó 15ÀÌÇÏ ÀÔ´Ï´Ù.');
}else if($('#userPW').val().length == 0 & $('#userPW').val() == "")
{
alert('ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä!');
}else if($('#userPwCheck').val().length == 0 & $('#userPwCheck').val() == "")
{
alert('È®ÀÎ ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä!');
}else if($('#userPW').val() != $('#userPwCheck').val())
{
alert('ºñ¹Ð¹øÈ£°¡ ÀÏÄ¡ÇÏÁö ¾Ê½À´Ï´Ù.');
}
});
//¹ÚÀοø ȸ¿ø °¡ÀÔüũ Ãß°¡... 2013³â 03¿ù 27ÀÏ
$('.dialog-close').css({cursor: 'pointer'})
$('.dialog-close').click(function(e){
$('.ui-dialog-content').dialog('close');
})
});
$.fn.removeText = function(_v){
if (typeof(_v)==="undefined")
{
$(this).each(function(){
if( this.value){
this.value = this.value.replace(/[^0-9-]/g,'');
}
});
}
else
{
return _v.replace(/[^0-9-]/g,'');
}
};
$.fn.numberFormat = function(_v){
_v = _v+"" ;
_v = _v.replace(",","");
this.proc = function(_v){
_v = _v.replace(",","");
if(_v){
var tmp = '',
number = '',
cutlen = 3,
comma = ','
i = 0,
len = _v.length,
mod = (len % cutlen),
k = cutlen - mod;
for (i; i < len; i++)
{
number = number + _v.charAt(i);
if (i < len - 1)
{
k++;
if ((k % cutlen) == 0)
{
number = number + comma;
k = 0;
}
}
}
return number;
}
};
var proc = this.proc;
if (typeof(_v)==="undefined")
{
$(this).each(function(){
this.value = proc($(this).removeText(this.value));
});
}
else
{
return proc(_v);
}
};
$.fn.onlyNumber = function (p) {
$(this).each(function(i) {
$(this).attr({'style':'text-align:right'});
this.value = $(this).removeText(this.value);
this.value = $(this).numberFormat(this.value);
$(this).bind('keypress keyup',function(e){
this.value = $(this).removeText(this.value);
this.value = $(this).numberFormat(this.value);
});
});
};
$.fn.dialogCreat = function (param) {
param.className = param.className + Math.random(1000);
param.modal = true;
var _this = $('.'+param.className);
if(!$(_this).hasClass(param.className)){
var div = document.createElement('div');
$(div).addClass(param.className);
$('body').append(div)
_this = $(div);
}
if(param.body_css){
$(_this).css(param.body_css);
}
if(param.iframe){
// window.open(param.iframe,"", "width="+param.width+",height="+param.height+",scrollbars=yes,resizeable=no,left=150,top=150");
// return;
$('.dialog-iframe').remove();
if($(_this).children('iframe').hasClass('dialog-iframe') && $(_this).children('iframe').attr('src') == param.iframe && !param.refresh){
}else{
$(_this).html('');
var iframe = document.createElement('iframe');
$(iframe).attr({'class':'dialog-iframe'});
$(iframe).attr({src:param.iframe,
frameborder:"0",
scrolling:((param.iframe_scroll)?param.iframe_scroll:'no'),
allowTransparency:true,
width:((param.iframe_width)?((param.iframe_width<0)?param.width+param.iframe_width:param.iframe_width):"100%"),
height:((param.iframe_height)?((param.iframe_height<0)?param.height+param.iframe_height:param.iframe_height):"100%")
})
$(_this).append(iframe)
}
}else if(param.html && $(_this).html() != param.html){
$(_this).html('');
$(_this).append(param.html)
}else if(param.refresh && param.html){
$(_this).html('');
$(_this).append(param.html)
}
var b1 = ($(_this).parent().hasClass('ui-dialog'))
var b2 = ($(_this).parent('.ui-dialog').css('display') == 'block');
var b3 = objToString(param.buttons);
if(b1 && b2 && !b3){
// $(_this).dialog('close');
}else{
$(_this).dialog(param);
}
if(param.titleHide){
$(_this).prev('.ui-dialog-titlebar').hide();
}else{
$(_this).prev('.ui-dialog-titlebar').show();
};
if(param.draggable){
$(_this).parent().draggable({cancel:null});
}
if(param.title_namebarHide){
$(_this).find('.dialog-iframe').load(function(){
$(_this).find('.dialog-iframe').contents().find('table.title_namebar').hide();
});
}
if(param.refresh){
// $('.ui-icon-closethick').before('data-icon="refresh"')
}
};
$.fn.pharos_refresh = function(){
var obj_iframe = $(this).children('iframe')
$(obj_iframe).attr('src',$(obj_iframe).attr('src'))
}
if($('.select_date').hasClass('select_date')){
var today=new Date();
var curYear=today.getFullYear();
$('.select_date').each(function(i){
var _this = $(this);
var max = ($(_this).attr('max')=='current')?curYear:$(_this).attr('max');
var min = ($(_this).attr('min')=='current')?curYear:$(_this).attr('min');
var select ="";
for(var k = min ; ((max > min)?k <= max:k >= max);((max > min)?k++:k--)){
$(_this).append("");
};
});
}
})(jQuery);
function colView(obj,target){
if($(obj).find('span').html()=='¼û±â±â'){
$(obj).find('span').html('º¸À̱â')
$('.'+target).hide();
}else{
$(obj).find('span').html('¼û±â±â')
$('.'+target).show();
}
}
function dateAdd(dday,addDay) {
if(dday){
var getDate = new Date(dday.split('-')[0],dday.split('-')[1],dday.split('-')[2]);
}else{
var getDate = new Date();
}
var addDate = getDate.getTime() + (addDay * 24 * 60 * 60 * 1000);
getDate.setTime(addDate);
var year = getDate.getFullYear();
var month = getDate.getMonth();
if(month == 0){
month = 1;
}
var date = getDate.getDate();
if (month < 10) month = "0" + month;
if (date < 10) date = "0" + date;
return year + "-" + month + "-" + date;
}
function objToString (obj) {
var str = '';
for (var p in obj) {
if (obj.hasOwnProperty(p)) {
str += p + '::' + obj[p] + '\n';
}
}
return str;
}
function dialogClose(type,url){
if(!type){
(function ($){
$('.ui-dialog-content').dialog('close');
})(jQuery);
}else if(type == 'refresh'){
if(url){
parent.document.location.href = parent.document.location.href;
}else{
//$('.ui-dialog-content').dialog('close');
//location.reload();
document.location.href = document.location.href
}
}
}
function windowClose(reload){
if(reload){
window.opener.document.location.href = window.opener.document.URL;
}
self.close();
}
function popupView_person(popaddr){
window.open(popaddr,'Window','scrollbars=no,status=no,width=650,height=643,menubar=no');
}
function sMeterTopyeong(type,value){
var re_value = 0;
if(type == 'm'){
re_value = value * 0.3025;
}else if(type == 'p'){
re_value = value * 3.3058;
}
return Math.round(re_value);
}
if (!Array.prototype.indexOf){// Check And Fix a Array indexOf Error in ie7
Array.prototype.indexOf = function (elt /*, from*/ ){
var len = this.length >>> 0;
var from = Number(arguments[1]) || 0;
from = (from < 0)
? Math.ceil(from)
: Math.floor(from);
if (from < 0){
from += len;
};
for (; from < len; from++){
if (from in this && this[from] === elt){
return from;
};
};
return -1;
};
}
$.fn.datepickerAdd = function(){
$(this).datepicker({
dateFormat: 'yy-mm-dd',
monthNamesShort: ['1¿ù','2¿ù','3¿ù','4¿ù','5¿ù','6¿ù','7¿ù','8¿ù','9¿ù','10¿ù','11¿ù','12¿ù'],
dayNamesMin: ['ÀÏ','¿ù','È','¼ö','¸ñ','±Ý','Åä'],
weekHeader: 'Wk',
changeMonth: true, //¿ùº¯°æ°¡´É
changeYear: true, //³âº¯°æ°¡´É
yearRange:'1990:+2', // ¿¬µµ ¼¿·ºÆ® ¹Ú½º ¹üÀ§(ÇöÀç¿Í °°À¸¸é 1988~ÇöÀç³â)
showMonthAfterYear: true, //³â µÚ¿¡ ¿ù Ç¥½Ã
buttonImageOnly: true, //À̹ÌÁöÇ¥½Ã
buttonText: '³¯Â¥¸¦ ¼±ÅÃÇϼ¼¿ä',
autoSize: false, //¿ÀÅ丮»çÀÌÁî(bodyµî »óÀ§Å±×ÀÇ ¼³Á¤¿¡ µû¸¥´Ù)
buttonImage: '/images/common/calendar_icon.gif', //À̹ÌÁöÁÖ¼Ò /wtm/images/egovframework/wtm2/sub/bull_calendar.gif
showOn: "both", //¿¤¸®¸ÕÆ®¿Í À̹ÌÁö µ¿½Ã »ç¿ë
showButtonPanel:true,
currentText:'¿À´Ã',
onSelect: function(dateText , inst){ if(($(this).attr('func'))){ eval($(this).attr('func'))(dateText)} }
});
//$(".date").attr('readonly','readonly')
$(this).change(function(){
var over_obj = $(this).attr('notover')
if(over_obj || $(this).val()){
if($(over_obj).val()>$(this).val()){
$(this).val('')
alert('±â°£ ¼³Á¤ÀÌ À߸øµÇ¾ú½À´Ï´Ù.');
$(this).focus();
}
}
})
}
$.fn.ajaxCommonSelectBoxList = function(_levelID,_codeID, _valueID){
if(!$(this).prop('tagName')){
return false;
}
var _this = $(this);
var param = {levelID :_levelID, codeID:_codeID, valueID:_valueID};
var request = $.ajax({
url: "/program/menumanage/xml/commonSelect.pharos",
data: param,
type: "post", //get, post ¹æ½Ä
timeout: 3000,
dataType: 'html', //or xml or script or html
contentType: "application/x-www-form-urlencoded; charset=euc-kr",
async: true // true:ºñµ¿±â, false:µ¿±â
});
var n = "";
var t = "";
var v = _valueID;
if( $(_this).attr('id')){
n = $(_this).attr('id').substr(-1,1)
t = "#";
}else{
n = $(_this).attr('class').substr(-1,1)
t = ".";
}
var o = (_levelID.indexOf('level') == -1)?'op':'lv';
if(t == '#'){
for(var i=n;i<5;i++){
$(t +"select_"+o+i).attr("_sel", $(t +"select_"+o+i).val());
$(t +"select_"+o+i).find('option').not(':first').remove();
}
}else{
$(t +"select_"+o+1).each(function(i){
$(this).attr("_sel", $(this).val());
$(this).find('option').not(':first').remove();
})
}
request.done(function(data) {
$(_this).append(data);
if(o == 'op' && t == '.'){
$(_this).each(function(i){
var v2 = $(this).attr('_sel')
if(v2){
$(this).val(v2);
}else{
$(this).change();
}
})
}
});
request.fail(function(jqXHR, textStatus,error) {
});
request.always(function() {
});
};
function levelCheckFun(){
if($('.levelCheck').hasClass('levelCheck')){
var _code = $('[name="levelCheck"]').val();
if(_code){
$.get("/program/lectureCnt/xml/json.printList_levelCheck.pharos?code="+_code, function(data){
$(".levelCheck").html(data);
$(".levelCheck").find('li').click(function(){
var _i = $(this).attr('code');
var _codeArr = _code.split(",");
var pos = _codeArr.indexOf(_i);
_codeArr.splice(pos,1);
$('[name="levelCheck"]').val(_codeArr.join(","))
levelCheckFun();
})
});
}else{
$(".levelCheck").html("");
}
}
}
function levelCheckFunList(){
if($('.levelCheck').hasClass('levelCheck')){
$('.levelCheck').each(function(i){
var _code = $(this).attr('code');
var _this = $(this);
if(_code){
$.get("/program/lectureCnt/xml/json.printList_levelCheck.pharos?code="+_code, function(data){
$(_this).html(data);
});
}else{
$(_this).html("");
}
})
}
}
function isMobileDevice() {
var filter = "win16|win32|win64|mac";
if( navigator.platform ){
if( filter.indexOf(navigator.platform.toLowerCase())<0 ){
return true;
}else{
return false;
}
}
}
function returnDate(type, str){
str = str+"";
var tempNumber = "";
if(str.indexOf('now') > -1){
var Now = new Date();
var date = "";
if(type == 'y'){
date = Now.getFullYear();
}else if(type == 'm'){
date = Now.getMonth();
}else if(type == 'd'){
date = Now.getDay();
}
var NowMonth = Now.getMonth();
var NowYear = Now.getYear();
if(str != "now"){
var cal = str.replace('now','')
tempNumber = date+ eval(cal)
}else{
tempNumber = date;
}
}else{
tempNumber = Number(str);
}
return tempNumber
}
function storageItem(name,value){
if(value){
sessionStorage[name] = value;
}else{
return sessionStorage[name];
}
/*if(typeof(Storage) !== "undefined") {
if(value){
localStorage.setItem(name, value);
}else{
return localStorage.getItem(name);
}
} else {
if(value){
sessionStorage[name] = value;
}else{
return sessionStorage[name];
}
}*/
}
function tel_keyup(){
$('.tel').keyup(function(e){
$('[name=keyE]').val(e.keyCode)
if(e.keyCode == 8 || e.keyCode == 46 || e.keyCode == 35 || e.keyCode == 36|| e.keyCode == 37 || e.keyCode == 38 || e.keyCode == 39 || e.keyCode == 40 || e.keyCode == 16 || e.keyCode == 110){
return false;
}else{
var m = $(this).val().replace(/\D/g,"");
var c = 0
var t = 0
if(m.substring(0,2) == '02'){
c = - 1
}else if(m.substring(0,4) == '1544'){
c = 1
}else if(m.substring(0,2) == '03' || m.substring(0,2) == '04' || m.substring(0,2) == '05' || m.substring(0,2) == '06' ){
t = - 1
}
if(m.length >= 3+c && m.length < 7+c+t){
var temp = m.substring(0,3+c) +"-"+ m.substring(3+c,m.length)
$(this).val(temp);
}else if(m.length >= 7+c+t){
var temp = m.substring(0,3+c) +"-"+ m.substring(3+c,7+c+t) +"-" + m.substring(7+c+t,m.length)
$(this).val(temp);
}
}
//if($(this).attr('maxLength') == $(this).val().length){
// $(this).next().focus();
//}
})
}
/* document.oncontextmenu=function(){return false;}
document.onselectstart=function(){return false;}
document.ondragstart=function(){return false;}
document.onmousedown=function(){return false;} */