var ns=(document.layers);
var ie=(document.all);
var w3=(document.getElementById && !ie);
var calunit=ns? "" : "px"
var byl = 0;

function initAd(){
	if(!ns && !ie && !w3) return;
	if(ie)		adDiv=eval('document.all.alertDiv.style');
	else if(ns)	adDiv=eval('document.layers["alertDiv"]');
	else if(w3)	adDiv=eval('document.getElementById("alertDiv").style');
	if (ie||w3) adDiv.visibility="visible";
	else adDiv.visibility ="show";
}
function showAd(){
	if (ie){documentWidth  =truebody().offsetWidth/2+truebody().scrollLeft-20;
	documentHeight =truebody().offsetHeight/2+truebody().scrollTop-20;}	
	else if (ns){documentWidth=window.innerWidth/2+window.pageXOffset-20;
	documentHeight=window.innerHeight/2+window.pageYOffset-20;} 
	else if (w3){documentWidth=self.innerWidth/2+window.pageXOffset-20;
	documentHeight=self.innerHeight/2+window.pageYOffset-20;} 
	adDiv.left=documentWidth-250+calunit;adDiv.top =documentHeight-200+calunit;
}

function closeAd(){
	if (ie||w3) adDiv.display="none";
	else adDiv.visibility ="hide";
}

function truebody(){
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function addBookmark(title,url) {
	if (window.sidebar) { 
		window.sidebar.addPanel(title, url,""); 
	} else if( document.all ) {
		window.external.AddFavorite( url, title);
	} else if( window.opera && window.print ) {
		return true;
	}
}

function ShowMap(){

	var mapka = '<div class="map">'
	+'<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="598" height="274">'
	+'<param name="movie" value="/img/mapka.swf">'
	+'<param name="quality" value="high">'
	+'<embed src="/img/mapka.swf" quality="high" width="598" height="274" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed>'
	+'</object>'
	+'<div onclick="closeAd()" style="color: #FFFFFF">Zamknij</div>';
	+'</div>';
	document.getElementById("alertDiv").innerHTML = mapka;
	
	if(byl == 1) document.getElementById("alertDiv").style.display="";
	else { byl = 1; initAd(); showAd(); }
		
}
