function getTatoo(tat) {
	if (tat == "yes") {
		var divID = "tatID";
		var url = "php/getTatoo.php";
		var pars = "tat=" + tat + "&r=" + Math.floor(Math.random()*1000);
		var getTat = new Ajax.Updater(divID, url, {method: 'get'});
	} else {
		document.getElementById("tatID").innerHTML="";
	}
}
function getChip(chip) {
	if (chip == "yes") {
		var divID = "chID";
		var url = "php/getChip.php";
		var pars = "chip=" + chip + "&r=" + Math.floor(Math.random()*1000);
		var getCh = new Ajax.Updater(divID, url, {method: 'get'});
	} else {
		document.getElementById("chID").innerHTML="";
	}
}
function numWalks() {
	var num = $F('walks');
	if (num > 0) {
		var divID="numWalks";
		var url = "php/numWalks.php";
		var pars = "num=" + num + "&r=" + Math.floor(Math.random()*1000);
		var getNum = new Ajax.Updater(divID, url, {method: 'get', parameters: pars});
	} else {
		document.getElementById("numWalks").innerHTML="";
	}
}
function submitFormDog() {
	var divID = "";
	var url = "";
	var do_alert = "false";
	if ($F('breed') == "") {
		var obj = document.getElementById('breed');
		obj.style.borderColor="#ff2323";
		do_alert = "true";
	}
	var petName = escape($F('petName'));
	if (petName == "") {
		var obj = document.getElementById('petName');
		obj.style.borderColor="#ff2323";
		do_alert = "true";
	}
	var guardian = escape($F('guardian'));
	if (guardian == "") {
		var obj = document.getElementById('guardian');
		obj.style.borderColor="#ff2323";
		do_alert = "true";
	}
	var guardian_phone = escape($F('guardian_phone'));
	if (guardian_phone == "") {
		var obj = document.getElementById('guardian_phone');
		obj.style.borderColor="#ff2323";
		do_alert = "true";
	}
	var age = $F('age');
	var tatYes = $F('tatYes');
	var tatNo = $F('tatNo');
	var tatooID = "";
	if (tatYes == null && tatNo == null) {
		var obj = document.getElementById('tatStatus');
		obj.style.borderColor="#ff2323";
		do_alert = "true";
	} else if (tatYes == "yes") {
		var tatooID = $F('tatooID');
		if (tatooID == "") {
			var obj = document.getElementById('tatooID');
			obj.style.borderColor="#ff2323";
			do_alert = "true";
		}
	}
	var chipYes = $F('chipYes');
	var chipNo = $F('chipNo');
	var chipID = "";
	if (chipYes == null && chipNo == null) {
		var obj = document.getElementById('chipStatus');
		obj.style.borderColor="#ff2323";
		do_alert = "true";
	} else if (chipYes == "yes") {
		var chipID = $F('chipID');
		if (chipID == "") {
			var obj = document.getElementById('chipID');
			obj.style.borderColor="#ff2323";
			do_alert = "true";
		}
	}
	var neutered = $F('neutered');
	var spayed = $F('spayed');
	var neither = $F('neither');
	if (neutered == null && spayed == null && neither == null) {
		var obj = document.getElementById('snip');
		obj.style.borderColor="#ff2323";
		do_alert = "true";
	}
	var house_allowed = $F('house_allowed');
	var yard_allowed = $F('yard_allowed');
	var furniture_allowed = $F('furniture_allowed');
	var bed_allowed = $F('bed_allowed');
	if (house_allowed == null && yard_allowed == null && furniture_allowed == null && bed_allowed == null) {
		var obj = document.getElementById('allowed_alert');
		obj.style.borderColor="#ff2323";
		do_alert = "true";
	}
	var house_stay = $F('house_stay');
	var yard_stay = $F('yard_stay');
	var crate_stay = $F('crate_stay');
	var other_stay = $F('other_stay');
	if (house_stay == null && yard_stay == null && crate_stay == null && other_stay == null) {
		var obj = document.getElementById('dog_kept');
		obj.style.borderColor="#ff2323";
		do_alert = "true";
	}
	var walks = $F('walks');
	if (walks == 0) {
		var obj = document.getElementById('walks');
		obj.style.borderColor="#ff2323";
		do_alert = "true";
	} else {
		for (var i=1; i<=walks; i++) {
			var test = "num_" + i;
			if (test == "") {
				var obj = document.getElementById(test);
				obj.style.borderColor="#ff2323";
				do_alert = "true";
			}
		} 
	}
	var num_1 = document.getElementById('num_1');
	var num_2 = document.getElementById('num_2');
	var num_3 = document.getElementById('num_3');
	var num_4 = document.getElementById('num_4');
	var num_5 = document.getElementById('num_5');
	var num_6 = document.getElementById('num_6');
	var num_7 = document.getElementById('num_7');
	var num_8 = document.getElementById('num_8');
	var num_9 = document.getElementById('num_9');
	var num_10 = document.getElementById('num_10');
	var walk_length = $F('walk_length');
	if (walk_length == "") {
		var obj = document.getElementById('walk_length');
		obj.style.borderColor="#ff2323";
		do_alert = "true";
	}
	var leashYes = $F('leashYes');
	var leashNo = $F('leashNo');
	var leashEither = $F('leashEither')
	if (leashYes == null && leashNo == null && leashEither == null) {
		var obj = document.getElementById('leash_check');
		obj.style.borderColor="#ff2323";
		do_alert = "true";
	}
	var playLength = escape($F('playLength'));
	if (playLength == "") {
		var obj = document.getElementById('playLength');
		obj.style.borderColor="#ff2323";
		do_alert = "true";
	}
	var playDescribe = escape($F('playDescribe'));
	if (playDescribe == "") {
		var obj = document.getElementById('playDescribe');
		obj.style.borderColor="#ff2323";
		do_alert = "true";
	}
	var chow = escape($F('chow'));
	if (chow == "") {
		var obj = document.getElementById('chow');
		obj.style.borderColor="#ff2323";
		do_alert = "true";
	}
	var diet = escape($F('diet'));
	if (diet == "") {
		var obj = document.getElementById('diet');
		obj.style.borderColor="#ff2323";
		do_alert = "true";
	}
	var nervous_yes = $F('nervous_yes');
	var nervous_no = $F('nervous_no');
	var nervous_some = $F('nervous_some');
	if (nervous_yes == null && nervous_no == null && nervous_some == null) {
		var obj = document.getElementById('nervous_check');
		obj.style.borderColor="#ff2323";
		do_alert = "true";
	}
	var aggressive_yes = $F('aggressive_yes');
	var aggressive_no = $F('aggressive_no');
	var aggressive_some = $F('aggressive_some');
	if (aggressive_yes == null && aggressive_no == null && aggressive_some == null) {
		var obj = document.getElementById('aggressive_check');
		obj.style.borderColor="#ff2323";
		do_alert = "true";
	}
	var excite_yes = $F('excite_yes');
	var excite_no = $F('excite_no');
	var excite_some = $F('excite_some');
	if (excite_yes == null && excite_no == null && excite_some == null) {
		var obj = document.getElementById('excite_check');
		obj.style.borderColor="#ff2323";
		do_alert = "true";
	}
	var noisy_yes = $F('noisy_yes');
	var noisy_no = $F('noisy_no');
	var noisy_some = $F('noisy_some');
	if (noisy_yes == null && noisy_no == null && noisy_some == null) {
		var obj = document.getElementById('noisy_check');
		obj.style.borderColor="#ff2323";
		do_alert = "true";
	}
	var aggressive_people_yes = $F('aggressive_people_yes');
	var aggressive_people_no = $F('aggressive_people_no');
	var aggressive_people_some = $F('aggressive_people_some');
	if (aggressive_people_yes == null && aggressive_people_no == null && aggressive_people_some == null) {
		var obj = document.getElementById('aggressive_people_check');
		obj.style.borderColor="#ff2323";
		do_alert = "true";
	}
	var nervous_children_yes = $F('nervous_children_yes');
	var nervous_children_no = $F('nervous_children_no');
	var nervous_children_some = $F('nervous_children_some');
	if (nervous_children_yes == null && nervous_children_no == null && nervous_children_some == null) {
		var obj = document.getElementById('nervous_children_check');
		obj.style.borderColor="#ff2323";
		do_alert = "true";
	}
	var bitten_yes = $F('bitten_yes');
	var bitten_no = $F('bitten_no');
	var bitten_some = $F('bitten_some');
	if (bitten_yes == null && bitten_no == null && bitten_some == null) {
		var obj = document.getElementById('bitten_check');
		obj.style.borderColor="#ff2323";
		do_alert = "true";
	}
	var bad_yes = $F('bad_yes');
	var bad_no = $F('bad_no');
	var bad_some = $F('bad_some');
	if (bad_yes == null && bad_no == null && bad_some == null) {
		var obj = document.getElementById('bad_check');
		obj.style.borderColor="#ff2323";
		do_alert = "true";
	}

	if (do_alert == "true") {
		alert("Please fill in all the required fields.");
		return false;
	}
}
function submitFormCat() {
	var divID = "";
	var url = "";
	var do_alert = "false";
	var petName = escape($F('petName'));
	if (petName == "") {
		var obj = document.getElementById('petName');
		obj.style.borderColor="#ff2323";
		do_alert = "true";
	}
	var guardian = escape($F('guardian'));
	if (guardian == "") {
		var obj = document.getElementById('guardian');
		obj.style.borderColor="#ff2323";
		do_alert = "true";
	}
	var guardian_phone = escape($F('guardian_phone'));
	if (guardian_phone == "") {
		var obj = document.getElementById('guardian_phone');
		obj.style.borderColor="#ff2323";
		do_alert = "true";
	}
	var age = $F('age');
	var tatYes = $F('tatYes');
	var tatNo = $F('tatNo');
	var tatooID = "";
	if (tatYes == null && tatNo == null) {
		var obj = document.getElementById('tatStatus');
		obj.style.borderColor="#ff2323";
		do_alert = "true";
	} else if (tatYes == "yes") {
		var tatooID = $F('tatooID');
		if (tatooID == "") {
			var obj = document.getElementById('tatooID');
			obj.style.borderColor="#ff2323";
			do_alert = "true";
		}
	}
	var chipYes = $F('chipYes');
	var chipNo = $F('chipNo');
	var chipID = "";
	if (chipYes == null && chipNo == null) {
		var obj = document.getElementById('chipStatus');
		obj.style.borderColor="#ff2323";
		do_alert = "true";
	} else if (chipYes == "yes") {
		var chipID = $F('chipID');
		if (chipID == "") {
			var obj = document.getElementById('chipID');
			obj.style.borderColor="#ff2323";
			do_alert = "true";
		}
	}
	var neutered = $F('neutered');
	var spayed = $F('spayed');
	var neither = $F('neither');
	if (neutered == null && spayed == null && neither == null) {
		var obj = document.getElementById('snip');
		obj.style.borderColor="#ff2323";
		do_alert = "true";
	}
	var feed = escape($F('feed'));
	if (feed == "") {
		var obj = document.getElementById('feed');
		obj.style.borderColor="#ff2323";
		do_alert = "true";
	}
	var cats_yes = $F('cats_yes');
	var cats_no = $F('cats_no');
	var cats_some = $F('cats_some');
	if (cats_yes == null && cats_no == null && cats_some == null) {
		var obj = document.getElementById('cats_check');
		obj.style.borderColor="#ff2323";
		do_alert = "true";
	}
	var dogs_yes = $F('dogs_yes');
	var dogs_no = $F('dogs_no');
	var dogs_some = $F('dogs_some');
	if (dogs_yes == null && dogs_no == null && dogs_some == null) {
		var obj = document.getElementById('dogs_check');
		obj.style.borderColor="#ff2323";
		do_alert = "true";
	}
	var scratch_yes = $F('scratch_yes');
	var scratch_no = $F('scratch_no');
	var scratch_some = $F('scratch_some');
	if (scratch_yes == null && scratch_no == null && scratch_some == null) {
		var obj = document.getElementById('scratch_check');
		obj.style.borderColor="#ff2323";
		do_alert = "true";
	}
	var spray_yes = $F('spray_yes');
	var spray_no = $F('spray_no');
	var spray_some = $F('spray_some');
	if (spray_yes == null && spray_no == null && spray_some == null) {
		var obj = document.getElementById('spray_check');
		obj.style.borderColor="#ff2323";
		do_alert = "true";
	}
	if (do_alert == "true") {
		alert("Please fill in all the required fields.");
		return false;
	}
}
function checkPassword() {
	var pass1 = $F('pwd');
	var pass2 = $F('pass2');
	if (pass1 == pass2 && pass1 != "" && pass2 != "") {
		document.getElementById('match').innerHTML="<p class='alert' style='font-size:11px;text-align:right;'>Passwords match</p>";
	} else if (pass1 != "" && pass2 != "") {
		document.getElementById('match').innerHTML="<p class='alert' style='font-size:11px;text-align:right;'>Password mis-match</p>";
	} else if (pass1 == "" && pass2 != "") {
		document.getElementById('match').innerHTML="<p class='alert' style='font-size:11px;text-align:right;'>Password mis-match</p>";
	} else if (pass2 == "" && pass1 != "") {
		document.getElementById('match').innerHTML="<p class='alert' style='font-size:11px;text-align:right;'>Password mis-match</p>";
	}
	if (pass1 == "" && pass2 == "") {
		document.getElementById('match').innerHTML="<p class='alert' style='font-size:11px;text-align:right;'>&nbsp;</p>";
	}
}
function checkSignUpForm(form, nopass) {
	if ($F('firstname') == "") {
		alert("Please fill in your first name.");
		form.firstname.focus();
		return false;
	}
	if ($F('lastname') == "") {
		alert("Please fill in your last name.");
		form.lastname.focus();
		return false;
	}
	if ($F('phone') == "") {
		alert("Please fill in your phone #.");
		form.phone.focus();
		return false;
	}
	if ($F('email') == "") {
		alert("Please fill in your email address.");
		form.email.focus();
		return false;
	}
	if (nopass == "") {
		if ($F('pwd') != $F('pass2')) {
			alert("Your passwords do not match.");
			form.pwd.focus();
			return false;
		}
		if ($F('pwd') == "") {
			alert("Please chose a password.");
			form.pwd.focus();
			return false;
		}
	}

	if ($F('country') == "" || $F('country') == "new") {
		alert("Please select a country.");
		form.country.focus();
		return false;
	}
	if ($F('state') == "" || $F('state') == "new") {
		alert("Please select a State/Province/Region.");
		form.state.focus();
		return false;
	}
	if ($F('city') == "" || $F('city') == "new") {
		alert("Please select a City.");
		form.city.focus();
		return false;
	}
	if ($F('postal_code') == "") {
		alert("Please fill in your postal code.");
		form.postal_code.focus();
		return false;
	}
/*	if ($F('street') == "") {
		alert("Please fill in your street address.");
		form.street.focus();
		return false;
	}
	if ($F('guardian') == "") {
		alert("Please fill in your pet guardian's information.");
		form.guardian.focus();
		return false;
	}*/

	if ($F('your_cat') == null && $F('your_dog') == null && $F('no_pet') == null && $F('both') == null) {
		alert("Please select your type of pet.");
		return false;
	}
	if ($F('exchange_type_cat') == null && $F('exchange_type_dog') == null && $F('exchange_type_both') == null && $F('exchange_type_none') == null && $F('exchange_type_sit') == null) {
		alert("Please select your exchange type.");
		return false;
	}


	if ($F('terms') == null) {
		alert("You must select the checkbox to signify you agree to the Terms & Conditions.");
		return false;
	}
	var cap = escape($F('check'));
	var captcha = cap.toLowerCase()
	var ref = $F('ref');
	if (captcha == "") {
		alert("Please fill in the Captcha question box at the bottom of the form");
		form.check.focus();
		return false;
	} else {
		if (ref == 1) {
			if (captcha != 4 && captcha != "four") {
				alert("Sorry, your answer is incorrect. Please try again.");
				form.check.focus();
				return false;
			}
		} else if (ref == 2) {
			if (captcha != 7 && captcha != "seven") {
				alert("Sorry, your answer is incorrect. Please try again.");
				form.check.focus();
				return false;
			}
		} else if (ref == 3) {
			if (captcha != 9 && captcha != "nine") {
				alert("Sorry, your answer is incorrect. Please try again.");
				form.check.focus();
				return false;
			}
		} else if (ref == 4) {
			if (captcha != 20 && captcha != "twenty") {
				alert("Sorry, your answer is incorrect. Please try again.");
				form.check.focus();
				return false;
			}
		} else if (ref == 5) {
			if (captcha != 5 && captcha != "five") {
				alert("Sorry, your answer is incorrect. Please try again.");
				form.check.focus();
				return false;
			}
		}
	}
}
function sitterSignupForm(form) {
	if ($F('firstname') == "") {
		alert("Please fill in your first name.");
		form.firstname.focus();
		return false;
	}
	if ($F('lastname') == "") {
		alert("Please fill in your last name.");
		form.lastname.focus();
		return false;
	}
/*	if ($F('phone') == "") {
		alert("Please fill in your phone #.");
		form.phone.focus();
		return false;
	}*/
	if ($F('emergency') == "") {
		alert("Please fill in an emergency contact name and phone #.");
		form.emergency.focus();
		return false;
	}
	if ($F('email') == "") {
		alert("Please fill in your email address.");
		form.email.focus();
		return false;
	}
	if ($F('pwd') != $F('pass2')) {
		alert("Your passwords do not match.");
		form.pwd.focus();
		return false;
	}
	if ($F('edit') == "false") {
		if ($F('pwd') == "") {
			alert("Please chose a password.");
			form.pwd.focus();
			return false;
		}
	}
	if ($F('edit') == "false") {
		if ($F('terms') == null) {
			alert("You must select the checkbox to signify you agree to the Terms & Conditions.");
			return false;
		}
	}
	if ($F('edit') == "false") {
		var cap = escape($F('check'));
		var captcha = cap.toLowerCase()
		var ref = $F('ref');
		if (captcha == "") {
			alert("Please fill in the Captcha question box at the bottom of the form");
			form.check.focus();
			return false;
		} else {
			if (ref == 1) {
				if (captcha != 4 && captcha != "four") {
					alert("Sorry, your answer is incorrect. Please try again.");
					form.check.focus();
					return false;
				}
			} else if (ref == 2) {
				if (captcha != 7 && captcha != "seven") {
					alert("Sorry, your answer is incorrect. Please try again.");
					form.check.focus();
					return false;
				}
			} else if (ref == 3) {
				if (captcha != 9 && captcha != "nine") {
					alert("Sorry, your answer is incorrect. Please try again.");
					form.check.focus();
					return false;
				}
			} else if (ref == 4) {
				if (captcha != 20 && captcha != "twenty") {
					alert("Sorry, your answer is incorrect. Please try again.");
					form.check.focus();
					return false;
				}
			} else if (ref == 5) {
				if (captcha != 5 && captcha != "five") {
					alert("Sorry, your answer is incorrect. Please try again.");
					form.check.focus();
					return false;
				}
			}
		}
	}
}
function  sitterSignupForm2(form) {
	if ($F('country') == "" || $F('country') == "new") {
		alert("Please select a country.");
		form.country.focus();
		return false;
	}
	if ($F('state') == "" || $F('state') == "new") {
		alert("Please select a state.");
		form.state.focus();
		return false;
	}
	if ($F('city') == "" || $F('city') == "new") {
		alert("Please select a city.");
		form.city.focus();
		return false;
	}
	if (escape($F('postal_code')) == "") {
		alert("Please provide your postal/zip code.");
		form.postal_code.focus();
		return false;
	}
/*	if (escape($F('street')) == "") {
		alert("Please provide your street address.");
		form.street.focus();
		return false;
	}
*/
	if (escape($F('exp_month')) == "" && escape($F('exp_year')) == "") {
		alert("Please provide your experience.");
		form.exp_month.focus();
		return false;
	}
	if ($F('sit_dogs') == null && $F('sit_cats') == null && $F('sit_both') == null) {
		alert("Please provide what animals you sit.");
		return false;
	}
	var outcall = $F('outcall');
	var incall = $F('incall');
	var both = $F('both');
	if (outcall == null && incall == null && both == null) {
		alert("Please select where you sit.");
		return false;
	}
	if (escape($F('availability')) == "") {
		alert("Please provide your availability.");
		form.availability.focus();
		return false;
	}
	var long_yes = $F('long_yes');
	var long_no = $F('long_no');
	if (long_yes == null && long_no == null) {
		alert("Please mention if you provide long-term pet sitting.");
		return false;
	}
	if (escape($F('howMany')) == "") {
		alert("Please say how many pets you will sit at one time.");
		form.howMany.focus();
		return false;
	}
	var kennels_yes = $F('kennels_yes');
	var kennels_no = $F('kennels_no');
	if (kennels_yes == null && kennels_no == null) {
		alert("Please say if you have kennels.");
		return false;
	}
	var vet_yes = $F('vet_yes');
	var vet_no = $F('vet_no');
	if (vet_yes == null && vet_no == null) {
		alert("Please say if you have access to an emergency veterinarian.");
		return false;
	}
	var prepare_yes = $F('prepare_yes');
	var prepare_no = $F('prepare_no');
	if (prepare_yes == null && prepare_no == null) {
		alert("Please say if you have an emergency preparedness plan.");
		return false;
	}
}
function makeListing(usr) {
	var divID = "listing";
	var pars = "usr=" + usr + "&r=" + Math.floor(Math.random()*1000);
	var url = "php/get_listing_form.php";
	var getListingForm = new Ajax.Updater(divID, url, {method: 'get', parameters: pars});
	return false;
}
function searchWorld(the_type) {
	var divID = "get_country";
	var pars = "world=" + $F('world_id') + "&type=" + the_type + "&r=" + Math.floor(Math.random()*1000);
	var url = "php/searchCountries.php";
	var getCountries = new Ajax.Updater(divID, url, {method: 'get', parameters: pars});
//	document.getElementById('get_state').innerHTML="";
//	document.getElementById('get_city').innerHTML="";
}
function searchCountry(the_type) {
	var divID = "get_state";
	var pars = "country=" + $F('country') + "&type=" + the_type + "&r=" + Math.floor(Math.random()*1000);
	var url = "php/searchStates.php";
	var getStates = new Ajax.Updater(divID, url, {method: 'get', parameters: pars});
	document.getElementById('get_city').innerHTML="";
}
function searchState(the_type) {
	var state = $F('state');
	var divID = "get_city";
	var pars = "state=" + $F('state') + "&type=" + the_type + "&r=" + Math.floor(Math.random()*1000);
	var url = "php/searchCities.php";
	var getCities = new Ajax.Updater(divID, url, {method: 'get', parameters: pars});
	if (state == "") {
		document.getElementById('get_city').innerHTML="";
	}
}
function searchCity() {
	var city = $F('city');
}
function searchForm() {
	var country = $F('country');
	var state = $F('state');
	var city = $F('city');
	if (city == "" || state == "" || country == "") {
		alert("You must select a Country, a State/Province/Region, and a City to search for.");
		return false;
	}
}
function addCountry(the_type) {
	var country = $F('country');
	if ($F('country') == "new") {
		document.getElementById('get_country').innerHTML="<input type='text' name='country' id='country' class='text' />";
		document.getElementById('get_state').innerHTML="<input type='text' name='state' id='state' class='text' />";
		document.getElementById('get_city').innerHTML="<input type='text' name='city' id='city' class='text' />";
	} else if ($F('country') != "new") {
		var divID = "get_state";
		var pars = "country=" + $F('country') + "&type=" + the_type + "&r=" + Math.floor(Math.random()*1000);
		var url = "php/grabStates.php";
		var getStates = new Ajax.Updater(divID, url, {method: 'get', parameters: pars});
		document.getElementById('get_city').innerHTML="<input type='text' name='city' id='city' class='text' />";
	}
}
function addState(the_type) {
	var state = $F('state');
	if ($F('state') == "new") {
		document.getElementById('get_state').innerHTML="<input type='text' name='state' id='state' class='text' />";
		document.getElementById('get_city').innerHTML="<input type='text' name='city' id='city' class='text' />";
	} else if ($F('state') != "new") {
		var divID = "get_city";
		var pars = "state=" + $F('state') + "&type=" + the_type + "&r=" + Math.floor(Math.random()*1000);
		var url = "php/grabCities.php";
		var getCities = new Ajax.Updater(divID, url, {method: 'get', parameters: pars});
	}
}
function addCity() {
	var city = $F('city');
	if ($F('city') == "new") {
		document.getElementById('get_city').innerHTML="<input type='text' name='city' id='city' class='text' />";
	}
}
function checkFormListing(form) {
	if ($F('country') == "" || $F('country') == "new") {
		alert("Please select a country.");
		form.country.focus();
		return false;
	}
	if ($F('state') == "" || $F('state') == "new") {
		alert("Please select a State/Province/Region.");
		form.state.focus();
		return false;
	}
	if ($F('city') == "" || $F('city') == "new") {
		alert("Please select a City.");
		form.city.focus();
		return false;
	}
	if ($F('postal_code') == "") {
		alert("Please fill in your postal code.");
		form.postal_code.focus();
		return false;
	}
	if ($F('street') == "") {
		alert("Please fill in your street address.");
		form.street.focus();
		return false;
	}
/*	if ($F('guardian') == "") {
		alert("Please fill in your pet guardian's information.");
		form.guardian.focus();
		return false;
	}*/

	if ($F('your_cat') == null && $F('your_dog') == null && $F('no_pet') == null && $F('both') == null) {
		alert("Please select your type of pet.");
		return false;
	}
	if ($F('exchange_type_cat') == null && $F('exchange_type_dog') == null && $F('exchange_type_both') == null && $F('exchange_type_none') == null) {
		alert("Please select your exchange type.");
		return false;
	}
}
function checkFormListing2(form) {
	if ($F('bedroom') == "") {
		alert("Please enter the number of bedrooms.");
		form.bedroom.focus();
		return false;
	}
	if ($F('bathroom') == "") {
		alert("Please enter the number of bathrooms.");
		form.bathroom.focus();
		return false;
	}
	if ($F('accomodate') == "") {
		alert("Please fill in how many people your home can accomodate.");
		form.accomodate.focus();
		return false;
	}
	if ($F('home_type') == "") {
		alert("Please select your type of home.");
		form.home_type.focus();
		return false;
	}
	if ($F('home_describe') == "") {
		alert("Please describe your home.");
		form.home_describe.focus();
		return false;
	}
	if ($F('nearest_city') == "") {
		alert("Please identify the nearest city to your home.");
		form.nearest_city.focus();
		return false;
	}
	if ($F('airport') == "") {
		alert("Please identify the nearest airport to your home.");
		form.airport.focus();
		return false;
	}
	if ($F('transportation') == "") {
		alert("Please identify the nearest public transportation to your home.");
		form.transportation.focus();
		return false;
	}
/*	if ($F('transport_distance') == "") {
		alert("Please identify the distance to public transportation from your home.");
		form.transport_distance.focus();
		return false;
	}
*/
}
function checkUploadPhoto(form) {
	if ($F('caption') == "") {
		alert("Please enter a caption for your photo.");
		form.caption.focus();
		return false;
	}
	if ($F('image') == "") {
		alert("Please select an image to upload.");
		form.image.focus();
		return false;
	}
}
function newPass(the_type) {
	var email = $F('usr');
	if (email == "") {
		alert("You must enter your email in the field provided.");
		return false;
	}
	var divID = "pass_sent";
	var url = "php/newPass.php";
	var pars = "email=" + email + "&type=" + the_type + "&r=" + Math.floor(Math.random()*1000);
	var sendPass = new Ajax.Updater(divID, url, {method: 'get', parameters: pars});
	return false;
}
function deletePic(filename, the_type) {
	var response = confirm ("Delete this picture?");
	if (response) {
		var divID = "display_photos";
		var url = "php/deletePic.php";
		if (the_type == "sitters") {
			var pars = "filename=" + filename + "&type=" + the_type + "&r=" + Math.floor(Math.random()*1000);
		} else {
			var pars = "filename=" + filename + "&r=" + Math.floor(Math.random()*1000);
		}
		var sendPass = new Ajax.Updater(divID, url, {method: 'get', parameters: pars});
	}
	return false;
}
function editCaption(filename, the_type) {
	var divID = filename;
	var url = "php/editCaption.php";
	if (the_type == "sitters") {
		var pars = "filename=" + filename + "&type=" + the_type + "&r=" + Math.floor(Math.random()*1000);
	} else {
		var pars = "filename=" + filename + "&r=" + Math.floor(Math.random()*1000);
	}
	var editCap = new Ajax.Updater(divID, url, {method: 'get', parameters: pars});
	return false;
}
function sitterSignIn(form) {
	var usr = $F('usr');
	var pwd = $F('pwd');
	if (usr == "") {
		alert("Please provide a username");
		form.usr.focus();
		return false
	}
	if (pwd == "") {
		alert("Please provide a password");
		form.pwd.focus();
		return false;
	}
}
function checkSitterSearch() {
	if ($F('country') == "") {
		alert("Please select your country");
		return false;
	} else if ($F('state') == "") {
		alert("Please select your state/region/province");
		return false;
	} else if ($F('city') == "") {
		alert("Please select your city");
		return false;
	}
	if ($F('sitter_dog') == null && $F('sitter_cat') == null && $F('sitter_both') == null) {
		alert("Please select the kind of sitter you're looking for");
		return false;
	}
}
function getListingPhoto(photo_id) {
	var divID = "main_image";
	var url = "php/getListingPhoto.php";
	var pars = "photo_id=" + photo_id + "&r=" + Math.floor(Math.random()*1000);
	var getPic = new Ajax.Updater(divID, url, {method: 'get', parameters: pars});
	return false;
}
function getSitterPhoto(photo_id) {
	var divID = "main_image";
	var url = "php/getSitterPhoto.php";
	var pars = "photo_id=" + photo_id + "&r=" + Math.floor(Math.random()*1000);
	var getPic = new Ajax.Updater(divID, url, {method: 'get', parameters: pars});
	return false;
}
function setMainImage(ref, user_id) {
	var divID = "replace";
	var url = "php/setMainImage.php";
	var pars = "id=" + ref + "&user_id=" + user_id + "&r=" + Math.floor(Math.random()*1000);
	var setMain = new Ajax.Updater(divID, url, {method: 'get', parameters: pars});
	return false;
}
function setPet(ref, the_value, user_id) {
	var divID = "replace";
	var url = "php/setPet.php";
	var pars = "id=" + ref + "&value=" + the_value + "&user_id=" + user_id + "&r=" + Math.floor(Math.random()*1000);
	var setPt = new Ajax.Updater(divID, url, {method: 'get', parameters: pars});
	return false;
}
function setMyStatus(ref, the_type) {
	var divID = "the_status";
	var url = "php/setMyStatus.php";
	var pars = "id=" + ref + "&value=" + the_type + "&r=" + Math.floor(Math.random()*1000);
	var setMYS = new Ajax.Updater(divID, url, {method: 'get', parameters: pars});
	return false;
}
function getPet(the_type, the_id) {
	var divID = "main_image";
	var url = "php/getPet.php";
	var pars = "type=" + the_type + "&id=" + the_id + "&r=" + Math.floor(Math.random()*1000);
	var getPets = new Ajax.Updater(divID, url, {method: 'get', parameters: pars});
	return false;
}
function checkmessage(theform) {
	if (theform.message.value == "" || theform.message.value == null) {
		alert("Please enter a message to send.");
		return false;
	}
	return true;
}
function deletePet() {
	var response = confirm ("Delete this Pet Profile?");
	if (response) {
		return true;
	}
	return false;
}
