// Various parameters

var nbsp = 160;    // non-breaking space char
var node_text = 3; // DOM text node-type
var emptyString = /^\s*$/
var glb_vfld;      // retain vfld for timer thread
var ErrorColor = 'Red';
var NormalColor = 'Black';


// For Debugging Only really

function DisplayPopUp(MyAlert)
{
	alert(MyAlert)
}

// Just a little function which allows you to check that you've found the include file

function AndMe()
{
	document.write("<h4>And Me!!!!</h4>")

}

// Check the minimum lenght of a string

function CheckMinLen(field,infofield,minlength)
{
	MyString=trimAll(field.value);
	if (MyString.length < minlength) {
		changecolor(infofield,ErrorColor);
		return false;
	}
	return true;
}

// Trim a String, left and right...

function trimAll(sString) 
{
	if (sString.length == 0) return '';

	while (sString.substring(0,1) == ' ')
	{
		sString = sString.substring(1, sString.length);
	}
	while (sString.substring(sString.length-1, sString.length) == ' ')
	{
		sString = sString.substring(0,sString.length-1);
	}
	return sString;
}

// Check to see of an Email address is valid

function validate_email(field,alerttxt)
{
	with (field)
	{
		apos=value.indexOf("@");
		dotpos=value.lastIndexOf(".");
		if (apos<1||dotpos-apos<2) 
  		{
			return false;
		}
		else 
		{
			return true;
		}
	}
}

// msg:	Display warn/error message in HTML element

function changecolor	(fld,NewColor)
{

  	var elem = document.getElementById(fld);
	elem.style.color=NewColor;
};

// Check to see if a particular string is numeric (only)

function IsNumeric(sText)
{
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
   
}


