﻿//상수 설정
var domain = document.domain;
var url		= document.URL;
var protocol = "http://";

if ( document.location.port == "443")
{
	protocol = "https://";
}

var home	= protocol + domain + ((document.location.port)? ':'+ document.location.port : '');

try {
    document.execCommand("BackgroundImageCache", false, true);
} catch (ignored) { };




String.prototype.trim = function()	 {	  return this.replace(/(^\s*)|(\s*$)/g, "");	 }
String.prototype.Trim = function() { return this.replace(/(^\s*)|(\s*$)/g, ""); }
String.prototype.ltrim = function() {return this.replace(/(^ *)/g, "");};
String.prototype.rtrim = function() {return this.replace(/( *$)/g, "");};
String.prototype.replaceAll = function(_findValue, _replaceValue) {return this.replace(new RegExp(_findValue,"g"), _replaceValue);}



//------ 숫자만 입력 받음 ---
	function onlyNumber() { 			
		if(((event.keyCode<48)||(event.keyCode>57))&&((event.keyCode<96)||(event.keyCode>105))&&(event.keyCode!=8)&&(event.keyCode!=9)&&(event.keyCode!=46)) event.returnValue = false;
	}



//배열인지 아닌지 
function isArray(arr) { 
	try{ 
			return /^\s?function Array()/.test(arr.constructor.toString()); 
		}
		
		catch(e) { 
			return false; 
		} 
} 


function isObject(obj)
{
	try
	{	obj
		return true
	}
	catch (e)
	{
		return false
	}

//	if(obj=='[object]') {return true} else {	return false}
}


function function_exists(obj)
{
	try
	{
		eval(obj);
		return true
	}
	
	catch(e) { 
		return false; 
	} 
}



// 전달된 ID에 해당하는 컨트롤을 반환
	function GetControl(sCID)
	{
		var objItem = document.getElementById(sCID);
		
		if(objItem)
			return objItem;
		else
			return null;
	}
	
	
	function GetControl_Name(sName)
    {
        var objItem = document.getElementsByName(sName)

        if (objItem)
            return objItem;
        else
            return null;

    }


function Flash_Player(url,wid,hei)
{ 
	if (wid == "") 	wid = 502
	if (hei == "") 	hei = 122


	// 플래시 코드 정의
	var flashStr =
     "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='" + wid + "' height='" + hei + "' id='banner2' align='middle'>" +
     "<param name='allowScriptAccess' value='always' />" +
     "<param name='movie' value='" + url + "' />" +
     "<param name='FlashVars' value='' />" +
     "<param name='wmode' value='transparent' />" +
     "<param name='menu' value='false' />" +
     "<param name='quality' value='high' />" +
     "<param name='bgcolor' value='' />" +
     "<embed src='" + url + "' FlashVars='' wmode='transparent' menu='false' quality='high' bgcolor='' width='" + wid + "' height='" + hei + "' name='banner2' align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='https://www.macromedia.com/go/getflashplayer' />" +
     "</object>";

	// 플래시 코드 출력
	document.write(flashStr);
}


function Flash_Player2(val, wid, hei) {
    if (wid == "") wid = 100
    if (hei == "") hei = 100


    var temp = "";
    temp += "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='" + wid + "' height='" + hei + "'>";
    temp += "<param name='movie' value='" + val + "'><param name='quality' value='high'><param name='wmode' value='transparent'><param name='menu' value='false'>";
    temp += "<embed src='" + val + "' quality='high' pluginspage='https://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='" + wid + "' height='" + hei + "'></embed>";
    temp += "</object>";

    return temp;
}



