	<script type="text/javascript">

	<?
	echo "var region='".$name_region."';\n";
	?>
	var arr = new Array();
			
    <?
	$i=0;
	while($row_Recordset1 = mysql_fetch_array($Recordset1))
		{
		$div='';
		$div='<table cellpadding="3" cellspacing="3" ><tr><td valign=top>';
		if($row_Recordset1['small'])
		$div .= '<img src="'.$bp.$row_Recordset1['small'].'" border=0 width=70></td><td valign=top>';
		$div .= '<b><a target=_blank href="'.$bp.'items/'.$row_Recordset1['zag_url'].'_'.$row_Recordset1['id'].'">'.$row_Recordset1['zag'].'</a></b><br>';
		
		$op = explode("<hr>",$row_Recordset1['opis']);
		if($op[0])
			{
			$ops = explode("\n", trim($op[0]));
			unset($ops[0]);
			if($ops[1])
			$opp = implode("<br>",$ops);
			}
		if(!$opp && $op[1])
			{
			$opp = obrez($op[1], 100);
			}
		$div .= $opp;
		
		$div .= '</td></tr></table>';
		echo "arr[".$i."] = new Array(".$row_Recordset1['map_x'].", ".$row_Recordset1['map_y'].", '".$row_Recordset1['zag']."', '".$div."');\n";
		$i++;
		}
	echo "var j = ".$i.";\n";
	?>


	var map;
 
function initialize() {
 
    var center = new google.maps.LatLng(arr[0][0], arr[0][1]);
 
    map = new google.maps.Map(document.getElementById('map'), {
        zoom: 11,
        center: center,
        mapTypeId: google.maps.MapTypeId.ROADMAP
    });
 
 
            var markers = [];
			
            for (var i = 0; i < j; i++) {
                var baloon = arr[i][3];
                var mark = add_marker(arr[i][0], arr[i][1], arr[i][2], baloon);
                markers.push(mark);
            }
            var markerCluster = new MarkerClusterer(map, markers);
		
}

	var tekinfo;

function add_marker(lat, lng, title, box_html) {
 
    var infowindow = new google.maps.InfoWindow({
        content: box_html
    });
 
    var marker = new google.maps.Marker({
        position: new google.maps.LatLng(lat, lng),
		
		draggable: true,
        map: map,
        title: title
		
    });
 

    google.maps.event.addListener(marker, 'click', function () {
	if(tekinfo){tekinfo.close(map,marker);}
	infowindow.open(map,marker);
	tekinfo = infowindow;
    });
 

    return marker;
}
 
 
    </script>

    <div style="width: 700px; height: 600px;" id="map"></div>