jQuery(function(){if($.browser.msie&&$.browser.version=="6.0"){$('button, .he').hover(function(){$(this).addClass("hover");},function(){$(this).removeClass("hover");});};if($.browser.msie&&$.browser.version<"7.9999"){$('button[disabled],input[disabled],optgroup[disabled],option[disabled],select[disabled],textarea[disabled]').addClass('disabled');};});jQuery.fn.getCheckboxVal=function(){var vals=[];var i=0;this.each(function(){vals[i++]=jQuery(this).val();});return vals;};function registerNS(ns)
{var nsParts=ns.split(".");var root=window;for(var i=0;i<nsParts.length;i++)
{if(typeof root[nsParts[i]]=="undefined")
root[nsParts[i]]=new Object();root=root[nsParts[i]];}}
function usingNS(ns)
{var o=eval(""+ns+"");if(o)
return o;else
alert("namespace "+ns+" not found.");}
function importJS(jsFile){$.ajax({type:"GET",url:jsFile+"?rev="+$config.REVISION,async:false,dataType:"script"});}
function importCSS(cssFile){try{var head=document.getElementsByTagName('head')[0];$(document.createElement('link')).attr({type:'text/css',href:cssFile,rel:'stylesheet',media:'screen'}).appendTo(head);}catch(exception){};}
var Common={blankSrc:function(view,size){var thumbsizes=[50,100,140,170,200,250];var thumbsize=0;for(var i=0;i<thumbsizes.length;i++){if(size<=thumbsizes[i]){thumbsize=thumbsizes[i];break;}}
if(thumbsize<=0)thumbsize=thumbsizes[thumbsizes.length-1];view.find('img').each(function(){var o=this;if($.browser.msie&&$.browser.version<"7.9999"){if(this.src==""){$(this).attr("src","/images/common/noimage_"+thumbsize+".gif");}else{var img=new Image();img.src=this.src;img.onerror=function(){$(o).attr("src","/images/common/noimage_"+thumbsize+".gif");};$(this).error(function(){$(this).unbind("error").attr("src","/images/common/noimage_"+thumbsize+".gif");});}}else{$(this).error(function(){$(this).unbind("error").attr("src","/images/common/noimage_"+thumbsize+".gif");});}});},pause:function(numberMillis){var now=new Date();var exitTime=now.getTime()+numberMillis;while(true){now=new Date();if(now.getTime()>exitTime)
return;}},ajaxLock:function(visible,e){var _self=this;var showInterval=250;if(visible){if($('#cursorLoader').length>0)$("#cursorLoader").remove();var posX,posY=0;if(e){if(e.pageX==null&&e.clientX!=null){var evt=document.documentElement,b=document.body;posX=e.clientX+(e&&e.scrollLeft||b.scrollLeft||0)+18;posY=e.clientY+document.documentElement.scrollTop+5;}else{posX=e.pageX+18;posY=e.pageY+5;}}else{var screenWidth=document.documentElement.clientWidth;var screenHeight=document.documentElement.clientHeight;var scrollLeft=document.documentElement.scrollLeft;var scrollTop=document.documentElement.scrollTop;posX=((screenWidth-16)/2)+scrollLeft;posY=((screenHeight-16)/2)+scrollTop;}
var loader='<img id="cursorLoader" style="position:absolute;z-index:9999;left:'+posX+'px;top:'+posY+'px;" src="/images/admin/ajax-loader.gif" alt="로드중" />';$('body').append($(loader));$(document).mousemove(function(e){$("#cursorLoader").each(function(){var posX=e.pageX+18;var posY=e.pageY+5;$(this).css({position:'absolute',zIndex:9999,left:posX,top:posY});});});}else{if($('#cursorLoader').length>0){$('#cursorLoader').fadeOut(showInterval,function(){$(this).remove();});}}},POPUP_LAYER:"SKT_HARU_POPUP_WINDOW",utfEncoding:function(str){return encodeURIComponent(str);},utfDecoding:function(str){return decodeURIComponent(str);},unicodeEncoding:function(str){return escape(str);},popupLayer:function(top,left,width,height,url,exec,layerstep){var divid=this.POPUP_LAYER;if(typeof(layerstep)!="undefined"){divid+=""+layerstep;}
var div=document.getElementById(this.POPUP_LAYER);if(!div){div=document.createElement("div");div.id=divid;div.className="";div.style.top=top+"px";div.style.width=width+"px";div.style.height=height+"px";div.style.left=left+"px";div.style.zIndex=9990;div.style.position="absolute";document.body.appendChild(div);}else{div.style.top=top+"px";div.style.width=width+"px";div.style.height=height+"px";div.style.left=left+"px";div.style.zIndex=9990;div.style.position="absolute";div.style.display="";}
this.drawRemoteHtml(url,div,exec,width,height);},drawRemoteHtml:function(url,dest,exec,width,height){$(dest).load(url,function(){eval('('+exec+')');});},closeLayer:function(layerstep){var divid=POPUP_LAYER;if(typeof(layerstep)!="undefined"){divid+=""+layerstep;}
var div=$(divid).get(0);if(div){document.body.removeChild(div);}},centerPopupWindow:function(targetUrl,windowName,properties){var childWidth=properties.childWidth;var childHeight=properties.childHeight;var childTop=(screen.height-childHeight)/2-50;var childLeft=(screen.width-childWidth)/2;var popupProps="width="+childWidth+",height="+childHeight+", top="+childTop+", left="+childLeft;if(properties.scrollBars=="YES"){popupProps+=", scrollbars=yes";}
var popupWin=window.open(targetUrl,windowName,popupProps);try{popupWin.focus();}catch(err){}
return popupWin;},centerPopupLayer:function(width,height,url,exec,layerstep){var mouseX,mouseY;mouseX=window.event.clientX+document.documentElement.scrollLeft+3;mouseY=window.event.clientY+document.documentElement.scrollTop+6;var screenWidth=document.documentElement.clientWidth;var screenHeight=document.documentElement.clientHeight;if(mouseX+width>=screenWidth){mouseX=screenWidth-width-50;}
this.popupLayer(mouseY,mouseX,width,height,url,exec,layerstep);},getXmlFirstChildNodeValue:function(obj,nodeName){var targetObj=obj.getElementsByTagName(nodeName)[0];if(targetObj.firstChild){return targetObj.firstChild.nodeValue;}else{return"";}},selectAllCheckbox:function(cbxName,doCheck){var cbxObj=document.getElementsByTagName(cbxName);for(var i=0;i<cbxObj.length;i++){cbxObj[i].checked=doCheck;}},checkTextAreaLength:function(taObj,maxLen,viewerId){var taStr=taObj.value;var taStrLen=taStr.length;var totalBytes=0;var totalLen=0;var oneChar="";var newTaStr="";for(var i=0;i<taStrLen;i++){oneChar=taStr.charAt(i);if(escape(oneChar).length>4){totalBytes+=2;}else{totalBytes++;}
if(totalBytes<=maxLen){totalLen=i+1;}}
if(totalBytes>maxLen){taObj.blur();msgbox.alert(maxLen+"byte까지만 입력할 수 있어요!");totalBytes=maxLen;newTaStr=taStr.substr(0,totalLen);taObj.value=newTaStr;}
taObj.focus();$(viewerId).get(0).innerHTML=""+totalBytes+"/"+maxLen+"";},scrollToAnchor:function(anchorName){location.href="#"+anchorName;},scrollToAnchorDom:function(anchorName,topOffset){if(!jQuery)return;var o=$("a[name='"+anchorName+"']");if(o.length<=0)return;document.body.scrollTop=o.offset().top-((topOffset)?topOffset:0);if(document.body.scrollTop==0){document.documentElement.scrollTop=o.offset().top-((topOffset)?topOffset:0);}},setCookieData:function(opt)
{opt=(opt)||{};var name=(opt.name)||"";var value=(opt.value)||"";var expires=(opt.expires)||null;var path=(opt.path)||null;var domain=(opt.domain)||null;var secure=(opt.secure)||null;var today=new Date();today.setTime(today.getTime());if(expires)
{expires=expires*1000*60*60*24;}
var expires_date=new Date(today.getTime()+(expires));document.cookie=name+"="+escape(value)+
((expires)?";expires="+expires_date.toGMTString():"")+
((path)?";path="+path:"")+
((domain)?";domain="+domain:"")+
((secure)?";secure":"");},getCookieData:function(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"";},removeCookieData:function(opt){opt=(opt)||{};var name=(opt.name)||"";var path=(opt.path)||null;var domain=(opt.domain)||null;if(Common.getCookieData(name)){document.cookie=name+"="+";expires=Thu, 01-Jan-1970 00:00:01 GMT";}},getTodayString:function(){var today=new Date();var year=today.getFullYear();var month="0"+(today.getMonth()+1);month=month.length>2?month.substring(1,3):month;var day="0"+(today.getDate());day=day.length>2?day.substring(1,3):day;return year+"-"+month+"-"+day;},validateRequired:function(fieldObj){var bValid=false;if(fieldObj.type=='text'||fieldObj.type=='hidden'||fieldObj.type=='textarea'||fieldObj.type=='file'||fieldObj.type=='select-one'||fieldObj.type=='radio'||fieldObj.type=='password'){var value='';if(fieldObj.type=="select-one"){var si=fieldObj.selectedIndex;if(si>=0){value=fieldObj.options[si].value;}}else{value=fieldObj.value;}
if(value==''){alert(fieldObj.title+"을(를) 입력해 주세요.");if(fieldObj.type!='hidden')
fieldObj.focus();bValid=false;}else{bValid=true;}}
return bValid;},mobileNoAddToken:function(mobileNo,token){if(!mobileNo)return"";mobileNo=mobileNo.trim();var retval="";token=(token)||"-";if(mobileNo.length==10)
retval=mobileNo.substr(0,3)+token+mobileNo.substr(3,3)+token+mobileNo.substr(6,4);else if(mobileNo.length==11)
retval=mobileNo.substr(0,3)+token+mobileNo.substr(3,4)+token+mobileNo.substr(7,4);else if(mobileNo.length>11)
retval=mobileNo.substr(0,3)+token+mobileNo.substr(3,4)+token+mobileNo.substring(7);else
retval=mobileNo;return retval;},decideStrEmailMobileNo:function(pstr){pstr=pstr.trim();var retval={paramType:"string",result:pstr,toString:function(){return"return json type is -> { paramType : \""+this.paramType+"\" , result : \""+this.result+"\"}";}};re=/[0-9]*[0-9]$/;if(re.test(pstr.replace(/-/gi,''))){pstr=pstr.replace(/-/gi,'');src=pstr.substr(0,3);if(src=="011"||src=="016"||src=="017"||src=="018"||src=="019"||src=="010"){if(pstr.length>=10&&pstr.length<=11)
retval.paramType="mobile";}}
if(retval.paramType=="string"){var regDoNot=/(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/;var regMust=/^[a-zA-Z0-9\-\.\_]+\@[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3})$/;if(!regDoNot.test(pstr)&&regMust.test(pstr))
retval.paramType="email";}
return retval;},setCenterPosition:function(rawobj,width,height){var screenWidth=document.documentElement.clientWidth;var screenHeight=document.documentElement.clientHeight;var scrollLeft=document.documentElement.scrollLeft;var scrollTop=document.documentElement.scrollTop;var x=((screenWidth-width)/2)+scrollLeft;var y=((screenHeight-height)/2)+scrollTop;rawobj.style.position="absolute";rawobj.style.left=x+"px";rawobj.style.top=y+"px";},setSpecificPosition:function(rawobj,x,y,width,height,notContainable){var mouseMargin={x:7,y:10};var screenWidth=document.documentElement.clientWidth;var screenHeight=document.documentElement.clientHeight;var scrollLeft=document.documentElement.scrollLeft;var scrollTop=document.documentElement.scrollTop;var objPosition={"x":x+mouseMargin.x,"y":y+mouseMargin.y};if(!notContainable){if(objPosition.x+width>screenWidth+scrollLeft){objPosition.x=x-width-mouseMargin.x+10;}
if(objPosition.y+height>screenHeight+scrollTop){objPosition.y=y-height-mouseMargin.y+10;}}
rawobj.style.position="absolute";rawobj.style.left=objPosition.x+"px";rawobj.style.top=objPosition.y+"px";},makeUrl:function(url){if(url.toLowerCase().startsWith("http://")||url.toLowerCase().startsWith("https://")){return url;}
return"http://"+url;},addComma:function(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;},toHaruDate:function(str){str=str+"";var v=str.trim();var retval=str;switch(v.length)
{case 4:retval=v.substr(0,2)+":"+v.substr(2,2);break;case 8:retval=v.substr(0,4)+"."+v.substr(4,2)+"."+v.substr(6,2);break;case 14:retval=v.substr(2,2)+"."+v.substr(4,2)+"."+v.substr(6,2)+" "+v.substr(8,2)+":"+v.substr(10,2);break;}
return retval;},toHaruDateFormat:function(str,formatStr){str=str+"";var dt=null
if(str.length>=8)
dt=str.substr(0,4)+"/"+str.substr(4,2)+"/"+str.substr(6,2);if(str.length>=12)
dt+=" "+str.substr(8,2)+":"+str.substr(10,2);if(str.length>=14)
dt+=":"+str.substr(12,2);dt=Date.CDate(dt);formatStr=formatStr.replaceAll("{","#{");return dt.format(formatStr);},varwidth:function(imgobj,mwidth){if(imgobj.width>mwidth){return mwidth}else{return imgobj.width}},jsonArrayFilter:function(jsonArray,compareColumn,searchKeyword){var retval=[];this.log("jsonArrayFilter started.");try
{if(searchKeyword.length<=0){return jsonArray;}
this.log("origin array");this.log(jsonArray);for(var i=0;i<jsonArray.length;i++){if(jsonArray[i]&&jsonArray[i][compareColumn]){var columnValue=jsonArray[i][compareColumn]+"";if(columnValue.indexOf(searchKeyword)>=0)retval.push(jsonArray[i]);}}
this.log("filtered array");this.log(retval);}catch(e){retval=jsonArray;this.log("jsonArrayFilter exception.");this.log(e);}
this.log("jsonArrayFilter finished.");return retval;},getFileExtension:function(fileName){var retval="";if(fileName.indexOf(".")>=0)retval=fileName.substring(fileName.lastIndexOf(".")+1).trim();return retval.toLowerCase();},log:function(msg){return;try{if(console&&console.log)console.log(msg);}catch(e){}},swfWriter:function(targetContainer,swfId,url,width,height,options){var _options={wmode:(options&&options.wmode)||"transparent",bgcolor:(options&&options.bgcolor)||"#ffffff",allowScriptAccess:(options&&options.allowScriptAccess)||"always",quality:(options&&options.quality)||"high",menu:(options&&typeof(options.menu)!="undefined")?options.menu:false};var attr=[];var htmls="";htmls+='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" id="'+swfId+'" height="'+height+'" width="'+width+'">';htmls+='<param name="movie" value="'+url+'">';for(var k in _options){htmls+='<param name="'+k+'" value="'+_options[k]+'">';attr.push(k+'="'+_options[k]+'"');}
htmls+='<embed src="'+url+'" '+attr.join(' ')+' type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" height="'+height+'" width="'+width+'">';htmls+='</object>';if(targetContainer)
targetContainer.innerHTML(htmls);else
return htmls;},cutString:function(string_value,maxWidth,dotHtml){dotHtml=(dotHtml)||'<span class="sp0">...</span>';if(!string_value||!string_value.length)return"";var str=string_value;var ascii_code;var string_value_length=string_value.length;var character;var character_width;var character_length;var total_width=0;var total_length=0;var special_char_size=6;var multibyte_char_size=12;var base_char_start=32;var base_char_end=127;var ascii_char_size=Array(4,4,4,6,6,10,8,4,5,5,6,6,4,6,4,6,6,6,6,6,6,6,6,6,6,6,4,4,8,6,8,6,12,8,8,9,8,8,7,9,8,3,6,8,7,11,9,9,8,9,8,8,8,8,8,10,8,8,8,6,11,6,6,6,4,7,7,7,7,7,3,7,7,3,3,6,3,11,7,7,7,7,4,7,3,7,6,10,7,7,7,6,6,6,9,6);for(i=0;i<string_value_length;i++){character=string_value.substring(i,(i+1));ascii_code=character.charCodeAt(0);if(ascii_code<base_char_start){character_width=special_char_size;}else if(ascii_code<=base_char_end){idx=ascii_code-base_char_start;character_width=ascii_char_size[idx];}else if(ascii_code>base_char_end){character_width=multibyte_char_size;}
if(total_width+character_width>maxWidth){str=str.substring(0,i)+''+dotHtml;break;}
total_width+=character_width;}
return str;},getRandomInt:function(min,max){min=(min)||100000;max=(max)||999999;var x=Math.floor(Math.random()*(max-min)+min);return x;},htmlStrip:function(resStr){var retval="";try{retval=resStr.replace(/<[^<|>]*>/ig,"");}catch(err){}
return retval;},htmlLinkStrip:function(resStr){var retVal="";try{retVal=resStr.replace(/(<a href|<\/a)[^<|>]*>/ig,"");}catch(err){}
return retVal;},htmlCache:{},htmlBind:function(cacheKey,jdom,json){var html=this.htmlCache[cacheKey];if(!html){html=this.htmlCache[cacheKey]=jdom.html();html=jdom.html();}
var _self=this;var replacedHtml=html.replaceAll("%7B","{").replaceAll("%7D","}").replace(/\{(.*?)\}/gi,function(t){if(t=="{TS}")return"<";if(t=="{TE}")return"/>";if(t=="{TC}")return">";var token=t;if(token.length>0&&token.substr(0,1)=="{")token=token.substring(1);if(token.length>0&&token.substr(token.length-1,1)=="}")token=token.substring(0,token.length-1);var value=null;var prop=json[token.toLowerCase()];if(typeof(prop)!="undefined"&&typeof(prop)!="object"&&typeof(prop)!="function"){value=prop;}
return((value==null)?t:value);});jdom.html(replacedHtml);},repeaterBind:function(bindingObj,templateObj,ds,callbackToken,callbackAppended,oppositeBool,htmlBool,addBool){if(typeof(templateObj)=="object")templateObj.hide();if(typeof(bindingObj)=="object")bindingObj.hide();if(typeof(oppositeBool)=="undefined")oppositeBool=false;if(typeof(htmlBool)=="undefined")htmlBool=false;if(typeof(addBool)=="undefined")addBool=false;if(addBool==false)
if(bindingObj)bindingObj.empty();var tplHtml=(typeof(templateObj)=="string")?templateObj:templateObj.html();for(var i=0;i<ds.length;i++){var data=ds[i];if(data==null)continue;var replacedHtml=tplHtml.replaceAll("%7B","{").replaceAll("%7D","}").replace(/\{(.*?)\}/gi,function(t){if(t=="{TS}")return"<";if(t=="{TE}")return"/>";if(t=="{TC}")return">";var token=t;if(token.length>0&&token.substr(0,1)=="{")token=token.substring(1);if(token.length>0&&token.substr(token.length-1,1)=="}")token=token.substring(0,token.length-1);token=token.toLowerCase();var value=null;var prop=data[token];if(typeof(prop)!="undefined"&&typeof(prop)!="object"&&typeof(prop)!="function"){value=prop;}
value=((value==null)?t:value);if(callbackToken&&typeof(callbackToken)=="function"){var cbResult=callbackToken(i,token,data);if(cbResult)value=cbResult;}
return value;});var jnode;if(htmlBool){jnode=replacedHtml;}else{jnode=$(replacedHtml);}
if(oppositeBool){bindingObj.prepend(jnode);}else{bindingObj.append(jnode);}
if(callbackAppended&&typeof(callbackAppended)=="function"){callbackAppended(i,jnode,data);}
if(typeof(bindingObj)=="object")bindingObj.show();};},recoverToHtmlStr:function(str){if(str!=""){var el=document.createElement("div");el.innerText=el.textContent=str;s=el.innerHTML;delete el;return s;}
return str;},recoverToHtmlTag:function(html){if(html!=""){var el=document.createElement("div");el.innerHTML=html;s=el.innerText;if(!s)s=el.textContent;delete el;return s;}
return html;},getSubPosition:function(baseObj,positionObj,subObj,mouseMargin){var coord=Common.getRelativeOffset(baseObj,positionObj);baseObj.css({position:"relative"});subObj.css({position:"absolute",left:coord.left+mouseMargin.x,top:coord.top+mouseMargin.y});},getRelativeOffset:function(containerNode,childNode){var retval={left:null,top:null};var containerOffset=containerNode.offset();var childOffset=childNode.offset();retval.left=childOffset.left-containerOffset.left;retval.top=childOffset.top-containerOffset.top;return retval;},formBind:function(container,data){$(container).find("input[type=text],input[type=radio],input[type=checkbox],select,textarea").each(function(){var obj=$(this);var value=data[this.name||this.id];if(value){if(this.type=="radio"||this.type=="checkbox")
obj.filter("input[value="+value+"]").attr("checked","checked");else if(obj.is("select"))
obj.find("option[value="+value+"]").attr("selected","selected");else
this.value=value;}});},makeParam:function(container){var param={};$(container).find("input[type=text],input[type=hidden],input[type=password],option[selected],input:radio:checked,input:checkbox:checked,select,textarea").each(function(){param[this.name||this.id||this.parentNode.name]=this.value;});return param;},toString:function(){return"Common object";}}
vbGeneralDate=0;vbLongDate=1;vbShortDate=2;vbLongTime=3;vbShortTime=4;vbUseSystemDayOfWeek=0;vbSunday=1;vbMonday=2;vbTuesday=3;vbWednesday=4;vbThursday=5;vbFriday=6;vbSaturday=7;vbUseSystem=0;vbFirstJan1=1;vbFirstFourDays=2;vbFirstFullWeek=3;Date.MonthNames=[null,'January','February','March','April','May','June','July','August','September','October','November','December'];Date.WeekdayNames=[null,'Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'];Date.IsDate=function(p_Expression){return!isNaN(new Date(p_Expression));}
Date.CDate=function(p_Date){if(Date.IsDate(p_Date)){return new Date(p_Date);}
if(typeof(p_Date)=="object")p_Date=p_Date.toString();var strTry=p_Date.replace(/\-/g,'/').replace(/\./g,'/').replace(/ /g,'/');strTry=strTry.replace(/pm$/i," pm").replace(/am$/i," am");if(Date.IsDate(strTry)){return new Date(strTry);}
var strTryYear=strTry+'/'+new Date().getFullYear();if(Date.IsDate(strTryYear)){return new Date(strTryYear);}
if(strTry.indexOf(":")){var strTryYear2=strTry.replace(/ /,'/'+new Date().getFullYear()+' ');if(Date.IsDate(strTryYear2)){return new Date(strTryYear2);}
var strTryDate=new Date().toDateString()+' '+p_Date;if(Date.IsDate(strTryDate)){return new Date(strTryDate);}}
return false;}
Date.DateAdd=function(p_Interval,p_Number,p_Date){if(!Date.CDate(p_Date)){return"invalid date: '"+p_Date+"'";}
if(isNaN(p_Number)){return"invalid number: '"+p_Number+"'";}
p_Number=new Number(p_Number);var dt=Date.CDate(p_Date);switch(p_Interval.toLowerCase()){case"yyyy":{dt.setFullYear(dt.getFullYear()+p_Number);break;}
case"q":{dt.setMonth(dt.getMonth()+(p_Number*3));break;}
case"m":{dt.setMonth(dt.getMonth()+p_Number);break;}
case"y":case"d":case"w":{dt.setDate(dt.getDate()+p_Number);break;}
case"ww":{dt.setDate(dt.getDate()+(p_Number*7));break;}
case"h":{dt.setHours(dt.getHours()+p_Number);break;}
case"n":{dt.setMinutes(dt.getMinutes()+p_Number);break;}
case"s":{dt.setSeconds(dt.getSeconds()+p_Number);break;}
case"ms":{dt.setMilliseconds(dt.getMilliseconds()+p_Number);break;}
default:{return"invalid interval: '"+p_Interval+"'";}}
return dt;}
Date.DateDiff=function(p_Interval,p_Date1,p_Date2,p_FirstDayOfWeek){if(!Date.CDate(p_Date1)){return"invalid date: '"+p_Date1+"'";}
if(!Date.CDate(p_Date2)){return"invalid date: '"+p_Date2+"'";}
p_FirstDayOfWeek=(isNaN(p_FirstDayOfWeek)||p_FirstDayOfWeek==0)?vbSunday:parseInt(p_FirstDayOfWeek);var dt1=Date.CDate(p_Date1);var dt2=Date.CDate(p_Date2);if("h,n,s,ms".indexOf(p_Interval.toLowerCase())==-1){if(p_Date1.toString().indexOf(":")==-1){dt1.setUTCHours(0,0,0,0)};if(p_Date2.toString().indexOf(":")==-1){dt2.setUTCHours(0,0,0,0)};}
var iDiffMS=dt2.valueOf()-dt1.valueOf();var dtDiff=new Date(iDiffMS);var nYears=dt2.getUTCFullYear()-dt1.getUTCFullYear();var nMonths=dt2.getUTCMonth()-dt1.getUTCMonth()+(nYears!=0?nYears*12:0);var nQuarters=parseInt(nMonths/3);var nMilliseconds=iDiffMS;var nSeconds=parseInt(iDiffMS/1000);var nMinutes=parseInt(nSeconds/60);var nHours=parseInt(nMinutes/60);var nDays=parseInt(nHours/24);var nWeeks=parseInt(nDays/7);if(p_Interval.toLowerCase()=='ww'){var offset=Date.DatePart("w",dt1,p_FirstDayOfWeek)-1;if(offset){dt1.setDate(dt1.getDate()+7-offset);}
var offset=Date.DatePart("w",dt2,p_FirstDayOfWeek)-1;if(offset){dt2.setDate(dt2.getDate()-offset);}
var nCalWeeks=Date.DateDiff("w",dt1,dt2)+1;}
switch(p_Interval.toLowerCase()){case"yyyy":return nYears;case"q":return nQuarters;case"m":return nMonths;case"y":case"d":return nDays;case"w":return nWeeks;case"ww":return nCalWeeks;case"h":return nHours;case"n":return nMinutes;case"s":return nSeconds;case"ms":return nMilliseconds;default:return"invalid interval: '"+p_Interval+"'";}}
Date.DatePart=function(p_Interval,p_Date,p_FirstDayOfWeek){if(!Date.CDate(p_Date)){return"invalid date: '"+p_Date+"'";}
var dtPart=Date.CDate(p_Date);switch(p_Interval.toLowerCase()){case"yyyy":return dtPart.getFullYear();case"q":return parseInt(dtPart.getMonth()/3)+1;case"m":return dtPart.getMonth()+1;case"y":return Date.DateDiff("y","1/1/"+dtPart.getFullYear(),dtPart)+1;case"d":return dtPart.getDate();case"w":return Date.Weekday(dtPart.getDay()+1,p_FirstDayOfWeek);case"ww":return Date.DateDiff("ww","1/1/"+dtPart.getFullYear(),dtPart,p_FirstDayOfWeek)+1;case"h":return dtPart.getHours();case"n":return dtPart.getMinutes();case"s":return dtPart.getSeconds();case"ms":return dtPart.getMilliseconds();default:return"invalid interval: '"+p_Interval+"'";}}
Date.MonthName=function(p_Month,p_Abbreviate){if(isNaN(p_Month)){if(!Date.CDate(p_Month)){return"invalid month: '"+p_Month+"'";}
p_Month=DatePart("m",Date.CDate(p_Month));}
var retVal=Date.MonthNames[p_Month];if(p_Abbreviate==true){retVal=retVal.substring(0,3)}
return retVal;}
Date.WeekdayName=function(p_Weekday,p_Abbreviate,p_FirstDayOfWeek){if(isNaN(p_Weekday)){if(!Date.CDate(p_Weekday)){return"invalid weekday: '"+p_Weekday+"'";}
p_Weekday=DatePart("w",Date.CDate(p_Weekday));}
p_FirstDayOfWeek=(isNaN(p_FirstDayOfWeek)||p_FirstDayOfWeek==0)?vbSunday:parseInt(p_FirstDayOfWeek);var nWeekdayNameIdx=((p_FirstDayOfWeek-1+parseInt(p_Weekday)-1+7)%7)+1;var retVal=Date.WeekdayNames[nWeekdayNameIdx];if(p_Abbreviate==true){retVal=retVal.substring(0,3)}
return retVal;}
Date.Weekday=function(p_Weekday,p_FirstDayOfWeek){p_FirstDayOfWeek=(isNaN(p_FirstDayOfWeek)||p_FirstDayOfWeek==0)?vbSunday:parseInt(p_FirstDayOfWeek);return((parseInt(p_Weekday)-p_FirstDayOfWeek+7)%7)+1;}
Date.FormatDateTime=function(p_Date,p_NamedFormat){if(p_Date.toUpperCase().substring(0,3)=="NOW"){p_Date=new Date()};if(!Date.CDate(p_Date)){return"invalid date: '"+p_Date+"'";}
if(isNaN(p_NamedFormat)){p_NamedFormat=vbGeneralDate};var dt=Date.CDate(p_Date);switch(parseInt(p_NamedFormat)){case vbGeneralDate:return dt.toString();case vbLongDate:return Format(p_Date,'DDDD, MMMM D, YYYY');case vbShortDate:return Format(p_Date,'MM/DD/YYYY');case vbLongTime:return dt.toLocaleTimeString();case vbShortTime:return Format(p_Date,'HH:MM:SS');default:return"invalid NamedFormat: '"+p_NamedFormat+"'";}}
Date.Format=function(p_Date,p_Format,p_FirstDayOfWeek,p_firstweekofyear){if(!Date.CDate(p_Date)){return"invalid date: '"+p_Date+"'";}
if(!p_Format||p_Format==''){return dt.toString()};var dt=Date.CDate(p_Date);this.pad=function(p_str){if(p_str.toString().length==1){p_str='0'+p_str}
return p_str;}
var ampm=dt.getHours()>=12?'PM':'AM'
var hr=dt.getHours();if(hr==0){hr=12};if(hr>12){hr-=12};var strShortTime=hr+':'+this.pad(dt.getMinutes())+':'+this.pad(dt.getSeconds())+' '+ampm;var strShortDate=(dt.getMonth()+1)+'/'+dt.getDate()+'/'+new String(dt.getFullYear()).substring(2,4);var strLongDate=Date.MonthName(dt.getMonth()+1)+' '+dt.getDate()+', '+dt.getFullYear();var retVal=p_Format;retVal=retVal.replace(new RegExp('C','gi'),'CCCC');retVal=retVal.replace(new RegExp('mmmm','gi'),'XXXX');retVal=retVal.replace(new RegExp('mmm','gi'),'XXX');retVal=retVal.replace(new RegExp('dddddd','gi'),'AAAAAA');retVal=retVal.replace(new RegExp('ddddd','gi'),'AAAAA');retVal=retVal.replace(new RegExp('dddd','gi'),'AAAA');retVal=retVal.replace(new RegExp('ddd','gi'),'AAA');retVal=retVal.replace(new RegExp('timezone','gi'),'ZZZZ');retVal=retVal.replace(new RegExp('time24','gi'),'TTTT');retVal=retVal.replace(new RegExp('time','gi'),'TTT');retVal=retVal.replace(new RegExp('yyyy','gi'),dt.getFullYear());retVal=retVal.replace(new RegExp('yy','gi'),new String(dt.getFullYear()).substring(2,4));retVal=retVal.replace(new RegExp('y','gi'),Date.DatePart("y",dt));retVal=retVal.replace(new RegExp('q','gi'),Date.DatePart("q",dt));retVal=retVal.replace(new RegExp('mm','gi'),(dt.getMonth()+1));retVal=retVal.replace(new RegExp('m','gi'),(dt.getMonth()+1));retVal=retVal.replace(new RegExp('dd','gi'),this.pad(dt.getDate()));retVal=retVal.replace(new RegExp('d','gi'),dt.getDate());retVal=retVal.replace(new RegExp('hh','gi'),this.pad(dt.getHours()));retVal=retVal.replace(new RegExp('h','gi'),dt.getHours());retVal=retVal.replace(new RegExp('nn','gi'),this.pad(dt.getMinutes()));retVal=retVal.replace(new RegExp('n','gi'),dt.getMinutes());retVal=retVal.replace(new RegExp('ss','gi'),this.pad(dt.getSeconds()));retVal=retVal.replace(new RegExp('s','gi'),dt.getSeconds());retVal=retVal.replace(new RegExp('t t t t t','gi'),strShortTime);retVal=retVal.replace(new RegExp('am/pm','g'),dt.getHours()>=12?'pm':'am');retVal=retVal.replace(new RegExp('AM/PM','g'),dt.getHours()>=12?'PM':'AM');retVal=retVal.replace(new RegExp('a/p','g'),dt.getHours()>=12?'p':'a');retVal=retVal.replace(new RegExp('A/P','g'),dt.getHours()>=12?'P':'A');retVal=retVal.replace(new RegExp('AMPM','g'),dt.getHours()>=12?'pm':'am');retVal=retVal.replace(new RegExp('XXXX','gi'),Date.MonthName(dt.getMonth()+1,false));retVal=retVal.replace(new RegExp('XXX','gi'),Date.MonthName(dt.getMonth()+1,true));retVal=retVal.replace(new RegExp('AAAAAA','gi'),strLongDate);retVal=retVal.replace(new RegExp('AAAAA','gi'),strShortDate);retVal=retVal.replace(new RegExp('AAAA','gi'),Date.WeekdayName(dt.getDay()+1,false,p_FirstDayOfWeek));retVal=retVal.replace(new RegExp('AAA','gi'),Date.WeekdayName(dt.getDay()+1,true,p_FirstDayOfWeek));retVal=retVal.replace(new RegExp('TTTT','gi'),dt.getHours()+':'+this.pad(dt.getMinutes()));retVal=retVal.replace(new RegExp('TTT','gi'),hr+':'+this.pad(dt.getMinutes())+' '+ampm);retVal=retVal.replace(new RegExp('CCCC','gi'),strShortDate+' '+strShortTime);tz=dt.getTimezoneOffset();timezone=(tz<0)?('GMT-'+tz/60):(tz==0)?('GMT'):('GMT+'+tz/60);retVal=retVal.replace(new RegExp('ZZZZ','gi'),timezone);return retVal;}
Date.getDateWeekPeriod=function(dateparam)
{var retval={sdate:"",edate:""};dateparam=(typeof(dateparam)=="string")?Date.CDate(dateparam):dateparam;var d=Date.CDate(dateparam);retval.sdate=Date.DateAdd("d",d.getDay()*-1,d).toShortDateString();retval.edate=Date.DateAdd("d",6-d.getDay(),d).toShortDateString();return retval;}
Date.getMonthCalendarPeriod=function(dateparam)
{var dateparam=(typeof(dateparam)=="string")?Date.CDate(dateparam):dateparam;var retval={sdate:"",edate:""};retval.sdate=Date.CDate(dateparam.format("#{yy}-#{mm}-1"));retval.edate=Date.DateAdd("m",1,retval.sdate).prev_day();if(retval.sdate.getDay()>0)retval.sdate=retval.sdate.prev_day(retval.sdate.getDay());if(retval.edate.getDay()<6)retval.edate=retval.edate.next_day(6-retval.edate.getDay());return retval;}
var lunarMonthTable=[[2,1,2,1,2,1,2,2,1,2,1,2],[1,2,1,1,2,1,2,5,2,2,1,2],[1,2,1,1,2,1,2,1,2,2,2,1],[2,1,2,1,1,2,1,2,1,2,2,2],[1,2,1,2,3,2,1,1,2,2,1,2],[2,2,1,2,1,1,2,1,1,2,2,1],[2,2,1,2,2,1,1,2,1,2,1,2],[1,2,2,4,1,2,1,2,1,2,1,2],[1,2,1,2,1,2,2,1,2,1,2,1],[2,1,1,2,2,1,2,1,2,2,1,2],[1,5,1,2,1,2,1,2,2,2,1,2],[1,2,1,1,2,1,2,1,2,2,2,1],[2,1,2,1,1,5,1,2,2,1,2,2],[2,1,2,1,1,2,1,1,2,2,1,2],[2,2,1,2,1,1,2,1,1,2,1,2],[2,2,1,2,5,1,2,1,2,1,1,2],[2,1,2,2,1,2,1,2,1,2,1,2],[1,2,1,2,1,2,2,1,2,1,2,1],[2,3,2,1,2,2,1,2,2,1,2,1],[2,1,1,2,1,2,1,2,2,2,1,2],[1,2,1,1,2,1,5,2,2,1,2,2],[1,2,1,1,2,1,1,2,2,1,2,2],[2,1,2,1,1,2,1,1,2,1,2,2],[2,1,2,2,3,2,1,1,2,1,2,2],[1,2,2,1,2,1,2,1,2,1,1,2],[2,1,2,1,2,2,1,2,1,2,1,1],[2,1,2,5,2,1,2,2,1,2,1,2],[1,1,2,1,2,1,2,2,1,2,2,1],[2,1,1,2,1,2,1,2,2,1,2,2],[1,5,1,2,1,1,2,2,1,2,2,2],[1,2,1,1,2,1,1,2,1,2,2,2],[1,2,2,1,1,5,1,2,1,2,2,1],[2,2,2,1,1,2,1,1,2,1,2,1],[2,2,2,1,2,1,2,1,1,2,1,2],[1,2,2,1,6,1,2,1,2,1,1,2],[1,2,1,2,2,1,2,2,1,2,1,2],[1,1,2,1,2,1,2,2,1,2,2,1],[2,1,4,1,2,1,2,1,2,2,2,1],[2,1,1,2,1,1,2,1,2,2,2,1],[2,2,1,1,2,1,4,1,2,2,1,2],[2,2,1,1,2,1,1,2,1,2,1,2],[2,2,1,2,1,2,1,1,2,1,2,1],[2,2,1,2,2,4,1,1,2,1,2,1],[2,1,2,2,1,2,2,1,2,1,1,2],[1,2,1,2,1,2,2,1,2,2,1,2],[1,1,2,4,1,2,1,2,2,1,2,2],[1,1,2,1,1,2,1,2,2,2,1,2],[2,1,1,2,1,1,2,1,2,2,1,2],[2,5,1,2,1,1,2,1,2,1,2,2],[2,1,2,1,2,1,1,2,1,2,1,2],[2,2,1,2,1,2,3,2,1,2,1,2],[2,1,2,2,1,2,1,1,2,1,2,1],[2,1,2,2,1,2,1,2,1,2,1,2],[1,2,1,2,4,2,1,2,1,2,1,2],[1,2,1,1,2,2,1,2,2,1,2,2],[1,1,2,1,1,2,1,2,2,1,2,2],[2,1,4,1,1,2,1,2,1,2,2,2],[1,2,1,2,1,1,2,1,2,1,2,2],[2,1,2,1,2,1,1,5,2,1,2,2],[1,2,2,1,2,1,1,2,1,2,1,2],[1,2,2,1,2,1,2,1,2,1,2,1],[2,1,2,1,2,5,2,1,2,1,2,1],[2,1,2,1,2,1,2,2,1,2,1,2],[1,2,1,1,2,1,2,2,1,2,2,1],[2,1,2,3,2,1,2,1,2,2,2,1],[2,1,2,1,1,2,1,2,1,2,2,2],[1,2,1,2,1,1,2,1,1,2,2,2],[1,2,5,2,1,1,2,1,1,2,2,1],[2,2,1,2,2,1,1,2,1,2,1,2],[1,2,2,1,2,1,5,2,1,2,1,2],[1,2,1,2,1,2,2,1,2,1,2,1],[2,1,1,2,2,1,2,1,2,2,1,2],[1,2,1,1,5,2,1,2,2,2,1,2],[1,2,1,1,2,1,2,1,2,2,2,1],[2,1,2,1,1,2,1,1,2,2,2,1],[2,2,1,5,1,2,1,1,2,2,1,2],[2,2,1,2,1,1,2,1,1,2,1,2],[2,2,1,2,1,2,1,5,2,1,1,2],[2,1,2,2,1,2,1,2,1,2,1,1],[2,2,1,2,1,2,2,1,2,1,2,1],[2,1,1,2,1,6,1,2,2,1,2,1],[2,1,1,2,1,2,1,2,2,1,2,2],[1,2,1,1,2,1,1,2,2,1,2,2],[2,1,2,3,2,1,1,2,2,1,2,2],[2,1,2,1,1,2,1,1,2,1,2,2],[2,1,2,2,1,1,2,1,1,5,2,2],[1,2,2,1,2,1,2,1,1,2,1,2],[1,2,2,1,2,2,1,2,1,2,1,1],[2,1,2,2,1,5,2,2,1,2,1,2],[1,1,2,1,2,1,2,2,1,2,2,1],[2,1,1,2,1,2,1,2,2,1,2,2],[1,2,1,1,5,1,2,1,2,2,2,2],[1,2,1,1,2,1,1,2,1,2,2,2],[1,2,2,1,1,2,1,1,2,1,2,2],[1,2,5,2,1,2,1,1,2,1,2,1],[2,2,2,1,2,1,2,1,1,2,1,2],[1,2,2,1,2,2,1,5,2,1,1,2],[1,2,1,2,2,1,2,1,2,2,1,2],[1,1,2,1,2,1,2,2,1,2,2,1],[2,1,1,2,3,2,2,1,2,2,2,1],[2,1,1,2,1,1,2,1,2,2,2,1],[2,2,1,1,2,1,1,2,1,2,2,1],[2,2,2,3,2,1,1,2,1,2,1,2],[2,2,1,2,1,2,1,1,2,1,2,1],[2,2,1,2,2,1,2,1,1,2,1,2],[1,5,2,2,1,2,1,2,1,2,1,2],[1,2,1,2,1,2,2,1,2,2,1,1],[2,1,2,1,2,1,5,2,2,1,2,2],[1,1,2,1,1,2,1,2,2,2,1,2],[2,1,1,2,1,1,2,1,2,2,1,2],[2,2,1,1,5,1,2,1,2,1,2,2],[2,1,2,1,2,1,1,2,1,2,1,2],[2,1,2,2,1,2,1,1,2,1,2,1],[2,1,6,2,1,2,1,1,2,1,2,1],[2,1,2,2,1,2,1,2,1,2,1,2],[1,2,1,2,1,2,1,2,5,2,1,2],[1,2,1,1,2,1,2,2,2,1,2,1],[2,1,2,1,1,2,1,2,2,1,2,2],[2,1,1,2,3,2,1,2,1,2,2,2],[1,2,1,2,1,1,2,1,2,1,2,2],[2,1,2,1,2,1,1,2,1,2,1,2],[2,1,2,5,2,1,1,2,1,2,1,2],[1,2,2,1,2,1,2,1,2,1,2,1],[2,1,2,1,2,2,1,2,1,2,1,2],[1,5,2,1,2,1,2,2,1,2,1,2],[1,2,1,1,2,1,2,2,1,2,2,1],[2,1,2,1,1,5,2,1,2,2,2,1],[2,1,2,1,1,2,1,2,1,2,2,2],[1,2,1,2,1,1,2,1,1,2,2,2],[1,2,2,1,5,1,2,1,1,2,2,1],[2,2,1,2,2,1,1,2,1,1,2,2],[1,2,1,2,2,1,2,1,2,1,2,1],[2,1,5,2,1,2,2,1,2,1,2,1],[2,1,1,2,1,2,2,1,2,2,1,2],[1,2,1,1,2,1,2,1,2,2,5,2],[1,2,1,1,2,1,2,1,2,2,2,1],[2,1,2,1,1,2,1,1,2,2,1,2],[2,2,1,2,1,4,1,1,2,2,1,2],[2,2,1,2,1,1,2,1,1,2,1,2],[2,2,1,2,1,2,1,2,1,1,2,1],[2,2,1,2,5,2,1,2,1,2,1,1],[2,1,2,2,1,2,2,1,2,1,2,1],[2,1,1,2,1,2,2,1,2,2,1,2],[1,5,1,2,1,2,1,2,2,2,1,2],[1,2,1,1,2,1,1,2,2,1,2,2]];function myDate(year,month,day,leapMonth)
{this.year=year;this.month=month;this.day=day;this.leapMonth=leapMonth;this.toString=function(){return this.year+"-"+this.month+"-"+this.day;}}
function lunarCalc(year,month,day,type,leapmonth)
{var solYear,solMonth,solDay;var lunYear,lunMonth,lunDay;var lunLeapMonth,lunMonthDay;var i,lunIndex;var solMonthDay=[31,0,31,30,31,30,31,31,30,31,30,31];if(year<1900||year>2040)
{alert('1900년부터 2040년까지만 지원합니다');return;}
if(year>=2000)
{solYear=2000;solMonth=1;solDay=1;lunYear=1999;lunMonth=11;lunDay=25;lunLeapMonth=0;solMonthDay[1]=29;lunMonthDay=30;}
else if(year>=1970)
{solYear=1970;solMonth=1;solDay=1;lunYear=1969;lunMonth=11;lunDay=24;lunLeapMonth=0;solMonthDay[1]=28;lunMonthDay=30;}
else if(year>=1940)
{solYear=1940;solMonth=1;solDay=1;lunYear=1939;lunMonth=11;lunDay=22;lunLeapMonth=0;solMonthDay[1]=29;lunMonthDay=29;}
else
{solYear=1900;solMonth=1;solDay=1;lunYear=1899;lunMonth=12;lunDay=1;lunLeapMonth=0;solMonthDay[1]=28;lunMonthDay=30;}
lunIndex=lunYear-1899;while(true)
{if(type==1&&year==solYear&&month==solMonth&&day==solDay)
{return new myDate(lunYear,lunMonth,lunDay,lunLeapMonth);}
else if(type==2&&year==lunYear&&month==lunMonth&&day==lunDay&&leapmonth==lunLeapMonth)
{return new myDate(solYear,solMonth,solDay,0);}
if(solMonth==12&&solDay==31)
{solYear++;solMonth=1;solDay=1;if(solYear%400==0)
solMonthDay[1]=29;else if(solYear%100==0)
solMonthDay[1]=28;else if(solYear%4==0)
solMonthDay[1]=29;else
solMonthDay[1]=28;}
else if(solMonthDay[solMonth-1]==solDay)
{solMonth++;solDay=1;}
else
solDay++;if(lunMonth==12&&((lunarMonthTable[lunIndex][lunMonth-1]==1&&lunDay==29)||(lunarMonthTable[lunIndex][lunMonth-1]==2&&lunDay==30)))
{lunYear++;lunMonth=1;lunDay=1;if(lunYear>2043){alert("입력하신 달은 없습니다.");break;}
lunIndex=lunYear-1899;if(lunarMonthTable[lunIndex][lunMonth-1]==1)
lunMonthDay=29;else if(lunarMonthTable[lunIndex][lunMonth-1]==2)
lunMonthDay=30;}
else if(lunDay==lunMonthDay)
{if(lunarMonthTable[lunIndex][lunMonth-1]>=3&&lunLeapMonth==0)
{lunDay=1;lunLeapMonth=1;}
else
{lunMonth++;lunDay=1;lunLeapMonth=0;}
if(lunarMonthTable[lunIndex][lunMonth-1]==1)
lunMonthDay=29;else if(lunarMonthTable[lunIndex][lunMonth-1]==2)
lunMonthDay=30;else if(lunarMonthTable[lunIndex][lunMonth-1]==3)
lunMonthDay=29;else if(lunarMonthTable[lunIndex][lunMonth-1]==4&&lunLeapMonth==0)
lunMonthDay=29;else if(lunarMonthTable[lunIndex][lunMonth-1]==4&&lunLeapMonth==1)
lunMonthDay=30;else if(lunarMonthTable[lunIndex][lunMonth-1]==5&&lunLeapMonth==0)
lunMonthDay=30;else if(lunarMonthTable[lunIndex][lunMonth-1]==5&&lunLeapMonth==1)
lunMonthDay=29;else if(lunarMonthTable[lunIndex][lunMonth-1]==6)
lunMonthDay=30;}
else
lunDay++;}}
function dayCalcDisplay(startYear,startMonth,startDay)
{if(!startYear||startYear==0||!startMonth||startMonth==0||!startDay||startDay==0)
{alert('날짜를 입력해주세요');return;}
var solMonthDay=[31,28,31,30,31,30,31,31,30,31,30,31];if(startYear%400==0||(startYear%4==0&&startYear%100!=0))solMonthDay[1]+=1;if(startMonth<1||startMonth>12||startDay<1||startDay>solMonthDay[startMonth-1]){if(solMonthDay[1]==28&&startMonth==2&&startDay>28)
alert("윤년이 아닙니다. 다시 입력해주세요");else
alert("날짜 범위를 벗어났습니다. 다시 입력해주세요");return;}
var startDate=new Date(startYear,startMonth-1,startDay);var date=lunarCalc(startYear,startMonth,startDay,1);return date;}
function getLunarDateFromSolarDate(pobj){if(typeof(pobj)=="string"){pobj=Date.CDate(pobj);}
var retval=dayCalcDisplay(pobj.Year(),pobj.Month(),pobj.Day())
return Date.CDate(retval.year+"-"+retval.month+"-"+retval.day);}
var TextUtil={SCHAR_EN:"qwertasdfgzxcvyuiopOPhjklbnm",SCHAR_KR:"ㅂㅈㄷㄱㅅㅁㄴㅇㄹㅎㅋㅌㅊㅍㅛㅕㅑㅐㅔㅒㅖㅗㅓㅏㅣㅠㅜㅡ",convertEngCharToKor:function(str){var en_h="rRseEfaqQtTdwWczxvg";var reg_h="["+en_h+"]";var reg_b="hk|ho|hl|nj|np|nl|ml|k|o|i|O|j|p|u|P|h|y|n|b|m|l";var reg_f="rt|sw|sg|fr|fa|fq|ft|fx|fv|fg|qt|r|R|s|e|f|a|q|t|T|d|w|c|z|x|v|g|";var reg_exp=new RegExp("("+reg_h+")("+reg_b+")((?:"+reg_f+")(?=(?:"+reg_h+")(?:"+reg_b+"))|(?:"+reg_f+"))","g");var retval=str.replace(reg_exp,this._korReplace);var ar=[];for(var i=0;i<retval.length;i++){if(this.SCHAR_EN.indexOf(retval.charAt(i))>=0)
ar.push(this.SCHAR_KR[this.SCHAR_EN.indexOf(retval.charAt(i))]);else if(this.SCHAR_EN.indexOf(retval.charAt(i).toLowerCase())>=0)
ar.push(this.SCHAR_KR[this.SCHAR_EN.indexOf(retval.charAt(i).toLowerCase())]);else if(this.SCHAR_KR.indexOf(retval.charAt(i))>=0)
ar.push(this.SCHAR_EN[this.SCHAR_KR.indexOf(retval.charAt(i))]);else
ar.push(retval.charAt(i));}
return ar.join('');},_korReplace:function(str,h,b,f){var en_h="rRseEfaqQtTdwWczxvg";var en_b={k:0,o:1,i:2,O:3,j:4,p:5,u:6,P:7,h:8,hk:9,ho:10,hl:11,y:12,n:13,nj:14,np:15,nl:16,b:17,m:18,ml:19,l:20}
var en_f={"":0,r:1,R:2,rt:3,s:4,sw:5,sg:6,e:7,f:8,fr:9,fa:10,fq:11,ft:12,fx:13,fv:14,fg:15,a:16,q:17,qt:18,t:19,T:20,d:21,w:22,c:23,z:24,x:25,v:26,g:27}
return String.fromCharCode(en_h.indexOf(h)*21*28+en_b[b]*28+en_f[f]+44032);},isKorean:function(str){var i;var ch;var retval=true;for(i=0;i<str.length;i++){ch=escape(str.charAt(i));if(this.strCharByte(ch)!=2){retval=false;}}
return retval;},isAlphabet:function(checkStr)
{var checkOK="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";for(i=0;i<checkStr.length;i++)
{ch=checkStr.charAt(i);for(j=0;j<checkOK.length;j++)
if(ch==checkOK.charAt(j))
break;if(j==checkOK.length)
{return(false);break;}}
return(true);},isAlphaNumericKorean:function(checkStr)
{var checkOK="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_, ";for(i=0;i<checkStr.length;i++)
{ch=checkStr.charAt(i);if(this.strCharByte(escape(ch))==2)continue;for(j=0;j<checkOK.length;j++)
if(ch==checkOK.charAt(j))
break;if(j==checkOK.length)
{return(false);break;}}
return(true);},strCharByte:function(chStr){if(chStr.substring(0,2)=='%u'){if(chStr.substring(2,4)=='00')
return 1;else
return 2;}else if(chStr.substring(0,1)=='%'){if(parseInt(chStr.substring(1,3),16)>127)
return 2;else
return 1;}else{return 1;}},deleteValidTag:function(tag,str){str=str.replaceAll("<( )*"+tag+"([^>])*?>","<"+tag+">");str=str.replaceAll("(<( )*(/)( )*?"+tag+"()*>)","</"+tag+">");str=str.replaceAll("(<"+tag+">)([^(<"+tag+">\\.</"+tag+">)])*?(</"+tag+">)","");str=str.replaceAll("(<"+tag+">)[\\s\\S]*?(</"+tag+">)","");return str;},subStringCount:function(html,findStr){var nowIndex=0;var i=0;while(html.indexOf(findStr,nowIndex)>-1){nowIndex=html.indexOf(findStr,nowIndex)+findStr.length;i++;}
return i;},OpenCloseTagCheck:function(html){var tagList=Array("div","span","table","script");for(var i=0;i<=tagList.length;i++){var strOpenTag="<"+tagList[i];var strCloseTag="</"+tagList[i];var openCount=TextUtil.subStringCount(html,strOpenTag);var closeCount=TextUtil.subStringCount(html,strCloseTag);var strAddTag="";if(openCount>closeCount){for(var j=0;j<openCount-closeCount;j++){strAddTag=strAddTag+strCloseTag+">";}
html=html+strAddTag;}else if(openCount<closeCount){for(var j=0;j<closeCount-openCount;j++){strAddTag=strAddTag+strOpenTag+">";}
html=strAddTag+html;}}
return html;},autoLink:function(str){var re=/((http|https|ftp):\/\/[\w?=&.-\/;#~%-]+([^ \n\r<>]+))/g;str=str.replace(re,'<a href="$1" onclick="window.open(this.href); return false;" rel="external">$1</a> ');if(str.indexOf("www")==0){str=" "+str;}
re=/((\swww)[^ \n\r<>]+)/g;str=str.replace(re,'<a href="http://$1" onclick="window.open(this.href); return false;" rel="external">$1</a> ');str=str.replace(" www","www");re=/(([a-z0-9*._+]){1,}\@(([a-z0-9]+[-]?){1,}[a-z0-9]+\.){1,}([a-z]{2,4}|museum)(?![\w\s?&.\/;#~%"=-]*>))/g;str=str.replace(re,'<a href="mailto:$1">$1</a>');return str;},countingContent:function(checkObj,countingObj,maxLength){var valSize=checkObj.val().length;var limitSize=valSize;if(maxLength>0)
limitSize=maxLength-valSize;countingObj.html(limitSize);},IS_FOCUS:false,startTimer:function(checkObj,countingObj,maxLength){if(this.IS_FOCUS){this.countingContent(checkObj,countingObj,maxLength);}
this.checkTimer(checkObj,countingObj,maxLength);},eventCountingText:function(checkObj,countingObj,maxLength){var _self=this;checkObj.bind("focus",function(e){_self.IS_FOCUS=true;_self.checkTimer(checkObj,countingObj,maxLength);});checkObj.bind("blur",function(e){_self.IS_FOCUS=false;});},checkTimer:function(checkObj,countingObj,maxLength){var _self=this;setTimeout(function(){_self.startTimer(checkObj,countingObj,maxLength);},200);},toString:function(){return"TextUtil";}};
var ValidUtil={isNumeric:function(obj,strName){if(isNaN(obj)||obj.indexOf(".")>=0){return false;}else{return true;}},isBlankFieldById:function(objid,columnname,checkbanword){return this.isBlankField(document.getElementById(objid),columnname,checkbanword);},isBlankField:function(obj,columnname,checkbanword){if(obj.value.trim()==""){var msgtype="입력";if(obj.tagName=="SELECT")msgtype="선택";return false;}else{var docheck=true;if(typeof(checkbanword)!="undefined"&&checkbanword==false)docheck=false;try{if(obj.tagName=="INPUT"&&obj.type=="file")docheck=false;}catch(e){}
if(docheck){if(ValidUtil.hasBanWord(obj.value)!=""){return false;}else{return true;}}}
return true;},isAlphaNumeric:function(checkStr){var checkOK="abcdefghijklmnopqrstuvwxyz0123456789";for(i=0;i<checkStr.length;i++){ch=checkStr.charAt(i);for(j=0;j<checkOK.length;j++)
if(ch==checkOK.charAt(j))
break;if(j==checkOK.length){return(false);break;}}
return(true);},isAlphaNumericExt:function(checkStr){var checkOK="abcdefghijklmnopqrstuvwxyz0123456789._";for(i=0;i<checkStr.length;i++){ch=checkStr.charAt(i);for(j=0;j<checkOK.length;j++)
if(ch==checkOK.charAt(j))
break;if(j==checkOK.length){return(false);break;}}
return(true);},isEmailAddress:function(strEmail,strName){var regDoNot=/(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/;var regMust=/^[a-zA-Z0-9\-\.\_]+\@[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3})$/;if(!regDoNot.test(strEmail)&&regMust.test(strEmail)){}else{return false;}
return true;},isJuminNumber:function(jumin1,jumin2,strName){var i;var IDtot=0;var IDAdd="234567892345";var now=new Date();var year;var day1;var day2;var age;var sex;for(i=0;i<=5;i++)
IDtot=IDtot+((i%8+2)*parseInt(jumin1.substring(i,i+1)));for(i=6;i<=11;i++)
IDtot=IDtot+((i%8+2)*parseInt(jumin2.substring(i-6,i-5)));IDtot=11-(IDtot%11);IDtot=IDtot%10;if(IDtot!=jumin2.substring(6,7)){return false;}
return true;},LengthCheck:function(strValue,strName,lowLength,highLength,showkorment){var nsize=0;var mx=highLength;var inshowkorment=true;if(typeof(showkorment)!="undefined")
{inshowkorment=showkorment;}
var msgadd="";nsize=strValue.length;if(nsize<lowLength){return false;}else if(nsize>mx){return false;}
else
return true;},GetLength:function(strValue){var nsize=0;var chrOrig;var charEscaped;for(var intinx=0;intinx<=strValue.length-1;intinx++){chrOrig=strValue.substring(intinx,intinx+1);chrEscaped=escape(chrOrig);if(chrEscaped.substring(0,2)=="%u")
nsize=nsize+2;else
nsize++;}
return nsize;},hasBanWord:function(checkContent,columnName)
{alert("DO Implement this method");return;var retval=false;var remoteurl="";var remoteparams="content="+Common.utfEncoding(checkContent);var httpobj=new Ajax.Request
(remoteurl,{asynchronous:false,method:"post",parameters:remoteparams,onSuccess:function(httpobj)
{var result=Common.getXmlFirstChildNodeValue(httpobj.responseXML,"string");if(result!="")
{retval=true;}else
{retval=false;}
if(retval)
{MsgBox.show("<b>\""+result+"\"</b> 은(는) 사용하실 수 없는 단어입니다");}},onFailure:function(httpobj)
{alert("ajax failed");window.open(remoteurl+"?"+remoteparams);return true;}})
return retval;},containsXssScripting:function(checkStr){var xsstag=[];xsstag.push("<iframe");xsstag.push("<script");xsstag.push("<style");for(var i=0;i<xsstag.length;i++){if(checkStr.toLowerCase().indexOf(xsstag[i])>=0)return true;if(decodeURIComponent(checkStr).toLowerCase().indexOf(xsstag[i])>=0)return true;}
return false;}}
Number.prototype.addZero=function(){var retval=String(this);if(this<10)retval="0"+retval;return retval;}
Number.prototype.digit=function(){return this.addZero();}
Date.prototype.toShortDateString=function(){var retval="";retval=this.format("#{yy}-#{mm}-#{dd}");return retval;}
Date.prototype.toShortDateInteger=function(){return parseInt(this.toShortDateString().replace(/-/gi,""));}
Date.prototype.num=function(){return this.toShortDateInteger();}
Date.prototype.Year=function(){return this.getFullYear();}
Date.prototype.Month=function(){return this.getMonth()+1;}
Date.prototype.Day=function(){return this.getDate();}
Date.prototype.getJSON=function(){var o=this;var retval={year:o.Year(),month:o.Month(),day:o.Day()}
return o;}
Date.prototype.toString=function(){return this.toShortDateString();}
Date.prototype.format=function(str){weekday=["일","월","화","수","목","금","토"];if(!this.valueOf()){return"";}
var self=this;return str.replace(/#\{(.*?)\}/gi,function($l){switch($l){case'#{yy}':return self.getFullYear();case'#{y}':return(self.getFullYear()+"").substring(2,4);case'#{mm}':return(self.getMonth()+1).digit(2);case'#{m}':return self.getMonth()+1;case'#{dd}':return(self.getDate()).digit(2);case'#{d}':return self.getDate();case'#{HH}':return(self.getHours()).digit(2);case'#{H}':return self.getHours();case'#{II}':return((self.getHours()+11)%12+1).digit(2);case'#{I}':return((self.getHours()+11)%12+1);case'#{MM}':return(self.getMinutes()).digit(2);case'#{M}':return self.getMinutes();case'#{SS}':return(self.getSeconds()).digit(2);case'#{S}':return self.getSeconds();case'#{ka}':return weekday[self.getDay()];case'#{p}':return(self.getHours()>=12&&self.getHours()<24)?'PM':'AM';case'#{kp}':return(self.getHours()>=12&&self.getHours()<24)?'오전':'오후';}});}
Date.prototype.clone=function(){return new Date(this.getTime());}
Date.prototype.next_day=function(days){d=this.clone();if(days!=0)d.setDate(d.getDate()+(days||1));return d;}
Date.prototype.prev_day=function(days){d=this.clone();if(days!=0)d.setDate(d.getDate()-(days||1));return d;}
Date.prototype.next_hour=function(hours){d=this.clone();if(hours!=0)d.setHours(d.getHours()+(hours||1));return d;}
Date.prototype.prev_hour=function(hours){d=this.clone();if(hours!=0)d.setHours(d.getHours()-(hours||1));return d;}
Array.clone=function(){return[].concat(this);}
Array.replace=function(originStr,replaceStr){var newarr=[];for(var i=0;i<this.length;i++){var s=String(this[i]);newarr.push(s.replace(new RegExp(originStr,"gi"),replaceStr));}
return newarr;}
Array.contains=function(arr,findStr,caseSensitive){var retval=false;for(var i=0;i<arr.length;i++){if(caseSensitive){if(arr[i]==findStr){retval=true;break;}}else{if(arr[i].toLowerCase()==findStr.toLowerCase()){retval=true;break;}}}
return retval;};String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"").replace(/　/g,"");}
String.prototype.ltrim=function(){return this.replace(/^\s+/,"");}
String.prototype.rtrim=function(){return this.replace(/\s+$/,"");}
String.prototype.contains=function(findStr){if(typeof(findStr)=="string")
return(this.indexOf(findStr)>=0)?true:false;else{var retval=false;for(var i=0;i<findStr.length;i++){if(this.indexOf(findStr[i])>=0){retval=true;break;}}
return retval;}}
String.prototype.equals=function(checkStr){if(typeof(checkStr)=="string")
return this==checkStr;else{var retval=false;for(var i=0;i<checkStr.length;i++){if(this==checkStr[i]){retval=true;break;}}
return retval;}}
String.prototype.replaceAll=function(findstring,newstring){return this.replace(new RegExp(findstring,"gi"),newstring);}
String.prototype.startsWith=function(str){return(this.match("^"+str)==str);}
String.prototype.endsWith=function(str){return(this.match(str+"$")==str);}
Object.extend=function(source,destination,aliasName){for(var property in source){if(!destination[property])
destination[property]=source[property];}
if(aliasName)
window[aliasName]=destination;return destination;};Object.create=function(objectSource,aliasName){if(aliasName)
window[aliasName]=objectSource;return objectSource;}
Object.clone=function(object){return Object.extend({},object);}
Object.deep_clone=function(obj){var retval=Object.getJsonStr(obj);try{eval("var tmp = "+retval);}catch(e){try{console.log(retval);}catch(e2){}}
return tmp;}
Object.getJsonStr=function(obj){var buffer=[];for(var k in obj){if(typeof(obj[k])=="function"){continue;}
else if(typeof(obj[k])=="object"){if(obj[k])
buffer.push(k+" : "+Object.getJsonStr(obj[k])+"");else
buffer.push(k+" : null");}
else if(typeof(obj[k])=="string")
buffer.push(k+" : \""+obj[k].replaceAll("\n","\\n").replaceAll("\r","\\r").replaceAll("\"","\\\"")+"\"");else
buffer.push(k+" : \""+obj[k]+"\"");}
return"{"+buffer.join(',')+"}";}
Object.isArray=function(object){return object!=null&&typeof object=="object"&&'splice'in object&&'join'in object;}
var Hashtable=function()
{this.create();}
Hashtable.prototype={indexCount:null,keyArray:null,valueArray:null,create:function()
{this.indexCount=0;this.keyArray=new Array();this.valueArray=new Array();},clear:function()
{this.indexCount=0;this.keyArray=null;this.valueArray=null;return true;},clone:function()
{try{var CloneHash=new Hashtable();CloneHash.indexCount=this.indexCount;CloneHash.keyArray=this.keyArray;CloneHash.valueArray=this.valueArray;return CloneHash;}catch(e){}},put:function(key,value)
{try{var nCount=this.indexCount;for(var i=0;i<nCount;i++)
{if(this.keyArray[i]==null)
{continue;}
var key1=String(new String(this.keyArray[i]));var key2=String(new String(key));if(key1.toUpperCase()==key2.toUpperCase())
{this.valueArray[i]=value;return;}}
this.addValue(key,value);}catch(e){}},addValue:function(key,value)
{try{this.keyArray[this.indexCount]=String(new String(key));if(value==null)
{value="";}
if(typeof(value)=="string")
{this.valueArray[this.indexCount]=String(new String(value));}
else if(typeof(value)=="object")
{this.valueArray[this.indexCount]=value;}
else
{this.valueArray[this.indexCount]=value;}
this.indexCount++;}catch(e){}},get:function(key)
{try{var nCount=this.indexCount;for(var i=0;i<nCount;i++)
{if(this.keyArray[i]==null)
{continue;}
var key1=String(new String(this.keyArray[i]));var key2=String(new String(key));if(key1.toUpperCase()==key2.toUpperCase())
{var value=this.valueArray[i];return value;}}
return null;}catch(e){}},getKeyList:function(){return this.keyArray;},contains:function(value)
{try{var nCount=this.indexCount;for(var i=0;i<nCount;i++)
{if(this.valueArray[i]==null)
{continue;}
if(typeof(this.valueArray[i])=="string")
{if(this.valueArray[i].toUpperCase()==value.toUpperCase())
{return true;}
else
{continue;}}
else if(typeof(this.valueArray[i])=="object")
{if(this.valueArray[i]==value)
{return true;}
else
{continue;}}
else
{if(this.valueArray[i]==value)
{return true;}
else
{continue;}}}
return false;}catch(e){}},containsValue:function(value)
{return this.contains(value);},containsKey:function(key)
{try{var nCount=this.indexCount;for(var i=0;i<nCount;i++)
{if(this.keyArray[i]==null)
{continue;}
if(typeof(this.keyArray[i])=="string")
{var key1=this.keyArray[i];var key2=String(new String(key));if(key1.toUpperCase()==key2.toUpperCase())
{return true;}
else
{continue;}}
else if(typeof(this.keyArray[i])=="object")
{if(this.keyArray[i]==key)
{return true;}
else
{continue;}}
else
{if(this.keyArray[i]==key)
{return true;}
else
{continue;}}}
return false;}catch(e){}},isEmpty:function()
{if(this.indexCount==0)
{return true;}
else
{return false;}},remove:function(key)
{try
{var nCount=this.indexCount;for(var i=0;i<nCount;i++)
{if(this.keyArray[i]==null)
{continue;}
var key1=String(new String(this.keyArray[i]));var key2=String(new String(key));if(key1.toUpperCase()==key2.toUpperCase())
{this.keyArray[i]=null;this.valueArray[i]=null;}}
return true;}catch(e){return false;}},size:function()
{return this.indexCount==null?0:this.indexCount;}}
var Vector=function()
{this.initialize();}
Vector.prototype={elements:null,Push:function(obj)
{this.elements.push(obj);},Count:function()
{return this.elements.length;},IsEmpty:function()
{if(this.elements.length<=0)
return true;else
return false;},RemoveAt:function(indexNo)
{if(this.sizecheck(indexNo))
{this.elements[indexNo]=null;this.reproduce();}else
{this.throwerr("index out of range [Length : "+this.elements.length+" / Called Index : "+indexNo+"]");}},Get:function(indexNo)
{if(this.sizecheck(indexNo))
{return this.elements[indexNo];}else
{this.throwerr("index out of range [Length : "+this.elements.length+" / Called Index : "+indexNo+"]");}},Pop:function(indexNo)
{var retobj=this.Get(indexNo);this.RemoveAt(indexNo);return retobj;},PopRandom:function()
{var rnd_max=this.elements.length-1;var rnd_min=0;var x=Math.floor(Math.random()*(rnd_max-rnd_min)+rnd_min);return this.Pop(x);},Contains:function(compareObj)
{var temparr=this.elements;var retval=false;var z=0;for(z=0;z<temparr.length;z++)
{if(temparr[z]==compareObj)
{retval=true;break;}}
return retval;},sizecheck:function(indexNo)
{if(indexNo<this.elements.length)
{return true;}else
{return false;}},throwerr:function(errmsg)
{alert(errmsg);},reproduce:function()
{var temparr=this.elements;var newarr=new Array();var z=0;for(z=0;z<temparr.length;z++)
{if(temparr[z]!=null)newarr.push(temparr[z]);}
this.elements=newarr;},initialize:function()
{this.elements=new Array();}}
if(!this.JSON){this.JSON={};}
(function(){"use strict";function f(n){return n<10?'0'+n:n;}
if(typeof Date.prototype.toJSON!=='function'){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+'-'+
f(this.getUTCMonth()+1)+'-'+
f(this.getUTCDate())+'T'+
f(this.getUTCHours())+':'+
f(this.getUTCMinutes())+':'+
f(this.getUTCSeconds())+'Z':null;};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf();};}
var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==='string'?c:'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4);})+'"':'"'+string+'"';}
function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==='object'&&typeof value.toJSON==='function'){value=value.toJSON(key);}
if(typeof rep==='function'){value=rep.call(holder,key,value);}
switch(typeof value){case'string':return quote(value);case'number':return isFinite(value)?String(value):'null';case'boolean':case'null':return String(value);case'object':if(!value){return'null';}
gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==='[object Array]'){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||'null';}
v=partial.length===0?'[]':gap?'[\n'+gap+
partial.join(',\n'+gap)+'\n'+
mind+']':'['+partial.join(',')+']';gap=mind;return v;}
if(rep&&typeof rep==='object'){length=rep.length;for(i=0;i<length;i+=1){k=rep[i];if(typeof k==='string'){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}
v=partial.length===0?'{}':gap?'{\n'+gap+partial.join(',\n'+gap)+'\n'+
mind+'}':'{'+partial.join(',')+'}';gap=mind;return v;}}
if(typeof JSON.stringify!=='function'){JSON.stringify=function(value,replacer,space){var i;gap='';indent='';if(typeof space==='number'){for(i=0;i<space;i+=1){indent+=' ';}}else if(typeof space==='string'){indent=space;}
rep=replacer;if(replacer&&typeof replacer!=='function'&&(typeof replacer!=='object'||typeof replacer.length!=='number')){throw new Error('JSON.stringify');}
return str('',{'':value});};}
if(typeof JSON.parse!=='function'){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==='object'){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v;}else{delete value[k];}}}}
return reviver.call(holder,key,value);}
text=String(text);cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return'\\u'+
('0000'+a.charCodeAt(0).toString(16)).slice(-4);});}
if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,'@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']').replace(/(?:^|:|,)(?:\s*\[)+/g,''))){j=eval('('+text+')');return typeof reviver==='function'?walk({'':j},''):j;}
throw new SyntaxError('JSON.parse');};}}());
