﻿/*
		// create an array of the items that are part of hiding/showing
		var sectionNamesArray = new Array("distributor-tab-content", "defense-tab-content", "support-tab-content");
		var tabArray = new Array("distributor-tab", "defense-tab", "support-tab");
		function hideandshowsections(section){
			for (var i=0; i< sectionNamesArray.length; i++) {
				document.getElementById(sectionNamesArray[i]).style.display="none";
				document.getElementById(tabArray[i]).className = "";
			}
			section.style.display="block";
			
		}
		
		function current(id) {
			document.getElementById(id).className = "current";
		}
*/
		
function submitform() {

	document.commercialdistributorsform.submit();
}

	
function search_type(searchType) { //displays the appropriate tab contents
	if(!document.getElementById) return false;
	if(!document.getElementsByTagName) return false;
	if(!document.getElementById("search-container")) return false;
	var showSearchType = "";
	if(!(showSearchType = document.getElementById(searchType))) return false;
	
	var searchContainer = document.getElementById("search-container");
	
	var searchTypes = searchContainer.getElementsByTagName("DIV");
	
	for (var i = 0; i < searchTypes.length; i++)
	{
		if(searchTypes[i].className.indexOf("search-type") != -1)
		{
			searchTypes[i].style.position = "absolute";
			searchTypes[i].style.left = "-9999em";
		}
	}

	showSearchType.style.position = "";
	showSearchType.style.left = "";	
}

function display(what) {
	if (what=='list'){
		document.getElementById('resultslist').style.display='block';
		document.getElementById('resultsmap').style.display='none';
	}
	if (what=='map'){
		document.getElementById('resultslist').style.display='none';
		document.getElementById('resultsmap').style.display='block';
	}
}

function show_map(id){
	document.getElementById("resultslist").style.display='none';
	document.getElementById("resultsmap").style.display='block';
	document.getElementById("resultsmap").innerHTML="<div id=\"status\"><center><font face=\"Arial\"><img src=\"/images/loading.gif\"><br>Please wait - loading map</font></center></div><iframe width=\"100%\" height=\"600\" scrolling=\"no\" frameborder=0 src=\"map.php?id="+id+"\"></iframe>";
	//document.getElementById("resultsmap").innerHTML="<iframe width=\"100%\" height=\"100%\" frameborder=0 src=\"http://www.danahermotion.com/locator/map.php\"></iframe>";
}



function updateinputs(element){
	if (element.id=='country'){
		if (element.value=='USA'){
			document.getElementById("zipdiv").style.display='block';
		}else if(element.value=='Canada'){
			document.getElementById("zipdiv").style.display='block';
		}else{
			document.getElementById("query").value='';
			document.getElementById("zipdiv").style.display='none';
		}
	}
}

function updateinputs_ad(element){
	if (element.id=='country'){
		if (element.value=='USA'){
			document.getElementById("statediv").style.display='block';
		}else if(element.value=='Canada'){
			document.getElementById("zipdiv").style.display='block';
		}else{
			document.getElementById("query").value='';
			document.getElementById("statediv").style.display='none';
		}
	}
}


function showproducts(showthis){
document.getElementById(showthis).style.display = "block";
}

function hideproducts(hidethis){
document.getElementById(hidethis).style.display = "none";
}

