var imNotSleepJet = true;


function showGMapOne( mapAccuracy, mapW, mapL, showMarker, html, cSmallControl, cSmallZoom, cLargeControl, cScale, cType, cDragging )
{
    if( imNotSleepJet )
    {
	imNotSleepJet = false;
	setTimeout( "showGMapOne( "+mapAccuracy+", "+mapW+", "+mapL+", "+showMarker+", '"+html+"', "+cSmallControl+", "+cSmallZoom+", "+cLargeControl+", "+cScale+", "+cType+", "+cDragging+" )", 2000 );
	return;
    }

    if(GBrowserIsCompatible()) 
    {
	var map = new GMap2( document.getElementById ? document.getElementById("mapDiv") : document.all.mapDiv );
	if( cSmallControl == true )						map.addControl(new GSmallMapControl());
	if( cLargeControl == true || (!cLargeControl && cLargeControl != false))map.addControl(new GLargeMapControl());
	if( cScale == true || (!cScale && cScale != false))			map.addControl(new GScaleControl());
	if( cType == true || (!cType && cType != false) )			map.addControl(new GMapTypeControl());
	if( cSmallZoom == true )						map.addControl(new GSmallZoomControl());
	if( cDragging != true || mapAccuracy == 1 )				map.disableDragging();

	if( html != '')
	{
	    html = "<div style='background-color:#fff; margin:0px; width:220px; height:80px '>"+html+"</div>";
	}

	var mapCenterPoint = new GLatLng( mapW, mapL);
	
	map.setCenter( mapCenterPoint, getZoomByAccuracy(mapAccuracy) );
	
	


	if( showMarker == true )
	{
	    marker = new GMarker( mapCenterPoint );
	    map.addOverlay(marker);
	    if( html != '' )
	    {
		GEvent.addListener(marker, "click", function()
		{
		    marker.openInfoWindowHtml( html );
		});
		marker.openInfoWindowHtml( html );
	    }
	}

	/* ograniczenia zoomowania */

	GEvent.addListener(map, "zoomend", function( oldLevel, newLevel )
	{
	    if( newLevel > 17 )
	    {
		map.setZoom(17);
		if( cDragging == true ) map.enableDragging();
	    }
	    else if( newLevel <= 6 )
	    {
		map.disableDragging();
		map.setZoom(6);
	    }
	    else
	    {
		if( cDragging == true ) map.enableDragging();
	    }
	});
    }
}

function getZoomByAccuracy( accuracy )
{
    switch( accuracy )
    {
        case 8 : return 15;
        case 7 : return 15;
        case 6 : return 14;
        case 5 : return 13;
        case 4 : return 12;
        case 3 : return 12;
        case 2 : return 9;
        case 1 : return 6;
    }
}