function flash(c,d,e) 
{
     var flash_tag = "";
     flash_tag = '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';
     flash_tag +='codebase="https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" ';
     flash_tag +='WIDTH="'+c+'" HEIGHT="'+d+'" >';
     flash_tag +='<param name="wmode" value="transparent">';
     //이부분은 플래쉬 배경을 투명으로 설정하는 부분으로 필요없다면 삭제해도 무방함
     flash_tag +='<param name="movie" value="'+e+'">';
     flash_tag +='<param name="quality" value="high">';
     flash_tag +='<embed src="'+e+'" quality="high" pluginspage="https://www.macromedia.com/go/getflashplayer" ';
     flash_tag +='type="application/x-shockwave-flash"  WIDTH="'+c+'" HEIGHT="'+d+'"></embed></object>'
     document.write(flash_tag);
}






function banner_link(url, b_adv_idx,type) {
    
    url = escape(url);
    if(type == "_self"){
		location.href=home + "/common/default.aspx?m=10&b_adv_idx=" + b_adv_idx  + "&Return_URL=" + url;		
	}else{
		window.open(home + "/common/default.aspx?m=10&b_adv_idx=" + b_adv_idx  + "&Return_URL=" + url);
	}
}

/**
* 브라우저 document 영역의
* clientWidth/clientHeight 구하기
*/
function getClientSize() 
{

	var oDoc = document[document.compatMode == 'CSS1Compat' ?'documentElement' : 'body'];
	if (/Opera/.test(navigator.userAgent)) oDoc = document.body;
  
	return [
		oDoc.clientWidth,
		oDoc.clientHeight
	];
}


/**
* 브라우저 document 영역의
* scrollWidth/scrollHeight 구하기
*/

function getScrollSize() {

	var oDoc = document[document.compatMode == 'CSS1Compat' ?'documentElement' : 'body'];
	if (/Opera|Safari/.test(navigator.userAgent)) oDoc = document.body;
 
  // IE6 미만이면
	if (/MSIE\s([0-9]+(\.[0-9]+)*)/.test(navigator.userAgent) && parseFloat(RegExp.$1) < 6) 
	{
   
		var aOld = [ oDoc.scrollLeft, oDoc.scrollTop ];
		var aClient = getClientSize();
   
		oDoc.scrollLeft = 999999;
		oDoc.scrollTop = 999999;
	   
		var aRet = [
		  oDoc.scrollLeft + aClient[0],
		  oDoc.scrollTop + aClient[1]
		];
   
		oDoc.scrollLeft = aOld[0];
		oDoc.scrollTop = aOld[1];
	   
		return aRet;
	}

	return [
		oDoc.scrollWidth,
	    oDoc.scrollHeight
	];
}




function moveFocus(num, now, next) {


    var obj = GetControl_Name(now)

    if (obj[0].value.length == num) {
        obj = GetControl_Name(next);
        obj[0].focus();
    }
} 








//파업 기본 생성
function Popup_Win(link, winname, winl, wint, wid, hei, scroll ,resize )
{
	var win = window.open(link ,winname , 'left='+winl+',top='+wint+',width='+wid+', height='+hei+', scrollbars='+scroll+',resizable='+resize);
	win.focus();
}



function Popup_Win2(link,  winname, wid , hei ,scroll)
{
	if (scroll == null) scroll ="0";
	if (winname == null || winname.lengtn == 0 ) winname = "Popup";

	var winl = eval((screen.width - wid) / 2) + "px" ;     //  뛰울 창의 폭
	var wint = eval((screen.height - hei) / 2) + "px" ;   //   뛰울 창의 높이 

	Popup_Win(link, winname, winl, wint, wid, hei, scroll ,"1" )
}










	
//SELECT 옵션 관련	
function AddOption(objID, value, text) 
{ 
	var obj = document.getElementById(objID);

	var oOption = document.createElement("OPTION"); 
	oOption.text = text; 
	oOption.value = value;

	if (obj) obj.options.add(oOption);
}


function ClearOption(objID) {

    var obj = document.getElementById(objID);
    var i;

    for (i = obj.length - 1; i >= 0; i--) {
        obj.remove(i);
    }
}


function DelOption(objID, i) {
    var obj = document.getElementById(objID);
    opts = obj.getElementsByTagName("option");
    obj.removeChild(opts[i]);

}

 






