
<!--
function Form1_Validator(theForm)
{

var alertsay = ""; // define for long lines


// check to see if the field is blank
if (theForm.name.value == "")
{
alert("You must enter an name.");
theForm.name.focus();
return (false);
}

// require at least 3 characters be entered
if (theForm.name.value.length < 3)
{
alert("Please enter at least 3 characters in the \"name\" field.");
theForm.name.focus();
return (false);
}

// allow ONLY alphanumeric keys, no symbols or punctuation
// this can be altered for any "checkOK" string you desire
var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZĊÄÖ abcdefghijklmnopqrstuvwxyzċäö-0123456789";
var checkStr = theForm.name.value;
var allValid = true;
for (i = 0;  i < checkStr.length;  i++)
{
ch = checkStr.charAt(i);
for (j = 0;  j < checkOK.length;  j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
}
if (!allValid)
{
alert("Please enter only letter and numeric characters in the \"name\" field.");
theForm.name.focus();
return (false);
}


if (theForm.text.value == "")
{
alert("You must enter a text.");
theForm.text.focus();
return (false);
}

// require at least 3 characters be entered
if (theForm.text.value.length < 3)
{
alert("Please enter at least 3 characters in the \"text\" field.");
theForm.text.focus();
return (false);
}



if (theForm.title.value == "")
{
alert("You must enter a title.");
theForm.title.focus();
return (false);
}

// require at least 3 characters be entered
if (theForm.title.value.length < 3)
{
alert("Please enter at least 3 characters in the \"title\" field.");
theForm.title.focus();
return (false);
}




// require at least 5 characters in the password field
if (theForm.Password.value.length < 5)
{
alert("Please enter at least 5 characters in the \"Password\" field.");
theForm.Password.focus();
return (false);
}

// check if both password fields are the same
if (theForm.Password.value != theForm.Password2.value)
{
	alert("The two passwords are not the same.");
	theForm.Password2.focus();
	return (false);
}

// allow only 1000 characters maximum in the text field
if (theForm.text.value.length > 3000)
{
alert("Please enter at most 3000 characters in the text field.");
theForm.text.focus();
return (false);
}

// check if no drop down has been selected concerning INTEREST
if (theForm.interest.selectedIndex < 0)
{
alert("Please select one of the \"Interest\" options.");
theForm.interest.focus();
return (false);
}

// check if the first drop down is selected, if so, invalid selection
if (theForm.interest.selectedIndex == 0)
{
alert("The first \"Interest\" option is not a valid selection.");
theForm.interest.focus();
return (false);
}


// check if no drop down has been selected
if (theForm.state.selectedIndex < 0)
{
alert("Please select one of the \"state\" options.");
theForm.state.focus();
return (false);
}

// check if the first drop down is selected, if so, invalid selection
if (theForm.state.selectedIndex == 0)
{
alert("The first \"state\" option is not a valid selection.");
theForm.state.focus();
return (false);
}


// check if no drop down has been selected
if (theForm.category.selectedIndex < 0)
{
alert("Please select one of the \"Category\" options.");
theForm.interest.focus();
return (false);
}

// check if the first drop down is selected, if so, invalid selection
if (theForm.category.selectedIndex == 0)
{
alert("The first \"category\" option is not a valid selection.");
theForm.category.focus();
return (false);
}


// check if email field is blank
if (theForm.Email.value == "")
{
alert("Please enter a value for the \"Email\" field.");
theForm.Email.focus();
return (false);
}


// test if valid email address, must have @ and .
var checkEmail = "@.";
var checkStr = theForm.Email.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("The \"email\" field must contain an \"@\" and a \".\".");
theForm.Email.focus();
return (false);
}


// check if numbers field is blank
if (theForm.phone.value == "")
{
alert("Please enter a value for the \"phone\" field.");
theForm.phone.focus();
return (false);
}

// only allow numbers to be entered
var checkOK = "012345 -6789";
var checkStr = theForm.phone.value;
var allValid = true;
var allNum = "";
for (i = 0;  i < checkStr.length;  i++)
{
ch = checkStr.charAt(i);
for (j = 0;  j < checkOK.length;  j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
if (ch != ",")
allNum += ch;
}
if (!allValid)
{
alert("Please enter only digit characters in the \"phone\" field.");
theForm.phone.focus();
return (false);
}



// alert if the box is NOT checked
if (!theForm.checkbox1.checked)
{
alertsay = "Just reminding you that you have to approve to the forms of agreement to advertise here"
alert(alertsay);
}

}



//-->