//After they submit form, check to see if info is valid.
function CheckRequiredFields() {
var errormessage = new String();
// Put field checks below this point.

if(WithoutContent(document.offer.firstname.value))
	{ errormessage += "\n\nPlease give us your first name."; }
if(WithoutContent(document.offer.lastname.value))
	{ errormessage += "\n\nPlease give us your last name."; }
if(WithoutContent(document.offer.address.value))
	{ errormessage += "\n\nPlease give us your address."; }
if(WithoutContent(document.offer.city.value))
	{ errormessage += "\n\nPlease give us your city."; }

if(WithoutSelectionValue(document.offer.state))
	{ errormessage += "\n\nPlease choose your state."; }
if(WithoutContent(document.offer.zipcode.value))
	{ errormessage += "\n\nPlease give us your zip code."; }
if(checkEmail(document.offer.email.value))
	{ errormessage += "\n\nPlease enter a valid email address."; }
if(WithoutContent(document.offer.phone.value))
	{ errormessage += "\n\nPlease give us a phone number where you can be reached."; }
	if(WithoutSelectionValue(document.offer.preserve))
	{ errormessage += "\n\nPlease choose a preserve."; }
if(WithoutContent(document.offer.arrival.value))
	{ errormessage += "\n\nPlease choose your arrival date."; }
if(WithoutCheck(document.offer.rules))
	{ errormessage += "\n\nYou must agree to the rules and restrictions and check the box."; }

// Put field checks above this point.
if(errormessage.length > 2) {
	alert('THE FOLLOWING ERRORS NEED TO BE CORRECTED:' + errormessage);
	return false;
	}
return true;
} // end of function CheckRequiredFields()


function WithoutContent(ss) {
if(ss.length > 0) { return false; }
return true;
}
function checkEmail(ss) {
if (ss.length > 0) {
	if (ss.indexOf("@") > 0 && ss.indexOf(".") > 3) {
		return false;
	}
}return true;
}

function WithoutCheck(ss) {
if(ss.checked) { return false; }
return true;
}

function WithoutSelectionValue(ss) {
for(var i = 0; i < ss.length; i++) {
	if(ss[i].selected) {
		if(ss[i].value != "nope") { return false; }
		}
	}
return true;
}

//After they submit form, check to see if info is valid (more information forms).
function infoCheck() {
var errormessage = new String();
// Put field checks below this point.

if(WithoutContent(document.offer.firstname.value))
	{ errormessage += "\n\nPlease give us your first name."; }
if(WithoutContent(document.offer.lastname.value))
	{ errormessage += "\n\nPlease give us your last name."; }
if(WithoutContent(document.offer.address.value))
	{ errormessage += "\n\nPlease give us your address."; }
if(WithoutContent(document.offer.city.value))
	{ errormessage += "\n\nPlease give us your city."; }

if(WithoutSelectionValue(document.offer.state))
	{ errormessage += "\n\nPlease choose your state."; }
if(WithoutContent(document.offer.zipcode.value))
	{ errormessage += "\n\nPlease give us your zip code."; }
if(checkEmail(document.offer.email.value))
	{ errormessage += "\n\nPlease enter a valid email address."; }
if(WithoutContent(document.offer.phone.value))
	{ errormessage += "\n\nPlease give us a phone number where you can be reached."; }
	
// Put field checks above this point.
if(errormessage.length > 2) {
	alert('THE FOLLOWING ERRORS NEED TO BE CORRECTED:' + errormessage);
	return false;
	}
return true;
} // end of function CheckRequiredFields()


function WithoutContent(ss) {
if(ss.length > 0) { return false; }
return true;
}
function checkEmail(ss) {
if (ss.length > 0) {
	if (ss.indexOf("@") > 0 && ss.indexOf(".") > 3) {
		return false;
	}
}return true;
}

function WithoutSelectionValue(ss) {
for(var i = 0; i < ss.length; i++) {
	if(ss[i].selected) {
		if(ss[i].value != "nope") { return false; }
		}
	}
return true;
}