/***********************************
/ 이미지 사이즈에 맞게 새창띄우기
/***********************************/
    function OpenImage(s){
        //
        // 변수 정의
        // 
        srcImg = new Image();
        clientWidth = screen.width;
        clientHeight = screen.height;
        srcImg.src = s;
  //
  // 열려는 파일을 이름
  //
        var srcFileName = srcImg.src.substr(srcImg.src.lastIndexOf("/")+1, srcImg.src.length);
        //
        // 새창 띄우고 이미지 삽입
        //
        win = window.open("","","width=15,height=15,scrollbars=no,resizable=no,left="+(clientWidth/2-15)+",top="+(clientHeight/2-15)+"");
        win.document.writeln("<html>");
        win.document.writeln("<head>");
        win.document.writeln("<title>"+document.title+" </title>");
        win.document.writeln("</head>");
        win.document.writeln("<body style='margin:0px;' bgcolor='#333333'>");
        win.document.writeln("<table border='0' cellpadding='0' cellspacing='0' style='cursor:hand' onclick='self.close()'>");
        win.document.writeln(" <tr>");
        win.document.writeln("  <td align='center'><img src="+s+" name='winImg' style='cursor:hand' onclick='self.close()' alt='클릭하면 사라집니다'></td>");
        win.document.writeln(" </tr>");
        win.document.writeln("</table>");
        win.document.writeln("</body>");
        win.document.writeln("</html>");

        srcImg = win.document.winImg;
        //
        // 이미지가 모두 로딩될때까지 기다림
        //
        while(true)
                if(srcImg.readyState == "complete")
                        break;
        
        //
        // 새창의 크기 설정
        //
        var winWidth = srcImg.width+10;
        var winHeight = srcImg.height+55;
        //
        // 새창이 띄워질 위치 설정
        //
        var left = (clientWidth/2)-(srcImg.width/2);
        var top = (clientHeight/2)-(srcImg.height/2);
        //
        // 이미지의 크기 overflow 확인후 새창의 크기와 위치 재설정
        //
        if(clientWidth <= srcImg.width){
                winWidth = clientWidth;
                left = 0;
                win.document.body.scroll = "auto";
        }
        if(clientHeight <= srcImg.height){
                winHeight = clientHeight-30;
                top = 0;
                win.document.body.scroll = "auto";
        }
        //
        // 이미지로딩이 끝났음으로 이미지의 크기를 사용할수 있다.
        // 해당 이미지의 사이즈에 맞게 윈도우를 재설정한다.
        win.moveTo(left, top);
        win.resizeTo(winWidth, winHeight);
}



function itostr(inum){
	return inum<10?"0"+inum:inum;
}



function DateTime()
{
	this.today = new Date();
	this.day = 0; 
}

DateTime.prototype.Date = function()
{ 
	return this.today.getYear() + "-" + itostr((this.today.getMonth() + 1)) + "-" + itostr(this.today.getDate());
};

DateTime.prototype.Now = function()
{ 
	this.today = new Date();
	return this.Date();
};

DateTime.prototype.AddDay = function(day)
{ 
	this.day = day;
	this.today = new Date();
	this.today.setDate(this.today.getDate() + this.day );
	return this.Date();
};









    
// 주민생일체크(앞자리)
function CheckPnum(v1)
{
	if ((  v1.substring(0,2) >= 0) && ( v1.substring(0,2)  < 100  ) )
	{
		if (( v1.substring(2,4) > 0) && (v1.substring(2,4) < 13 ))
		{
			if (( v1.substring(4,6) > 0) && (v1.substring(4,6) < 32 ))
			{
				return true;
			}
		}
	}
	return false;
}


function Chk_jumin(jumin_1,jumin_2)
{
	// 주민등록번호 체크 

	var chk=0;
	var i = 0;
	
	if (jumin_2.length != 7){return false;}

	for(i = 0; i <=5 ; i++)
	{ 
		chk = chk + ((i%8+2) * parseInt(jumin_1.substring(i,i+1)))
	}

	for(i = 6; i <=11 ; i++)
	{ 
		chk = chk + ((i%8+2) * parseInt(jumin_2.substring(i-6,i-5)))
	}

	chk = 11 - (chk %11)
	chk = chk % 10


	if(chk == jumin_2.substring(6,7)){		return true;	}

	return false;

}




