function vfNumericField(object,decplc,def,MinValue, MaxValue)
{
   var val = object.value;
   var grpchr = ",";
   var decchr = ".";
   var num;
   if (val.length>0)
   {
      num = ToNumeric(val,grpchr,decchr);
      if (num == null)
      {
         object.focus();
         object.select();
         alert("Value must be a valid numeric");
      }
      else
      {
		if (num < MinValue)
		{
			object.focus();
			object.select();
			alert("Value must be more than " + MinValue);
			return;
		}
		if (num > MaxValue)
		{
			object.focus();
			object.select();
			alert("Value must be less than " + MaxValue);
			return;
		}
		object.value = fNumberFormat(num,decplc);
      }
   }
 }

function NumericKeyStrokes(object,evt)
{
   var charCode = (navigator.appName == "Netscape") ? evt.which : evt.keyCode;

   if (charCode > 31 && ((charCode < 48 && charCode != 46) || charCode > 57))
   {
      return false;
   }
   else
   {
      var val = object.value;
      if ((charCode == 46) && (val.length > 0))
      {
         if (val.indexOf(".") == -1)
         {
            return true;
         }
         else
         {
            return false;
         }
      }
      else
      {
         return true;
      }
   }
}

function vfDateField(objName,strFormat) {
var datefield = objName;
if (chkdate(objName,strFormat) == false) {
datefield.select();
alert("That date is invalid.  Please try again.");
datefield.focus();
return false;
}
else {
return true;
   }
}
function chkdate(objName,strFormat) {
//var strDatestyle = "US"; //United States date style
var strDatestyle = "EU";  //European date style
var strDate;
var strDateArray;
var strDay;
var strMonth;
var strYear;
var intday;
var intMonth;
var intYear;
var booFound = false;
var datefield = objName;
var strSeparatorArray = new Array("-"," ","/",".");
var intElementNr;
var err = 0;
var strMonthArrayShort = new Array(12);
var strMonthArrayLong = new Array(12);

	strMonthArrayShort[0] = "Jan";
	strMonthArrayShort[1] = "Feb";
	strMonthArrayShort[2] = "Mar";
	strMonthArrayShort[3] = "Apr";
	strMonthArrayShort[4] = "May";
	strMonthArrayShort[5] = "Jun";
	strMonthArrayShort[6] = "Jul";
	strMonthArrayShort[7] = "Aug";
	strMonthArrayShort[8] = "Sep";
	strMonthArrayShort[9] = "Oct";
	strMonthArrayShort[10] = "Nov";
	strMonthArrayShort[11] = "Dec";

	strMonthArrayLong[0] = "January";
	strMonthArrayLong[1] = "Febuary";
	strMonthArrayLong[2] = "March";
	strMonthArrayLong[3] = "April";
	strMonthArrayLong[4] = "May";
	strMonthArrayLong[5] = "June";
	strMonthArrayLong[6] = "July";
	strMonthArrayLong[7] = "August";
	strMonthArrayLong[8] = "September";
	strMonthArrayLong[9] = "October";
	strMonthArrayLong[10] = "Novemeber";
	strMonthArrayLong[11] = "Descember";

strDate = datefield.value;
if (strDate.length < 1) 
{
	return true;
}
if ((strDate.length >= 1) && (strDate.length <= 5))
{
	return false;
}
for (intElementNr = 0; intElementNr < strSeparatorArray.length; intElementNr++) {
if (strDate.indexOf(strSeparatorArray[intElementNr]) != -1) {
strDateArray = strDate.split(strSeparatorArray[intElementNr]);
if (strDateArray.length != 3) {
err = 1;
return false;
}
else {
strDay = strDateArray[0];
strMonth = strDateArray[1];
strYear = strDateArray[2];
}
booFound = true;
   }
}
if (booFound == false) {
if (strDate.length>5) {
strDay = strDate.substr(0, 2);
strMonth = strDate.substr(2, 2);
strYear = strDate.substr(4);
   }
}
if (strYear.length == 2) {
strYear = '20' + strYear;
}
// US style
if (strDatestyle == "US") {
strTemp = strDay;
strDay = strMonth;
strMonth = strTemp;
}
intday = parseInt(strDay, 10);
if (isNaN(intday)) {
err = 2;
return false;
}
intMonth = parseInt(strMonth, 10);
if (isNaN(intMonth)) {
for (i = 0;i<12;i++) {
if (strMonth.toUpperCase() == strMonthArrayShort[i].toUpperCase() || strMonth.toUpperCase() == strMonthArrayLong[i].toUpperCase()) {
intMonth = i+1;
if (strFormat == "Short")
{
	strMonth = strMonthArrayShort[i];
}
else
{
	strMonth = strMonthArrayLong[i];
}

i = 12;
   }
}
if (isNaN(intMonth)) {
err = 3;
return false;
   }
}
intYear = parseInt(strYear, 10);
if (isNaN(intYear)) {
err = 4;
return false;
}
if (intMonth>12 || intMonth<1) {
err = 5;
return false;
}
if ((intMonth == 1 || intMonth == 3 || intMonth == 5 || intMonth == 7 || intMonth == 8 || intMonth == 10 || intMonth == 12) && (intday > 31 || intday < 1)) {
err = 6;
return false;
}
if ((intMonth == 4 || intMonth == 6 || intMonth == 9 || intMonth == 11) && (intday > 30 || intday < 1)) {
err = 7;
return false;
}
if (intMonth == 2) {
if (intday < 1) {
err = 8;
return false;
}
if (LeapYear(intYear) == true) {
if (intday > 29) {
err = 9;
return false;
}
}
else {
if (intday > 28) {
err = 10;
return false;
}
}
}
if (strDatestyle == "US") 
{
	datefield.value = strMonthArray[intMonth-1] + " " + intday+" " + strYear;
}
else 
{
	if (intday < 10)
	{
		if (strFormat == "Short")
		{
			datefield.value = "0" + intday + " " + strMonthArrayShort[intMonth-1] + " " + strYear;
		}
		else
		{
			datefield.value = "0" + intday + " " + strMonthArrayLong[intMonth-1] + " " + strYear;
		}
	}
	else
	{
		if (strFormat == "Short")
		{
			datefield.value = intday + " " + strMonthArrayShort[intMonth-1] + " " + strYear;
		}
		else
		{
			datefield.value = intday + " " + strMonthArrayLong[intMonth-1] + " " + strYear;
		}
	}
}
return true;
}
function LeapYear(intYear) {
if (intYear % 100 == 0) {
if (intYear % 400 == 0) { return true; }
}
else {
if ((intYear % 4) == 0) { return true; }
}
return false;
}
function doDateCheck(from, to) {
if (Date.parse(from.value) <= Date.parse(to.value)) {
alert("The dates are valid.");
}
else {
if (from.value == "" || to.value == "") 
alert("Both dates must be entered.");
else 
alert("To date must occur after the from date.");
   }
}

