function writeFlash(nazwa,x,y,background,zmienne) {
  t = '<embed type="application/x-shockwave-flash" src="' + nazwa + '"';
  t = t + ' width="';
  t = t + x;
  t = t + '" height="';
  t = t + y;
  if (background) { t = t + '" bgcolor="' + background + '"'; }
  	else { t = t + '" wmode="transparent"'; }
  t = t + '" scale="noscale"';
  t = t + '" quality="high"';
  t = t + '" salign="t"';
  t = t + ' swLiveConnect=true';
  t = t + ' name="topswf"';
  t = t + ' id="topswf"';
  t = t + '" flashvars="' + zmienne + '"';
  t = t + ' />';
document.write (t);
}

function writeFlash2(nazwa,x,y,background,zmienne) {
  t = '<embed type="application/x-shockwave-flash" src="' + nazwa + '"';
  t = t + ' width="';
  t = t + x;
  t = t + '" height="';
  t = t + y;
  if (background) { t = t + '" bgcolor="' + background + '"'; }
  	else { t = t + '" wmode="transparent"'; }
  t = t + '" scale="noscale"';
  t = t + '" quality="high"';
  t = t + '" flashvars="' + zmienne + '"';
  t = t + ' />';
document.write (t);
}

function writeFlash3(nazwa,x,y,background,zmienne) {
  t = '<embed type="application/x-shockwave-flash" src="' + nazwa + '"';
  t = t + ' width="';
  t = t + x;
  t = t + '" height="';
  t = t + y;
  if (background) { t = t + '" bgcolor="' + background + '"'; }
  	else { t = t + '" wmode="transparent"'; }
  t = t + ' scale="noscale"';
  t = t + ' quality="high"';
  t = t + ' salign="t"';
  t = t + ' swLiveConnect=true';
  t = t + ' name="galery_forum"';
  t = t + ' flashvars="' + zmienne + '"';
  t = t + ' />';
document.write (t);
}

var oldLayer;

function info(whichLayer) {


	if (document.getElementById && oldLayer!=whichLayer) {

		// this is the way the standards work
		
		if (oldLayer) {
		  var style2 = document.getElementById(oldLayer).style;
		  style2.display = style2.display?"":"none";


		  var style3 = document.getElementById("zz"+oldLayer).style;
		  style3.display = style3.display?"":"none";


                  var styleq = document.getElementById("z"+oldLayer);
                  styleq.className = styleq.className?"":"highlite";				  

		
		}
					
		var style2 = document.getElementById(whichLayer).style;
		style2.display = style2.display?"":"block";

		var style3 = document.getElementById("zz"+whichLayer).style;
		style3.display = style3.display?"":"block";



		var styleq = document.getElementById("z"+whichLayer);
		styleq.className = styleq.className?"":"highlite";

	
		oldLayer = whichLayer;
		
	}

}

function cenaZawiera() {


	if (document.getElementById) {

		
		  var style3 = document.getElementById("cenazawiera").style;
		  style3.display = style3.display?"":"block";

		
	}

}



function printarticle(articleid) {
	var Opt="toolbar=no,location=no,directories=no,menubar=no,scrollbars=yes,width=750,height=600,left=0,top=0"; 
	var linkname = "print.php?id="+articleid;
 printWindow=window.open(linkname,"printarticle",Opt); 
 printWindow.focus();
 }
 
// pokazywacz afrokrajow
function ShowCountry(cn) {
  targetSWF = document.topswf;
  targetSWF.SetVariable("transport", "1");
	targetSWF.SetVariable("linkcn", cn);
}

function GMapLoad() {
  if (GBrowserIsCompatible()) {
    
    // konfig mapy
    var map = new GMap2(document.getElementById("gmap_cont"));
    map.setCenter(new GLatLng(0.0, 0.0));
    map.setMapType(G_PHYSICAL_MAP);
    map.addControl(new GSmallZoomControl());

    // konfig markera
    var pointIcon = new GIcon();
    pointIcon.image = "images/punkt2.png";
    pointIcon.iconSize = new GSize(14, 14);
    pointIcon.iconAnchor = new GPoint(7, 7);

    // konstruktor markera
    function createMarker(point, label, url, ID) {
    
      // spacja -> nbsp
      var label2 = label.replace(/ /g,"&nbsp;");
      
      opts = { 
        "icon": pointIcon,
        "title": label,
        "labelText": "<div id=\"" + ID + "\" class=\"gmap_label\" onmouseover=\"GMapLabelHighlight(" + ID + ",'over');\" onmouseout=\"GMapLabelHighlight(" + ID + ");\">" + label2 + "</div>",
        "labelOffset": new GSize(0, -18)
      };
    
      //var marker = new GMarker(point, opts);
      var marker = new LabeledMarker(point, opts);
            
      GEvent.addListener(marker, "click", function() {
        //var testString = "nazwa: " + label + ", URL: " + url;
        //alert(testString);
        document.location.href = url;
      });
      
      return marker;
    }

    // prostokat dla marketow 
	  var bounds = new GLatLngBounds();
    
    // index dla elementu div w labeltext
    var ID = 0;

    // dodaj markery do mapy
    for (var key in GMapData) {
      var point = new GLatLng(GMapData[key][0],GMapData[key][1]);
      var url = GMapData[key][2];
      bounds.extend(point);
      map.addOverlay(createMarker(point, key, url, ID));
      ID++;
    }
    
    // autozumocentrowanie mapy
    if (map.getBoundsZoomLevel(bounds) > 10) {
      map.setZoom(10);
    } else {
      map.setZoom(map.getBoundsZoomLevel(bounds));
    }
    var clat = (bounds.getNorthEast().lat() + bounds.getSouthWest().lat()) / 2;
    var clng = ((bounds.getNorthEast().lng() + bounds.getSouthWest().lng()) / 2);
    map.setCenter(new GLatLng(clat,clng));

  }
}

function GMapLabelHighlight(ID,com) {
  var targetObject = document.getElementById(ID);
  if (com == "over") {
    targetObject.style.backgroundColor="#009900";
    targetObject.style.color="#FFFFFF";
  } else {
    targetObject.style.backgroundColor="#FFFFFF";  
    targetObject.style.color="#666666";
  }
}

