function load(clickMap,lat,lng,zoom,marker_lat,marker_lng) {
  if(lat==0 && lng==0 && zoom==0){
    lat=53.774283;
    lng=20.492249;
    zoom=12;
  }

  if (GBrowserIsCompatible()) {
    var map = new GMap2(document.getElementById("mapsearch"));

    map.addControl(new GLargeMapControl());
    map.addControl(new GOverviewMapControl());
    map.addControl(new GScaleControl());
    map.addControl(new GMapTypeControl());
    var MapTypes = map.getMapTypes();
    MapTypes[0].getName= function() {
      return "Mapa";
    }
    MapTypes[1].getName = function() {
      return "Satelitarna";
    }
    MapTypes[2].getName = function() {
      return "Hybrydowa";
    }
    map.addControl(new GMapTypeControl());

    map.enableContinuousZoom();
    map.enableDoubleClickZoom();
 
    if(clickMap==1){
      GEvent.addListener(map, "click", function(overlay, point) {
	 

        if (overlay) {
          map.removeOverlay(overlay);
          document.getElementById("marker_geo_lat").value=0;
          document.getElementById("marker_geo_lng").value=0;
        } else {
          map.clearOverlays();
          map.addOverlay(new GMarker(point));
          document.getElementById("marker_geo_lat").value=point.y.toString();
          document.getElementById("marker_geo_lng").value=point.x.toString();
        }
      });
      GEvent.addListener(map, "moveend", function() {
        map.closeInfoWindow();
        var center = map.getCenter();
        var zoom = map.getZoom();
        // document.getElementById("message").innerHTML = 'Lat,Lng '+ center.toString() + ', Zoom(' + zoom.toString() + ')';
        if(document.getElementById("geo_lat")) var geo_lat = document.getElementById("geo_lat");
        if(document.getElementById("geo_lng")) var geo_lng = document.getElementById("geo_lng");
        if(document.getElementById("geo_zoom")) var geo_zoom = document.getElementById("geo_zoom");

//        if(marker_lng && marker_lat){
//          var point = new GLatLng(marker_lat, marker_lng);
//          var marker = new GMarker(point);
//          map.addOverlay(marker);
//        }

        var temp=center.toString();
        var gdzie_przecinek=temp.indexOf(',')
        var dlugosc=temp.length;
        if(geo_lat) geo_lat.value=temp.substring(1,gdzie_przecinek);
        if(geo_lng) geo_lng.value=temp.substring(gdzie_przecinek+1,dlugosc-1);
        if(geo_zoom) geo_zoom.value=zoom.toString();


      });
    } else {
      if(marker_lng && marker_lat){
        var point = new GLatLng(marker_lat, marker_lng);
        var marker = new GMarker(point);
        map.addOverlay(marker);
      }
    }
  
    //  nearest_objects=null;
    //if(nearest_objects!=null) {
      if((typeof(nearest_objects)!="undefined") && (nearest_objects!=null)) {
      for(var i=0;i<nearest_objects.length; i++) {
        var markr=new GMarker(new GLatLng(nearest_objects[i].lat,nearest_objects[i].lng), {icon:nearest_icons['icon_'+nearest_objects[i].category]?nearest_icons['icon_'+nearest_objects[i].category]:nearest_icons['icon_0']});
        markr.bindInfoWindowHtml(nearest_objects[i].title);
        map.addOverlay(markr);
      }
    }


    map.setCenter(new GLatLng(lat, lng), zoom);

    map.hideControls();
    GEvent.addListener(map, "mouseover", function(){
      map.showControls();
    });
    GEvent.addListener(map, "mouseout", function(){
      map.hideControls();
    });
  	 
  
  }
} 

function openPopup(url) {
  newwindow=window.open('/popup.php?url='+url,'name','height=600,width=800');
}

function changebg(td) {
  td.style.background='#D20707';
  td.style.color='#FFFFFF';
}
function bchangebg(td) {
  td.style.color='#666666';
  td.style.background='#FFFFFF';
}

            
function checkForm(lang){
  if(document.getElementById('title_'+lang).value=='' || document.getElementById('telefon').value==''){
    document.getElementById('error').style.display='';
    if(document.getElementById('title_'+lang).value=='')
      document.getElementById('name_'+lang).style.color='#ff0000';
    else
      document.getElementById('name_'+lang).style.color='#666666';
    if(document.getElementById('telefon').value=='')
      document.getElementById('phone').style.color='#ff0000';
    else
      document.getElementById('phone').style.color='#666666';

  }
  else{
    document.formula.submit();
  }
}

function set_tr() {
  document.getElementById('info_tr').style.display = "";
  //document.getElementById('mapsearch').style.display = "none";
  //document.getElementById('slideShow').style.display = "none";
  document.getElementById('photo_tr').style.display = "none";
  document.getElementById('360_tr').style.display = "none";
  document.getElementById('map_tr').style.display = "none";
  document.getElementById('distances_tr').style.display = "none";
  document.getElementById('schools_tr').style.display = "none";
}

function change_CSS(new_class, element) {
  var el = document.getElementById(element);
  if(document.getElementById('menuC').value != element)el.className = new_class;
}

function checkInterest(){
  /*	var of_id=document.zaint.of_id.value;
	var ajaxRequest;
	var postBody = 'action=checkInterest&of_id='+of_id;
	new Ajax.Request('/scripts/ajax.php', {method:'post', postBody:postBody, onSuccess: 
			function(t){
			if(t.responseText==1)
			$('layer2').style.display='none';
			else
			$('layer2').style.display='';
     }
		}); */
  $('layer2').toggle();
}

function save_zaint() {
  $('layer2').style.display='none';
}

function togge(id)

{
  el = document.getElementById(id);

  var display = el.style.display ? '' : 'none';

  el.style.display = display;

}

function click_on_menu(element,hide1,hide2) {
  
  
  $(element+'_tr').style.display="";
  $(element).className="kom_ofr1_on";
  $(hide2+'_tr').style.display="none";
  $(hide1).className="kom_ofr1";
  $(hide1+'_tr').style.display="none";
  $(hide2).className="kom_ofr1";
}

function changeBG(td) {

  td.style.background='#D20707';
  td.style.color='#FFFFFF';
}
function bchangeBG(td) {
  td.style.color='#666666';
  td.style.background='#FFFFFF';
}

var of_num=1;

function show_photo(num) {
  of_num=num;
  $('of_photo_img').src=$('of_photo_'+num).getAttribute('bigphoto');
  //$('of_photo_link').href=$('of_photo_'+num).getAttribute('bigphoto');
  $('of_photo_link').title=$('of_photo_'+num).getAttribute('title');
}

function show_lightbox() {
  lightbox_ob.start($('of_photo_'+of_num));
}