//<script Language="JavaScript">
<!--



function Validate (form)
{
	var ret = true;

	if (form.First_Name.value == ""){
		document.getElementById ('First_NameL').className = "required"
		ret = false;
	}else{
		document.getElementById ('First_NameL').className = "filled"
	}

	if (form.Last_Name.value == ""){
		document.getElementById ('Last_NameL').className = "required"
		ret = false;
	}else{
		document.getElementById ('Last_NameL').className = "filled"
	}

	if (form.Telephone_Number.value == ""){
		document.getElementById ('Telephone_NumberL').className = "required"
		ret = false;
	}else{
		document.getElementById ('Telephone_NumberL').className = "filled"
	}

	if (form.EMail_Address.value == ""){
		document.getElementById ('EMail_AddressL').className = "required"
		ret = false;
	}else{
		document.getElementById ('EMail_AddressL').className = "filled"
	}

	if (form.Comments_Text.value == ""){
		document.getElementById ('Comments_TextL').className = "required"
		ret = false;
	}else{
		document.getElementById ('Comments_TextL').className = "filled"
	}



	return ret;
}

function Clear (who)
{
	document.getElementById (who.id + 'L').className = "normal"
	document.getElementById ('mainbutton').disabled = !Validate (document.getElementById ('mainform'))
}





function Form1_Validator(theForm)
{

var alertsay = ""; // define for long lines
// alertsay is not necessary for your code,
// but I need to break my lines in multiple lines
// so the code won't extend off the edge of the page



// check to see if the First Name field is blank
if (theForm.First_Name.value == "")
{
alert("שדה ''שם פרטי'' ריק \n\n נא להקליד שם פרטי");
theForm.First_Name.focus();
return (false);
}

// require at least 2 characters be entered in the First Name field
if (theForm.First_Name.value.length < 2)
{
alert("הקלד בבקשה לפחות 2 תווים בשדה \"שם פרטי\" .");
theForm.First_Name.focus();
return (false);
}



// check to see if the Last Name field is blank
if (theForm.Last_Name.value == "")
{
alert("שדה ''שם משפחה'' ריק \n\n נא להקליד שם משפחה");
theForm.Last_Name.focus();
return (false);
}

// require at least 2 characters be entered in the Last Name field
if (theForm.Last_Name.value.length < 2)
{
alert("הקלד בבקשה לפחות 2 תווים בשדה \"שם משפחה\" .");
theForm.Last_Name.focus();
return (false);
}



// check to see if the Telephone Number field is blank
if (theForm.Telephone_Number.value == "")
{
alert("שדה ''מספר טלפון'' ריק \n\n נא להקליד מספר טלפון");
theForm.Telephone_Number.focus();
return (false);
}

// require at least 2 characters be entered in the Last Name field
if (theForm.Telephone_Number.value.length < 9)
{
alert("הקלד בבקשה לפחות 9 תווים בשדה \"מספר טלפון\" .");
theForm.Telephone_Number.focus();
return (false);
}



// check if E-mail field is blank
if (theForm.EMail_Address.value == "")
{
alert("שדה ''דואר אלקטרוני'' ריק \n\n נא להקליד דואר אלקטרוני");
theForm.EMail_Address.focus();
return (false);
}

// test if valid EMail Address, must have @ and .
var checkEmail = "@.";
var checkStr = theForm.EMail_Address.value;
var EmailValid = false;
var EmailAt = false;
var EmailPeriod = false;
for (i = 0;  i < checkStr.length;  i++)
{
ch = checkStr.charAt(i);
for (j = 0;  j < checkEmail.length;  j++)
{
if (ch == checkEmail.charAt(j) && ch == "@")
EmailAt = true;
if (ch == checkEmail.charAt(j) && ch == ".")
EmailPeriod = true;
	  if (EmailAt && EmailPeriod)
		break;
	  if (j == checkEmail.length)
		break;
	}
	// if both the @ and . were in the string
if (EmailAt && EmailPeriod)
{
		EmailValid = true
		break;
	}
}
if (!EmailValid)
{
alert("שדה \"דואר אלקטרוני\" חייב לכלול את התווים \"@\" ו- \".\" כדי שיהיה תקין");
theForm.EMail_Address.focus();
return (false);
}



// check to see if the Comments Text field is blank
if (theForm.Comments_Text.value == "")
{
alert("שדה ''תוכן פנייה'' ריק \n\n נא להקליד תוכן פנייה'");
theForm.Comments_Text.focus();
return (false);
}

// require at least 2 characters be entered in the Last Name field
if (theForm.Comments_Text.value.length < 2)
{
alert("הקלד בבקשה לפחות 2 תווים בשדה \"תוכן פנייה'\" .");
theForm.Comments_Text.focus();
return (false);
}



// because this is a sample page, don't allow to exit to the post action
// comes in handy when you are testing the form validations and don't
// wish to exit the page
// alertsay = "All Validations have succeeded. "
// alertsay = alertsay + "This is just a test page. There is no submission page."
// alert(alertsay);
return (true);
// replace the above with return(true); if you have a valid form to submit to
}



function textCounter(field, countfield, maxlimit) {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else 
countfield.value = maxlimit - field.value.length;
}



//-->
//</script>
