function addEvent(elm, evType, fn, useCapture) {
  // cross-browser event handling for IE5+, NS6 and Mozilla
  // By Scott Andrew
  if (elm.addEventListener) {
    elm.addEventListener(evType, fn, useCapture);
    return true;
  } else if (elm.attachEvent) {
    var r = elm.attachEvent('on' + evType, fn);
    EventCache.add(elm, evType, fn);
    return r;
  } else {
    elm['on' + evType] = fn;
  }
}

addEvent(window, 'unload', EventCache.flush, false);

function init() {
  if (GBrowserIsCompatible()) {
    var map = new GMap2(document.getElementById("map"));
    //map.addControl(new GSmallMapControl());
    map.addControl(new GLargeMapControl());
    //map.addControl(new GMapTypeControl());
    map.addControl(new GOverviewMapControl());
    map.addControl(new GScaleControl(), new GControlPosition(G_ANCHOR_BOTTOM_LEFT, new GSize(10, 40)));
    
    map.setCenter(new GLatLng(54.4616, 17.0294), 16);
    
    // Place a marker in the center of the map and open the info window
    // automatically
    var marker = new GMarker(map.getCenter());
    //GEvent.addListener(marker, "click", function() {
    //  marker.openInfoWindowTabsHtml(infoTabs);
    //});
    map.addOverlay(marker);
    //marker.openInfoWindowTabsHtml(infoTabs); 
  }
}

//addEvent(window, 'load', init, false);

function dodaj() {
    var title = "Kchnie Słupsk - Kuchta";
    var url = "http://www.kuchnie.slupsk.pl";
    if (window.sidebar) { // Mozilla Firefox Bookmark
        window.sidebar.addPanel(title, url,"");
    } else if( window.external ) { // IE Favorite
        window.external.AddFavorite( url, title);
    } else if(window.opera && window.print) { // Opera Hotlist
        var mbm = document.createElement('a');
        mbm.setAttribute('rel','sidebar');
        mbm.setAttribute('href',url);
        mbm.setAttribute('title',title);
        mbm.click();
    }
}

function startowa() {
	document.body.style.behavior = "url(#default#homepage)";
	document.body.setHomePage("kuchnie.slupsk.pl");
}

function obrazki() {
  for (i=0; i<document.images.length; i++) {
    if (document.images[i].complete == false) return false;
  }
  return true;
}

function blokada(co) {
	linki = document.getElementById(co).getElementsByTagName('a');
	//wylaczenie linkow
	for (i=0; i<linki.length; i++) {
		//linki[i].href = "#";
		linki[i].setAttribute('onclick', 'return false');
	}
}

