<!-- Begin
function check_date(field){
var checkstr = "0123456789";
var DateField = field;
var Datevalue = "";
var DateTemp = "";
var seperator = "/";
var day;
var month;
var year;
var leap = 0;
var err = 0;
var i;
   err = 0;
   DateValue = DateField.value;
   /* Delete all chars except 0..9 */
   for (i = 0; i < DateValue.length; i++) {
	  if (checkstr.indexOf(DateValue.substr(i,1)) >= 0) {
	     DateTemp = DateTemp + DateValue.substr(i,1);
	  }
   }
   DateValue = DateTemp;
   /* Always change date to 8 digits - string*/
   /* if year is entered as 2-digit / always assume 20xx */
   if (DateValue.length == 6) {
      DateValue = DateValue.substr(0,4) + '20' + DateValue.substr(4,2); }
   if (DateValue.length != 8) {
      err = 19;}
   /* year is wrong if year = 0000 */
   year = DateValue.substr(4,4);
   if (year == 0) {
      err = 20;
   }
   /* Validation of month*/
   month = DateValue.substr(0,2);
   if ((month < 1) || (month > 12)) {
      err = 21;
   }
   /* Validation of day*/
   day = DateValue.substr(2,2);
   if (day < 1) {
     err = 22;
   }
   /* Validation leap-year / february / day */
   if ((year % 4 == 0) || (year % 100 == 0) || (year % 400 == 0)) {
      leap = 1;
   }
   if ((month == 2) && (leap == 1) && (day > 29)) {
      err = 23;
   }
   if ((month == 2) && (leap != 1) && (day > 28)) {
      err = 24;
   }
   /* Validation of other months */
   if ((day > 31) && ((month == "01") || (month == "03") || (month == "05") || (month == "07") || (month == "08") || (month == "10") || (month == "12"))) {
      err = 25;
   }
   if ((day > 30) && ((month == "04") || (month == "06") || (month == "09") || (month == "11"))) {
      err = 26;
   }
   /* if 00 ist entered, no error, deleting the entry */
   if ((day == 0) && (month == 0) && (year == 00)) {
      err = 0; day = ""; month = ""; year = ""; seperator = "";
   }
   /* if no error, write the completed date to Input-Field (e.g. 13.12.2001) */
   if (err == 0) {     
      return true;
   }
   /* Error-message if err != 0 */
   else {
      return false;	  
   }
}
//  End -->


function chkNumeric(field)
//  check for valid numeric strings	
{//alert(field);
	var strValidChars = "0123456789";
	var strChar;
	var blnResult = true;
	var strString = field.value;
	
	//  test strString consists of valid characters listed above
	for (i = 0; i < strString.length && blnResult == true; i++)
	{
		strChar = strString.charAt(i);
		if (strValidChars.indexOf(strChar) == -1)
		{
		    blnResult = false;
		}
	}
	return blnResult;
}



function chkEmail(cntrl)
{
    re=/^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?[\s]*)$/;		            

	if(cntrl!=null && cntrl.value.trim()!='' && !cntrl.value.trim().match(re)) 
	{ 
		isValid = false;
		var strMessage;
		
		strMessage='Please provide a valid email address!';

		alert(strMessage);
		cntrl.focus();		
    } 
    else
    {
		isValid = true;    
    }

    return isValid;
}


function chkZipCode(field,blnAlert) {

   var valid = "0123456789";
   var hyphencount = 0;
   var blnReturn = true;
   var strMessage = "";


   if (field.value.length!=5) {
    strMessage = "Please enter a 5 digit  zip code.";
    blnReturn =  false;
   }

   for (var i=0; i < field.value.length; i++) {
      temp = "" + field.value.substring(i, i+1);

      if (valid.indexOf(temp) == "-1") {
        strMessage = "Invalid characters in your zip code.  Please try again.";
        blnReturn = false;
      }
   }

   if (blnReturn == false && blnAlert)
   {
      alert(strMessage);
   }
   
   return blnReturn;   
}

function chkZipCode(cntrl)
{
	re=/(^\\d{5}$)|(^\\d{5}-\\d{4}$)/;

	if(cntrl!=null && cntrl.value.trim()!='' && !cntrl.value.trim().match(re)) 
	{ 
		isValid = false;
		var strMessage;
		
		strMessage='You have entered an invalid zipcode!';

		//alert(strMessage);
		cntrl.focus();		
    } 
    else
    {
		isValid = true;    
    }

    return isValid;
}
function checkMoney(cntrl)
{
    re = /^\d+(\.\d{2})?$/;
    
    if(cntrl!=null && cntrl.value.trim()!='' && !cntrl.value.trim().match(re)) 
	{ 
		isValid = false;
		var strMessage;
		
		strMessage='Please provide a valid price!';

		alert(strMessage);
		cntrl.focus();		
    } 
    else
    {
		isValid = true;    
    }

    return isValid;
}
function checkValue()
{
	var e = window.event;
	
	//alert("hui code:"+e.keyCode+"text"+e.value);
	var bResult = false;	
	
	if(e.keyCode == '27' || e.keyCode == '144')
	{
		return false; 
	}
	else
	{
		if(parseInt(e.keyCode) > 47 && parseInt(e.keyCode) < 58)
		{
			bResult = true; 
		}
		if(parseInt(e.keyCode) > 95 && parseInt(e.keyCode) < 106)
		{
			bResult = true; 
		}
		if(parseInt(e.keyCode) == 8 || parseInt(e.keyCode) == 9 )
		{
			bResult = true; 
		}
		if((parseInt(e.keyCode) == 13) || (parseInt(e.keyCode) == 46) || (parseInt(e.keyCode) > 34 && parseInt(e.keyCode) < 41))
		{
			bResult = true; 
		}
	}
	if(!bResult)
	{
		alert("Please enter numeric only.");
	}
	return bResult;
}
function checkBlank(obj)
{
    if( obj.value == '' )
    {
        alert("Please provide a value.");
        obj.focus();
        return false;
    }
}
