function nullToZero(_param) {
	if(_param==null || _param=='') {
		return _param='0';
	}
	else
	{
		return _param;
	}
}

function isEmpty(_param) {
	if(_param==null || _param =='' || _param.length <= 0) {
		return true;
	}
	else
	{
		return false;
	}
}

function isNotEmpty(_param) {
	if(_param==null || _param =='' || _param.length <= 0) {
		return false;
	}
	else
	{
		return true;
	}
}

function myreplace(_str) 
{
	var str=_str;
	for(var i=0; i<str.length; i++)
    {
		str =    str.replace(/\'/g,"''")
			        .replace(/\&/g,"&amp;") 
					.replace(/\</g,"&lt;")
					.replace(/\>/g,"&gt;")
					.replace(",","")
					.replace("/","")
					.replace("(","")
					.replace(")","")
					.replace(".","")
					.replace(":","")
					.replace(/ /g, "");
	}
	return str;
}
    
    
	
function convertMoneyForm(txtNumber)
{
    var rxSplit = new RegExp('([0-9])([0-9][0-9][0-9][,.])');
    var arrNumber = txtNumber.split('.');
    arrNumber[0] += '.';
    do {
        arrNumber[0] = arrNumber[0].replace(rxSplit, '$1,$2');
     } while (rxSplit.test(arrNumber[0]));

    if (arrNumber.length > 1) {
        return arrNumber.join('');
    }
    else {
        return arrNumber[0].split('.')[0];
    }
}

function NumFormat(t) {
  var s=t.value;
  s=s.replace(/\D/g,'');
  var l=s.length-3;
  while(l>0) {
    s=s.substr(0,l)+','+s.substr(l);
    l-=3;
  }
  t.value = s;
  return t;
}

	// ??? ??? ?? ????.
function Space_All(str)
{
  var index, len
           
  while(true)
  {
   index = str.indexOf(" ")
   // ??? ??? ?????.
   if (index == -1) break
   // ??? ??? ????.
   len = str.length
   // ??? ?????.
   str = str.substring(0, index) + str.substring((index+1),len)
  }
   
  return str;
}

function checkNumber(param){
	val=param;
	re=/[^0-9]/gi;
	param=val.replace(re,"");
}


//to Integer type
function toInteger(param)
{
	param = parseInt(Math.round(toFloat(param)));
	return param;
}

//to Float type
function toFloat(param)
{
	param = parseFloat(nullToZero(myreplace(param)));
	param = Math.round(param * 100) / 100;
	return param;
}

//to Float type
function toFloat1(param)
{
	param = parseFloat(nullToZero(myreplace(param)));
	param = Math.round(param * 10) / 10;
	return param;
}

//??? ??
function checkNum(objNumBox)
{
   var numBoxValue = objNumBox.value;
   for(var i=0;i<numBoxValue.length;i++)
   {
      if(isNaN(numBoxValue.charAt(i))){
          window.alert("숫자만 가능합니다.");
          objNumBox.value = '0';
          for(var j=0;j<i;j++)
          {
              objNumBox.value += numBoxValue.charAt(j);
          }
          return;
      } 
    }
}

function onlyNumber()
{
  if ( ((event.keyCode < 48) || (57 < event.keyCode)) && 46 != event.keyCode ) 
       event.returnValue=false;
}


//마우스 오른쪽 버튼 막기
function BlockRight()
 {
  return false;
 }
 
 
 function center(){ 
    var x,y; 
    if (self.innerHeight) { // IE 외 모든 브라우저 
        x = (screen.availWidth - self.innerWidth) / 2; 
        y = (screen.availHeight - self.innerHeight) / 2; 
    }else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict 모드 
        x = (screen.availWidth - document.documentElement.clientWidth) / 2; 
        y = (screen.availHeight - document.documentElement.clientHeight) / 2; 
    }else if (document.body) { // 다른 IE 브라우저( IE < 6) 
        x = (screen.availWidth - document.body.clientWidth) / 2; 
        y = (screen.availHeight - document.body.clientHeight) / 2; 
    } 
    window.moveTo(x,y); 
} 
 
//-------------------------------------------------------------------------------------------------
// select box copy한다. 2006.03
//-------------------------------------------------------------------------------------------------
function copySelectBox(objFrom, objTo){
	var listcnt = objFrom.length;
	objTo.length = listcnt;

	for(i=0;i<listcnt;i++){
		objTo[i].value = objFrom[i].value;
		objTo[i].text = objFrom[i].text;
	}
}

//-------------------------------------------------------------------------------------------------
// multiple select box 를 모두 선택한 상태로 한다. 2006.03
//-------------------------------------------------------------------------------------------------
function setSelectedAll(obj){
	for(i=0;i<obj.length;i++){
		obj[i].selected = true;
	}
	return;
}
 
