function validateForm(one)
{

	if(""==document.forms.one.First_Name.value)
	{
		alert("Please enter your first name.");
		
		return false;
	}
	
	if(""==document.forms.one.Last_Name.value)
	{
		alert("Please enter your last name.");
		
		return false;
	}
	
	if(""==document.forms.one.email.value)
	{
		alert("Please enter your e-mail address.");
		
		return false;
	}
	
	if(""==document.forms.one.address1.value)
	{
		alert("Please enter your street address.");
		
		return false;
	}
	if(""==document.forms.one.City.value)
	{
		alert("Please enter your city.");
		
		return false;
	}
	
	if(document.forms.one.State.selectedIndex == 0)
		{
		alert("Please select your state.");
		
		return false;
	}
	
	if(""==document.forms.one.Zip.value)
	{
		alert("Please enter your ZIP code.");
		
		return false;
	}

if(""==document.forms.one.Phone1_1.value)
	{
		alert("Please enter a valid phone number where we can contact you.");
		
		return false;
	}
	
if(""==document.forms.one.Phone1_2.value)
	{
		alert("Please enter a valid phone number where we can contact you.");
		
		return false;
	}
	
	if(document.forms.one.Best_time_to_call.selectedIndex == 0)
	{
		alert("Please select the best time to contact you.");
		
		return false;
	}
	
	if(""==document.forms.one.Lead_Source.value)
	{
		alert("Please tell us how you found us.");
		
		return false;
	}
	
	if(""==document.forms.one.C_Interested_in_Services1.value)
	{
		alert("Please tell us which services you are interested in.");
		
		return false;
	}
		
	if(document.one.weddingNoDate.value=="") {
		if(""==document.forms.one.weddingmonth.value)
		{
			alert("Please enter your wedding month.");
			
			return false;
		}
		if(""==document.forms.one.weddingdate.value)
		{
			alert("Please enter your wedding date.");
			
			return false;
		}
			if(""==document.forms.one.weddingyear.value)
		{
			alert("Please enter your wedding year.");
			
			return false;
		}
		if( checkDate(document.forms.one.weddingmonth.value, document.forms.one.weddingdate.value, document.forms.one.weddingyear.value) )
		{
			if( isInPast(document.forms.one.weddingmonth.value, document.forms.one.weddingdate.value, document.forms.one.weddingyear.value) )
			{
				alert("Your wedding date is in the past.");
				return false;			
			}
		} 
		else
		{
			alert("Please enter a valid date.");	
			return false;
		}
		
	}

	if(""==document.forms.one.Location_City.value)
	{
		alert("Please enter the city your wedding will be in.");
		
		return false;
	}
	else
	{
		// replace any wierd city names like st louis to saint louis.
		document.forms.one.Location_City.value = fixWeirdCity(document.forms.one.Location_City.value);
	}
	
	if("State"==document.forms.one.Location_State.value)
	{
		alert("Please enter the state your wedding will be in.");
		
		return false;
	}


if(""==document.forms.one.Reception_venue.value)
	{
		alert("Please enter your reception venue.");
		
		return false;
	}

	var realname=document.forms.one.First_Name.value + " " + document.forms.one.Last_Name.value;
	
	document.forms.one.realname.value=realname;
	
	var address=document.forms.one.address1.value + " " + document.forms.one.address2.value;
	
	document.forms.one.address.value=address;
	
	var Phone_Number=document.forms.one.Area_Code1.value + "-" + document.forms.one.Phone1_1.value + "-" + document.forms.one.Phone1_2.value;
	
	document.forms.one.Phone_Number.value=Phone_Number;
	
	var Other_Phone=document.forms.one.Area_Code2.value + "-" + document.forms.one.Phone2_1.value + "-" + document.forms.one.Phone2_2.value;
	
	document.forms.one.Other_Phone.value=Other_Phone; 

	var Wedding_Date=document.forms.one.weddingmonth.value + "/" + document.forms.one.weddingdate.value + "/" + document.forms.one.weddingyear.value;

	document.forms.one.Wedding_Date.value=Wedding_Date;
	
	var Requested_appointment=document.forms.one.ApptMonth.value + "/" + document.forms.one.ApptDay.value + "/" + document.forms.one.ApptYear.value + " " + document.forms.one.Requested_appointment_time.value;

	document.forms.one.Requested_appointment_date.value=Requested_appointment;
	
	var Account_Name=realname + ": " + Wedding_Date;
	
	document.forms.one.Account_Name.value=Account_Name;
	
	var Location=document.forms.one.Location_City.value + document.forms.one.Location_State.value;
	
	document.forms.one.Location.value=Location;

	validateDate();
}

