
	var icon = new GIcon();
	icon.iconAnchor = new GPoint(0,0);
	icon.infoWindowAnchor = new GPoint(10, 10);

	
    var map;
    var geocoder = null;
    var addressMarker;
	var getC;
	
	function onLoad() {
		load();
		var urlparam = "?";
		getStates();
	}
	

    function load() {
      if (GBrowserIsCompatible()) {
        map = new GMap2(document.getElementById("map"));
        map.addControl(new GSmallMapControl());
        map.setCenter(new GLatLng(30.0, 0.0), 1);
        map.setMapType(G_NORMAL_MAP);
		map.enableScrollWheelZoom();
	


        geocoder = new GClientGeocoder();


	  } // if
	} // end
	
	
	function getStates(urlparam) {
		
		urlparam = getCookie("s_param");
//alert(urlparam);
	
		var xmlhttp;
		if (window.XMLHttpRequest) {
		  xmlhttp=new XMLHttpRequest();
		}
		else if (window.ActiveXObject) {
		  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
		else {
		  alert("Your browser does not support XMLHTTP!");
		}
		xmlhttp.onreadystatechange=function() {
			if(xmlhttp.readyState==4) {

				var xml = xmlhttp.responseXML;



				var markers = xml.documentElement.getElementsByTagName("marker");

/*var responseText = xml.documentElement.xml; // IE
if (!responseText) { // FF, Chrome, Safari
   var s = new XMLSerializer();
   responseText = s.serializeToString(xml.documentElement);
}
alert(responseText);
*/





				map.clearOverlays();
				
				for (var i = 0; i < markers.length; i++) {
				  var projectid = markers[i].getAttribute("projectID");
				  var projectname = markers[i].getAttribute("projectName");
				  var projecttheme = markers[i].getAttribute("projectTheme");
				  var projectcountry = markers[i].getAttribute("projectCountry");
				  var projectadmin = markers[i].getAttribute("projectAdmin");
				  var projectwhat = markers[i].getAttribute("projectAdminWhat");
				  var projectadminname = markers[i].getAttribute("projectAdminName");
				  var projectadmincountry = markers[i].getAttribute("projectAdminCountry");
				  var projectadminmail = markers[i].getAttribute("projectAdminMail");
				  var projectadminweb = markers[i].getAttribute("projectAdminWeb");
				  var point = new GLatLng(parseFloat(markers[i].getAttribute("lat")), parseFloat(markers[i].getAttribute("lng")));
				  var img_profile = markers[i].getAttribute("imgProfile");
				  var img_map = markers[i].getAttribute("imgMap");
				  var img_bubble = markers[i].getAttribute("imgBubble");
				  var img_star = markers[i].getAttribute("imgStar");
				  var marker = createMarker(point, projectid, projectname, projecttheme, projectcountry, projectadmin, projectwhat, projectadminname, projectadmincountry, projectadminmail, projectadminweb, img_profile, img_map, img_bubble, img_star);

				  map.addOverlay(marker);
				
         	    }

			} // if
		} // end
		
		url = "/fileadmin/map/data.php"
		if (document.URL.split('/de/')[1]) lang="lang=de";
		else lang = "lang=en";
		
//alert(url+urlparam+lang);
		xmlhttp.open("GET",url+urlparam+lang,true);
		xmlhttp.send(null);
		
	}



	
	function createMarker(point, projectid, projectname, projecttheme, projectcountry, projectadmin, projectwhat, projectadminname, projectadmincountry, projectadminmail, projectadminweb, img_profile, img_map, img_bubble, img_star) {
	

projectname = projectname.replace(/&amp;#252;/g,"ü").replace(/&amp;#246;/g,"ö").replace(/&amp;#196;/g,"Ä").replace(/&amp;amp;/g,"&");
projectadmin = projectadmin.replace(/&amp;#252;/g,"ü").replace(/&amp;#246;/g,"ö").replace(/&amp;#196;/g,"Ä").replace(/&amp;amp;/g,"&");
projectadminname = projectadminname.replace(/&amp;#252;/g,"ü").replace(/&amp;#246;/g,"ö").replace(/&amp;#196;/g,"Ä").replace(/&amp;amp;/g,"&");

if (document.URL.split('/de/')[1]) {
	organizerLabel = "Projektbetreiber";
	projectLabel = "Projekt";
} else {
	organizerLabel = "Project organiser";
	projectLabel = "Project";
}	
if (img_bubble.indexOf(',')>-1) {
	img_bubble = img_bubble.substring(0, img_bubble.indexOf(','));
}


		var html = "<table width='300' border='0' cellspacing='0' cellpadding='0'>" +
					"<tr>" +
					"<td style='font-size:12px;' colspan='2' valign='top'>"+
						"<strong>"+projectname+"</strong>"+ 
						"<img src='http://www.youisme.com/uploads/pics/"+img_star+"' width='14' />"+"<br />"+
						projectcountry+"</td>"+
					"</tr>"+
					"<tr>"+
					"<td style='font-size:12px;' valign='top'>"+
						projecttheme+
					"</td>"+
					"<td rowspan='2' style='font-size:12px;line-height:1.5em;padding-left:4px;'>"+
						organizerLabel+":<br />"+
						projectadmin+
						"<div style='height:13px;'></div>"+
						projectwhat+"<br />"+
						projectadminname+"<br />"+
						"<div style='height:6px;'></div>"+
	"<a href='javascript:setDontClearMapSearchStateAndGo(\"http://www.youisme.com/index.php?id=16&tx_ttnews[tt_news]="+projectid+"&no_cache=1\");' class='link_black'>"+
							projectLabel+" &raquo;"+
						"</a></td>"+
					"</tr>"+
					"<tr>"+
					"<td style='font-size:12px;' width='160' valign='top'>"+
						"<div style='height:8px;'></div>"+
						"<img src='http://www.youisme.com/uploads/pics/"+img_bubble+"' width='120'/>"+
					"</td>"+
					"<td valign='top' style='font-size:12px;line-height:1.5em;padding-left:4px;'>"+
						
					"</td>"+
					"</tr>"+
				"</table>";
		
		var letteredIcon = new GIcon(G_DEFAULT_ICON );
		letteredIcon.image = "/fileadmin/map/marker.png"; //"/uploads/pics/"+img_map+"";
		//letteredIcon.shadow = "/fileadmin/map/shadow.png";
		letteredIcon.iconSize = new GSize(16,26);
		letteredIcon.shadowSize = new GSize(26,26);
		markerOptions = { icon:letteredIcon };
		var marker = new GMarker(point, markerOptions);
	
		GEvent.addListener(marker, 'click', function() {
		marker.openInfoWindowHtml(html);
//alert(html);
      });
      return marker;
    }


    function showAddress(address) {
      if (geocoder) {
        geocoder.getLatLng(address,
          function(point) {
              addressMarker = new GMarker(point);
              map.setCenter(point, 6);
          }
        );
      }
    }
	
	
	function get_data(obj) {
		
		
		
		var getstr = "?";
	
		
		for (i=0; i<obj.childNodes.length; i++) {
			if (obj.childNodes[i].tagName == "INPUT") {
			
				if (obj.childNodes[i].type == "text") {
					getstr += obj.childNodes[i].name + "=" + escape(escape(obj.childNodes[i].value)) + "&";
				}
			
				if (obj.childNodes[i].type == "checkbox") {
					if (obj.childNodes[i].checked) {
						
						getstr += obj.childNodes[i].name + "=" + obj.childNodes[i].value + "&";
					} 
					else {
						getstr += obj.childNodes[i].name + "=&";
					}
				}
	
			}
		}
		
		var name = "s_param";
		var expires = "0";
//alert(getstr);	
		document.cookie = name+"="+getstr+"; path=/";
		getStates(getstr);
	}
	
	function getCookie(c_name) {
		if (document.cookie.length>0) {
			c_start=document.cookie.indexOf(c_name + "=");
		 	if (c_start!=-1) {
				c_start=c_start + c_name.length+1;
				c_end=document.cookie.indexOf(";",c_start);
				if (c_end==-1) c_end=document.cookie.length;
				return unescape(document.cookie.substring(c_start,c_end));
			}
		}
		
		return "?";
	}
	
	function lookup_1(inputString) {
		if(inputString.length == 0) {
			jQuery('#suggestions_1').hide();
		} else {
			jQuery('#suggestions_1').css("top", (jQuery('#projectsearch').position().top + jQuery('#projectsearch').height()) + "px");
			jQuery.post("/fileadmin/map/completer_1.php", {queryString: ""+inputString+""}, function(data){
				if(data.length >0) {
					jQuery('#suggestions_1').show();
					jQuery('#autoSuggestionsList_1').html(data);
				}
			});
		}
	} // lookup
	
	function fill_1(thisValue) {
		jQuery('#projectsearch').val(thisValue);
		setTimeout("jQuery('#suggestions_1').hide();", 200);
	}
	
	function lookup_2(inputString) {
		if(inputString.length == 0) {
			jQuery('#suggestions_2').hide();
		} else {
			jQuery('#suggestions_2').css("top", (jQuery('#projectnamesearch').position().top + jQuery('#projectnamesearch').height()) + "px");
			jQuery.post("/fileadmin/map/completer_2.php", {queryString: ""+inputString+""}, function(data){
				if(data.length >0) {
					jQuery('#suggestions_2').show();
					jQuery('#autoSuggestionsList_2').html(data);
				}
			});
		}
	} // lookup
	
	function fill_2(thisValue) {
		jQuery('#projectnamesearch').val(thisValue);
		setTimeout("jQuery('#suggestions_2').hide();", 200);
	}
	
	function lookup_3(inputString) {
		if(inputString.length == 0) {
			jQuery('#suggestions_3').hide();
		} else {
			jQuery('#suggestions_3').css("top", (jQuery('#projectmembersearch').position().top + jQuery('#projectnamesearch').height()) + "px");
			jQuery.post("/fileadmin/map/completer_3.php", {queryString: ""+inputString+""}, function(data){
				if(data.length >0) {
					jQuery('#suggestions_3').show();
					jQuery('#autoSuggestionsList_3').html(data);
				}
			});
		}
	} // lookup
	
	function fill_3(thisValue) {
		jQuery('#projectmembersearch').val(thisValue);
		setTimeout("jQuery('#suggestions_3').hide();", 200);
	}



	


