function showPlacesNav() {
	document.getElementById('places-to-go-subnav').style.display = 'inline';
	document.getElementById('places-to-go-subnav').style.zIndex = '12345679';
}

function hidePlacesNav() {
	document.getElementById('places-to-go-subnav').style.display = 'none';
}

function showResourcesNav() {
	document.getElementById('family-resources-subnav').style.display = 'inline';
	document.getElementById('family-resources-subnav').style.zIndex = '13345679';
}

function hideResourcesNav() {
	document.getElementById('family-resources-subnav').style.display = 'none';
}

function showSubNav(element) {
	document.getElementById('chooseSub').style.display = 'none';
	document.getElementById('addSub').style.display = 'none';
	document.getElementById('calSub').style.display = 'none';
	document.getElementById('dealsSub').style.display = 'none';
	document.getElementById(element.id + 'Sub').style.display = 'inline';
	document.getElementById(element.id + 'Sub').style.zIndex = '12345678';
	//ONLY FOR CHOOSE SUB, other wise the calendar stays with z-index -1... weird IE BUG!
	if (element.id == 'choose') {
		if (document.getElementById('calendar-wrapper') != null) {
			document.getElementById('calendar-wrapper').style.display = 'none';
		}
		if (document.getElementById('map-and-details-wrapper') != null) {
			document.getElementById('region-details-wrapper').style.zIndex = '-1';
			document.getElementById('region-details-wrapper').style.display = 'none';
			document.getElementById('map-and-details-wrapper').style.backgroundImage = 'url("/assets/region/generic-map.jpg")';
		}
		
		if (document.getElementById('region-name') != null) {
			document.getElementById('region-name').style.zIndex = '-1';
			document.getElementById('region-change-location').style.zIndex = '-2';
			document.getElementById('region-name').style.display = 'none';
			document.getElementById('region-change-location').style.display = 'none';
		}	
		
		if (document.getElementById('nearby-map') != null) {
			document.getElementById('nearby-map').style.zIndex = '-1';
			//document.getElementById('nearby-map').style.display = 'none';
		}
		if (document.getElementById('attraction-map') != null) {
			//document.getElementById('attraction-map').style.position = 'absolute';
			if (document.getElementById('attraction-map-wrapper') != null) {
				document.getElementById('attraction-map-wrapper').style.position = 'static';
			}
			document.getElementById('attraction-map').style.zIndex = '-1';
			//document.getElementById('attraction-map').style.display = 'none';
		}
		if (document.getElementById('day') != null) {
			document.getElementById('day').style.display = 'none';
		} 
		if (document.getElementById('month') != null) {
			document.getElementById('month').style.display = 'none';
		} 
		if (document.getElementById('categories') != null) {
			document.getElementById('categories').style.display = 'none';
		} 
		if (document.getElementById('month_monthCategory') != null) {
			document.getElementById('month_monthCategory').style.display = 'none';
		} 
		if (document.getElementById('root-categories') != null) {
			document.getElementById('root-categories').style.display = 'none';
		} 
	} else if (element.id == 'add') {
		if (document.getElementById('map-and-details-wrapper') != null) {
			document.getElementById('region-details-wrapper').style.zIndex = '-1';
			document.getElementById('region-details-wrapper').style.display = 'none';
			document.getElementById('map-and-details-wrapper').style.backgroundImage = 'url("/assets/region/generic-map.jpg")';
		}
		if (document.getElementById('region-name') != null) {
			document.getElementById('region-name').style.zIndex = '-1';
			document.getElementById('region-change-location').style.zIndex = '-2';
			document.getElementById('region-name').style.display = 'none';
			document.getElementById('region-change-location').style.display = 'none';
		}			
		if (document.getElementById('nearby-map') != null) {
			document.getElementById('nearby-map').style.zIndex = '-1';
			//document.getElementById('nearby-map').style.display = 'none';
		}
		if (document.getElementById('attraction-map') != null) {
			if (document.getElementById('attraction-map-wrapper') != null) {
				document.getElementById('attraction-map-wrapper').style.position = 'static';
			}
			document.getElementById('attraction-map').style.zIndex = '-1';
			//document.getElementById('attraction-map').style.display = 'none';
		}
		if (document.getElementById('root-categories') != null) {
			document.getElementById('root-categories').style.display = 'none';
		} 
	} else {
		if (document.getElementById('calendar-wrapper') != null) {
			document.getElementById('calendar-wrapper').style.display = 'inline';
		}
	}

}

