var currentTool;

function toolSwitch(toolID) {
	var targetTool=document.getElementById(toolID);

	if (targetTool==null) return;
	currentTool.style.display="none";
	targetTool.style.display="block";
	currentTool=targetTool;
}

function replacePicture() {
	var selectedThumbnail=document.getElementById("selectedThumbnail");
	if (selectedThumbnail) selectedThumbnail.removeAttribute("id");
	document.getElementById("currentImage").src=this.getElementsByTagName("img")[0].src.replace("/thumbnails/","/");
	this.setAttribute("id","selectedThumbnail");
}

function homeListingEvents() {
	var thumbnails=document.getElementById("thumbnails");
	if (thumbnails) {
	   thumbnails=thumbnails.getElementsByTagName("li");
	   for (var temp=0;temp<thumbnails.length;temp++) thumbnails[temp].onclick=replacePicture;
	}

	currentTool=document.getElementById("formInquiry");
	currentTool.style.display="block";
}

if (window.addEventListener) window.addEventListener("load",homeListingEvents,false);
else window.attachEvent("onload",homeListingEvents);
