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_google"));
    //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.441667, 17.000278), 12);
    
    
    // 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);
     
  }
}



function displayEmail(user, domain, name, subject) {
	document.write('<a href="mailto: ' + user + '&#64;' + domain + '?subject=' + subject +'">' + name + '</a>');
}

function key() {
	k = document.getElementById('key');
	k.style.visibility = 'visible';
	//alert(k.style.visibility);
}

function displayWindow(url, width, height, name) {
	//window.open(url,name,'width='+width+',height='+height+',name="name",resizable=0,scrollbars=no,menubar=no');
	clientW = screen.width;
	clientH = screen.height;
	if (height > clientH) {
		scrollValue = 'yes';
		width = width+19; //19 - szerokosc scrolla
		newHheight = clientH-100; //zmienijszenie wysokosci do wymiarow clienta
	} else {
		scrollValue = 'no';
		newHheight = height;
	}
	w = window.open(url,name,'width='+width+',height='+newHheight+',name="name",resizable=0,scrollbars='+scrollValue+',menubar=no');
	w.moveTo(clientW/2-width/2, clientH/2-newHheight/2);
}


