onLoadSetupIE = function() {
	/* first part does the drop-down menus in IE */
	var sfEls = document.getElementById("navbarTop").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
	/* this part does the drop-down for selecting plots in IE */
	/* var sfEls = document.getElementById("developmentSummaryList").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	} */
	/* this part does the drop-down menu for selecting developments */
	if (document.getElementById("selectDevelopment")) {
		var selectDevelopment = document.getElementById("selectDevelopment");
		selectDevelopment.onchange=function() {
			if (!isblank(this.value)) {
				window.location.href = this.value;
			}
		}
	}
	/* define the function for popping-up house details */
	popupHouseDetails=function(developmentID,plotNumber) {
		popupWinString = "popupHouseDetails.php?developmentID=" + developmentID + "&plotNumber=" + plotNumber;
		popupWinHouseDetails = window.open(popupWinString, "winHouseDetails", "width=720,height=600,status=no,location=no,resizable=yes,scrollbars=yes");
		popupWinHouseDetails.focus();
	}
	/* define the function for popping-up the awards page */
	popupAwards=function() {
		popupWinString = "popupAboutAwards.php";
		popupWinHouseDetails = window.open(popupWinString, "winAboutAwards", "width=720,height=600,status=no,location=no,resizable=yes,scrollbars=yes");
		popupWinHouseDetails.focus();
	}
	/* this part does the drop-down menu for selecting developments */
	if (document.getElementById("selectHouse")) {
		var selectHouse = document.getElementById("selectHouse");
		selectHouse.onchange=function() {
			popupHouseDetails();
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", onLoadSetupIE);


onLoadSetup = function() {
	/* this part does the drop-down menu for selecting developments */
	if (document.getElementById("selectDevelopment")) {
		var selectDevelopment = document.getElementById("selectDevelopment");
		selectDevelopment.onchange=function() {
			if (!isblank(this.value)) {
				window.location.href = this.value;
			}
		}
	}
	/* define the function for popping-up house details */
	popupHouseDetails=function(developmentID,plotNumber) {
		popupWinString = "popupHouseDetails.php?developmentID=" + developmentID + "&plotNumber=" + plotNumber;
		popupWinHouseDetails = window.open(popupWinString, "winHouseDetails", "width=720,height=600,status=no,location=no,resizable=yes,scrollbars=yes");
		popupWinHouseDetails.focus();
	}
	/* define the function for popping-up the awards page */
	popupAwards=function() {
		popupWinString = "popupAboutAwards.php";
		popupWinHouseDetails = window.open(popupWinString, "winAboutAwards", "width=720,height=600,status=no,location=no,resizable=yes,scrollbars=yes");
		popupWinHouseDetails.focus();
	}
	/* this part does the drop-down menu for selecting developments */
	if (document.getElementById("selectHouse")) {
		var selectHouse = document.getElementById("selectHouse");
		selectHouse.onchange=function() {
			popupHouseDetails();
		}
	}
}
if (window.addEventListener) window.addEventListener("load", onLoadSetup, false);


/* function for displaying a new main page and closing the pop-up window */
function popupClose(newPage) {
	opener.location=newPage; 
	window.close();
}

/* function for displaying a new main page and closing the pop-up window */
function popupTandC(slideName) {
	popupTandCString = "popupTandC.php?slideName=" + slideName;
	popupTandCDetails = window.open(popupTandCString, "winTandC", "width=720,height=600,status=no,location=no,resizable=yes,scrollbars=yes");
	popupTandCDetails.focus();
}



/* function that displays the Google map on the map pages */
function initializeMap(lat, long) {
	var map = new GMap2(document.getElementById("mainMapCanvas"));
	var point = new GLatLng(lat,long);
	map.setCenter(point, 8);
	map.addOverlay(new GMarker(point));
	map.addControl(new GSmallMapControl());
}

// Utility function checking for blank strings
function isblank(s) {
	if (s == null) return true;
	if (s == "") return true;
	for(var i = 0; i<s.length; i++) {
 		var c = s.charAt(i);
 		if ((c!=' ') && (c!='\n') && (c!='\t'))
 			return false;
	}
	return true;
}
