	var params;
	var attributes;
	var thisMap;
	var types;
	var xPrice;
	var filters;
	var startup = true;
	
	function jsReady() {
		/*if ($("object[name=map]").size() > 0 && typeof($("object[name=map]")[0].onJSLoad) == "function") {
			$("object[name=map]")[0].onJSLoad();
		}*/
		//$("button[name=update]").click();
	}
	function getPsOIs(city) {
		return thisMap.getCityPsOI(city);
	}
	function cityClick(city) {
		thisMap.setFocusCity(city);
		$("object#map").fadeOut("slow");
	}
	function filterSubmit (event) {
		
		if (startup) {
			startup = false;return;	
		}
		
		event.preventDefault();
		types = new Array();
		status = new Array();
		
		$("input[name*=soort]:checked").each(
			function() {
				types.push($(this).val());
			}				
		);
		xPrice = $("input[name=priceX]:checked").size() > 0 ? true: false;
		valsToFilters();
		event.preventDefault();
	}
	function valsToFilters () {
		filters = new Object();
		
		
		if (mipSpan.html().indexOf("+")>-1)
			filters.minPrice = Infinity;
		else
			filters.minPrice = Math.floor(Number(String(mipSpan.html()).replace(".", "")));
		if (mapSpan.html().indexOf("+")>-1)
			filters.maxPrice = Infinity;
		else 
			filters.maxPrice = Math.ceil(Number(String(mapSpan.html()).replace(".", "")));
		
		
		filters.types	 = types;
		filters.xPrice 	 = xPrice;
		filters.hk = $("input[name=doel]:checked").val() == "T" ? "V":$("input[name=doel]:checked").val() ;
		//FILTERS TO MAPAPP
		if ($("input[name=doel]:checked").val() =="T") {
			
			filters.types = new Array("07");	
		}
		thisMap.setFilters(filters);
	}
	
	$(document).ready(function() {
		var niceBrowser = true;
		if ($.browser.msie && parseInt($.browser.version) < 7) {
			niceBrowser = false;
			$("div.allTheWay div.mainMinus div.FL div#kaartGroot, h2.totaal").html("");
			$("p#goodBrowser").removeClass("DN");
			/*
			 
			 *
			 <p id="goodBrowser">
			 Uw browser is sterk verouderd, om deze website volledig te kunnen bekijken dient u te updaten naar een modernere browser:
			 <a href="http://www.microsoft.com/netherlands/windows/internet-explorer/worldwide-sites.aspx">Microsoft Internet Explorer 8</a> 
			 <a href="http://www.mozilla-europe.org/nl/firefox/">Mozilla Firefox</a>
			 <a href="http://www.google.com/chrome/index.html?hl=nl&brand=CHMB&utm_campaign=nl&utm_source=nl-ha-emea-be-sk&utm_medium=ha">Google Chrome</a>
			 </p>
			 * */
		}
		
		if (niceBrowser) {
			/*=========end FLASH ============*/
			$("button[name=update]").bind("click", filterSubmit);
//	var source = "http://www.evosys.be/Virtual/huva/nieuw/includes/mapAppData.php";../../../
var source = "includes/mapAppData.php";

			if (String(document.location).search("nieuwbouw.php")>-1) {
				source = "includes/mapAppData.php?nieuwbouw";
	source = "includes/mapAppData.php?nieuwbouw";
			}
			thisMap = new MapApp({
				//apiKey: "ABQIAAAAy_3-fAT44OGlGoN6RxPmahQNwb4coqjf3voVjQuXUqXbCvF0GBTkLbAuGPTk7Y3KS-vXL8GvA_QE5w",
apiKey: "ABQIAAAAvMTzlJDcThRCaW9PhwTPdBS05p51BFC8-Sxmf5jl9TnvPAow-RTgs4LTsTm8oHvafihIuQBljMAoTg",

				dataSource: source,
				onComplete: jsReady
			});
			
			
			/* Filters */
			types = new Array();
			xPrice = true;
			/* Map control options */
			$("#satteliteButtLink").mouseover(function(){
				$("#satteliteButtLink img").removeClass("satteliteButt");
				$("#satteliteButtLink img").addClass("satteliteButtHover");
			});
			$("#satteliteButtLink").mouseout(function(){
				$("#satteliteButtLink img").removeClass("satteliteButtHover");
				$("#satteliteButtLink img").addClass("satteliteButt");
			});
			$("#satteliteButtLink").click(function(){
				$("#satteliteButtLink img").removeClass("satteliteButtHover");
				$("#satteliteButtLink img").addClass("satteliteButtActive");
				$("#mapButtLink img").removeClass("mapButtActive");
				$("#mapButtLink img").addClass("mapButt");
			});
			$("#mapButtLink").mouseover(function(){
				$("#mapButtLink img").removeClass("mapButt");
				$("#mapButtLink img").addClass("mapButtHover");
			});
			$("#mapButtLink").mouseout(function(){
				$("#mapButtLink img").removeClass("mapButtHover");
				$("#mapButtLink img").addClass("mapButt");
			});
			$("#mapButtLink").click(function(){
				$("#mapButtLink img").removeClass("mapButtHover");
				$("#mapButtLink img").addClass("mapButtActive");
				$("#satteliteButtLink img").removeClass("satteliteButtActive");
				$("#satteliteButtLink img").addClass("satteliteButt");
			});
		}

	});
