			function trim(str)
			{
			  return str.replace(/^\s+|\s+$/g, '');
			}

			function trimAll()
			{

			   document.contact_form.txtFname.value = trim(document.contact_form.txtFname.value);
			   document.contact_form.txtEmail.value = trim(document.contact_form.txtEmail.value);
			   document.contact_form.txtPhone.value = trim(document.contact_form.txtPhone.value);
			   document.contact_form.message.value = trim(document.contact_form.message.value);
			}


			function ValidatePhone(phone){
				if(phone.value.length == 10){
				}else
				{
					return false;
				}
				return true;
			}

			var numb = '0123456789';
			var space= ' ';
			var lwr = 'abcdefghijklmnopqrstuvwxyz';
			var upr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';

			function isValid(parm,val) {
			if (parm.value == "") {
				return true;

			}
			for (i=0; i<parm.value.length; i++) {
			if (val.indexOf(parm.value.charAt(i),0) == -1) {

				return false;
				}else
				{

				}
			}
				return true;
			}

			function isAlpha(parm) {
				return isValid(parm,lwr+upr+space);
			}

			function isNumber(parm) {return isValid(parm,numb);}

			function ValidateEmail(email){
					var atCharPresent = false;
					var dotPresent = false;

					for ( var Idx = 0; Idx < email.value.length; Idx++ ){
						if ( email.value.charAt ( Idx ) == '@' )
							atCharPresent = true;
						if ( email.value.charAt ( Idx ) == '.' )
							dotPresent = true;
					}
					if ( !atCharPresent || !dotPresent ){
						return false;
						}
				return true;
			}

			function vaidateForm(){
				var errorMessage = "";
				var check = 0;
			  	trimAll();
				chk = document.contact_form;

				if(chk.txtFname.value == ""){
					check = check + 1;
					errorMessage += "Please enter first name which is required."+"\n";
					if (check == 1){
						chk.txtFname.focus();
	 				}
				}else if(!isAlpha(chk.txtFname))
				{
						check = check + 1;
						errorMessage += "Name should be only alpha characters (A to Z)."+"\n";
						if (check == 1){
							chk.txtFname.focus();
	 				}
				}

				if(chk.txtEmail.value == ""){
						check = check + 1;
						errorMessage += "Email address is required."+"\n";
						if (check == 1){
							chk.txtEmail.focus();
	 				}
				}else if(! ValidateEmail(chk.txtEmail)){
						check = check + 1;
						errorMessage += "Invalid Email address, Please check."+"\n";
						if (check == 1){
							chk.txtEmail.focus();
	 				}
				}

				if(!ValidatePhone(chk.txtPhone)){
					check = check + 1;
					errorMessage += "Phone number should be 10 characters in length."+"\n";
					if (check == 1){
						chk.txtEmail.focus();
	 				}
				}else if(!isNumber(chk.txtPhone))
				{
					check = check + 1;
					errorMessage += "Phone number should be numeric! \n Please correct the Phone Number."+"\n";
					if (check == 1){
						chk.txtPhone.focus();
	 				}
				}
				if(chk.message.value == ""){
						check = check + 1;
						errorMessage += "Please type in your message."+"\n";
						if (check == 1){
							chk.message.focus();
	 				}
				}

				if (errorMessage.length != 0)
				{
					errorMessage = errorMessage + "\n All fields marked with * are required fields"
					alert(errorMessage);
					return false;
				} else {
					return true;
				}
			}
		