
function findAddress(address, idelement) {
		var map = new GMap2(document.getElementById(idelement));
		var geocoder = new GClientGeocoder();
		map.addControl(new GSmallMapControl());
		var placeFound = new GLatLng(52.1065, 18.9404);
		suffix = " poland";

		geocoder.getLatLng(address + ', ' + suffix,

			function(placeFound) {
      			if (!placeFound) {
        			//alert(address + " not found");
      			} else {
        			map.setCenter(placeFound, 13);
        			 var marker = new GMarker(placeFound);
			        map.addOverlay(marker);
			        if(session_map_large){
			        	text_info = '<h3>'+document.getElementById("name_company").value+'</h3><p>'+address+'</p>';
			       		marker.openInfoWindowHtml(text_info);
			       		marker.bindInfoWindowHtml(text_info);
			       	}
				}
      		}
      	);
	}
document.observe("dom:loaded", function(event){  
//alert(document.getElementById("adress_company").value);
	if($('adress_company')){
		str = document.getElementById("adress_company").value;
		tab = str.split("/");
		id_element = "contact_maps";
		findAddress(tab[0] + ", " + document.getElementById("city_company").value, id_element);
	}
});

session_map_large = false;
function largeMap(){
      if($('#adress_company')){
		$("#layerMap").show();
		session_map_large = true;
		str = document.getElementById("adress_company").value;
		str2 = document.getElementById("city_company").value;
		$("#article_content").hide();
		tab = str.split("/");
		var id_element = "largeMap";
		findAddress(tab[0] + ", " + str2, id_element);
	}
}

function closeMap(){
	$("#layerMap").hide();
	$("#article_content").show();
}