function hideSubNav(element) {
	
	document.getElementById(element.id + 'Sub').style.display = 'none';
	
	if (document.getElementById('calendar-wrapper') != null) {
		document.getElementById('calendar-wrapper').style.display = 'inline';
	}

	if (document.getElementById('attraction-map') != null) {
		//document.getElementById('attraction-map').style.display = 'inline';
		document.getElementById('attraction-map').style.zIndex = '6';
	}
	if (document.getElementById('map-and-details-wrapper') != null) {
		document.getElementById('region-details-wrapper').style.zIndex = '4';
		document.getElementById('region-details-wrapper').style.display = 'inline';
		document.getElementById('map-and-details-wrapper').style.backgroundImage = 'none';
	}
	if (document.getElementById('region-name') != null) {
		document.getElementById('region-name').style.zIndex = '16';
		document.getElementById('region-change-location').style.zIndex = '17';
		document.getElementById('region-name').style.display = 'inline';
		document.getElementById('region-change-location').style.display = 'inline';
		if (navigator.userAgent.indexOf('Firefox') > -1) {
			document.getElementById('region-name').style.top = '13px';
		}
	}	
	if (document.getElementById('nearby-map') != null) {
		document.getElementById('nearby-map').style.zIndex = '5';
		//document.getElementById('nearby-map').style.display = 'inline';
	}
	if (document.getElementById('day') != null) {
		document.getElementById('day').style.display = 'inline';
	} 
	if (document.getElementById('month') != null) {
		document.getElementById('month').style.display = 'inline';
	} 
	if (document.getElementById('categories') != null) {
		document.getElementById('categories').style.display = 'inline';
	} 
	if (document.getElementById('month_monthCategory') != null) {
		document.getElementById('month_monthCategory').style.display = 'inline';
	} 
	if (document.getElementById('root-categories') != null) {
		document.getElementById('root-categories').style.display = 'inline';
	} 
}
YAHOO.util.Event.onDOMReady(function(){
	var chooseLocationPopup = new YAHOO.widget.Panel("findNeighborhoodPopup", { visible:false, width:"300px",context:["chooseLoc","tl","bl"], underlay: false, close: false} );
	var chooseLocationInput = document.getElementById('cityFinderInput');
	var cityFinderContainer = document.getElementById('cityFinderContainer');
	var chooseLocMousedOver = false;
	var findNeighborhoodPopupMousedOver = false;
	var cityFinderInputHasFocus = false;
	chooseLocationPopup.render();
	document.getElementById('findNeighborhoodPopup').style.display = 'block';
	var tryHideChooseLoc = function(){
		YAHOO.lang.later(500,null,function(){
			if(!(chooseLocMousedOver || findNeighborhoodPopupMousedOver || cityFinderInputHasFocus)){
				cityFinderInputMousedOver = false;
				findNeighborhoodPopupMousedOver = false;
				cityFinderInputHasFocus = false;
				cityFinderContainer.style.display = 'none';
				chooseLocationPopup.hide();
			}	
		});
	};
	
	YAHOO.util.Event.addListener('chooseLoc', "mouseover", function(e){
		chooseLocMousedOver = true;
		chooseLocationInput.value = '';
		cityFinderContainer.style.display = 'block';
		chooseLocationPopup.show();
	});
	YAHOO.util.Event.addListener('chooseLoc', "mouseout", function(e){
		chooseLocMousedOver = false;
		tryHideChooseLoc();
	});
	
	YAHOO.util.Event.addListener('findNeighborhoodPopup', "mouseover", function(e){
		findNeighborhoodPopupMousedOver = true;
	});
	YAHOO.util.Event.addListener('findNeighborhoodPopup', "mouseout", function(e){
		findNeighborhoodPopupMousedOver = false;
		tryHideChooseLoc();
	});
	
	YAHOO.util.Event.addListener('cityFinderInput', "focus", function(e){
		cityFinderInputHasFocus = true;
	});
	YAHOO.util.Event.addListener('cityFinderInput', "blur", function(e){
		cityFinderInputHasFocus = false;
		tryHideChooseLoc();
	});

	var theAutoComplete = new YAHOO.gckAutocomplete.autocomplete('cityFinderInput','cityFinderContainer','','workingGif','/assets/region/neighborhood/chooseLocationBack2.gif','/assets/region/neighborhood/searchBackground.gif');
});