/**
* project: lib.jsUtil.js ver 0.1.1
* description: 유틸리티 함수
* author: unkown
*/


//문자 바꾸기, 사용법 var str = 문자열.replaceAll("a", "1");  
String.prototype.trim = function(){
        return this.replace(/(^\s*)|(\s*$)/gi, "");
}

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;
}



function selectedOpts(objOption, oValue){
    for(var optIdx=0; optIdx < objOption.length; optIdx++){
       if(objOption[optIdx].value == oValue) {
           objOption[optIdx].selected = true;
           return;
       }
    }
}

//입력한 데이타를 금액 포맷으로 맞추기
String.prototype.number_format=function(){
return this.replace(/(\d)(?=(?:\d{3})+(?!\d))/g,'$1,');
}

//공백제거
String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/g,"");
}
String.prototype.ltrim = function() {
return this.replace(/^\s+/,"");
}
String.prototype.rtrim = function() {
return this.replace(/\s+$/,"");
}