function genEmail(webName, to, subject) {
site = "trainthethirdway.com";
document.write('<a href=\"mailto:' + to + '@' + site + '?Subject=THE THIRD WAY ' + subject + '\">');
document.write(webName + '</a>');
}
function webEmail(webName, to, subject) {
site = "wi.rr.com";
document.write('<a href=\"mailto:' + to + '@' + site + '?Subject=Web Design Information ' + subject + '\">');
document.write(webName + '</a>');
}

function FormCheck(form) {
	var blnFormCheck
	
	blnFormCheck = true;
	
	if (blnFormCheck == true)
		blnFormCheck = FirstNameCheck(form);
	
	if (blnFormCheck == true)
		blnFormCheck = LastNameCheck(form);
	
	if (blnFormCheck == true)
		blnFormCheck = AddressCheck(form);
	
	if (blnFormCheck == true)
		blnFormCheck = CityCheck(form);
	
	if (blnFormCheck == true)
		blnFormCheck = StateCheck(form);
	
	if (blnFormCheck == true)
		blnFormCheck = ZipCheck(form);
	
	if (blnFormCheck == true)
		blnFormCheck = CountryCheck(form);
		
	if (blnFormCheck == true)
		blnFormCheck = Phone1Check(form);
		
	if (blnFormCheck == true)
		blnFormCheck = Phone2Check(form);
		
	if (blnFormCheck == true)
		blnFormCheck = EmailCheck(form);
	
	return blnFormCheck;
	
}	  
function FirstNameCheck(form) {
	form = eval(form);
	form = document.contact.name;
	if (document.contact.first_name.value == "" ) //|| isNaN(document.createprofile.firstname.value))
	{
        alert("Please enter your first name.");
        document.contact.first_name.focus();
		return false;
	}
	
	return true;
}	
function LastNameCheck(form) {
	form = eval(form);
	form = document.contact.name;
	if (document.contact.last_name.value == "" ) //|| isNaN(document.createprofile.firstname.value))
	{
        alert("Please enter your last name.");
        document.contact.last_name.focus();
		return false;
	}
	
	return true;
}	
function AddressCheck(form) {
	form = eval(form);
	form = document.contact.name;
	if (document.contact.address.value == "" ) //|| isNaN(document.createprofile.firstname.value))
	{
        alert("Please enter your address.");
        document.contact.address.focus();
		return false;
	}
	
	return true;
}	
function CityCheck(form) {
	form = eval(form);
	form = document.contact.name;
	if (document.contact.city.value == "" ) //|| isNaN(document.createprofile.firstname.value))
	{
        alert("Please enter your city.");
        document.contact.city.focus();
		return false;
	}
	
	return true;
}	
function StateCheck(form) {
	form = eval(form);
	form = document.contact.name;
	if (document.contact.state.value == "" ) //|| isNaN(document.createprofile.firstname.value))
	{
        alert("Please enter your state/province.");
        document.contact.state.focus();
		return false;
	}
	
	return true;
}	
function ZipCheck(form) {
	form = eval(form);
	form = document.contact.name;
	if (document.contact.zip.value == "" ) //|| isNaN(document.createprofile.firstname.value))
	{
        alert("Please enter your zip.");
        document.contact.zip.focus();
		return false;
	}
	
	return true;
}	
function CountryCheck(form) {
	form = eval(form);
	form = document.contact.name;
	if (document.contact.country.value == "" ) //|| isNaN(document.createprofile.firstname.value))
	{
        alert("Please enter your country.");
        document.contact.country.focus();
		return false;
	}
	
	return true;
}	
function Phone1Check(form) {
	form = eval(form);
	form = document.contact.name;
	if (document.contact.phone1.value == "" ) //|| isNaN(document.createprofile.firstname.value))
	{
        alert("Please enter your area code.");
        document.contact.phone1.focus();
		return false;
	}
	
	return true;
}	
function Phone2Check(form) {
	form = eval(form);
	form = document.contact.name;
	if (document.contact.phone2.value == "" ) //|| isNaN(document.createprofile.firstname.value))
	{
        alert("Please enter your phone number.");
        document.contact.phone2.focus();
		return false;
	}
	
	return true;
}	
function isEmail(string) {
	if (!string) return false;
		var iChars = "*|,\":<>[]{}`\';()&amp;$#%";
		for (var i = 0; i < string.length; i++) {
			if (iChars.indexOf(string.charAt(i)) != -1)
			return false;
		}
	return true;
}                      		   
function EmailCheck(form) {
	form = eval(form);
	form = document.contact.name //alert("form alert " + form); 
	if (isEmail(document.contact.email.value) == false) 
	{
		alert("Please enter a valid email address.");
		document.contact.email.focus();   
		return false;
	}
}

// Check if using IE or Mozilla
IE4=(document.all);

if(IE4)
{
	g_YearIndex = 2;
}
else
{
	g_YearIndex = 1;
}
// Function Name: showPost
// Purpose: Displays an alert of the passed in forms values
// Parameters: theForm - form to be dispalyed
// Return: None
function showPost(theForm)
{
	var al = theForm.name;
	for (var x=0; x< theForm.elements.length; x++) {
		al += "\n" + theForm.elements[x].name + "=" + theForm.elements[x].value;
	}
	alert( al );
}
// Function Name: FIND
// Purpose: Finds an object on the page and returns a referance to it
// Parameters: item - name of object ot find
// Return: Object - referance to the found object, or false if not found
function FIND(item) {
	if (document.all) 
		return(document.all[item]);
	if (document.getElementById) 
		return(document.getElementById(item));
	return(false);
}

function isEmail(string) {
	if (string.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
		return true;
	else
		return false;
}

