//Change house style
	function changeStyle() {
		myValue = document.form1.Style.value;
		htValue = document.form1.HT.value;
		window.location.href = 'homes.php?HT=' + htValue + '&style=' + myValue;
	}
	function changeStyle_sq() {
		myValue = document.form1.Style.value;
		sf1Value = document.form1.SF1.value;
		sf2Value = document.form1.SF2.value;
		window.location.href = 'homes_sq.php?SF1=' + sf1Value + '&SF2=' + sf2Value + '&style=' + myValue;
	}
	function changeStyle_style() {
		myValue = document.form1.Style.value;
		window.location.href = 'homes_style.php?style=' + myValue;
	}

//Email Bar location function (onscroll/onresize)
	function Scroll() {
		xLoc = document.body.scrollLeft;
		yLoc = document.body.scrollTop;
		var x = document.getElementById("EmailBar");
		var DocHeight = document.body.offsetHeight;
		var DocMax = DocHeight + 20;
		var STop = x.style.top.replace("px","");
		//STop = parseInt(STop);
		//alert(document.body.clientHeight + " + " + yLoc);
		var NewTop = document.body.clientHeight + yLoc - 20;
		//if (STop <= DocHeight || NewTop <= STop) {
			x.style.visibility = "visible";
			x.style.bottom = "";
			x.style.top = NewTop;
			//alert(document.body.clientHeight);
		//}
	}
//Location Function (onclick)
	function SendMe (PLACE) {
		window.location.href = PLACE;		
	}