//---------------사업자 등록번호 체크 함수 -------
    function Chk_biz_Num(buss_no) 
    { 
        var ret; 
        var tot = 0; 
        var tmp; 
        var chk_digit; 

		if (buss_no == "0000000000")
			return false;

        tot = Number(buss_no.charAt(0)) * 1; 
        tot += Number(buss_no.charAt(1)) * 3; 
        tot += Number(buss_no.charAt(2)) * 7; 
        tot += Number(buss_no.charAt(3)) * 1; 
        tot += Number(buss_no.charAt(4)) * 3; 
        tot += Number(buss_no.charAt(5)) * 7; 
        tot += Number(buss_no.charAt(6)) * 1; 
        tot += Number(buss_no.charAt(7)) * 3; 

        tmp = Number(buss_no.charAt(8)) * 5; 
        tot += ( Math.floor(tmp/10) + (tmp%10) ); 

        chk_digit = 10 - (tot % 10); 
        if(chk_digit == 10) chk_digit = 0; 


        if( String(chk_digit) != String(buss_no.charAt(9))) 
        return false; 
        else 
        return true; 

    }




    /*******************************************************************************
    * 문자열 길이 계산 2008-11-10
    *******************************************************************************/

    function CalByte(tg, ReLen, ReByte) {
        var curText;
        var strLen;
        var byteIs;
        var lastByte;
        var thisChar;
        var escChar;
        var curTotalMsg;
        var okMsg;

        curText = new String(tg.value);
        strLen = curText.length;
        byteIs = 0;

        for (i = 0; i < strLen; i++) {
            thisChar = curText.charAt(i);
            escChar = escape(thisChar);

            if (escChar.length > 4 || thisChar == '·') {
                byteIs += 2;  //특수문자 한글인 경우.
            } else if (thisChar != '\r') {  //개행을 제외한 이외의 경우
                byteIs += 1;
            }
        }


        document.getElementById(ReLen).innerHTML = strLen;
        document.getElementById(ReByte).innerHTML = byteIs;
    }


    function strip_string(strval) {
        var _pattern = /[^0-9]/g;
        strval = strval.replace(_pattern, "");

        return strval;
    }




    function mail_chk(cg) {
        cg_no = cg.length

        for (i = 0; i < cg_no; i++) {
            cg = cg.replace(/(\s)+/, '');
            cg = cg.replace(/[^A-Za-z0-9_\-@\. ]/, "\.");
        }

        emailEx1 = /^([A-Za-z0-9_-]{1,15})(@{1})([A-Za-z0-9_-]{1,15})(\.{1})([A-Za-z0-9_-]{2,10})(\.{1}[A-Za-z]{2,10})?(\.{1}[A-Za-z]{2,10})?$/;

        if (emailEx1.test(cg)) return cg;

        return false;
    } 
	

 
 
 
 
 
 
 
 
 
 
 
 
 
 
    
    

    function Check_Manager() 
    {
        this.count = null;
        this.value = null;
    }


    function  Check_All(sName)
    {
        ObjItem = GetControl_Name(sName)
        
        if (ObjItem.length)
        {
            for(var j=0;j<ObjItem.length;j++)
            { 
	            ObjItem[j].checked = !eval(ObjItem[j].checked)
            }
        }else{
            ObjItem.checked = !eval(ObjItem.checked)
        }
    }


    function CheckSelected_Value(sName)
    {
        ObjItem = GetControl_Name(sName)
  
        var check_manager = new Check_Manager();
        
        var count = 0;
        var value = "";
        
/*        
        
        if (isObject(ObjItem)) 
        {
*/            
            if (ObjItem.length)
            {
	            for(var j=0; j < ObjItem.length ;j++)
	            { 
		            if (eval(ObjItem[j].checked))
		            {
			            count += 1
			            value += "," + ObjItem[j].value ;
		            }
	            }	
            }
            else
            {
	            if (eval(ObjItem.checked))
	            {
		            count += 1
			        value += "," + ObjItem[j].value ;
	            }
            }
/*        
        }
        else
        {
            count = -99;
            value = "";
        }
*/        
        check_manager.count = count;
        check_manager.value = value;
       
        
        return check_manager
    }






    function fileUploadPreview(thisObj, preViewer) {
        if (!/(\.gif|\.jpg|\.jpeg|\.png|\.swf)$/i.test(thisObj.value)) {
            alert("이미지 형식의 파일을 선택하십시오");
            return;
        }

        preViewer = (typeof (preViewer) == "object") ? preViewer : document.getElementById(preViewer);

        var ua = window.navigator.userAgent;

        if (ua.indexOf("MSIE 8") > -1) {
            thisObj.select();

            var selectionRange = document.selection.createRange();
            var selectionText = selectionRange.text.toString();

            preViewer.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='file://" + selectionText + "', sizingMethod='scale')";
            thisObj.blur();
        } else if (ua.indexOf("MSIE 7") > -1) {
            thisObj.select();

            var selectionRange = document.selection.createRange();
            var selectionText = selectionRange.text.toString();

            preViewer.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='file://" + selectionText + "', sizingMethod='scale')";
        }else {
            preViewer.innerHTML = "";
            var W = preViewer.offsetWidth;
            var H = preViewer.offsetHeight;
            var tmpImage = document.createElement("img");
            preViewer.appendChild(tmpImage);

            tmpImage.onerror = function() {
                return preViewer.innerHTML = "<img src='/common/images/common/no_sajin.gif' alt='' />";
            }

            tmpImage.onload = function() {
                if (this.width > W) {
                    this.height = this.height / (this.width / W);
                    this.width = W;
                }
                if (this.height > H) {
                    this.width = this.width / (this.height / H);
                    this.height = H;
                }
            }
            if (ua.indexOf("Firefox/3") > -1) {
                var picData = thisObj.files.item(0).getAsDataURL();
                tmpImage.src = picData;
            } else {
                tmpImage.src = "file://" + thisObj.value;
            }
        }
    }


    function fileUploadView(imgURL, preViewer) {

        preViewer = (typeof (preViewer) == "object") ? preViewer : document.getElementById(preViewer);
        var ua = window.navigator.userAgent;

        if (ua.indexOf("MSIE 8") > -1) {
            preViewer.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + imgURL + "', sizingMethod='scale')";
        } else if (ua.indexOf("MSIE 7") > -1) {
            preViewer.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + imgURL + "', sizingMethod='scale')";
        } else {
            preViewer.innerHTML = "";
            var W = preViewer.offsetWidth;
            var H = preViewer.offsetHeight;
            var tmpImage = document.createElement("img");
            preViewer.appendChild(tmpImage);

            tmpImage.onerror = function() {
                return preViewer.innerHTML = "<img src='/common/images/common/img_blank_photo02.gif' alt='' />";
            }

            tmpImage.onload = function() {
                if (this.width > W) {
                    this.height = this.height / (this.width / W);
                    this.width = W;
                }
                if (this.height > H) {
                    this.width = this.width / (this.height / H);
                    this.height = H;
                }
            }
            if (ua.indexOf("Firefox/3") > -1) {
                var picData = imgURL;
                tmpImage.src = picData;
            } else {
                tmpImage.src = imgURL;
            }
        }
    }



    function file_upload(target, val) {

        var obj = GetControl(target)
        var fname = val;

        var arr = ("file:///" + fname.replace(/ /gi, "%20").replace(/\\/gi, "/")).split("/");

        obj.value = arr[arr.length - 1];

    }





    function ReplaceAll(FullString, TargetString, ReplaceString) {

        var RegExpSelect = new RegExp(TargetString, "gi")   //선택된 문자열에 대한 regular expression 개체 생성

        var NewString = FullString.replace(RegExpSelect, ReplaceString);

        return NewString;
    }
	
	





















    function ConfirmDel(msg) {
        var result = confirm(msg);

        if (result)
            return true;
        else
            return false;
    } 
    
    
    
    
    
    
    
    
    
    
    
    