function NoDateCheck(){
	if (document.one.NoDateCheckbox.checked) {
		document.one.weddingmonth.value = "";
		document.one.weddingmonth.style.backgroundColor="#ADAA9C";
		document.one.weddingmonth.style.color="#ADAA9C";
		document.one.weddingmonth.disabled=true;
		document.one.weddingdate.value = "";
		document.one.weddingdate.style.backgroundColor="#ADAA9C";
		document.one.weddingdate.style.color="#ADAA9C";
		document.one.weddingdate.disabled=true;
		document.one.weddingyear.value = "";
		document.one.weddingyear.style.backgroundColor="#ADAA9C";
		document.one.weddingyear.style.color="#ADAA9C";
		document.one.weddingyear.disabled=true;
		document.one.weddingNoDate.value="NoWeddingDateYet";		
		}
	else {
		document.one.weddingmonth.value = "";
		document.one.weddingmonth.style.backgroundColor="#FFFFFF";
		document.one.weddingmonth.style.color="#000000";
		document.one.weddingmonth.disabled=false;
		document.one.weddingdate.value = "";
		document.one.weddingdate.style.backgroundColor="#FFFFFF";
		document.one.weddingdate.style.color="#000000";
		document.one.weddingdate.disabled=false;
		document.one.weddingyear.value = "";
		document.one.weddingyear.style.backgroundColor="#FFFFFF";
		document.one.weddingyear.style.color="#000000";
		document.one.weddingyear.disabled=false;
		document.one.weddingNoDate.value = "";	
		}
}

function NoLocationCheck(){
	if (document.one.NoLocationCheckbox.checked) {
		document.one.Location_City.value = "No_Location_Yet";
		document.one.Location_City.style.backgroundColor="#ADAA9C";
		document.one.Location_City.style.color="#ADAA9C";
		document.one.Location_City.disabled=true;
		document.one.Location_State.value = "none";
		document.one.Location_State.style.backgroundColor="#ADAA9C";
		document.one.Location_State.style.color="#ADAA9C";
		document.one.Location_State.disabled=true;
	}
	else {
		document.one.Location_City.value = "";
		document.one.Location_City.style.backgroundColor="#FFFFFF";	
		document.one.Location_City.disabled=false;
		document.one.Location_State.value = "State";	
		document.one.Location_State.style.backgroundColor="#FFFFFF";		
		document.one.Location_State.disabled=false;
	}
}

function NoCeremonyCheck(){
	if (document.one.NoCeremonyCheckbox.checked) {
		document.one.Ceremomy_venue.value = "No_Ceremony_Venue_Yet";
		document.one.Ceremomy_venue.style.backgroundColor="#ADAA9C";
		document.one.Ceremomy_venue.style.color="#ADAA9C";
		document.one.Ceremomy_venue.disabled=true;
	}
	else {
		document.one.Ceremomy_venue.value = "";
		document.one.Ceremomy_venue.style.backgroundColor="#FFFFFF";
		document.one.Ceremomy_venue.disabled=false;
	}
}

function NoReceptionCheck(){
	if (document.one.NoReceptionCheckbox.checked) {
		document.one.Reception_venue.value = "No_Reception_Venue_Yet";
		document.one.Reception_venue.style.backgroundColor="#ADAA9C";
		document.one.Reception_venue.style.color="#ADAA9C";
		document.one.Reception_venue.disabled=true;
	}
	else {
		document.one.Reception_venue.value = "";
		document.one.Reception_venue.style.backgroundColor="#FFFFFF";
		document.one.Reception_venue.disabled=false;
	}
}

var monthLength = new Array(31,28,31,30,31,30,31,31,30,31,30,31);

function checkDate(month, day, year)
{
	day = parseInt(day);
	month = parseInt(month);
	year = parseInt(year);

	if (!day || !month || !year)
		return false;

	if (year/4 == parseInt(year/4))
		monthLength[1] = 29;

	if (day > monthLength[month-1])
		return false;

	monthLength[1] = 28;

	var now = new Date();
	now = now.getTime(); //NN3

	var dateToCheck = new Date();
	dateToCheck.setYear(year);
	dateToCheck.setMonth(month-1);
	dateToCheck.setDate(day);
	var checkDate = dateToCheck.getTime();

	var futureDate = (now < checkDate);
	var pastDate = (now > checkDate);

	return true;
}

function isInPast(month, day, year)
{
	day = parseInt(day);
	month = parseInt(month);
	year = parseInt(year);

	var now = new Date();
	now = now.getTime();

 	var dateToCheck = new Date();
	dateToCheck.setYear(year);
	dateToCheck.setMonth(month-1);
	dateToCheck.setDate(day);
	
	var checkDate = dateToCheck.getTime();

	var futureDate = (now < dateToCheck);
	var pastDate = (now > dateToCheck);

	return pastDate;
}

function isWithinDays(month, day, year)
{
	day = parseInt(day);
	month = parseInt(month);
	year = parseInt(year);

	var today = new Date();
	today.setDate(today.getDate() + 30);

	var futureDate = today.getTime();
	var dateToCheck = new Date();
	dateToCheck.setYear(year);
	dateToCheck.setMonth(month-1);
	dateToCheck.setDate(day);
	var checkDate = dateToCheck.getTime();
	
	return checkDate < futureDate;
}