/**
* ************************************************
* ¾÷¹«±×·ì¸í : °øÅë ÀÚ¹Ù½ºÅ©¸³Æ®
* ¼ºê¾÷¹«¸í : ¾÷¹«¿ë °øÅë ÀÚ¹Ù½ºÅ©¸³Æ®
* ¼³¸í :
* ÀÛ¼ºÀÚ : ±è¼®Ã¶ (indark9@gmail.com)
* ÀÛ¼ºÀÏ : 2007. 7. 31 ¿ÀÈÄ 5:25:55
* *************************************************
*/
/*
[Function Category]
A. Object °ü·Ã ÇÔ¼ö.
B. String °ü·Ã ÇÔ¼ö.
C. Numeric °ü·Ã·ÃÇÔ¼ö.
D. Date °ü·Ã ÇÔ¼ö.
E. Form °ü·Ã ÇÔ¼ö.
F. Cookie °ü·Ã ÇÔ¼ö.
G. URI¹× Window °ü·Ã ÇÔ¼ö.
[Function List]
A-1. showProps ÀÔ·Â °´Ã¼¿¡ ¼ÓÇÑ ¸ðµç ¼Ó¼º°ú ÇÔ¼ö¸¦ º¸¿©ÁØ´Ù.
A-2. isObject ÀÔ·Â °´Ã¼°¡ ½ÇÁ¦·Î ÆäÀÌÁö»ó¿¡ Á¸ÀçÇÏ´Â HTML°´Ã¼ÀÎÁö¸¦ °Ë»çÇÑ´Ù.
A-3. isArray ÀÔ·Â °´Ã¼°¡ Array ÇüÅÂÀÎÁö °Ë»çÇÑ´Ù.
B-1. trim ÀÔ·Â ¹®ÀÚ¿ÀÇ ¾ÕµÚ °ø¹é(white space)À» Á¦°ÅÇÑ´Ù.
B-2. trimByFront ÀÔ·Â ¹®ÀÚ¿ÀÇ ¾Õ¿¡¼ °ø¹é(white space)À» Á¦°ÅÇÑ´Ù.
B-3. trimByBack ÀÔ·Â ¹®ÀÚ¿ÀÇ µÚ¿¡¼ °ø¹é(white space)À» Á¦°ÅÇÑ´Ù.
B-4. isNull ÀÔ·Â °´Ã¼ÀÇ °ªÀÌ ³Î(null)ÀÎÁö¸¦ °Ë»çÇÑ´Ù.
B-5. strlen ÀÔ·Â °´Ã¼ÀÇ ¹ÙÀÌÆ®´ÜÀ§ÀÇ ±æÀ̸¦ ±¸ÇÑ´Ù.
B-6. removeSpace ¹®ÀÚ¿ÀÇ °ø¹é(white space)À» Á¦°ÅÇÑ´Ù.
B-7. insertComma ¹®ÀÚ¿À» µÚ¿¡¼ºÎÅÍ 3ÀÚ¸®¾¿ ,(comma)·Î ²÷´Â´Ù.
B-8. removeComma ,(comma)¸¦ »èÁ¦ÇÑ´Ù.
B-9. replace ¹®ÀÚ¿À» ±³È¯ÇÑ´Ù.
B-10. removeString ÀÔ·Â ¹®ÀÚ¿ÀÇ ÁöÁ¤¹®ÀÚ¸¦ Á¦°ÅÇÑ´Ù.
B-11. parseSubLocationCodes ´ë»ó ¹®ÀÚ¿ ¿ÞÂÊ¿¡ '0'¹®ÀÚ¸¦ µ¡ºÙ¿©ÁØ´Ù.
B-12. eliminateZero ´ë»ó ¹®ÀÚ¿¿¡ '0'¹®ÀÚ¸¦ Á¦°ÅÇÑ´Ù.
B-13. convertBr ¹®ÀÚ¿ÀÇ ¿£ÅÍÅ° °ªÀ»
ű׷Πº¯È¯ÇÑ´Ù.
C-1. getRandom ÁöÁ¤ÇÑ ÀÚ¸®¼öÀÇ ³¼ö¸¦ ¹ß»ý½ÃŲ´Ù.
C-2. toInteger ¼Ò¼öÁ¡À» Æ÷ÇÔÇÑ ¼ýÀÚ¸¦ ¼Ò¼öÁ¡À» Á¦°ÅÇÑ Á¤¼ö·Î º¯È¯ÇÑ´Ù.
C-3. toReal ¼Ò¼öÁ¡À» Æ÷ÇÔÇÏÁö ¾ÊÀº ¼ýÀÚ¸¦ ¼Ò¼öÁ¡À» Æ÷ÇÔÇÑ ½Ç¼ö·Î º¯È¯ÇÑ´Ù.
D-1. toTimeString ÀÚ¹Ù½ºÅ©¸³Æ® Date °´Ã¼¸¦ Time ¹®ÀÚ¿·Î º¯È¯ÇÑ´Ù.
D-2. toTimeObject Time ½ºÆ®¸µÀ» ÀÚ¹Ù½ºÅ©¸³Æ® Date °´Ã¼·Î º¯È¯ÇÑ´Ù.
D-3. getCurrentTime ÇöÀç ½Ã°¢À» Time Çü½ÄÀ¸·Î ¸®ÅÏÇÑ´Ù.
D-4. getYear ÇöÀç Ò´À» YYYYÇü½ÄÀ¸·Î ¸®ÅÏ
D-5. getMonth ÇöÀç êÅÀ» MMÇü½ÄÀ¸·Î ¸®ÅÏ
D-6. getDay ÇöÀç ìíÀ» DDÇü½ÄÀ¸·Î ¸®ÅÏ
D-7. getDayOfWeek ¿À´Ã³¯Â¥¿¡ ÇØ´çÇÏ´Â ¿äÀÏÀ» ±¸ÇÑ´Ù.
D-8. shiftTime ÁÖ¾îÁø Time °ú y³â m¿ù dÀÏ h½Ã Â÷À̳ª´Â TimeÀ» ±¸ÇÑ´Ù.
D-9. getHourBefore ÇöÀç·ÎºÎÅÍ ÁöÁ¤ÇÑ ¸¸ÅÀÇ ÀÌÀü½Ã°£À» ±¸ÇÑ´Ù.
D-10. getDayBefore ÇöÀç·ÎºÎÅÍ ÁöÁ¤ÇÑ ¸¸ÅÀÇ ÀÌÀüÀÏÀ» ±¸ÇÑ´Ù.
D-11. getMonthBefore ÇöÀç·ÎºÎÅÍ ÁöÁ¤ÇÑ ¸¸ÅÀÇ ÀÌÀü¿ùÀ» ±¸ÇÑ´Ù.
D-12. getYearBefore ÇöÀç·ÎºÎÅÍ ÁöÁ¤ÇÑ ¸¸ÅÀÇ ÀÌÀü¿¬µµ¸¦ ±¸ÇÑ´Ù.
D-13. getHourAfter ÇöÀç·ÎºÎÅÍ ÁöÁ¤ÇÑ ¸¸ÅÀÇ ÀÌÈĽð£À» ±¸ÇÑ´Ù.
D-14. getDayAfter ÇöÀç·ÎºÎÅÍ ÁöÁ¤ÇÑ ¸¸ÅÀÇ ÀÌÈÄÀϸ¦ ±¸ÇÑ´Ù.
D-15. getMonthAfter ÇöÀç·ÎºÎÅÍ ÁöÁ¤ÇÑ ¸¸ÅÀÇ ÀÌÈÄ¿ùÀ» ±¸ÇÑ´Ù.
D-16. getYearAgter ÇöÀç·ÎºÎÅÍ ÁöÁ¤ÇÑ ¸¸ÅÀÇ ÀÌÈÄ¿¬µµ¸¦ ±¸ÇÑ´Ù.
D-17. getMonthInterval µÎ ½Ã°£ÀÌ ¸î °³¿ù Â÷ÀÌÀÎÁö ±¸ÇÑ´Ù.
D-18. getDayInterval µÎ ½Ã°£ÀÌ ¸îÀÏ Â÷ÀÌÀÎÁö ±¸ÇÑ´Ù.
D-19. getHourInterval µÎ ½Ã°£ÀÌ ¸î½Ã°£ Â÷ÀÌÀÎÁö ±¸ÇÑ´Ù.
D-20. isLeapYear À±³â¿©ºÎ¸¦ ³ªÅ¸³½´Ù.
D-21. ValidFormattedDate °ªÀÌ YYYY-MM-DD Çü½ÄÀÌ ¸Â´ÂÁö °Ë»çÇÑ´Ù.
D-22. tranFormatForView YYYYMMDD Çü½ÄÀÇ ³¯ÀÚ¸¦ YYYY-MM-DD ¶Ç´Â YYYY³â MM¿ù DDÀÏ·Î º¯È¯ÇÑ´Ù.
F-1. setCookie ÄíÅ°°ªÀ» ÁöÁ¤ÇÑ´Ù.
F-2. getCookie ÄíÅ°°ªÀ» °¡Á®¿Â´Ù.
F-3. deleteCookie ÁöÁ¤ÇÑ ÄíÅ°À̸§ÀÇ ÄíÅ°¸¦ »èÁ¦ÇÑ´Ù.
G-1. openWindow »õâÀ» ÁöÁ¤ÇÑ ¿É¼ÇÀ¸·Î ¶ç¿î´Ù.
[variables]
contextPath ÄÁÅؽºÆ® Æнº¸¦ ÁöÁ¤ÇÑ´Ù.
*/
//var gFunctionName;
//disableRightButton();
//enableEnterKey();
var ContextPath = "/land_info";
/**
* A-1. ÀÔ·Â °´Ã¼¿¡ ¼ÓÇÑ ¸ðµç ¼Ó¼º°ú ÇÔ¼ö¸¦ º¸¿©ÁØ´Ù.
*
* @param obj HTML °´Ã¼ id ¶Ç´Â °´Ã¼ name
* @return
*/
function showProps(obj)
{
var msg = "";
var i = 0;
var prop;
if (obj)
{
for (prop in obj)
{
i++;
msg = msg + i + ". " + prop + "=" + obj[prop] + "\n";
}
msg = "°´Ã¼ÀÇ ¼Ó¼º [ÃÑ " + i + "°Ç]\n\n" + msg;
return msg;
}
return "ÀÎÀÚ·Î °´Ã¼°¡ ÀԷµǾî¾ß ÇÕ´Ï´Ù";
}
/**
* A-2. ÀÔ·Â °´Ã¼°¡ ½ÇÁ¦·Î ÆäÀÌÁö»ó¿¡ Á¸ÀçÇÏ´Â HTML°´Ã¼ÀÎÁö¸¦ °Ë»çÇÑ´Ù.
*
* @param obj °´Ã¼ ID
* @return
*/
function isObject(obj)
{
return typeof(obj) == "object";
}
/**
* A-3. ÀÔ·Â °´Ã¼°¡ Array ÇüÅÂÀÎÁö °Ë»çÇÑ´Ù.
*
* @param obj °´Ã¼ ID
* @return
*/
function isArray(obj)
{
return typeof(obj) == "object" && typeof(obj[0]) == "object";
}
/**
* B-1. ÀÔ·Â ¹®ÀÚ¿ÀÇ ¾ÕµÚ °ø¹é(white space)À» Á¦°ÅÇÑ´Ù.
*
* @param str ¹®ÀÚ¿
* @return
*/
function trim(str)
{
var n = str.length;
var i;
for (i = 0; i < n; i++)
{
if (str.charAt(i) != " ")
{
break;
}
}
var j;
for (j = n - 1; j >= 0; j--)
{
if (str.charAt(j) != " ")
{
break;
}
}
if (i > j)
{
return "";
}
else
{
return str.substring(i, j + 1);
}
}
/**
* B-2. ÀÔ·Â ¹®ÀÚ¿ÀÇ ¾Õ¿¡¼ °ø¹é(white space)À» Á¦°ÅÇÑ´Ù.
*
* @param str ¹®ÀÚ¿
* @return
*/
function trimByFront(str)
{
var n = str.length;
var i;
for (i = 0; i < n; i++)
{
if (str.charAt(i) != " ")
{
break;
}
}
return str.substring(i);
}
/**
* B-3. ÀÔ·Â ¹®ÀÚ¿ÀÇ µÚ¿¡¼ °ø¹é(white space)À» Á¦°ÅÇÑ´Ù.
*
* @param str ¹®ÀÚ¿
* @return
*/
function trimByBack(str)
{
var n = str.length;
var j;
for (j = n - 1; j >= 0; j--)
{
if (str.charAt(j) != " ")
{
break;
}
}
return str.substring(0, j + 1);
}
/**
* B-4. ÀÔ·Â °´Ã¼ÀÇ °ªÀÌ ³Î(null)ÀÎÁö¸¦ °Ë»çÇÑ´Ù.
*
* @param str ¹®ÀÚ¿
* @return
*/
function isNull(str)
{
return strlen(str) == 0;
}
/**
* B-5. ÀÔ·Â °´Ã¼ÀÇ ¹ÙÀÌÆ®´ÜÀ§ÀÇ ±æÀ̸¦ ±¸ÇÑ´Ù.
*
* @param obj °´Ã¼ ID
* @return
*/
function strlen(str)
{
var j = 0;
for (var i = 0; i < str.length; i++)
{
if (escape(str.charAt(i)).length == 6) j++;
j++;
}
return(j);
}
/**
* B-6. ¹®ÀÚ¿ÀÇ °ø¹é(white space)À» Á¦°ÅÇÑ´Ù.
*
* @param str ¹®ÀÚ¿
* @return
*/
function removeSpace(str)
{
return removeString(str, " ");
}
/**
* B-7. ¹®ÀÚ¿À» µÚ¿¡¼ºÎÅÍ 3ÀÚ¸®¾¿ ,(comma)·Î ²÷´Â´Ù.
*
* @param str ¹®ÀÚ¿
* @return ,(comma)°¡ »ðÀÔµÈ ¹®ÀÚ¿
*/
function insertComma(str)
{
str = removeComma(str);
var strIdx = str.indexOf(".");
if (strIdx == -1)
{
return insertCharacterByBack(str, ",", 3);
}
else
{
var str1 = str.substring(0, strIdx);
var str2 = str.substring(strIdx);
return insertCharacterByBack(str1, ",", 3) + str2;
}
}
/**
* B-8. ,(comma)¸¦ »èÁ¦ÇÑ´Ù.
*
* @param str ¹®ÀÚ¿
* @return
*/
function removeComma(str)
{
return removeString(str, ",");
}
/**
* B-9. ¹®ÀÚ¿À» ±³È¯ÇÑ´Ù.
*
* @param source Àüü ¹®ÀÚ¿
* @param target ¹Ù²Ù±æ ¿øÇÏ´Â ¹®ÀÚ¿
* @param replace ¹Ù²Ü ¹®ÀÚ¿
* @return
*/
function replace(source, target, replace)
{
var sourceData = "";
sourceData = source;
if (sourceData == null) return "";
if (target == null || target == "") return source;
var iTargetLen = target.length;
var sbfReplace = "";
var i = 0;
var j = 0;
while (j > -1)
{
j = sourceData.indexOf(target, i);
if (j > -1)
{
sbfReplace += sourceData.substring(i, j);
sbfReplace += replace;
i = j + iTargetLen;
}
}
sbfReplace += sourceData.substring(i, sourceData.length);
return sbfReplace;
}
/**
* B-10. ÀÔ·Â ¹®ÀÚ¿ÀÇ ÁöÁ¤¹®ÀÚ¸¦ Á¦°ÅÇÑ´Ù.
*
* @param str ¹®ÀÚ¿
* @return
*/
function removeString(str, delStr)
{
var newVal = "";
var n = str.length;
for (var i = 0; i < n; i++)
{
if (str.charAt(i) != delStr) {
newVal += str.charAt(i);
}
}
return newVal;
}
/**
* B-11. ÀÔ·Â ¹®ÀÚ¿¿¡ '0'À» ¾Õ¿¡ ºÙ¿©ÁØ´Ù.
*@param code ´ë»ó ¹®ÀÚ¿
*@param limit ¿øÇÏ´Â Å©±â
*@return
*
*/
function addZeroCode(code, limit) {
var length=code.length;
var result="";
for(var i=length;i ű׷Πº¯È¯ÇÑ´Ù.
*@param str ´ë»ó ¹®ÀÚ¿
*@return
*IE9¿¡¼ ¿£ÅÍ.. ÀÎ½Ä ¹®Á¦ ÆÐÄ¡ by shinalf 2011.11.07
*/
function convertBr(str){
var memo = "\n";
//IE¹öÀü °¡Á®¿À±â
var ie = getInternetExplorerVersion();
for(var i=0; i=9 || ie==-1){
if( (str.charCodeAt(i)==10)){
memo +="
";
}else{
memo += str.charAt(i);
}
}else{
if( (str.charCodeAt(i)==13) && ( str.charCodeAt(i+1)==10)){
i++;
memo +="
";
}else{
memo += str.charAt(i);
}
}
}
return memo;
}
/**
* C-1. ÁöÁ¤ÇÑ ÀÚ¸®¼öÀÇ ³¼ö¸¦ ¹ß»ý½ÃŲ´Ù.
*
* @param size ³¼ö Å©±â
* @return
*/
function getRandom(size)
{
var random;
while ((random = Math.random() * Math.pow(10, size) - 1) < Math.pow(10, size - 1));
return(parseInt(random));
}
/**
* C-2. ¼Ò¼öÁ¡À» Æ÷ÇÔÇÑ ¼ýÀÚ¸¦ ¼Ò¼öÁ¡À» Á¦°ÅÇÑ Á¤¼ö·Î º¯È¯ÇÑ´Ù.
*
* @param str ¹®ÀÚ¿
* @return
*/
function toInteger(str)
{
if (str.indexOf(".") == -1)
return str;
else
return str.substring(0, str.indexOf("."));
}
/**
* C-3. ¼Ò¼öÁ¡À» Æ÷ÇÔÇÏÁö ¾ÊÀº ¼ýÀÚ¸¦ ¼Ò¼öÁ¡À» Æ÷ÇÔÇÑ ½Ç¼ö·Î º¯È¯ÇÑ´Ù.
*
* @param str ¹®ÀÚ¿
* @return
*/
function toReal(str)
{
var strIdx = str.indexOf(".");
if (strIdx == -1)
return str + ".0";
else if (strIdx == str.length - 1)
return str + "0";
else
return str;
}
/**
* D-1. ÀÚ¹Ù½ºÅ©¸³Æ® Date °´Ã¼¸¦ Time ¹®ÀÚ¿·Î º¯È¯ÇÑ´Ù.
*
* @param date Date °´Ã¼
* @return
*/
function toTimeString(date)
{
var year = date.getFullYear();
var month = date.getMonth() + 1;
// 1¿ù=0, 12¿ù=11
var day = date.getDate();
var hour = date.getHours();
var min = date.getMinutes();
var sec = date.getSeconds();
if (("" + month).length == 1) {
month = "0" + month;
}
if (("" + day).length == 1) {
day = "0" + day;
}
if (("" + hour).length == 1) {
hour = "0" + hour;
}
if (("" + min).length == 1) {
min = "0" + min;
}
if (("" + sec).length == 1) {
sec = "0" + sec;
}
return("" + year + month + day + hour + min + sec);
}
/**
* D-2. Time ½ºÆ®¸µÀ» ÀÚ¹Ù½ºÅ©¸³Æ® Date °´Ã¼·Î º¯È¯ÇÑ´Ù.
*
* @param time Time ¹®ÀÚ¿
* @return
*/
function toTimeObject(time)
{
var year = time.substr(0, 4);
var month = time.substr(4, 2) - 1;
// 1¿ù=0, 12¿ù=11
var day = time.substr(6, 2);
var hour = time.substr(8, 2);
var min = time.substr(10, 2);
return new Date(year, month, day, hour, min);
}
/**
* D-3. ÇöÀç ½Ã°¢À» Time Çü½ÄÀ¸·Î ¸®ÅÏÇÑ´Ù.
*
* @return
*/
function getCurrentTime()
{
return toTimeString(new Date());
}
/**
* D-4. ÇöÀç Ò´À» YYYYÇü½ÄÀ¸·Î ¸®ÅÏ
*
* @return
*/
function getYear()
{
return getCurrentTime().substr(0, 4);
}
/**
* D-5. ÇöÀç êÅÀ» MMÇü½ÄÀ¸·Î ¸®ÅÏ
*
* @return
*/
function getMonth()
{
return getCurrentTime().substr(4, 2);
}
/**
* D-6. ÇöÀç ìíÀ» DDÇü½ÄÀ¸·Î ¸®ÅÏ
*
* @return
*/
function getDay()
{
return getCurrentTime().substr(6, 2);
}
/**
* D-7. ¿À´Ã³¯Â¥¿¡ ÇØ´çÇÏ´Â ¿äÀÏÀ» ±¸ÇÑ´Ù.
*
* @return
*/
function getDayOfWeek()
{
var now = new Date();
var day = now.getDay();
var week = new Array("ÀÏ", "¿ù", "È", "¼ö", "¸ñ", "±Ý", "Åä");
return week[day];
}
/**
* D-8. ÁÖ¾îÁø Time °ú y³â m¿ù dÀÏ h½Ã Â÷À̳ª´Â TimeÀ» ±¸ÇÑ´Ù.
*
* @param time Time °´Ã¼
* @param y y³â Â÷ÀÌ
* @param m m¿ù Â÷ÀÌ
* @param d dÀÏ Â÷ÀÌ
* @param h h½Ã Â÷ÀÌ
* @return
*/
function shiftTime(time, y, m, d, h) {
var date = toTimeObject(time);
date.setFullYear(date.getFullYear() + y);
// y³âÀ» ´õÇÔ
date.setMonth(date.getMonth() + m);
// m¿ùÀ» ´õÇÔ
date.setDate(date.getDate() + d);
// dÀÏÀ» ´õÇÔ
date.setHours(date.getHours() + h);
// h½Ã¸¦ ´õÇÔ
return toTimeString(date);
}
/**
* D-9. ÇöÀç·ÎºÎÅÍ ÁöÁ¤ÇÑ ¸¸ÅÀÇ ÀÌÀü½Ã°£À» ±¸ÇÑ´Ù.
*
* @param nHour ½Ã°£
* @return
*/
function getHourBefore(nHour)
{
nHour = eval(nHour);
return shiftTime(getCurrentTime(), 0, 0, 0, -nHour);
}
/**
* D-10. ÇöÀç·ÎºÎÅÍ ÁöÁ¤ÇÑ ¸¸ÅÀÇ ÀÌÀüÀÏÀ» ±¸ÇÑ´Ù.
*
* @param nDay ÀÏ
* @return
*/
function getDayBefore(nDay)
{
nDay = eval(nDay);
return shiftTime(getCurrentTime(), 0, 0, -nDay, 0);
}
/**
* D-11. ÇöÀç·ÎºÎÅÍ ÁöÁ¤ÇÑ ¸¸ÅÀÇ ÀÌÀü¿ùÀ» ±¸ÇÑ´Ù.
*
* @param nMonth ¿ù
* @return
*/
function getMonthBefore(nMonth)
{
nMonth = eval(nMonth);
return shiftTime(getCurrentTime(), 0, -nMonth, 0, 0);
}
/**
* D-12. ÇöÀç·ÎºÎÅÍ ÁöÁ¤ÇÑ ¸¸ÅÀÇ ÀÌÀü¿¬µµ¸¦ ±¸ÇÑ´Ù.
*
* @param nYear ¿¬
* @return
*/
function getYearBefore(nYear)
{
nYear = eval(nYear);
return shiftTime(getCurrentTime(), -nYear, 0, 0, 0);
}
/**
* D-13. ÇöÀç·ÎºÎÅÍ ÁöÁ¤ÇÑ ¸¸ÅÀÇ ÀÌÈĽð£À» ±¸ÇÑ´Ù.
*
* @param nHour ½Ã°£
* @return
*/
function getHourAfter(nHour)
{
nHour = eval(nHour);
return shiftTime(getCurrentTime(), 0, 0, 0, nHour);
}
/**
* D-14. ÇöÀç·ÎºÎÅÍ ÁöÁ¤ÇÑ ¸¸ÅÀÇ ÀÌÈÄÀϸ¦ ±¸ÇÑ´Ù.
*
* @param nDay ÀÏ
* @return
*/
function getDayAfter(nDay)
{
nDay = eval(nDay);
return shiftTime(getCurrentTime(), 0, 0, nDay, 0);
}
/**
* D-15. ÇöÀç·ÎºÎÅÍ ÁöÁ¤ÇÑ ¸¸ÅÀÇ ÀÌÈÄ¿ùÀ» ±¸ÇÑ´Ù.
*
* @param nMonth ¿ù
* @return
*/
function getMonthAfter(nMonth)
{
nMonth = eval(nMonth);
return shiftTime(getCurrentTime(), 0, nMonth, 0, 0);
}
/**
* D-16. ÇöÀç·ÎºÎÅÍ ÁöÁ¤ÇÑ ¸¸ÅÀÇ ÀÌÈÄ¿¬µµ¸¦ ±¸ÇÑ´Ù.
*
* @param nYear ¿¬
* @return
*/
function getYearAfter(nYear)
{
nYear = eval(nYear);
return shiftTime(getCurrentTime(), nYear, 0, 0, 0);
}
/**
* D-17. µÎ ½Ã°£ÀÌ ¸î °³¿ù Â÷ÀÌÀÎÁö ±¸ÇÑ´Ù.
*
* @param time1
* @param time2
* @return
*/
function getMonthInterval(time1, time2)
{
var date1 = toTimeObject(time1);
var date2 = toTimeObject(time2);
var years = date2.getFullYear() - date1.getFullYear();
var months = date2.getMonth() - date1.getMonth();
var days = date2.getDate() - date1.getDate();
return years * 12 + months + ((days >= 0) ? 0 : -1);
}
/**
* D-18. µÎ ½Ã°£ÀÌ ¸îÀÏ Â÷ÀÌÀÎÁö ±¸ÇÑ´Ù.
*
* @param time1
* @param time2
* @return
*/
function getDayInterval(time1, time2)
{
var date1 = toTimeObject(time1);
var date2 = toTimeObject(time2);
var day = 1000 * 3600 * 24;
return parseInt((date2 - date1) / day, 10);
}
/**
* D-19. µÎ ½Ã°£ÀÌ ¸î½Ã°£ Â÷ÀÌÀÎÁö ±¸ÇÑ´Ù.
*
* @param time1
* @param time2
* @return
*/
function getHourInterval(time1, time2)
{
var date1 = toTimeObject(time1);
var date2 = toTimeObject(time2);
var hour = 1000 * 3600;
return parseInt((date2 - date1) / hour, 10);
}
/**
* D-20. À±³â¿©ºÎ¸¦ ³ªÅ¸³½´Ù.
**/
function isLeapYear(aYear)
{
return (aYear % 4 == 0) && ((aYear % 100 != 0) || (aYear % 400 == 0));
}
/**
* D-21. °ªÀÌ YYYY-MM-DD Çü½ÄÀÌ ¸Â´ÂÁö °Ë»çÇÑ´Ù.
*
* @param str1 ¹®ÀÚ¿1
* @return
*/
function validFormattedDate(strDate) {
if (strDate.length != 10) return false;
var str1 = replace(strDate, '-', '');
var yyyy = str1.substring(0, 4);
var mm = str1.substring(4, 6);
var dd = str1.substring(6, 8);
return ValidDate(yyyy, mm, dd);
}
/**
* D-22. YYYYMMDD Çü½ÄÀÇ ³¯ÀÚ¸¦ YYYY-MM-DD ¶Ç´Â YYYY³â MM¿ù DDÀÏ·Î º¯È¯ÇÑ´Ù.
*
* @param str1 YYYYMMDD Çü½ÄÀÇ ¹®ÀÚ¿
* @param code ¼±ÅÃÄÚµå
* @return
*/
function tranFormatForView(str1, code){
var yyyy = str1.substring(0, 4);
var mm = str1.substring(4, 6);
var dd = str1.substring(6, 8);
var result;
if(code==0) {
result = yyyy + "-" + mm + "-" + dd;
}else if(code==1) {
result = yyyy + "³â " + eliminateZero(mm)+ "¿ù " + eliminateZero(dd)+"ÀÏ";
}
return result;
}
/**
* F-1. ÄíÅ°°ªÀ» ÁöÁ¤ÇÑ´Ù.
*
* @param name ÄíÅ°¸í
* @param value ÄíÅ°°ª
* @param expiredays ¸¸·áÀÏ
* @return
*/
function setCookie( name, value, expiredays )
{
var todayDate = new Date();
todayDate.setDate( todayDate.getDate() + expiredays );
if(expiredays == ""){
document.cookie = name + "=" + escape( value ) + "; path=/;";
}else{
document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";";
}
}
/**
* F-2. ÄíÅ°°ªÀ» °¡Á®¿Â´Ù.
*
* @param name ÄíÅ°¸í
* @return
*/
function getCookie(name) {
var nameOfCookie = name + "=";
var x = 0;
var endOfCookie;
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 "";
}
/**
* F-3. ÁöÁ¤ÇÑ ÄíÅ°À̸§ÀÇ ÄíÅ°¸¦ »èÁ¦ÇÑ´Ù.
*
* @param name ÄíÅ° À̸§
* @param name ÄíÅ° °ª
* @return
*/
function deleteCookie(name)
{
var expire = new Date();
expire.setDate(expire.getDate() - 1);
document.cookie = name + "=; path=/; expires=" + expire.toGMTString() + ";";
}
/**
* G-1. »õâÀ» ÁöÁ¤ÇÑ ¿É¼ÇÀ¸·Î ¶ç¿î´Ù.
*
* @param url ̢˂ URL
* @param url âÀÇ À̸§
* @param width âÀÇ ³ÐÀÌ
* @param height âÀÇ ³ôÀÌ
* @param scroll ½ºÅ©·Ñ ¿©ºÎ(true/false)
* @param resize Å©±âÁ¶Àý ¿©ºÎ(true/false)
* @return âÀÇ °´Ã¼
*/
function openWindow(url, name, W, H, scroll, resize, option)
{
var X = 0;
var Y = 0;
if (option == 8)
{
X = (window.screen.width - W) / 2;
Y = window.screen.height - H - 83;
}
else
{
// if (parseInt(W) <= 400 && parseInt(H) <= 400)
// {
// // X = (window.screen.width/2) - (W/2+10);
// // Y = (window.screen.height/2) - (H/2+50);
// if (window.screen.width < W + window.event.screenX)
// X = window.event.screenX - W - 10;
// else
// X = window.event.screenX;
//
// if (window.screen.height < H + window.event.screenY)
// Y = window.event.screenY - H - 30;
// else
// Y = window.event.screenY;
// }
}
var win = window.open(url, name, "status=no, height=" + H + ",width=" + W + ", left=" + X + ", top=" + Y + ", screenX=" + X + ", screenY=" + Y + ", scrollbars=" + scroll + ", resizable=" + resize);
win.focus();
return win;
}
/////////////////////////////////////////////////////////////////////
// Select box °ü·Ã ÇÔ¼ö
/////////////////////////////////////////////////////////////////////
/**
* SELECT °´Ã¼°¡ Ãʱâ»óÅÂ(index == 0)¿¡¼ º¯°æµÇ¾ú´ÂÁö °Ë»çÇÑ´Ù.
*
* @param obj °´Ã¼ ID
* @param msg °´Ã¼ À̸§
* @return
*/
function isSelected(obj, msg)
{
if (!isObject(obj))
return false;
if (obj.selectedIndex == 0)
{
if (msg)
{
window.alert("[" + msg + "]ÀÌ(°¡) ¼±ÅõÇÁö ¾Ê¾Ò½À´Ï´Ù.");
obj.focus();
}
return false;
}
return true;
}
function compareOptionValues(a, b)
{
// Radix 10: for numeric values
// Radix 36: for alphanumeric values
var sA = parseInt(a.value, 36);
var sB = parseInt(b.value, 36);
return sA - sB;
}
function compareOptionText(a, b)
{
// Radix 10: for numeric values
// Radix 36: for alphanumeric values
var sA = parseInt(a.text, 36);
var sB = parseInt(b.text, 36);
return sA - sB;
}
/**
* SELECT ¸®½ºÆ®¿¡¼ ´Ù¸¥ ¸®½ºÆ®·Î Ç׸ñÀ» À̵¿ÇÑ´Ù.
*
* @param srcList ¿øº» ¸®½ºÆ®
* @param tarList ´ë»ó ¸®½ºÆ®
* @param moveAll true : Àüü Ç׸ñ, false : ¼±ÅÃÇÑ Ç׸ñ
* @return
*/
function moveDualList(srcList, tarList, moveAll)
{
if (srcList.length == 0)
{
window.alert("À̵¿ÇÒ Ç׸ñÀÌ ¾ø½À´Ï´Ù.");
return false;
}
if ((srcList.selectedIndex == -1) && (!moveAll))
{
window.alert("À̵¿ÇÒ Ç׸ñÀ» ¼±ÅÃÇϼ¼¿ä.");
return false;
}
var newtarList = new Array(tarList.options.length);
var len = 0;
var i, j;
for (len = 0; len < tarList.options.length; len++)
{
if (tarList.options[ len ] != null)
{
newtarList[ len ] = new Option(tarList.options[ len ].text, tarList.options[ len ].value, tarList.options[ len ].defaultSelected, tarList.options[ len ].selected);
}
}
for (i = 0; i < srcList.options.length; i++)
{
if (srcList.options[i] != null && (srcList.options[i].selected || moveAll))
{
newtarList[ len ] = new Option(srcList.options[i].text, srcList.options[i].value, srcList.options[i].defaultSelected, srcList.options[i].selected);
len++;
}
}
newtarList.sort(compareOptionValues);
// BY VALUES
//newtarList.sort(compareOptionText); // BY TEXT
for (j = 0; j < newtarList.length; j++)
{
if (newtarList[ j ] != null)
{
tarList.options[ j ] = newtarList[ j ];
}
}
for (i = srcList.options.length - 1; i >= 0; i--)
{
if (srcList.options[i] != null && (srcList.options[i].selected || moveAll))
{
srcList.options[i] = null;
}
}
return true;
}
/**
* ÀÔ·Â ¹®ÀÚ¿À» µÚ¿¡¼ºÎÅÍ ÁöÁ¤ÇÑ Å©±â¸¸Å ±¸ºÐ¹®ÀÚ·Î ²÷´Â´Ù. (»èÁ¦´ë»ó)
*
* @param strMain ¹®ÀÚ¿
* @param strIns ±¸ºÐ ¹®ÀÚ
* @param size »ðÀÔ ´ÜÀ§
* @return
*/
function insertCharacterByBack(strMain, strIns, size)
{
var returnStr = "";
var tempStrMain = strMain + "";
var tempStrIns = strIns + "";
var strMainLength = tempStrMain.length;
if (strMainLength < size)
{
return tempStrMain;
}
else
{
var strLengthDiv = parseInt(strMainLength / size);
var strLengthRemnant = parseInt(strMainLength % size);
if (strLengthRemnant > 0)
{
returnStr = tempStrMain.substring(0, strLengthRemnant) + strIns;
}
for (var i = 0; i < strLengthDiv; i++)
{
if (i == 0)
{
returnStr = returnStr + tempStrMain.substring(strLengthRemnant, strLengthRemnant + size);
}
else
{
returnStr = returnStr + tempStrIns + tempStrMain.substring(strLengthRemnant + (size * i), strLengthRemnant + (size * i) + size);
}
}
return returnStr;
}
}
/**
* À̺¥Æ® ÃʱâÈ
*/
function disableRightButton()
{
if (window.Event)
document.captureEvents(Event.MOUSEUP);
function nocontextmenu()
{
window.event.cancelBubble = true;
window.event.returnValue = false;
return false;
}
function norightclick(e)
{
if (window.Event)
{
if (e.which == 2 || e.which == 3) return false;
}
else if (window.event.button == 2 || window.event.button == 3)
{
window.event.cancelBubble = true;
window.event.returnValue = false;
return false;
}
return true;
}
document.oncontextmenu = nocontextmenu;
document.onmousedown = norightclick;
}
/**
* ÆùÆ® »çÀÌÁî ÁÜÀÎ Áܾƿô ÀåÂ÷¹ý Àû¿ë
var fSize = 12;
function scaleFont(n){
if (n == 0) {
fSize = 12;
document.getElementById('ContentsLeft').style.fontSize = fSize + "px";
document.getElementById('ContentsRight').style.fontSize = fSize + "px";
}
else {
fSize = fSize + n;
document.getElementById('ContentsLeft').style.fontSize = fSize + "px";
document.getElementById('ContentsRight').style.fontSize = fSize + "px";
}
}
*/
/**
* Html ÅÂ±× º¯È¯
*/
function convertHtml(val) {
val = val.replace(/>/g, ">");
val = val.replace(/-1) rv = 11;
// }
return rv;
}
/*
* ¸®´º¾ó ÆäÀÌÁö Àû¿ë µÇ´Â ½ºÅ©¸³Æ®
* */
$(document).ready(function(){
/* GNB */
$(".gnb > ul > li").mouseenter(function(){
$(this).children().next().show();
});
$(".gnb > ul > li").mouseleave(function(){
$(".subWrap").hide();
});
/*allMenu*/
$(".show_allMenu, .allMenuClose").click(function(){
$(".AllMenu").toggle();
$(".show_allMenu").toggleClass("show_allMenu_on");
});
//location01
$(".sub-navi01").hide();
$("#toggle-navi01").click(function(){
$(".sub-navi01").slideToggle();
$("#toggle-navi01").toggleClass("dropdown-on");
});
//location02
$(".sub-navi02").hide();
$("#toggle-navi02").click(function(){
$(".sub-navi02").slideToggle();
});
//location03
$(".sub-navi03").hide();
$("#toggle-navi03").click(function(){
$(".sub-navi03").slideToggle();
$("#toggle-navi03").toggleClass("dropdown-on");
});
//ºñÁÖ¾óÀ̹ÌÁö show_hide
$(".btn-visual").click(function(){
if($(".visual").is(":hidden")){
$(".visual").slideDown("slow");
$(this).removeClass("btn-visual-on");
$(this).addClass("btn-visual");
$(this).text('À̹ÌÁö °¨Ãß±â');
}else{
$(".visual").slideUp("slow");
$(this).removeClass("btn-visual");
$(this).addClass("btn-visual-on");
$(this).text('À̹ÌÁö º¸À̱â');
}
});
/*ºü¸¥¹Î¿ø¼ºñ½º Æ˾÷*/
$(".more").hide();
$("#footerBG4").hide();
$(".btn-more").click(function(){
$(".more").show();
$("#footerBG4").show();
return false;
});
$(".btn-minwon-close").click(function(){
$(".more").hide();
$("#footerBG4").hide();
return false;
});
//table0202¿¡ bdbŬ·¡½º ÀÚµ¿Ãß°¡
/*$(".table0202 > tbody > tr:last-child").find("td").addClass("bdb");
$(".table0202 > tbody > tr:last-child").find("th").addClass("bdb");
$(".table0202").find("tr > td[rowspan]:last").addClass('bdb');
$(".table0202").find("tr > th[rowspan]:last").addClass('bdb');*/
});
function dEI(elementID){
return document.getElementById(elementID);
}
function quickFindRoadCode() {
var sgg = document.getElementById("sggnm").value;
if(sgg==null || sgg=="" || sgg == "½Ã,±º,±¸"){
alert("½Ã±º±¸ ¼±ÅÃÇØ ÁÖ¼¼¿ä");
return;
}else {
window.open("/land_info/common/landCode.do?searchType=road&landCd="+sgg, '_blank', 'width=590,height=510,scrollbars=yes,resizable=yes');
}
}