// toggle nav visibility 

function toggle(targetId, ref){
	
  if (document.getElementById){
	  
		var target = document.getElementById( targetId);
		var myRef = document.getElementById(ref);
	
		if (target.style.display == "none"){
			target.style.display = "";
			myRef.className = "selected";
		} else {
			target.style.display = "none";
			myRef.className = "deselected";
		}
  }
}

// commercial tab switch

function swapTabs(target,ref){
	
	if (document.getElementById){
	var myDesc = document.getElementById( "desc" );
	var myFiles = document.getElementById( "files" );
	var myTab1 = document.getElementById( "tab1" );
	var myTab2 = document.getElementById( "tab2" );
		if (target == "desc"){
			myDesc.style.display = "";
			myFiles.style.display = "none";
			myTab1.className = "selected";
			myTab2.className = "deselected";
		} else if (target == "files") {
			myDesc.style.display = "none";
			myFiles.style.display = "";
			myTab1.className = "deselected";
			myTab2.className = "selected";
		}
	}
}

// residential investments tab switch

function swapResTabs(target,tabCount){
	
	if (document.getElementById){
		for(i=1; i <= tabCount; i++){
			var currentTab = document.getElementById("tab" + i);
			var currentDiv = document.getElementById("div" + i);
			if (i == target) {
				currentDiv.style.display = "";
				currentTab.className = "selected";
			} else {
				currentDiv.style.display = "none";
				currentTab.className = "deselected";
			}
		}
	}

}

function goSearch(searchPage) {
	document.location = searchPage;
}

function showPic (whichpic, placeholder) {
 if (document.getElementById) {
  document.getElementById(placeholder).src = whichpic.href;
  document.getElementById(placeholder).alt = whichpic.title;
  document.getElementById(placeholder).title = whichpic.title;
  return false;
 } else {
  return true;
 }
}

function showMap (whichpic, placeholder,zoomId) {
 if (document.getElementById) {
  document.getElementById(placeholder).src = whichpic.href;
  zoom(zoomId);
  return false;
 } else {
  return true;
 }
}

function swapMap(targ){
	
	if (document.getElementById){
	var propMap = document.getElementById( "mapimages" );
	var propImg = document.getElementById( "propimages" );
	var propMapOption = document.getElementById( "mapOption" );
	var propImgOption = document.getElementById( "imagesOption" );

		if (targ == "images"){
			propMap.style.display = "none";
			propImg.style.display = "";
			propMapOption.style.display = "";
			propImgOption.style.display = "none";
		} else if (targ == "map") {
			propMap.style.display = "";
			propImg.style.display = "none";
			propMapOption.style.display = "none";
			propImgOption.style.display = "";
		}
	}
}

// zoom swap

function zoom(zoomId){
	
	if (document.getElementById){
	
		for (i=1;i<5;i++) {
			var varZoom = "zoom" + i;
			if (zoomId == varZoom){
				document.getElementById(zoomId).src = "images/i_map_on.gif"
			} else {
				document.getElementById(varZoom).src = "images/i_map_off.gif"
			}
		}
	}
}

function include(jsFile) {
	document.write('<script type="text/javascript" src="' + jsFile + '"></script>');
}

include("scripts/email_tracker.js");
