function test(src) {
     var emailReg = "^[\\w-_\.]*[\\w-_\.]\@[\\w]\.+[\\w]+[\\w]$";
     var regex = new RegExp(emailReg);
     return regex.test(src);
  }

function Trim(TRIM_VALUE){
if(TRIM_VALUE.length < 1){
return"";
}
TRIM_VALUE = RTrim(TRIM_VALUE);
TRIM_VALUE = LTrim(TRIM_VALUE);
if(TRIM_VALUE==""){
return "";
}
else{
return TRIM_VALUE;
}
} //End Function

function RTrim(VALUE){
var w_space = String.fromCharCode(32);
var v_length = VALUE.length;
var strTemp = "";
if(v_length < 0){
return"";
}
var iTemp = v_length -1;

while(iTemp > -1){
if(VALUE.charAt(iTemp) == w_space){
}
else{
strTemp = VALUE.substring(0,iTemp +1);
break;
}
iTemp = iTemp-1;

} //End While
return strTemp;

} //End Function

function LTrim(VALUE){
var w_space = String.fromCharCode(32);
if(v_length < 1){
return"";
}
var v_length = VALUE.length;
var strTemp = "";

var iTemp = 0;

while(iTemp < v_length){
if(VALUE.charAt(iTemp) == w_space){
}
else{
strTemp = VALUE.substring(iTemp,v_length);
break;
}
iTemp = iTemp + 1;
} //End While
return strTemp;
} //End Function


function checkForm1(testForm){

	if(Trim(testForm.Name.value) ==""){
	alert("Please fill in your Name.")
	testForm.Name.focus()
	return false;
	}	

	if (Trim(testForm.Email.value) ==""){			
		alert("Please fill in an Email Address.")
		testForm.Email.focus()
		return false;
		}
	else{
		 if (test(testForm.Email.value) == false){
		     alert("Email is not valid. Please check your Email Address.")
			 testForm.Email.focus()
			 return false;
		 }
	}

	if (Trim(testForm.Message.value) ==""){
	alert("Please fill in your Message.")
	testForm.Message.focus()
	return false;
	}





    return true;
}

 
function CheckNumeric()
{
   // Get ASCII value of key that user pressed
   var key = window.event.keyCode;

   // Was key that was pressed a numeric character (0-9) or "(" or ")" or "-"?
   if (( key > 47 && key < 58 ) || (key==40) || (key==41) || (key==45))
      return; // if so, do nothing
   else
      window.event.returnValue = null; // otherwise, discard character
}

function CheckText()
{
   // Get ASCII value of key that user pressed
   var key = window.event.keyCode;

   // Was key that was pressed a special character (<,>,<!"#$%&'>,<;>)?
   if ( key != 33 && key != 34 && key != 35 && key != 36 && key != 37 && key != 38 && key != 39 && key != 59 )
      return; // if so, do nothing
   else
      window.event.returnValue = null; // otherwise, discard character
}
//  End -->