var pLocs = new Array(new Array("nope","Please Choose A Preserve","ncmap"),
				new Array ("Bend","<a href='http://www.1000trails.com/site/page/pg3487-as11.html' target='_blank'>More Info On Bend/Sunriver.</a>","Benmap"),
				new Array ("Carolina","<a href='http://www.1000trails.com/site/page/pg3487-as50.html' target='_blank'>More Info On Carolina Landing.</a>","Carmap"),
				new Array ("Chesapeake","<a href='http://www.1000trails.com/site/page/pg3487-as47.html' target='_blank'>More Info On Chesapeake Bay.</a>","Chemap"),
				new Array ("Forest","<a href='http://www.1000trails.com/site/page/pg3487-as49.html' target='_blank'>More Info On Forest Lake.</a>","Formap"),
				new Array ("Conner","<a href='http://www.1000trails.com/site/page/pg3487-as3.html' target='_blank'>More Info On LaConner.</a>","Lacmap"),
				new Array ("Conroe","<a href='http://www.1000trails.com/site/page/pg3487-as34.html' target='_blank'>More Info On Lake Conroe.</a>","Lconmap"),
				new Array ("Minden","<a href='http://www.1000trails.com/site/page/pg3487-as15.html' target='_blank'>More Info On Lake Minden.</a>","25map"),
				new Array ("Texoma","<a href='http://www.1000trails.com/site/page/pg3487-as30.html' target='_blank'>More Info On Lake Texoma.</a>","Ltexmap"),
				new Array ("Whitney","<a href='http://www.1000trails.com/site/page/pg3487-as33.html' target='_blank'>More Info On Lake Whitney.</a>","Whimap"),
				new Array ("Medina","<a href='http://www.1000trails.com/site/page/pg3487-as36.html' target='_blank'>More Info On Medina Lake.</a>","Medmap"),
				new Array ("Morgan","<a href='http://www.1000trails.com/site/page/pg3487-as19.html' target='_blank'>More Info On Morgan Hill.</a>","55map"),
				new Array ("Natchez","<a href='http://www.1000trails.com/site/page/pg3487-as38.html' target='_blank'>More Info On Natchez Trace.</a>","Natmap"),
				new Array ("Orlando","<a href='http://www.1000trails.com/site/page/pg3487-as51.html' target='_blank'>More Info On Orlando.</a>","26map"),
				new Array ("Pacific","<a href='http://www.1000trails.com/site/page/pg3487-as10.html' target='_blank'>More Info On Pacific City.</a>","Pacmap"),
				new Array ("Pio","<a href='http://www.1000trails.com/site/page/pg3487-as27.html' target='_blank'>More Info On Pio Pico.</a>","52map"),
				new Array ("Soledad","<a href='http://www.1000trails.com/site/page/pg3487-as22.html' target='_blank'>More Info On Soledad Canyon</a>","2map"),
				new Array ("Verde","<a href='http://www.1000trails.com/site/page/pg3487-as29.html' target='_blank'>More Info On Verde Valley.</a>","Vervmap"),
				new Array ("Whalers","<a href='http://www.1000trails.com/site/page/pg3487-as57.html' target='_blank'>More Info On Whalers Rest.</a>","Whamap"),
				new Array ("Wilderness","<a href='http://www.1000trails.com/site/page/pg3487-as23.html' target='_blank'>More Info On Wilderness Lakes.</a>","48map"),
				new Array ("Wilmington","<a href='http://www.1000trails.com/site/page/pg3487-as43.html' target='_blank'>More Info On Wilmington.</a>","Wilmap"),
				new Array ("Hershey","<a href='http://www.1000trails.com/site/page/pg3487-as44.html' target='_blank'>More Info On Hershey.</a>","Hermap"),
				new Array ("Indian","<a href='http://www.1000trails.com/site/page/pg3487-as40.html' target='_blank'>More Info On Indian Lakes.</a>","Inlamap"),
				new Array ("Kenisee","<a href='http://www.1000trails.com/site/page/pg3487-as42.html' target='_blank'>More Info On Kenisee Lakes.</a>","Kenmap"),
				new Array ("LakeShore","<a href='http://www.1000trails.com/site/page/pg3487-as140.html' target='_blank'>More Info On Lake & Shore.</a>","Lshoremap"),
				new Array ("Clair","<a href='http://www.1000trails.com/site/page/pg3487-as41.html' target='_blank'>More Info On St. Clair.</a>","Sclairmap"));
  
//This function will replace the Preserve information with a link to the page.
function pChange (location) {
	for (i=0; i<pLocs.length; i++) {
		if (pLocs[i][0] == location) {
			document.getElementById("preserveInfo").innerHTML = pLocs[i][1];
			if(document.getElementById("mapsm") != null) {
				mapSRC = "images/maps/" + pLocs[i][2]+".jpg";
				mapSRCBig = "images/maps/" + pLocs[i][2]+"_big.jpg";
				document.getElementById("mapsm").src = mapSRC;
				document.getElementById("mapbig").src = mapSRCBig;
			}
			break;		
		}
	}
}