function ismaxlength(obj){
var mlength=obj.getAttribute? parseInt(obj.getAttribute("maxlength")) : ""
if (obj.getAttribute && obj.value.length>mlength)
obj.value=obj.value.substring(0,mlength)
document.getElementById(obj.id+"Count").innerHTML=obj.value.length;
document.getElementById(obj.id+"CountLeft").innerHTML=1000 -obj.value.length;
}

function validateDates()
	{
	var Issues = "This form is incomplete, please fill in the following:\n";
	var valid = true;
	
	//if (document.getElementById("theCity").value == "")
	//	{
	//	valid = false;
	//	Issues = Issues + ", "
	//	}
	
	if (document.getElementById("fname").value == "")
		{
		valid = false;
		Issues = Issues + "-First Name\n";
		document.getElementById("fname").style.backgroundColor="yellow";
		}
	
	if (document.getElementById("lname").value == "")
		{
		valid = false;
		Issues = Issues + "-Last Name\n";
		document.getElementById("lname").style.backgroundColor="yellow";
		}
	
	if (document.getElementById("email").value == "")
		{
		valid = false;
		Issues = Issues + "-E-Mail\n";
		document.getElementById("email").style.backgroundColor="yellow";
		}
	else
		{
		if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.getElementById("email").value))
			{
			}
		else
			{
		valid = false;
		Issues = Issues + "-Valid E-Mail\n";
		document.getElementById("email").style.backgroundColor="yellow";
		document.getElementById("email").value="";
			}
		}
	
	if (document.getElementById("Address1").value == "")
		{
		valid = false;
		Issues = Issues + "-Address\n";
		document.getElementById("Address1").style.backgroundColor="yellow";
		}
	
	if (document.getElementById("city").value == "")
		{
		valid = false;
		Issues = Issues + "-City\n";
		document.getElementById("city").style.backgroundColor="yellow";
		}
	
	if (document.getElementById("state").value == "")
		{
		valid = false;
		Issues = Issues + "-State/Province\n";
		document.getElementById("state").style.backgroundColor="yellow";
		}
	
	if (document.getElementById("postalCode").value == "")
		{
		valid = false;
		Issues = Issues + "-Zip/Postal Code\n";
		document.getElementById("postalCode").style.backgroundColor="yellow";
		}

	if (document.getElementById("besttimetocall").value == "")
		{
		valid = false;
		Issues = Issues + "-Best Time to Call\n";
		document.getElementById("besttimetocall").style.backgroundColor="yellow";
		}
	
	if (document.getElementById("phone").value == "")
		{
		valid = false;
		Issues = Issues + "-Phone Number\n";
		document.getElementById("phone").style.backgroundColor="yellow";
		}
	
	if (document.getElementById("topic").value == "")
		{
		valid = false;
		Issues = Issues + "-Nature of Inquiry\n";
		document.getElementById("topic").style.backgroundColor="yellow";
		}
	
		valid==false;
	if (valid == false)
		{
		alert(Issues);
		}
	else
		{		
		//displays the confirmation box
		var confirmationText = "Please Confirm the following Data.\n \n";
		var confirmationText = confirmationText+"Name: "+document.getElementById("fname").value+" "+document.getElementById("lname").value+"\n";
		var confirmationText = confirmationText+"Address 1: "+document.getElementById("Address1").value+"\n";
		var confirmationText = confirmationText+"City: "+document.getElementById("city").value+"\n";
		var confirmationText = confirmationText+"State: "+document.getElementById("state").value+"\n";
		var confirmationText = confirmationText+"PostalCode: "+document.getElementById("postalCode").value+"\n";
		var confirmationText = confirmationText+"Best Time to Call: "+document.getElementById("besttimetocall").value+"\n";
		var confirmationText = confirmationText+"Phone Number: "+document.getElementById("phone").value+"\n";
		var confirmationText = confirmationText+"Nature of Inquiry: "+document.getElementById("topic").value+"\n";
		//confirmationText = confirmationText+"Date: "+document.getElementById("theDate").value+"\n";

		//var agree = confirm(confirmationText);
		var agree = true;
		if (agree)
			{
			//window.opener.location=window.opener.location;
			}
		else
			{
			return false;
			}
		}
	return valid;
	}

function confirmDates()
	{
	//document.getElementById("contactSubmit").disabled=true
	var datesValid = validateDates();
	
	if (datesValid)
		{
		return true;
		}
	else
		{
		//document.getElementById("contactSubmit").disabled=false;
		return false;
		}
	return false;
	}