//Roll On / Roll Off Functions (onmouseover/onmouseout)
	function NavRollOn(ME) {
		ME.className = "NavText_Rollover";
		ME.style.cursor = "pointer";
	}
	function NavRollOff(ME) {
		ME.className = "NavText";
	}
	function BOXRollOn(ME) {
		ME.className = "BOX_Rollover";
		ME.style.cursor = "pointer";
	}
	function BOXRollOff(ME) {
		ME.className = "BOX";
	}
	function FeaturedBOXRollOn(ME) {
		ME.className = "Featured_BOX_Rollover";
		ME.style.cursor = "pointer";
	}
	function FeaturedBOXRollOff(ME) {
		ME.className = "Featured_BOX";;
	}
	function SideNavOn(ME) {
		ME.className = "SideNavText_Rollover";
		ME.style.cursor = "pointer";
	}
	function SideNavOff(ME) {
		ME.className = "SideNavText";
	}
	function ETextOn(ME) {
		ME.className = "EText_Rollover";
		ME.style.cursor = "pointer";
	}
	function ETextOff(ME) {
		ME.className = "EText";
	}
	function DFeaturedOn(ME) {
		ME.className = "INDFeature_Rollover";
		ME.style.cursor = "pointer";
	}
	function DFeaturedOff(ME) {
		ME.className = "INDFeature";
	}
	//Testing New Javascript function
	var SHOWN = 0;
	var SHOWNTR = 0;
	var SHOWNTYPE = 0;
		function ShowMe(ME,ID,TYPE) {
			if (TYPE == "NAME") {
				NAME = ME;
			}else{
				NAME = ME.name;
			}
			NAME = NAME.replace("C","");
			//alert(SHOWN);
			if (TYPE == "IMG") {
				NAMETR = "Image" + ID;
			}else{
				NAMETR = "Text" + ID;
			}
			NAME_OBJ = document.getElementById(NAME);
			//alert(NAMETR);
			NAMETR_OBJ = document.getElementById(NAMETR);
			NAME_ORG = NAMETR_OBJ.style.visibility;
			if (SHOWN != 0) {
				SHOWNC = SHOWN + "C";
				if (SHOWNTYPE != "NAME") {
					document.form1[SHOWNC].checked = false;
				}
				SHOWN_OBJ = document.getElementById(SHOWN);
				SHOWNTR_OBJ = document.getElementById(SHOWNTR);
				SHOWNTR_OBJ.style.visibility = "hidden";
				SHOWN_OBJ.className = "ImageHIDE";
				SHOWNTR_OBJ.style.height = "";
			}
			//alert(SHOWN + " " + NAME)
			if (SHOWN != NAME || NAME_ORG == "hidden") {
				if (TYPE != "NAME") {
					document.form1[NAME + "C"].checked = true;
				}
				if (TYPE == "DESC") {
					NAMETR_OBJ.style.height = "100";
				}else{
					NAMETR_OBJ.style.height = "20";
				}
				NAMETR_OBJ.style.visibility = "visible";
				NAME_OBJ.className = "ImageSHOW";
				SHOWN = NAME;
				SHOWNTR = NAMETR;
				SHOWNTYPE = TYPE;
			}else{
				SHOWN = NAME;
				SHOWNTR = NAMETR;
				SHOWNTYPE = TYPE;
			}
		
		}
	//End New Javascript Function
	/*function ShowMe(HID,ME,IDE,TYPE) {
			//alert(TYPE);
			var INAME = ME.name;
			//alert(INAME);
			var i;
			var ELNUM = document.form1.elements.length;
			for (i=0;i<ELNUM;i++) {
				if (document.form1.elements[i].type == "checkbox") {
					var FileBOX = INAME.replace("C","");
					if (document.form1.elements[i].name == INAME) {
						if (document.form1[INAME].checked == true) {
							var x = document.getElementById(HID);
							x.style.visibility = "visible";
							if (TYPE != "DESC") {
								x.style.height = "20";
							}else{
								x.style.height = "100";
							}
							var FB = document.getElementById(FileBOX);
							FB.className = "ImageSHOW";
						}else{
							var x = document.getElementById(HID);
							x.style.visibility = "hidden";
							x.style.height = "";
							var FB = document.getElementById(FileBOX);
							FB.className = "ImageHIDE";
						}
					}else{
						var OFID = document.form1.elements[i].name;
						var OFIDS = OFID.replace("C","");
						var OF = document.getElementById(OFIDS);
						OF.className = "ImageHIDE";
						document.form1.elements[i].checked = false;
					}
				}
			}
			if (TYPE == "TEXT") {
				var NMID = "Name" + IDE;
				var NM = document.getElementById(NMID);
				NM.className = "ImageHIDE";
			}
		}*/
		function NameEdit(HID,ME) {
			var INAME = ME.id;
			var i;
			var ELNUM = document.form1.elements.length;
			var FileBOX = INAME.replace("C","");
			for (i=0;i<ELNUM;i++) {
				if (document.form1.elements[i].type == "checkbox") {
					var OFID = document.form1.elements[i].name;
					var OFIDS = OFID.replace("C","");
					var OF = document.getElementById(OFIDS);
					OF.className = "ImageHIDE";
					document.form1.elements[i].checked = false;
				}
			}
			var FB = document.getElementById(FileBOX);
			if (FB.className == "ImageHIDE") {
				var x = document.getElementById(HID);
				x.style.visibility = "visible";
				x.style.height = "20";
				FB.className = "ImageSHOW";
			}else{
				var x = document.getElementById(HID);
				x.style.visibility = "hidden";
				FB.className = "ImageHIDE";
				x.style.height = "";
			}
		}
		function SendSelf() {
				MYURL = document.URL;
				LASTSL = MYURL.lastIndexOf("/") + 1;
				NEWURL = MYURL.slice(LASTSL);
				//alert(NEWURL);
				document.form1.action = NEWURL;
				document.form1.submit();
			}
		//Image Swapper for moreinfo.php
		function SwapImage(KEY) {
				var SM_IMGE = document.getElementById(KEY + "_IMG");
				var LG_IMGE = document.getElementById("LARGEIMG");
				var LG_TITLE = document.getElementById("LARGE_TITLE");
				var ME_TITLE = document.getElementById(KEY + "_TITLE");
				var SM_ALT = SM_IMGE.alt;
				var SM_NAME = SM_ALT.replace(" ", "_");
				var SM_COUNT = SM_NAME.indexOf(" ");
				while (SM_COUNT > -1) {
					SM_NAME = SM_NAME.replace(" ", "_");
					SM_NAME = SM_NAME.replace("-", "_");
					SM_COUNT = SM_NAME.indexOf(" ");
					if (SM_COUNT == -1) {
						SM_COUNT = SM_NAME.indexOf("-");
					}
				}				
				var LG_ALT = LG_IMGE.alt;
				var LG_NAME = LG_ALT.replace(" ", "_");
				var LG_COUNT = LG_NAME.indexOf(" ");
				while (LG_COUNT > -1) {
					LG_NAME = LG_NAME.replace(" ", "_");
					LG_NAME = LG_NAME.replace("-", "_");
					LG_COUNT = LG_NAME.indexOf(" ");
					if (LG_COUNT == -1) {
						LG_COUNT = LG_NAME.indexOf("-");
					}
				}
				var NEWSMSRC = eval(LG_NAME + "_Sm.src");
				var NEWLGSRC = eval(SM_NAME + "_Lg.src");
				SM_IMGE.alt = LG_ALT;
				SM_IMGE.src = NEWSMSRC;
				LG_TITLE.innerHTML = SM_ALT;
				LG_IMGE.alt = SM_ALT;
				LG_IMGE.src = NEWLGSRC;
				ME_TITLE.innerHTML = LG_ALT;
			}
		function ResizeColumn100P() {
			//alert(document.body.scrollHeight);
			THIS_SIDE = document.getElementById('Side');
			//alert(document.body.clientHeight);
			//alert(document.body.clientHeight);
			//alert(document.body.offsetHeight);
			var DocOHeight = document.body.scrollHeight;
			var DocCHeight = document.body.clientHeight;
			DocOHeight = parseInt(DocOHeight);
			DocCHeight = parseInt(DocCHeight);
			//alert(document.body.scrollHeight);
			if (DocCHeight > DocOHeight) {
				THIS_SIDE.style.height = DocCHeight - 135;
				//alert("Client");
			}else{
				THIS_SIDE.style.height = DocOHeight - 135;
				//alert("Scroll");
			}
		}
		function ChangeTableH() {
			var TableH = document.getElementById('TableH');
			//alert(TableH.height);
			DocHeight = parseInt(document.body.scrollHeight);
			//alert(DocHeight);
			NewDocHeight = DocHeight - 80;
			TableH.style.height = NewDocHeight;
		}
		function ValidateForm() {
			Required = FormCheck();
			Validate = ValidateEmail();
			//alert(Required + " " + Validate);
			if (Required == false) {
				alert("Please Fill out Required Fields.");
				return false;
			}else if (Validate == false) {
				alert("Please Enter A Valid Email.");
				return false;
			}	
		}
		function FormCheck() {
			var NotFilled = false;
			NAME = document.getElementById('Name');
			EMAIL = document.getElementById('Email');
			if (document.form1.Name.value == "") {
				NotFilled = true;
				NAME.className = "ShowRequired";
			}else{
				NAME.className = "";
			}
			if (document.form1.Email.value == "") {
				NotFilled = true;
				EMAIL.className = "ShowRequired";
			}else{
				EMAIL.className = "";
			}			
			if (NotFilled == true) {
				//alert("Please Fill out Required Fields.");
				return false;			
			}
			
		}
		function ValidateEmail() {
			ME = document.form1.Email.value;
			Length = ME.length;
			AtPOS = ME.indexOf("@");
			DotPOS = ME.lastIndexOf(".");
			DotPOSP = DotPOS + 1; 
			CHARAD = Length - DotPOSP;
			if (CHARAD == 2 || CHARAD == 3) {
				CHARAD_TF = true;
			}else{
				CHARAD_TF = false;
			}
			//alert(Length + " " + DotPOS + " " + AtPOS + " " + CHARAD_TF);
			if (AtPOS == -1 || DotPOS == -1 || CHARAD_TF == false) {
				//alert("Please Enter A Valid Email.");
				return false;
			}
		}
		function AddHomeCheck() {
			var NotFilled = false;
			NAME = document.getElementById('Name');
			BED = document.getElementById('Bed');
			BATH = document.getElementById('Bath');
			ASF = document.getElementById('ASF');
			if (document.form1.Name.value == "") {
				NotFilled = true;
				NAME.className = "ShowRequired";
			}else{
				NAME.className = "";
			}
			if (document.form1.Bed.value == "") {
				NotFilled = true;
				BED.className = "ShowRequired";
			}else{
				BED.className = "";
			}
			if (document.form1.Bath.value == "") {
				NotFilled = true;
				BATH.className = "ShowRequired";
			}else{
				BATH.className = "";
			}
			if (document.form1.ASF.value == "") {
				NotFilled = true;
				ASF.className = "ShowRequired";
			}else{
				ASF.className = "";
			}	
			if (NotFilled == true) {
				alert("Please Fill out Required Fields.");
				return false;		
			}
		}
		function Delete(URL) {
			if (confirm("Are you sure you want to delete this home?")) {
				window.location.href = URL;
			}		
		}
