// Declare map!
try {
	AWEMap = new mapAttributeSet();
	AWEMap.viewPlacement = new MQMapCornerPlacement(MQMapCorner.TOP_RIGHT, new MQSize(135,0));
	AWEMap.mapDiv = "map1";
	AWEMap.mapPointsLat = "mapPointsLat";
	AWEMap.mapPointsLon = "mapPointsLon";
	AWEMap.mapLabelTitle = "mapTitles";
	AWEMap.mapLabelText = "mapLabels";
	AWEMap.mapLegend = "mapMarkers";
} catch(e) {
	// No maps on this page.  Do nothing.
}

function ToggleVisibility(WhichForm) {
	// Declare for use later
        var TheFormDiv;
	// e.g. "events box", "music box"
        var DynamicClass = WhichForm.toLowerCase() + " box";
	// Each tab in the search box thing
        var AllTheForms = new Array("Food","Music","Events","Movies");
	// Loop through all of them until we find a match
        for(var i = 0; i < AllTheForms.length; i++) {
		// This is the div we want to make visible
                 TheFormDiv = "SearchFormContent" + AllTheForms[i];
		// Match; show div, assign css class
                if(AllTheForms[i].toLowerCase() == WhichForm.toLowerCase()) {
                        document.getElementById('DynamicDiv').className = DynamicClass;
                        document.getElementById(TheFormDiv).style.visibility = 'visible';
                        document.getElementById(TheFormDiv).style.display = 'block';
		// No match; hide div
                } else {
                        document.getElementById(TheFormDiv).style.visibility = 'hidden';
                        document.getElementById(TheFormDiv).style.display = 'none';
                }
        }
}

function TransformForm(WhichForm) {
        if(!WhichForm) { WhichForm = "Events"; }
	// Change image mapped img src.  Take out "temp_" when adding Nightlife search back.
        TheImg = "/entertainment/images/temp_tabs_" + WhichForm.toLowerCase() + ".gif";
        document.images['SearchFormTabs'].src = TheImg;
	// Show appropriate div, hide all others, assign css class
        ToggleVisibility(WhichForm);
}

function ETClearValue(x) {
	if(x.value == "Name" || x.value == "Nightlife (bars/nightclubs)" || x.value == "Title") {
		x.value='';
	}
}

function SetFormAction(WhichForm) {
	var TheCategory = WhichForm.SearchEventCategory.value;
        if(TheCategory == 56) {
                WhichForm.action = "/entertainment/music/index.ssf";
        } else if(TheCategory == 70 || TheCategory == 69) {
                WhichForm.action = "/theater/results/index.ssf";
        } else {
                WhichForm.action = "/entertainment/arts/index.ssf";
        }
}

function MatchDates(TheForm,ThisIndex) {
	if(ThisIndex == 0) { ThisIndex = 1; }
	TheForm.SearchDateEnd.options[ThisIndex-1].selected = true;
}
