var mapShow=false;

function doMapLink() {
$.get("/app/include/map_search.cfm",
		
	function(data){
		//alert("Data Loaded: " + data);
			$("#map-france").html(data);
			$("#map-france").css("background", "none"); 
		});
		
		//check if regions hidden filed already exists
		if (!$("#regions").length) {
			createInputfield();
		}
		
		if (mapShow==false) {
			showMap();
		} else {
			$("#regions").remove();
			hideMap();
		}

}

function doMap(regions) {
	$("#regions").val(regions);
}

function createInputfield() {
	// create a hidden inputfield
	inputField = document.createElement("input");
	inputField.setAttribute("type", "hidden");
	inputField.setAttribute("name", "regions");
	inputField.setAttribute("id", "regions");
	inputField.setAttribute("value", "");

	var theForm=document.getElementById("searchform");
	theForm.appendChild(inputField);
}

function showMap() {
	$("#cnt-region").hide();
	$("#region").val("");
	$("#cnt-kmrange").hide();
	$("#kmrange").val("");
	$("#cnt-zipcode").hide();
	$("#zipcode").val("");
	$("#cnt-city").hide();
	$("#city").val("");
	$("#map-france").show();
	$("#maplink").html("");
	mapShow=true;
	$("#maplink").html(detailed_search);
	$("#maplink").attr("title", detailed_search);
}

function hideMap() {
	$("#cnt-region").show();
	$("#cnt-kmrange").show();
	$("#cnt-zipcode").show();
	$("#cnt-city").show();
	$("#map-france").hide();
	$("#maplink").html(search_with_map);
	$("#maplink").attr("title", search_with_map);
	mapShow=false;
}