/* 
	Title: MKK - Map search JavaScript file containing functions for the map search
	Description: Contains functions for the map search
	Client: MMK
	Date: 01/12/2006
	Updated: 02/12/2008
	Version 1.01
	Author: Ben Ellis
*/

/* 
	Title: mapSearch()
	Description: Function to show and hide the map areas
	Arguments: None
*/
function mapSearch(id){

	// Parent containers
	var map_area = "";
	var map_detail = "";
	var current_area = "";
	var current_details = "";
	
	// Parent items
	map_area = document.getElementById("map_areas");
	map_detail = document.getElementById("map_details");
	
	// Current items
	current_area = document.getElementById("map_area_"+id);
	current_details = document.getElementById("map_details_"+id);
	
	// Loop through all the map areas and set class to inactive
	for (i=0; i<map_area.childNodes.length; i++) {
		node = map_area.childNodes[i];
		if (node.nodeName=="LI") node.className = "";
	}
	
	// Loop through all the map details and set class to hidden
	for (i=0; i<map_detail.childNodes.length; i++) {
		node = map_detail.childNodes[i];
		if (node.nodeName=="UL") {
			$(node).fadeOut(500);
		}
	}
	
	// Set the current map area class to active
	if(current_area) current_area.className = "active";
	
	// Set the current map details to visable
	if(current_details) {
		//current_details.className = "show";
		$(current_details).fadeIn(500);
	}
}