﻿function realNamePop() {
    var URL ="http://www.siren24.com/siren24/sst/name/jsp/name02p_j01.jsp"; 
    var status = "toolbar=no,directories=no,scrollbars=no,resizable=no,status=no,menubar=no,width= 640, height= 480, top=0,left=20"; 
    var newChild = window.open(URL,"",status); 			
    if (!newChild) {
        alert("안내 페이지가 XP SP2의 팝업 차단으로 인하여 정상적으로 출력되지 못하였습니다. ");
    }		
}
function cal_byte (aquery,objcheck,maxCount,CounterViewer) {
	var tmpStr;
	var temp=0;
	var onechar;
	var tcount;
	tcount = 0;

	tmpStr = new String(aquery);
	temp = tmpStr.length;

	for (k=0;k<temp;k++) {
		onechar = tmpStr.charAt(k);
		if (escape(onechar) =='%0D') { } else if (escape(onechar).length > 4) { tcount += 2; } else { tcount++; }
	}
	try {
		if(CounterViewer!=null && CounterViewer!="")
			document.all[CounterViewer].innerHTML = "("+tcount + "/" +maxCount +")";
	}
	catch(e) {}
	if (tcount>maxCount) {
		reserve = tcount-maxCount;
		alert("내용은 "+maxCount+"바이트 이상은 저장하실수 없습니다.\r\n 쓰신 내용을 "+reserve+"바이트가 초과되었습니다.\r\n 초과된 부분은 자동으로 삭제됩니다."); 
		nets_check(objcheck.value,objcheck,maxCount,CounterViewer);
	    return;
	}
}
function nets_check(aquery,objcheck,maxCount,CounterViewer) {
	var tmpStr;
	var temp=0;
	var onechar;
	var tcount;
	tcount = 0;

	tmpStr = new String(aquery);
	temp = tmpStr.length;

	for (k=0;k<temp;k++) {
		onechar = tmpStr.charAt(k);
		if (escape(onechar).length > 4) {
			tcount += 2;
		} else {			
			if (escape(onechar)=='%0A') {
			} else {
				tcount++;
			}
		}
		if(tcount>maxCount) {
			tmpStr = tmpStr.substring(0,k);
			break;
		}
	}
	objcheck.value = tmpStr;
	cal_byte(tmpStr,objcheck,maxCount,CounterViewer);
}
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 SetCookie( name, value) {
    document.cookie = name + '=' + escape( value ) + '; path=/; domain=estsoft.co.kr;'
}
function SetCookieOne(name,value) {
    document.cookie = name + "=" + escape(value) +";";
}
function getObject(id) {
    return document.getElementById(id);
}

// Prototype
String.prototype.trim = function() {
    return this.replace(/^\s+|\s+$/g, '');
};

/* Checker */
// is null or Empty
String.prototype.IsNullOrEmpty = function() {
    var strText = this.trim();
    for (var i = 0; i < strText.length; i++) {
        if ((strText.charAt(i) != "\t") && (strText.charAt(i) != "\n") && (strText.charAt(i) != "\r")) { return false; }
    }
    return true;
};
String.prototype.remove = function(regix) { return (regix == null) ? this : eval("this.replace(/[" + regix.meta() + "]/g, \"\")"); }
String.prototype.IsPassWord = function() { return (/^[A-Za-z0-9`\-=\\\[\];',\./~!@#\$%\^&\*\(\)_\+|\{\}:"<>\?]{6,13}$/).test(this.remove(arguments[0]));}