//쿠키 쓰기    
function setCookie( name, value, expiredays )
{    
    var today = new Date();    
    
    today.setDate( today.getDate() + expiredays );

    document.cookie = name + "=" + escape(value) + "; path=/;    expires=" + today.toGMTString() + "; domain=gemcom.co.kr;"     //domain을 사용하게 되면 하위도메인에서도 공유가 가능하다.
}



//쿠키 가져오기
function getCookie(name)
{    
    var idx_s = document.cookie.indexOf(name + "=");    
    var idx_e = 0;   
     
    if (idx_s != -1)
    { 
        idx_s += name.length + 1; 
        idx_e = document.cookie.indexOf(";",idx_s); 
    
        if (idx_e == -1)
        {     
            idx_e = document.cookie.length; 
        }    
    }
    else
    { 
        return "";    
    }    
    
    return document.cookie.substring(idx_s,idx_e);
}
    

// 쿠키지우기
function delCookie(name)
{
    today   = new Date();
    today.setDate(today.getDate() - 1);
    document.cookie = name + "=; path=/; expires=" + today.toGMTString() + "; domain=gemcom.co.kr;";
}















var GemCom = function() {
    this.version = "v0.1 r100305"; 	// 버젼(String)
    this.selColor = "#d6e3f1"; 		// 반전 색상(String)
    //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
}

