<!-- Hide from non-JavaScript browsers


/*=======================Check if input is numeric only===========================================*/
   function NumericOnly()
	{
	// to allow 0-9 numeric digit in the input field
		if( window.event.keyCode < 48 || window.event.keyCode > 57 ) window.event.returnValue = false;
	}
/*======================================================================================================*/

/*========================================= UpperCase===========================================*/  
   function UpperCase(ctrl){
        var outString = ctrl.value
	
	ctrl.value=outString.toUpperCase()
       }
/*===============================================================================================*/
/*=======================Check if input is numeric only===========================================*/
function NumericDotOnly()
	{
	// to allow 0-9 numeric digit and . (dot for decimal) in the input field
		if(( window.event.keyCode < 48 && window.event.keyCode != 46 ) || window.event.keyCode > 57 ) window.event.returnValue = false;
	}
/*======================================================================================================*/
 function ValidDate(value, format) {
  /*=============================================*/
    var year, month, day;
    var monthlength = new Array(31,28,31,30,31,30,31,31,30,31,30,31);
    var maxmonthday;

    try {
      if ( !(value) || (value == "") ) {
        throw "invalid date";
      }

      switch ( format.toLowerCase() ) {
        case  "dd/mm/yyyy" : {
          day  = parseFloat(value.substr(0, 2));
          month = parseFloat(value.substr(3, 2));
          break;
        }
        case "mm/dd/yyyy" : {
          month = parseFloat(value.substr(0, 2));
          day  = parseFloat(value.substr(3, 2));
          break;
        }
        default : throw "invalid format";
      }

      year  = parseFloat(value.substr(6, 4));

      if ( isNaN(day) || isNaN(month) || isNaN(year) ) throw "invalid date";
      if ( (year<0) || (year>3000) )  throw "invalid year";
	  if ( (year>99) && (year<1900) )  throw "invalid year";

      year = Y2K(year);
	  
      if ( (month<=0) || (month>12) ) throw "invalid month";

      if (month==2 && (year/4==Math.floor(year/4) || year/400==Math.floor(year/400))) {
        maxmonthday = 29;
      }
      else {
        maxmonthday = monthlength[month-1];
      }
        
      if ((day<=0) || (day>maxmonthday)) throw "invalid day"
      return(true);
    } 
      catch(e) {
      return false;      
    }
  }
  
  function isBlank(t){
	var s=new String(t)
	var len=s.length
	var i
	for(i=0;i<len;++i){
		if(s.charAt(i)!=" ")
			return false
		}		
	return true
	}

  function CheckDate(mObject) {
  /*=============================================*/
    var val

    //--- "document.all" specific utk IE

    val = mObject.value
    
    //--- Check tgl
    if (ValidDate(val, "dd/mm/yyyy") ) {
      //--- Jika valid format tgl tsb
      mObject.value = FormatDate(val, "dd/mm/yyyy");
    } 
      else {
		if (!(isBlank(mObject.value))) {
			window.alert("Salah input tanggal!!");
			mObject.focus();
		}
    }
  }
  
 
  
    
// -- End Hide -->
