﻿String.prototype.trim = function(){
a = this
var search = 0
while ( a.charAt(search) == " "){ search = search + 1 }	
a = a.substring(search, (a.length))
search = a.length - 1
while (a.charAt(search) ==" ") {search = search - 1}
return a.substring(0, search + 1)}
String.prototype.comma=function(){tmp=this.split('.');var str=new Array();var v=tmp[0].replace(/,/gi,'');
for(var i=0;i<=v.length;i++){str[str.length]=v.charAt(v.length-i);if(i%3==0&&i!=0&&i!=v.length){str[str.length]='.';}}
str=str.reverse().join('').replace(/\./gi,',');return (tmp.length==2)?str+'.'+tmp[1]:str;}
String.prototype.chkBlank = function() {if (this.replace(/\s/g, "") == "") {return true;}else{return false;}}
String.prototype.chkKor = function(){
if((this.replace(/\s/g, "") != "") && this.replace(/[ㄱ-ㅎㅏ-ㅣ가-힣]+/g,"") == "")
return true;
else
return false;
}
String.prototype.chkEng = function(){
if((this.replace(/\s/g, "") != "") && this.replace(/[a-zA-Z]+/g,"") == "")
return true;
else
return false;
}
String.prototype.chkNum = function(){
if((this.replace(/\s/g, "") != "") && this.replace(/\d+/g,"") == "")
return true;
else
return false;
}

function SelectCombo(Obj, Data) {
for (i=0; i < Obj.length; i++) {
if(Obj.options[i].value.trim() == Data.trim()) {
Obj.options[i].selected = true;
break;
}}}
function SelectComboByName(Obj, name) {
for (i=0; i < Obj.length; i++) {
if(Obj.options[i].text == name) {
Obj.options[i].selected = true;
break;
}}}
function GetComboName(Obj, val){
for (var i=0; i < Obj.length; i++) {
if(Obj.options[i].value == val) {
return Obj.options[i].text;
}}}
function GetComboValue(Obj, name){
for (var i=0; i < Obj.length; i++) {
if(Obj.options[i].text == name) {
return Obj.options[i].value;
}}}
function SelectRadio(Obj, Data) {
for (i=0; i < Obj.length; i++) {
if(Obj[i].value == Data) {
Obj[i].checked = true;
break;
}}}
function setValue(sName,value,type){
switch(type){
case "r" :
for( i = 0; i < sName.length; i++ ){
if( sName[i].value == value ){
sName[i].checked = true;
break;}}
break;
case "s" :
for( i = 0; i < sName.length; i++ ){
if( sName.options[i].value == value ){
sName.selectedIndex = i;
break;
}}
break;
case "c" :
if( value == "Y" ){
sName.checked = true;
}
break;
}}