// 등록 및 수정시 리스트 블럭킹
GemCom.prototype.screen_blind = function(mode) {
    var screenBlindDiv = $('screenBlindDiv');
    if (mode === true) {
        screenBlindDiv.style.display = "block";
        var _height = parseInt(document.body.clientHeight, 10);
        if (parseInt(document.body.scrollHeight, 10) > _height) _height = parseInt(document.body.scrollHeight, 10);
        screenBlindDiv.style.height = parseInt(document.body.scrollTop, 10) + (_height) + "px"; // : "100%";
        screenBlindDiv.style.marginTop = "-" + parseInt(document.body.scrollTop, 10) + "px";
        this.change_alpha(screenBlindDiv, 0, 30, 10, "stop");

    }
    else {
        this.change_alpha(screenBlindDiv, 30, 0, 10, true);

    }
}


// 레이어 투명도 설정 - 버그수정 필요 #####
GemCom.prototype.change_alpha = function(obj, begin, end, step, stop, handler) {
    if (begin === end) {
        if (stop === true) {
            obj.style.display = "none";
            obj.style.height = "0px";
            return false;
        }
        else {
            if (stop === "stop") return false;
            setTimeout(function() {
                if (classObj.popNotice_beginHandler == handler) {
                    classObj.popNotice_beginHandler = null;
                    classObj.change_alpha(obj, 100, 0, 5, true);
                }
            }, 2000); // 2초간 멈춤
        }
    }
    else {
        var opacity = begin > end ? begin - step : begin + step;
        obj.style.filter = " alpha(opacity=" + opacity + " Style=4 FinishOpacity=90)";
        if (classObj.popNotice_beginHandler == null) {
            classObj.popNotice_beginHandler = setTimeout(function() {
                classObj.change_alpha(obj, opacity, end, step, stop);
            }, 20);
        }
        else {
            setTimeout(function() {
                classObj.change_alpha(obj, opacity, end, step, stop, classObj.popNotice_beginHandler);
            }, 20);
        }
    }
}


// 알림글 띄우기
GemCom.prototype.popup_notice = function(msg, normal) {
    var noticePop = $('noticePopupDiv');
    noticePop.innerHTML = msg;
    noticePop.style.display = "block";
    noticePop.className = normal === true ? "green" : "red";
    this.popNotice_beginHandler = null;
    this.change_alpha(noticePop, 0, 85, 5);
}