function ToNumeric(val,groupchar,decimalchar)
{
   var cleanInput, num, m, exp;
   var digits = 18;
   exp = new RegExp("^\\s*([-\\+])?(((\\d+)\\" + groupchar + ")*)(\\d+)"
                   + ((digits > 0) ? "(\\" + decimalchar + "(\\d{1," + digits + "}))?" : "")
                   + "\\s*$");
   m = val.match(exp);
   if (m == null)
   {
      return null;
   }

   var intermed = m[2] + m[5] ;
   cleanInput = m[1] + intermed.replace(new RegExp("(\\" + groupchar + ")", "g"), "") + ((digits > 0) ? "." + m[7] : 0);
   num = parseFloat(cleanInput);

   return (isNaN(num) ? null : num);
}

function DateKeyStrokes(object,evt)
{
   var charCode = (navigator.appName == "Netscape") ? evt.which : evt.keyCode;

   if (charCode > 31 && (charCode < 45 || charCode > 57 || charCode == 46))
   {
      return false;
   }
   else
   {
      return true;
   }
}

function vfStringUCase(object)
{
   val = object.value;
   if (val.length > 0)
   {
      object.value = val.toUpperCase();
   }
}

function vfStringLCase(object)
{
   val = object.value;
   if (val.length > 0)
   {
      object.value = val.toLowerCase();
   }
}

function fNumberFormat(num,decplc)
{
   var str = "" + Math.round(eval(num) * Math.pow(10,decplc));
   while (str.length <= decplc)
   {
      str = "0" + str;
   }
   var decpt = str.length - decplc
   if (decplc > 0)
   {
      return SetNumberFormat(str.substring(0,decpt) + "." + str.substring(decpt,str.length));
   }
   else
   {
      return SetNumberFormat(str.substring(0,decpt));
   }
}


function SetNumberFormat(amount)
{
   try 
   {
        amount = parseInt(amount);
        var samount = new String(amount);
        if (samount.length < 3) { return amount; }  

        for (var i = 0; i < Math.floor((samount.length-(1+i))/3); i++)
        {
           samount = samount.substring(0,samount.length-(4*i+3)) + ',' + samount.substring(samount.length-(4*i+3));
        }
   }
    catch (exception) { alert("Format Comma"); }
    return samount;
}

function ConfirmReverseCFCPaymentMessageBox()
{
    return confirm("You are about to reverse a CFC Transaction - are you sure you want to continue?");
}


<!-- Begin

//  End -->


















