function reCreateSecureBox(obj)
{
obj.setAttribute("src", "/_board/zb_cryptimg.php?dummy=" + getDummy());
}
function getDummy()
{
var today = new Date();
return today.getTime();
}
function setSaveID(name, value, expiredays, flag)
{
var today = new Date();
today.setDate( today.getDate() + expiredays );
value = value.trim();
if(flag == true) document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + today.toGMTString() + ";"
else document.cookie = name + "=; path=/; expires=" + today.toGMTString() + ";"
}
V = function(o){ return typeof(o) == 'number' ? true : !(o == undefined || o == null || o == ''); }
function bindNumber(e,num){
if(V(num) && (num > -1)){
e.className = getClassnameByLength(num);
e.innerHTML = checkNumber(num);
}
}
function checkNumber(num) {
try{
var n = Number(num);
if(!V(n)) return "0";
if (n > 999) {
return "999+";
} else {
return n;
}
}catch(e){ return "0";}
}
function getClassnameByLength(num) {
var numLength = String(num).length;
if (numLength >= 4 ) {
return "rballnum4" ;
} else {
return "rballnum" + String(numLength);
}
}
function getescape(str)
{
var ch = "";
var newstr = "";
var i = 0;
while(i < str.length) {
ch = str.charCodeAt(i);
if(detectchartype(ch) == 1) { newstr += "____" + ch + ";"}
else newstr += str.charAt(i);
i++;
}
return Base64.encode(escape(newstr));
}
function detectchartype(ch)
{
var type=-1;
var s = ch - 0xAC00; //44032
if( s >= -43999 && s <= -43906) type = 0; //±âÈ£
if( s >= -43984 && s <= -43975) type = 2; //¼ýÀÚ
if( s >= -43967 && s <= -43910) type = 3; //¿µ¾î
if((s >= -43871 && s <= -30755) || (s >= 21249 && s <= 21478)) type = 1; //Ư¼ö¹®ÀÚ
if((s >= -24064 && s <= -31729) || (s >= 19712 && s <= 19979)) type = 6; //ÇÑÀÚ
if( s >= 0 && s <= 11172) type = 5; //ÇѱÛ
if( s >= -31679 && s <= -31498) type = 4; //ÀϾî
return type;
}
var Base64 = {
// private property
_keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
// public method for encoding
encode : function (input) {
var output = "";
var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
var i = 0;
//input = Base64._utf8_encode(input);
while (i < input.length) {
chr1 = input.charCodeAt(i++);
chr2 = input.charCodeAt(i++);
chr3 = input.charCodeAt(i++);
enc1 = chr1 >> 2;
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
enc4 = chr3 & 63;
if (isNaN(chr2)) {
enc3 = enc4 = 64;
} else if (isNaN(chr3)) {
enc4 = 64;
}
output = output +
this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);
}
return output;
},
// public method for decoding
decode : function (input) {
var output = "";
var chr1, chr2, chr3;
var enc1, enc2, enc3, enc4;
var i = 0;
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
while (i < input.length) {
enc1 = this._keyStr.indexOf(input.charAt(i++));
enc2 = this._keyStr.indexOf(input.charAt(i++));
enc3 = this._keyStr.indexOf(input.charAt(i++));
enc4 = this._keyStr.indexOf(input.charAt(i++));
chr1 = (enc1 << 2) | (enc2 >> 4);
chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
chr3 = ((enc3 & 3) << 6) | enc4;
output = output + String.fromCharCode(chr1);
if (enc3 != 64) {
output = output + String.fromCharCode(chr2);
}
if (enc4 != 64) {
output = output + String.fromCharCode(chr3);
}
}
output = Base64._utf8_decode(output);
return output;
},
// private method for UTF-8 encoding
_utf8_encode : function (string) {
string = string.replace(/\r\n/g,"\n");
var utftext = "";
for (var n = 0; n < string.length; n++) {
var c = string.charCodeAt(n);
if (c < 128) {
utftext += String.fromCharCode(c);
}
else if((c > 127) && (c < 2048)) {
utftext += String.fromCharCode((c >> 6) | 192);
utftext += String.fromCharCode((c & 63) | 128);
}
else {
utftext += String.fromCharCode((c >> 12) | 224);
utftext += String.fromCharCode(((c >> 6) & 63) | 128);
utftext += String.fromCharCode((c & 63) | 128);
}
}
return utftext;
},
// private method for UTF-8 decoding
_utf8_decode : function (utftext) {
var string = "";
var i = 0;
var c = c1 = c2 = 0;
while ( i < utftext.length ) {
c = utftext.charCodeAt(i);
if (c < 128) {
string += String.fromCharCode(c);
i++;
}
else if((c > 191) && (c < 224)) {
c2 = utftext.charCodeAt(i+1);
string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
i += 2;
}
else {
c2 = utftext.charCodeAt(i+1);
c3 = utftext.charCodeAt(i+2);
string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
i += 3;
}
}
return string;
}
}
function zeroPad(n) {
return (n < 10 ? '0' : '') + n;
}
/* string prototype */
String.prototype.isValidUserID = function()
{
var str = this.trim();
if( str.isNull() ) return false;
// $('#debug').html(str.length );
if(str.length < 4 || str.length > 12) return false;
return (/^[a-zA-Z]+[a-zA-Z0-9_]+[a-zA-Z0-9]+$/).test(str);
/*
var re = /(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{6,}/;
var validPassword = re.test(input);
matches a string of six or more characters;
that contains at least one digit (\d is shorthand for [0-9]);
at least one uppercase; and
at least one lowercase character.
*/
} // end of function
String.prototype.isValidPasswd = function ()
{
if( this.isNull() ) return false;
if(this.length < 4 || this.length > 12) return false;
return true;
}
String.prototype.copy = function (desc)
{
desc.value = this.value;
}
String.prototype.trim = function()
{
return this.replace(/(^ *)|( *$)/g, "");
} // end of function
String.prototype.ltrim = function()
{
return this.replace(/(^ *)/g, "");
} // end of function
String.prototype.rtrim = function()
{
return this.replace(/( *$)/g, "");
} // end of function
String.prototype.lpad = function( maxLength, fillChar )
{
var srcStr = this.substr( 0, maxLength );
var cnt = 0;
for( var inx = srcStr.length; inx < maxLength; inx++ ) {
srcStr = fillChar.charAt(cnt) + srcStr;
cnt++;
cnt = ( cnt == fillChar.length ) ? 0 : cnt;
}
return srcStr;
} // end of function
String.prototype.rpad = function( maxLength, fillChar )
{
var srcStr = this.substr( 0, maxLength );
var cnt = 0;
for( var inx = srcStr.length; inx < maxLength; inx++ ) {
srcStr = srcStr + fillChar.charAt(cnt);
cnt++;
cnt = ( cnt == fillChar.length ) ? 0 : cnt;
}
return srcStr;
} // end of function
String.prototype.removeChr = function( findPattern )
{
return (findPattern == null) ? this : eval( "this.replace(/(" + findPattern + ")/g, '' )" );
} // end of function
String.prototype.replaceChr = function( findPattern, replacePattern )
{
return (findPattern == null) ? this : eval( "this.replace(/(" + findPattern + ")/g, '" + replacePattern + "' )" );
} // end of function
String.prototype.getByte = function( utf8Yn )
{
var str = this.trim();
var utf8Add = ( utf8Yn == true ) ? 2 : 1;
var len = 0;
for( var i = 0; i < str.length; i++, len++ ) {
if( str.charCodeAt(i) < 0 || str.charCodeAt(i) > 127 ) len += utf8Add; // add Extra 2 when charSet is UTF-8
}
return len;
} // end of function
/**
* ¹®ÀÚ¿À» Á¤¼ö·Î º¯È¯
* @return {Number} Á¤¼ö
*/
String.prototype.getInt = function()
{
if(!isNaN(this)) return parseInt(this);
else return null;
} // end of function
/**
* ¹®ÀÚ¿¿¡¼ ¼ýÀÚ¸¸ °¡Á®¿À±â
* @return {String} ¼ýÀڷθ¸ ±¸¼ºµÈ ¹®ÀÚ¿
*/
String.prototype.getNum = function()
{
return this.trim().replace(/[^0-9]/g, "");
} // end of function
/**
* ¹®ÀÚ¿¿¡¼ ¼ýÀÚ¸¸ °¡Á®¿À±â
* @return {String} ¼ýÀڷθ¸ ±¸¼ºµÈ ¹®ÀÚ¿
*/
String.prototype.getNotNum = function()
{
return this.trim().replace(/[0-9]/g, "");
} // end of function
/**
* ¹®ÀÚ¿¿¡¼ ¿µ¹®ÀÚ¸¸ °¡Á®¿À±â
* @return {String} ¿µ¹®Àڷθ¸ ±¸¼ºµÈ ¹®ÀÚ¿
*/
String.prototype.getAlpha = function()
{
return (this.trim().replace(/[^a-zA-Z]/g, ""));
} // end of function
/**
* ¹®ÀÚ¿¿¡¼ ¼ýÀÚ-¹®ÀÚ¸¸ °¡Á®¿À±â
* @return {String} ¿µ¹®Àڷθ¸ ±¸¼ºµÈ ¹®ÀÚ¿
*/
String.prototype.getAlphaNum = function()
{
return (this.trim().replace(/[^0-9a-zA-Z]/g, ""));
} // end of function
/**
* ¼ýÀÚ¿¡ 3ÀÚ¸®¸¶´Ù ÄÞ¸¶¸¦ Âï¾î¼ ¹Ýȯ
* @return {String} 3ÀÚ¸®¸¶´Ù ÄÞ¸¶°¡ ÂïÈù ¹®ÀÚ¿
*/
String.prototype.getMoney = function()
{
var num = this.trim();
while((/(-?[0-9]+)([0-9]{3})/).test(num)) {
num = num.replace((/(-?[0-9]+)([0-9]{3})/), "$1,$2");
}
return num;
} // end of function
/**
* ƯÁ¤ ¹®ÀÚ¿À» Æ÷ÇÔÇϰí ÀÖ´ÂÁö ¿©ºÎ¸¦ üũ
* @param {String} pattern üũÇÒ ¹®ÀÚ¿
* @return {Boolean} Æ÷ÇÔ¿©ºÎ
*/
String.prototype.hasValue = function( pattern )
{
return ( this.indexOf(pattern) >= 0 ) ? true : false;
} // end of function
String.prototype.isNull = function( pattern )
{
//if( this == undefined || this == null || (typeof this == 'string' && this == '') ) return true;
if( this == undefined || this == null || this == '' ) return true;
return false;
} // end of function
String.prototype.isAlphaNum = function()
{
var str = this.trim();
//mask°¡ µÇ¾î ÀÖÀ» °æ¿ì¿¡ ´ëÇØ ó¸®ÇØ¾ß ÇÑ´Ù.
//Áö±ÝÀº °í·ÁÄ¡ÇѰí ÀÏ´Ü ÄÚµù
//var param = ( typeof inputStr == 'object' ) ? this.getUnmaskStr( inputStr ) : inputStr;
if( str.isNull() ) return true;
return (/^[0-9a-zA-Z]+$/).test(str);
} // end of function
String.prototype.isNumber = function()
{
var str = this.trim();
str = str.replaceAll(".", "");
str = str.replaceAll(",", "");
str = str.replaceAll("-", "");
str = str.replaceAll("+", "");
if( str.isNull() ) return true;
return (/^[0-9]+$/).test(str);
} // end of function
String.prototype.isEmail = function()
{
var str = this.trim();
if( str.isNull() ) return true;
var filter=/^.+@.+\..{2,3}$/
if (filter.test(str)) return true;
else return false;
}
String.prototype.allowType = function (exts)
{
var str = this.trim();
if(str == "") return true;
str = str.toLowerCase();
var extpos = str.lastIndexOf(".");
var ext = str.substring(extpos+1);
arrExts = exts.split(",");
for(var i=0; i < arrExts.length; i++) {
if(ext == arrExts[i].trim()) return true;
}
return false;
}
var zFormUtil = new function() {
this.formcheck = function(form)
{
var el = null;
//return false when form is invalid object
if(form == undefined || typeof form != 'object') {
zMsgUtil.alert("ÀÔ·ÂÆûÀÌ °³Ã¼°¡ ¾Æ´Õ´Ï´Ù.");
return false;
}
if(form.tagName != "FORM") {
zMsgUtil.alert("ÀÔ·ÂÆûÀÌ °³Ã¼°¡ ¾Æ´Õ´Ï´Ù.");
return false;
}
for(var i=0; i < form.elements.length; i++) {
//el = form.elements.item( i );
el = form.elements[i];
if(el.getAttribute("disabled")) {
continue;
}
else if(!this.checkRequired(el) ||
!this.checkEmail(el) ||
!this.checkNumber(el) ||
!this.checkAlphabet(el) ||
!this.checkAlphaNumeric(el) ||
!this.checkMaxbyte(el) ||
!this.checkMinbyte(el) ||
!this.checkFixbyte(el) ||
!this.checkFileext(el)
) {
return false;
}
}
return true;
} // end of function
/*
obj : input type object
check the value of obj is not empty.
*/
this.checkRequired = function(obj)
{
var hasvalue = false;
if(obj.getAttributeNode("required")) {
switch(obj.tagName) {
case "TEXTAREA" :
case "INPUT" : hasvalue = (obj.value.trim())?true:false; break;
case "SELECT" : hasvalue = (obj.selectedIndex >= 0 && obj.options[obj.selectedIndex].value)?true:false; break;
}
if(!hasvalue) {
var title = obj.getAttributeNode("title");
if(title) zMsgUtil.alert("* Ç¥½ÃµÈ Ç׸ñ [" + title.value + "]Àº(´Â) ÇʼöÇ׸ñÀÔ´Ï´Ù.");
else zMsgUtil.alert("* Ç¥½ÃµÈ Ç׸ñÀº ÇʼöÇ׸ñÀÔ´Ï´Ù.");
$(obj).focus();
return false;
}
else return true;
}
else return true;
} // end of function
/*
obj : input type object
check the value of obj is an email or not.
*/
this.checkEmail = function(obj)
{
if(obj.getAttributeNode("email")) {
if(obj.value.isEmail() == false) {
var title = obj.getAttributeNode("title");
if(title) zMsgUtil.alert("ÇØ´ç Ç׸ñ [" + title.value + "]Àº(´Â) Email ÁÖ¼ÒÇü½Ä¿¡ ¸Â°Ô ÀÔ·ÁÇϼ¼¿ä.");
else zMsgUtil.alert("ÇØ´ç Ç׸ñÀº Email ÁÖ¼ÒÇü½Ä¿¡ ¸Â°Ô ÀÔ·ÁÇϼ¼¿ä.");
$(obj).focus();
return false;
}
else return true;
}
else return true;
} // end of function
/*
obj : input type object
check the value of obj is a number or not.
*/
this.checkNumber = function(obj)
{
if(obj.getAttributeNode("number")) {
if(obj.value.isNumber() == false) {
var title = obj.getAttributeNode("title");
if(title) zMsgUtil.alert("ÇØ´ç Ç׸ñ [" + title.value + "]Àº(´Â) ¼ýÀÚ¸¸ ÀԷ°¡´ÉÇÕ´Ï´Ù.");
else zMsgUtil.alert("ÇØ´ç Ç׸ñÀº ¼ýÀÚ¸¸ ÀԷ°¡´ÉÇÕ´Ï´Ù.");
$(obj).focus();
return false;
}
else return true;
}
else return true;
} // end of function
/*
obj : input type object
check the value of obj is an alphanumeric string.
*/
this.checkAlphabet = function(obj)
{
if(obj.getAttributeNode("alphabet")) {
if(obj.value.isAlphaNum() == false) {
var title = obj.getAttributeNode("title");
if(title) zMsgUtil.alert("ÇØ´ç Ç׸ñ [" + title.value + "]Àº(´Â) ¿µ¹®ÀÚ¸¸ ÀԷ°¡´ÉÇÕ´Ï´Ù.");
else zMsgUtil.alert("ÇØ´ç Ç׸ñÀº ¿µ¹®ÀÚ¸¸ ÀԷ°¡´ÉÇÕ´Ï´Ù.");
$(obj).focus();
return false;
}
else return true;
}
else return true;
} // end of function
/*
obj : input type object
check the value of obj is an alphanumeric string.
*/
this.checkAlphaNumeric = function(obj)
{
if(obj.getAttributeNode("alphanum")) {
if(obj.value.isAlphaNum() == false) {
var title = obj.getAttributeNode("title");
if(title) zMsgUtil.alert("ÇØ´ç Ç׸ñ [" + title.value + "]Àº(´Â) ¿µ¹®ÀÚ¿Í ¼ýÀÚ¸¸ ÀԷ°¡´ÉÇÕ´Ï´Ù.");
else zMsgUtil.alert("ÇØ´ç Ç׸ñÀº ¿µ¹®ÀÚ¿Í ¼ýÀÚ¸¸ ÀԷ°¡´ÉÇÕ´Ï´Ù.");
$(obj).focus();
return false;
}
else return true;
}
else return true;
} // end of function
/*
obj : input type object
check the length of value of obj is larger than maxbyte.
*/
this.checkMinbyte = function(obj)
{
if(obj.getAttributeNode("minbyte")) {
if(obj.value.getByte() < obj.getAttribute("minbyte")) {
var title = obj.getAttributeNode("title");
if(title) zMsgUtil.alert("ÇØ´ç Ç׸ñ [" + title.value + "]À»(¸¦) [#]¹ÙÀÌÆ® ÀÌ»óÀ¸·Î ÀÔ·ÂÇϼ¼¿ä.", obj.getAttribute("minbyte"));
else zMsgUtil.alert("ÇØ´ç Ç׸ñÀ» [#]¹ÙÀÌÆ® ÀÌ»óÀ¸·Î ÀÔ·ÂÇϼ¼¿ä.", obj.getAttribute("minbyte"));
$(obj).focus();
return false;
}
else return true;
}
else return true;
} // end of function
/*
obj : input type object
check the length of value of obj is larger than maxbyte.
*/
this.checkMaxbyte = function(obj)
{
if(obj.getAttributeNode("maxbyte")) {
if(obj.value.getByte() > obj.getAttribute("maxbyte")) {
var title = obj.getAttributeNode("title");
if(title) zMsgUtil.alert("ÇØ´ç Ç׸ñ [" + title.value + "]À»(¸¦) [#]¹ÙÀÌÆ® ÀÌÇÏ·Î ÀÔ·ÂÇϼ¼¿ä.", obj.getAttribute("maxbyte"));
else zMsgUtil.alert("ÇØ´ç Ç׸ñÀ» [#]¹ÙÀÌÆ® ÀÌÇÏ·Î ÀÔ·ÂÇϼ¼¿ä.", obj.getAttribute("maxbyte"));
$(obj).focus();
return false;
}
else return true;
}
else return true;
} // end of function
/*
obj : input type object
check the length of value of obj is fixbyte.
*/
this.checkFixbyte = function(obj)
{
if(obj.getAttributeNode("fixbyte")) {
if(obj.value.getByte() != obj.getAttribute("fixbyte")) {
var title = obj.getAttributeNode("title");
if(title) zMsgUtil.alert("ÇØ´ç Ç׸ñ [" + title.value + "]À»(¸¦) [#]¹ÙÀÌÆ®·Î ÀÔ·ÂÇϼ¼¿ä.", obj.getAttribute("fixbyte"));
else zMsgUtil.alert("ÇØ´ç Ç׸ñÀ» [#]¹ÙÀÌÆ®·Î ÀÔ·ÂÇϼ¼¿ä.", obj.getAttribute("fixbyte"));
$(obj).focus();
return false;
}
else return true;
}
else return true;
} // end of function
/*
obj : input type object
check filetype
*/
this.checkFileext = function(obj)
{
if(obj.getAttributeNode("allowtype")) {
var allowtypes = obj.getAttribute("allowtype");
if(!obj.value.allowType(allowtypes)) {
var title = obj.getAttributeNode("title");
if(title) zMsgUtil.alert("ÇØ´ç Ç׸ñ [" + title.value + "]ÀÇ ÆÄÀÏÀº [#]Çü½Ä¸¸ °¡´ÉÇÕ´Ï´Ù.", allowtypes);
else zMsgUtil.alert("ÇØ´ç Ç׸ñÀÇ ÆÄÀÏÀº [#]Çü½Ä¸¸ °¡´ÉÇÕ´Ï´Ù.", allowtypes);
$(obj).focus();
return false;
}
else return true;
}
else return true;
} // end of function
} //end of class
/*
message code ¸¦ ¹ÙÅÁÀ¸·Î ¸Þ½ÃÁö¸¦ Ãâ·ÂÇÑ´Ù.
*/
var zMsgUtil = new function() {
/*
°æ°íâ¿¡ ¸Þ½ÃÁö¸¦ Ãâ·ÂÇÑ´Ù.
*/
this.alert = function( msg )
{
alert( this.getMsg(arguments) );
} // end of function
/*
message code¿¡ µî·ÏµÈ ¸Þ½ÃÁö¸¦ ¸®ÅÏÇÑ´Ù.
*/
this.getMsg = function( inputMsg )
{
if( typeof arguments[ 0 ] == "object" ) arguments = arguments[ 0 ];
var argLen = arguments.length;
if( argLen == 0 ) return '';
var msg = arguments[0];
if(this.message) {
msg = this.message[ arguments[0] ] ? this.message[ arguments[0] ] : arguments[0];
}
if( argLen == 1 ) return msg.removeChr( '#' );
// bind @ to Input String (array)
var idx = 0;
for( var i = 1; i < argLen; i++ ) {
idx = msg.indexOf( "#", idx );
msg = msg.substr( 0, idx ) + String( arguments[i] ) + msg.substring( idx + 1 );
idx = idx + String( arguments[i] ).length;
}
return msg;
} // end of function
} // end of class
function isIE(flag)
{
if (window.navigator.userAgent.indexOf('MSIE') != -1) {
if (window.navigator.userAgent.indexOf('MSIE 8') != -1 && flag != 1) {
return false; //8.0Àº IE°¡ ¾Æ´Ñ°ÍÀ¸·Î °£ÁÖ(ÇÁ·Î±×·¥ ³Ê¹« ¸¹À» °÷À» ¼ÕºÁ¾ß ÇÑ´Ù.)
}
else {
return true;
}
} else {
return false;
}
}
String.prototype.zlength = function ()
{
return(this.length+(escape(this)+"%u").match(/%u/g).length-1);
}
//usage : variable.replaceAll
String.prototype.replaceAll = function(str1, str2)
{
var temp_str = "";
if (this.trim() != "" && str1 != str2)
{
temp_str = this.trim();
while (temp_str.indexOf(str1) > -1)
{
temp_str = temp_str.replace(str1, str2);
}
}
return temp_str;
}
//for cursor position : start
function getCurosorPosition (ctrl)
{
var CaretPos = 0;
if (document.selection) { // IE Support
var Sel = document.selection.createRange ();
Sel.moveStart ('character', -ctrl.value.length);
CaretPos = Sel.text.length;
}
else if (ctrl.selectionStart || ctrl.selectionStart == '0') {// Firefox support
CaretPos = ctrl.selectionStart;
}
return (CaretPos);
}
function setCursorPosition(ctrl, pos)
{
if(ctrl.setSelectionRange)
{
ctrl.setSelectionRange(pos,pos);
}
else if (ctrl.createTextRange) {
var range = ctrl.createTextRange();
range.collapse(true);
range.moveEnd('character', pos);
range.moveStart('character', pos);
range.select();
}
}
//for cursor position : end
String.prototype.getChrCount = function(ch)
{
var count = 0;
for(var i = 0; i < this.length; i++) {
if(this.substr(i, 1) == ch) count++;
}
return count;
}
function getByte(bsize)
{
var retsize = "";
bsize = parseInt(bsize, 10);
if(bsize < 1024) {retsize = bsize + " B";}
else if(bsize < (1024 * 1024)) {retsize = (bsize/1024).toFixed(2) + " K";}
else if(bsize < (1024 * 1024 * 1024)) {retsize = (bsize/(1024*1024)).toFixed(2) + " M";}
else if(bsize < (1024 * 1024 * 1024 * 1024)) {retsize = (bsize/(1024*1024*1024)).toFixed(2) + " G";}
else if(bsize < (1024 * 1024 * 1024 * 1024 * 1024)) {retsize = (bsize/(1024*1024*1024*1024)).toFixed(2) + " T";}
else retsize = bsize;
return retsize;
}
/******************* old common function *****************************/
function setDataOver(tr)
{
for(var i=0; i < tr.cells.length; i++) {
tr.cells[i].style.backgroundColor='#f5f5f5';
}
}
function setDataOut(tr)
{
for(var i=0; i < tr.cells.length; i++) {
tr.cells[i].style.backgroundColor='';
}
}
function getobj(id)
{
return document.getElementById(id);
}
/* µÎ°³ÀÇ ¹®ÀÚ¿ »çÀÌÀÇ ¹®ÀåÀ» °ËÃâÇØ ³»´Â ÇÔ¼ö */
function str_extract_java(value, start, end)
{
var tmp;
var stStr = eval("/"+start+"/");
var endStr = eval("/["+end+" ]+/g");
if ((value.search(stStr)) == -1)
return value;
tmp = value.split(start);
tmp = tmp[1];
tmp = tmp.replace(endStr, "");
return tmp;
}
function setCookie( name, value, expiredays )
{
var todayDate = new Date();
todayDate.setDate( todayDate.getDate() + expiredays );
document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}
function getCookie( 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 "";
}
// Áֹεî·Ï¹øÈ£ üũ
function checkJoomin(ssn)
{
var key = "234567892345";
var total = 0;
ssn = ssn.replaceAll("-", "");
if(ssn.length == 0) return false;
for(var i=0; i<12; i++)
{
total = total + ssn.charAt(i)*key.charAt(i);
}
total = 11 - (total % 11);
switch(total)
{
case 11:
total=1;
break;
case 10:
total=0;
break;
default:
total=total;
break;
}
if(ssn.charAt(12) != total)
{
return false;
}
return true;
}
// »ç¾÷ÀÚµî·Ï¹øÈ£ üũ
function checkBizNo(vencode)
{
/*
if (vencode.length == 10)
return true;
else
return false;
*/
vencode = vencode.trim();
vencode = vencode.replaceAll("-", "");
if (vencode.length != 10) return false;
if(vencode == "") return false;
//¾Æ·¡ÀÇ ·ÎÁ÷¿¡¼ 888-88-88888ÀÌ¸é ¹«Á¶°Ç Åë°úµÇ¹Ç·Î, 888-88-88888 ÀÌ¸é ¿À·ùó¸®
if(vencode == "8888888888") return false;
var sum = 0;
var getlist =new Array(10);
var chkvalue =new Array("1","3","7","1","3","7","1","3","5");
for(var i=0; i<10; i++) { getlist[i] = vencode.substring(i, i+1); }
for(var i=0; i<9; i++) { sum += getlist[i]*chkvalue[i]; }
sum = sum + parseInt((getlist[8]*5)/10, 10);
sidliy = sum % 10;
sidchk = 0;
if(sidliy != 0) { sidchk = 10 - sidliy; }
else { sidchk = 0; }
if(sidchk != getlist[9]) { return false; }
return true;
}
function hexa(numb){
var k=0;
var kk=0;
var str = "";
k = numb;
while(1) {
kk = k % 16;
k = Math.floor(k/16);
str = convert(kk) + str;
if (k == 0) break;
}
//str = convert(kk) + str;
return(str);
}
function convert(nr)
{
var chr;
if (nr==10){chr="A"}
else if (nr==11){chr="B"}
else if (nr==12){chr="C"}
else if (nr==13){chr="D"}
else if (nr==14){chr="E"}
else if (nr==15){chr="F"}
else {chr=nr;}
return(chr);
}
function imgReSize(imgWidth, imgHeight, maxWidth, imgObj)
{
if(imgWidth > maxWidth) {
heightValue = parseInt((maxWidth * imgHeight)/imgWidth, 10);
widthValue = maxWidth;
}
else {
heightValue = imgHeight;
widthValue = imgWidth;
}
imgObj.style.width = widthValue;
imgObj.style.height = heightValue;
}
function imgReSizeFixed(imgWidth,imgHeight,maxWidth,maxHeight, imgObj)
{
if (imgWidth > maxWidth)
{
widthValue = maxWidth;
}
else
{
widthValue = imgWidth;
}
WidthRate = (widthValue / imgWidth) ;
if (imgHeight > maxHeight)
{
heightValue = maxHeight ;
}
else
{
heightValue = imgHeight ;
}
HeightRate = (heightValue / imgHeight) ;
if (maxWidth == 0)
{
WidthRate = 100;
}
if (maxHeight == 0)
{
HeightRate = 100;
}
if (HeightRate < WidthRate)
{
widthValue = imgWidth * HeightRate ;
heightValue = imgHeight * HeightRate ;
}
else
{
widthValue = imgWidth * WidthRate;
heightValue = imgHeight * WidthRate;
}
imgObj.style.width = widthValue;
imgObj.style.height = heightValue;
}
function removeItems(obj, remainsize)
{
if(typeof(remainsize) == "undefined") remainsize = 0;
for(var k=obj.length ; k >= remainsize; k--) {
obj.remove(k);
}
}
function moveItems(sourceObj, targetObj, iscopy, dupcheck, removeitemonduple)
{
var newOpt;
var isduple = false;
var dupleindex = new Array();
var selindex = sourceObj.selectedIndex;
for(var k=0; k < targetObj.options.length; k++) targetObj.options[k].selected = false;
var cnt = sourceObj.options.length;
for(var k=0; k < cnt; k++) {
dupleindex[k] = 0;
if(sourceObj.options[k].value != "" && sourceObj.options[k].selected) {
var srcval = sourceObj.options[k].value;
/* Áߺ¹Ã¼Å© ½ÃÀÛ */
isduple = false;
if(dupcheck == true) {
for(var j=0; j < targetObj.options.length; j++) {
if(targetObj.options[j].value == srcval) {
isduple = true;
dupleindex[k] = 1;
}
}
}
if(isduple == true) continue;
/* Áߺ¹Ã¼Å© ³¡ */
var fnm = sourceObj.options[k].text;
var newOpt2 = new Option(fnm, srcval);
var selcnt = targetObj.options.length;
targetObj.options[selcnt]=newOpt2;
targetObj.options[selcnt].selected = true;
}
}
if(iscopy == false) {
for(var k=cnt-1 ; k >= 0; k--) {
if(sourceObj.options[k].value != "" && sourceObj.options[k].selected && (dupleindex[k] == 0 || (dupleindex[k] == 1 && removeitemonduple == true))) {
sourceObj.remove(k);
}
}
}
if(selindex == sourceObj.options.length) selindex = sourceObj.options.length -1;
if(selindex != -1) sourceObj.options[selindex].selected = true;
}
function moveItemUp(obj)
{
var selIndex = obj.selectedIndex;
var sText;
var sValue;
if(selIndex != 0 && selIndex != -1) {
var cnt = obj.options.length;
var isfirst = false;
for(var k=0; k < cnt; k++) {
if(obj.options[k].selected && isfirst == false) isfirst = true;
else obj.options[k].selected = false;
}
sValue = obj.options[selIndex-1].value;
sText = obj.options[selIndex-1].text;
obj.options[selIndex-1].value = obj.options[selIndex].value;
obj.options[selIndex-1].text = obj.options[selIndex].text;
obj.options[selIndex].value = sValue;
obj.options[selIndex].text = sText;
obj.options[selIndex].selected = false;
obj.options[selIndex-1].selected = true;
}
}
function moveItemDown(obj)
{
var opLength = obj.options.length;
var selIndex = obj.selectedIndex;
var sText;
var sValue;
if( selIndex != (opLength - 1) && selIndex != -1 ) {
var cnt = obj.options.length;
var isfirst = false;
for(var k=0; k < cnt; k++) {
if(obj.options[k].selected && isfirst == false) isfirst = true;
else obj.options[k].selected = false;
}
sValue = obj.options[selIndex+1].value;
sText = obj.options[selIndex+1].text;
obj.options[selIndex+1].value = obj.options[selIndex].value;
obj.options[selIndex+1].text = obj.options[selIndex].text;
obj.options[selIndex].value = sValue;
obj.options[selIndex].text = sText;
obj.options[selIndex].selected = false;
obj.options[selIndex+1].selected = true;
}
}
function getNumberFormat(str)
{
str = String(str);
var str2 = "";
var j = 0;
var minus = str.substring(0, 1);
if(minus == "-" && minus == str) return str;
if(minus == "-") {
str = str.substring(1, str.length);
}
for(i=str.length; i > 0 ;i--) {
ch = str.substring(i, i-1);
str2 = ch + str2;
j++;
if(j%3 == 0) str2 = "," + str2;
}
if(j%3 == 0) str2 = str2.substring(1, str2.length);
if(minus == "-") str2 = minus + str2;
return str2;
}
function getDateFormat(str, orgstr, ikeycode)
{
var str2 = "";
var j = 0;
var len = str.length;
if(ikeycode == 8) {
if(orgstr.length == 5) return str.substring(0, 4);
if(orgstr.length == 4) return str.substring(0, 3);
}
if(len >= 4) {
str2 = str.substring(0, 4);
if(len >= 6) {
var month = str.substring(4, 6);
if(len == 6 && (parseInt(month, 10) < 1 || parseInt(month, 10) > 12)) {
str2 += "-" + str.substring(4, 5);
return(str2);
}
str2 += "-" + month;
var day = str.substring(6);
if(len == 8) {
if(parseInt(day, 10) < 1 || parseInt(day, 10) > 31) {
str2 += "-" + str.substring(6, 7);
return(str2);
}
str2 += "-" + day;
}
else if(len == 7) {
if(parseInt(day, 10) < 1 || parseInt(day, 10) > 31) {
str2 += "-" + day;
return(str2);
}
str2 += "-" + day;
}
}
else str2 += "-" + str.substring(4);
return str2;
}
else return str;
}
function getBiznoFormat(str)
{
var len = str.length;
if(len <= 3) return str;
else if(len <= 5) return str.substr(0, 3) + "-" + str.substr(3, 2);
else if(len <= 10) return str.substr(0, 3) + "-" + str.substr(3, 2) + "-" + str.substr(5, 5);
}
function getAreaLength(str)
{
if(str.substring(0, 2) == "02") return {arealen:2,maxlen:10};
else if(str.substring(0, 2) == "15" || str.substring(0, 2) == "16") return {arealen:4,maxlen:8};
else {
var areacode = str.substring(0, 3);
if(areacode == "050" || areacode == "013") return {arealen:4,maxlen:12};
else return {arealen:3,maxlen:11};
}
}
function getTelFormat(str)
{
var str2 = "";
var j = 0;
var len = str.length;
if(len < 2) return str;
var noinfo = getAreaLength(str);
if(len > noinfo.maxlen) str = str.substr(0, noinfo.maxlen);
retstr = str.substr(0, noinfo.arealen);
var telno = str.substr(noinfo.arealen);
var tellen = telno.length;
if(tellen == 0) return retstr;
if(tellen < 8) {
if(tellen <= 3) {
retstr = retstr + "-" + telno.substr(0, len);
}
else {
if(noinfo.maxlen == 8) {
retstr = retstr + "-" + telno.substr(0, 4);
}
else {
retstr = retstr + "-" + telno.substr(0, 3) + "-" + telno.substr(3);
}
}
}
else {
retstr = retstr + "-" + telno.substr(0, 4) + "-" + telno.substr(4, 4);
}
return retstr;
}
function getSSNFormat(str)
{
var len = str.length;
if(len < 7) return str;
else return str.substr(0, 6) + "-" + str.substr(6, 7);
}
function getCardFormat(str)
{
var len = str.length;
if(len < 4) return str;
else if(len <= 8) return str.substr(0, 4) + "-" + str.substr(4, 4);
else if(len <= 12) return str.substr(0, 4) + "-" + str.substr(4, 4) + "-" + str.substr(8, 4);
else if(len <= 16) return str.substr(0, 4) + "-" + str.substr(4, 4) + "-" + str.substr(8, 4) + "-" + str.substr(12, 4);
}
function getXY(obj)
{
if(typeof obj != "object") return {left:0,top:0};
for (var sumTop=0,sumLeft=0;obj!=document.body;sumTop+=obj.offsetTop,sumLeft+=obj.offsetLeft, obj=obj.offsetParent) {
if(obj.tagName == "HTML") break;
}
return {left:sumLeft,top:sumTop};
}
function showFlash(url,w,h,id,bg,vars,win){
// Ç÷¡½Ã ÄÚµå Á¤ÀÇ
var flashStr=
"";
// Ç÷¡½Ã ÄÚµå Ãâ·Â
document.write(flashStr);
}
function isValidDate(datestr)
{
var MonthName = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
datestr = datestr.trim();
if (datestr.indexOf("-")!=-1){
var sdate = datestr.split("-")
}
else {
var sdate = datestr.split("/")
}
if(sdate[0].length == 4) {
//2006-08-22
if(sdate[1].length != 2 || sdate[2].length != 2) return false;
var tmpmonth = parseInt(sdate[1] - 1, 10);
datestr = MonthName[tmpmonth] + " " + parseInt(sdate[2], 10) + ", " + parseInt(sdate[0], 10);
}
else {
//08-22-2006
if(sdate[0].length != 2 || sdate[1].length != 2) return false;
var tmpmonth = parseInt(sdate[0] - 1, 10);
datestr = MonthName[tmpmonth] + " " + parseInt(sdate[1], 10) + ", " + parseInt(sdate[2], 10);
}
var chkDate=new Date(Date.parse(datestr));
var cmpDate="";
if(isIE(1)) cmpDate = chkDate.getYear()+"-"+ parseInt(chkDate.getMonth()+1, 10)+"-"+(chkDate.getDate());
else cmpDate = parseInt(1900 + chkDate.getYear())+"-"+ parseInt(chkDate.getMonth()+1, 10)+"-"+(chkDate.getDate());
var datestr2=(Math.abs(sdate[0]))+"-"+(Math.abs(sdate[1]))+"-"+(Math.abs(sdate[2]))
if(datestr2 != cmpDate){
return false;
}
else {
if(cmpDate == "NaN/NaN/NaN"){
return false;
}
else {
return true;
}
}
}
function fillChr(str, fillch, len)
{
var str2 = String(str);
var intlen = str2.length;
if( intlen >= len ) return str;
for(var i=0; i < len - intlen; i++) {
str2 = fillch + str2;
}
return str2;
}
function getValidDateFormat(datestr)
{
if(datestr == "") return datestr;
if (datestr.indexOf("-")!=-1){
var sdate = datestr.split("-")
}
else {
var sdate = datestr.split("/")
}
if(sdate[0].length == 4) {
datestr = sdate[0] + "-" + fillChr(parseInt(sdate[1], 10), "0", 2) + "-" + fillChr(parseInt(sdate[2], 10), "0", 2);
}
else {
datestr = sdate[2] + "-" + fillChr(parseInt(sdate[0], 10), "0", 2) + "-" + fillChr(parseInt(sdate[1], 10), "0", 2);
}
return datestr;
}
function iframe_reset()
{
dataobj=document.all? document.all.pagecontent : document.getElementById("pagecontent");
dataobj0=document.all? parent.document.all.clubmain : parent.document.getElementById("clubmain");
if(dataobj == null || dataobj0 == null ) return;
dataobj.style.top=0;
dataobj.style.left=0;
pagelength=dataobj.offsetHeight;
if(pagelength < 650) pagelength = 650;
dataobj0.height = pagelength+20;
}
/* radio °´Ã¼Áß ¼±ÅÃµÈ °´Ã¼ÀÇ index¸¦ return */
function getRadioIdx(obj)
{
if( obj == undefined )
{
return -1;
}
//radio Ç׸ñÀÌ Çϳª Àΰܿì,
if(obj.length == undefined)
{
if(obj.checked == true) return 1; //Çϳª°¡ ¼±ÅõǾúÀ¸¸é..
else return -1; //¼±ÅõÇÁö ¾Ê¾ÒÀ¸¸é..
}
for(var i=0; i < obj.length; i++)
{
if( obj[i].checked == true )
{
return i;
}
}
return -1;
}
/* radio °´Ã¼Áß ¼±ÅÃµÈ °´Ã¼ÀÇ value¸¦ return */
function getRadioValue(obj)
{
if( obj == undefined )
{
alert('°´Ã¼°¡ Á¸ÀçÇÏÁö ¾Ê½À´Ï´Ù.');
return '';
}
//radio Ç׸ñÀÌ Çϳª Àΰܿì,
if(obj.length == undefined)
{
if(obj.checked == true) return obj.value; //Çϳª°¡ ¼±ÅõǾúÀ¸¸é..
else return ''; //¼±ÅõÇÁö ¾Ê¾ÒÀ¸¸é..
}
for(var i=0; i < obj.length; i++)
{
if( obj[i].checked == true )
{
return obj[i].value;
}
}
return '';
}
function getCheckedCounter(obj)
{
if( obj == undefined ) return 0;
var chkcnt = 0;
for(var i=0; i < obj.length; i++) {
if(obj[i].checked) chkcnt++;
}
return chkcnt;
}
function checkFileType(str, exts)
{
str = str.trim();
if(str == "") return false;
str = str.toLowerCase();
var extpos = str.lastIndexOf(".");
var ext = str.substring(extpos+1);
arrExts = exts.split(",");
for(var i=0; i < arrExts.length; i++) {
if(ext == arrExts[i].trim()) return true;
}
return false;
}
function innerText(htmlStr)
{
var strRegExp = /<\/?[^>]+>/gi;
return htmlStr.replace(strRegExp, "");
}
function isValidRGB(color)
{
if(IsAlphaNumeric(color) == false) return false;
for(i=0;i 'F') return false;
}
return true;
}
function removeRow(oTable, curTr)
{
for(var i=0; i <= oTable.rows.length; i++) {
if(oTable.rows[i] == curTr) {
oTable.rows[i].removeNode(true);
break;
}
}
}
function getCurTrNo(oTable, curTr)
{
for(var i=0; i <= oTable.rows.length; i++) {
if(oTable.rows[i] == curTr) {
return i;
break;
}
}
return -1;
}
function getCurTr()
{
if (!e) var e=window.event;
var S=e.srcElement;
var curTr=S.parentElement.parentElement;
return curTr;
}
function addZero(str)
{
return ((str < 10) ? "0" : "") + str;
}
function getdateformat(year,month,day)
{
month++;
var format = "%Y-%m-%d";
var Y = year;
var y = year.toString().substr(2,2);
var m = addZero(month);
var d = addZero(day);
format = format.replace(/%Y/g, Y);
format = format.replace(/%y/g, y);
format = format.replace(/%m/g, m);
format = format.replace(/%d/g, d);
return format;
}
function oneday(startobj, endobj, flag)
{
var date = new Date;
var Y = date.getFullYear();
var m = date.getMonth();
var d = date.getDate();
endobj.value = getdateformat(Y, m, d);
startobj.value = endobj.value;
}
function oneweek(startobj, endobj, flag)
{
var date = new Date;
var Y = date.getFullYear();
var m = date.getMonth();
var d = date.getDate();
if(flag == true) {
endobj.value = getdateformat(Y, m, d);
startobj.value = relativeDate(endobj.value, -6);
}
else {
startobj.value = getdateformat(Y, m, d);
endobj.value = relativeDate(startobj.value, 6);
}
}
function onemonth(startobj, endobj, flag)
{
var date = new Date;
var Y = date.getFullYear();
var m = date.getMonth();
var d = date.getDate();
if(flag == true) {
endobj.value = getdateformat(Y, m, d);
startobj.value = relativeMonth(endobj.value, -1);
}
else {
startobj.value = getdateformat(Y, m, d);
endobj.value = relativeMonth(startobj.value, 1);
}
}
function threemonth(startobj, endobj, flag)
{
var date = new Date;
var Y = date.getFullYear();
var m = date.getMonth();
var d = date.getDate();
if(flag == true) {
endobj.value = getdateformat(Y, m, d);
startobj.value = relativeMonth(endobj.value, -3);
}
else {
startobj.value = getdateformat(Y, m, d);
endobj.value = relativeMonth(startobj.value, 3);
}
}
function alldays(startobj, endobj, chkobj)
{
if(chkobj) chkobj.value = "Y";
endobj.value = "";
startobj.value = "";
}
function fromfirstday(startobj, endobj)
{
var date = new Date;
var Y = date.getFullYear();
var m = date.getMonth();
var d = date.getDate();
endobj.value = getdateformat(Y, m, d);
startobj.value = getdateformat(Y, m, 1);
}
/**
* Function : ±âÁØÀÏÀÇ »ó´ëÀûÀÎ ³âµµ¸¦ °è»êÇÑ ³¯Â¥¸¦ ±¸ÇÑ´Ù.
* @param : bastDt - ±âÁØÀÏ
* : n - »ó´ëÀû ³âµµ¼ö
* @return : String - °è»êµÈ ÀÏÀÚ
*/
function relativeYear(bastDt, n)
{
return relativeMonth(bastDt, n*12);
}
/**
* Function : ±âÁØÀÏÀÇ »ó´ëÀûÀÎ °³¿ù¸¦ °è»êÇÑ ³¯Â¥¸¦ ±¸ÇÑ´Ù.
* @param : bastDt - ±âÁØÀÏ
* : n - »ó´ëÀû °³¿ù¼ö
* @return : String - °è»êµÈ ÀÏÀÚ
*/
function relativeMonth(bastDt, n)
{
var oldDate, newLastDate;
var oDestDate = null;
//±âÁØÀÏ Å¸ÀÔÀÌ Date °´Ã¼
if (typeof bastDt == "object") { oDestDate = bastDt; }
//±âÁØÀÏ Å¸ÀÔÀÌ String °´Ã¼
else { oDestDate = castDateType( bastDt ); }
// ÇöÀç ÀÏÀÚ¸¦ ¹é¾÷ÇØ µÎ°í 1ÀÏ·Î ¼¼ÆÃÇÑ ÈÄ »ó´ëÀûÀÎ °³¿ù °è»êÈÄ ´Ù½Ã ÇöÀçÀÏÀÚ¸¦ º¹¿øÇÑ´Ù.
// ÀÌÀ¯) ±¸ÇÏ´Â »ó´ëÀÏÀÚÀÇ ³â¿ùÀÇ ¸¶Á÷¸· ÀÏÀÚ°¡ ÇöÀçÀÇ ÀÏÀÚº¸´Ù ÀûÀ» °æ¿ì
// »ó´ëÀÏÀÚÀÇ ¸¶Áö¸·ÀÏÀÚ·Î ¼¼ÆÃÇØ¾ß ÇÔ
// ¿¹> 20050731 ÀÇ ÇÑ´ÞÀüÀ» ÀÏÀÚ´Â 20050631(X) °¡ ¾Æ´Ï°í 20050630 ÀÌ´Ù.
oldDate = oDestDate.getDate();
oDestDate.setDate(1);
//»ó´ëÀûÀÎ °³¿ù °è»ê
oDestDate.setMonth( oDestDate.getMonth() + n );
//»ó´ëÀûÀÎ ³â¿ùÀÇ ¸¶Áö¸· ÀÏÀÚ¿Í ÀÌÀü ³â¿ù ÀÏÀÚ¸¦ ºñ±³ÇÑ ÈÄ Å¸´çÇÑ ÀÏÀÚ¸¦ ¼¼ÆÃ
//¿¹> 20050731 ÀÇ ÇÑ´ÞÀüÀ» ÀÏÀÚ´Â 20050631(X) °¡ ¾Æ´Ï°í 20050630 ÀÌ´Ù.
var nTmp = oDestDate.getYear().toString();
if ( nTmp.length == 2 ) { nTmp = "19" + nTmp; }
else if( nTmp.length == 3) { nTmp = parseInt(nTmp, 10) + 1900;}
newLastDate = getDaysInMonth( eval(nTmp), oDestDate.getMonth()+1 );
if(oDestDate.getMonth()+1 == 2) { //2¿ù´Þ¿¡ ´ëÇØ¼..
if(oldDate > getDaysInMonth(eval(nTmp), oDestDate.getMonth()+1)) {
oDestDate.setDate(newLastDate);
}
else {
oDestDate.setDate(oldDate - 1);
}
}
else {
if ( oldDate > newLastDate ) { oDestDate.setDate(newLastDate); }
else oDestDate.setDate(oldDate - 1);
}
if ( bastDt.length == 6 ) { return castStrType( oDestDate, "yyyyMM" ); }
else { return castStrType( oDestDate ); }
}
/**
* Function : ±âÁØÀÏÀÇ »ó´ëÀûÀÎ ÀÏÀÚ¸¦ °è»êÇÑ ³¯Â¥¸¦ ±¸ÇÑ´Ù.
* @param : bastDt - ±âÁØÀÏ
* : n - »ó´ëÀû ÀÏÀÚ¼ö
* @return : String - °è»êµÈ ÀÏÀÚ
*/
function relativeDate(bastDt, n)
{
var oDestDate = null;
//±âÁØÀÏ Å¸ÀÔÀÌ Date °´Ã¼
if (typeof bastDt == "object") { oDestDate = bastDt; }
//±âÁØÀÏ Å¸ÀÔÀÌ String °´Ã¼
else { oDestDate = castDateType( bastDt ); }
oDestDate.setDate(oDestDate.getDate() + n);
return castStrType( oDestDate );
}
/**
* Function : String Çü½ÄÀ» Date Çü½ÄÀ¸·Î º¯È¯
* @param : strDate - String Çü½ÄÀÇ ³¯Â¥.
* @return : Date - º¯È¯µÈ Date Çü½ÄÀÇ °´Ã¼
*/
function castDateType( strDate )
{
/*
if ( !isValidDate( strDate ) )
{
dialogError("À¯È¿ÇÑ ÀÏÀÚ Çü½ÄÀÌ ¾Æ´Õ´Ï´Ù.(¿¹:20058010)");
return null;
}
*/
var dtRtn = null;
if ( strDate.length == 6 ) { strDate += "01"; }
//Æ÷¸ËÀ» °¡Áø ÇüÅ·ΠÀü´ÞµÇ¾úÀ» °æ¿ì. (¿¹ 2005.01.01)
if ( strDate.length == 10 )
{
var aDate = strDate.split( strDate.substring(4, 5) );
dtRtn = new Date(aDate[0], eval(aDate[1])-1, aDate[2]);
}
//Æ÷¸ËÀÌ ¾ø´Â ÇüÅ·ΠÀü´ÞµÇ¾úÀ» °æ¿ì. (¿¹ 20050101)
else if (strDate.length == 8 )
{
var year = eval(strDate.substring(0, 4));
var month = eval(strDate.substring(4, 6));
var date = eval(strDate.substring(6, 8));
dtRtn = new Date(year, month-1, date);
}
else
{
throw "ºÎÀûÇÕÇÑ ³¯Â¥ Çü½ÄÀÔ´Ï´Ù.(" + strDate + ")";
}
return dtRtn;
}
/**
* Function : Date Çü½ÄÀ» String Çü½ÄÀ¸·Î º¯È¯
* @param : dtDate - Date Çü½ÄÀÇ ³¯Â¥.
* : delm - ³¯Â¥ÀÇ Æ÷¸Ë ±¸ºÐÀÚ (¿¹ '.' -> 2005.08.01 )
* @return : String - º¯È¯µÈ String Çü½ÄÀÇ °´Ã¼
*/
function castStrType( dtDate, format )
{
var re = "";
var delm = "-";
if ( format == null ) { format = "yyyyMMdd"; }
for (var i=0; i= 0; k--) {
obj.remove(k);
}
}
function addListItem(obj, val, txt)
{
var newOpt = new Option(txt, val);
var selcnt = obj.options.length;
obj.options[selcnt]=newOpt;
}