var GemComSubmit = function() {
    this.version = "v0.1 100308"; 	// 버젼(String)

    this.form = null;
}


GemComSubmit.prototype.CreateForm = function(name, method, action, target) {

    this.form = document.createElement("form");

    this.form.name = name;
    this.form.method = method;
    this.form.action = action;
    this.form.target = target;
};


GemComSubmit.prototype.AddHidden = function(name, value) {
    var input = document.createElement('input');

    input.type = 'hidden';
    input.name = name;
    input.value = value;

    this.form.insertBefore(input);

};


GemComSubmit.prototype.UTF8Submit = function(wid, hei, scl) {

    document.insertBefore(this.form);
    document.charset = "utf-8";

    window.open('', this.form.target, 'width=' + wid + ',height=' + hei + ',scrollbars=' + scl);

    this.form.submit();
};


GemComSubmit.prototype.PopSubmit = function(wid, hei, scl) {
    
    document.insertBefore(this.form);
    document.charset = "euc-kr";

    window.open('', this.form.target, 'width=' + wid + ',height=' + hei + ',scrollbars=' + scl);

    this.form.submit();
};






//onKeyUp="addComma(this)"




 function addComma(obj) 
 {
    obj.value = addRest_str(obj.value);
 }

 

 function addRest_str(value)
 {
 
    var etc = value.split(".")[1]; //소수점 처리
    value = value.split(".")[0];
 
    var inp_value = new String(value);
    var org_value = commaRemove(inp_value);
    var org_value_leng = org_value.length%3;
    var newStr = "";
    var remain = 0;
  
    for (var i=1; i <= org_value.length; i++) 
    {
        newStr = newStr + org_value.charAt(i-1);
   
        if ( org_value.length > 3 )
        {
            remain = i%3;
 
            if ( remain == org_value_leng )
            {
                if ( i != org_value.length )
                {
                    newStr = newStr + ",";
                }
            }
        }
   
    }
  
    if(etc != null) return newStr + "." + etc;   else return newStr;
 }




 // ","제거하기
 function commaRemove(source)
 {
    var data = source;
 
    if (data.length <1) 
        return "";
        
    var newStr="";
 
    while(data.indexOf(",") != -1)
    {
        newStr = newStr + data.substring(0,data.indexOf(","));
        data= data.substring(data.indexOf(",") + 1);
    }
  
    return newStr + data; 
  }


//----------------------------------------------------------------------
// 함 수 명 : block_val(데이터)
// 설    명 : SQL Injection 체크
//----------------------------------------------------------------------
function deny_check(val) {

  var chk_val = "";
  var block_arr = new Array(13);

  //차단할 단어
  block_arr[0] = ";--";
  block_arr[1] = "/*";
  block_arr[2] = "*/";
  block_arr[3] = "@@";
  block_arr[4] = "alter";
  block_arr[5] = "create";
  block_arr[6] = "cursor";
  block_arr[7] = "delete";
  block_arr[8] = "drop";
  block_arr[9] = "insert";
  block_arr[10] = "kill";
  block_arr[11] = "sysobjects";
  block_arr[12] = "syscolumns";
  block_arr[13] = "update";

  //루프
  for (i = 0; i <= 13; i++) {
      //차단된 단어가 포함되어 있는 경우
      if (val.indexOf(block_arr[i]) >= 0) {
          chk_val = block_arr[i]; //해당 단어 리턴
      }
  }

  return chk_val;

}

function block_msg(deny_val, focus_val) {
  alert(deny_val + " : 차단된 단어가 포함되어 있습니다.");
  focus_val.focus();
}

//----------------------------------------------------------------------
// 함 수 명 : string_check(데이터)
// 설    명 : ",'를 빈값으로 변환
//----------------------------------------------------------------------
function string_replace(strval) {

    strval = strval.replace(/'/g, "");
    strval = strval.replace(/"/g, "");

    return strval;
}
